# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261034961 -7200 # Node ID e35f4098820571faf49cd095759b96ee1adb1667 Revision: 200947 Kit: 200951 diff -r 000000000000 -r e35f40988205 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for xmlsrv package +* +*/ + + +#include "../inc/xmlsrv.hrh" + +#include "../xmlsrv_plat/group/bld.inf" +#include "../xmlsecurityengine/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r e35f40988205 inc/xmlsrv.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/xmlsrv.hrh Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/* ============================================================================== +* Name : xmlsrv.hrh +* Part of : xmlsrv +* Interface : +* Description : +* Version : %version % +* +* ============================================================================== +*/ + +#ifndef XMLSRV_HRH +#define XMLSRV_HRH +/* +//un-comment following line for 5.1/TB9.1 platforms and comment for 5.2/TB9.2 +macro __RD_ENABLE_XMLENGINE__ +#if !defined ( __RD_ENABLE_XMLENGINE__ ) + #define __RD_ENABLE_XMLENGINE__ 1 +#endif +*/ +#endif // defined XMLSRV_HRH \ No newline at end of file diff -r 000000000000 -r e35f40988205 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/GROUP/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/GROUP/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Messaging - GMXML +// Generic XML parser and composer +// +// + +/** + @file +*/ + + +PRJ_PLATFORMS +DEFAULT + +// Subproject builds +#include "../XMLDom/GROUP/bld.inf" +#include "../XMLParser/GROUP/bld.inf" +#include "../Rom/bld.inf" + +PRJ_MMPFILES diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/GROUP/syslibs_legacyminidomparser.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/GROUP/syslibs_legacyminidomparser.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,65 @@ + + + + SMIL parsing implemented via generic XML Parser / Composer with a "mini-DOM" API able to perform syntax checking against simple DTDs. Replaces SMIL Translater implementation of 7.0s. + + + + include f32file.h in gmxmlparser.h + + + + Adding SMIL parser into webservices-xml package. + + + + + + Relocating Header files for XML API + + + + stray scanner defect. + + + + + Mixed header files will now contain only published All or published Partner or internal + + + + + + Added IM tag message server. + + + written a new api which handles the case when there is quotation in file name. + + + + Checked the if condition is not false for the AppendChild function. + + + + Added a new exported leaving function. This is BR approved and BR number is BR2302.3 + + + + Added condition to differentiate the winscw and armv5 def files for case sensitive + + + + Added IM tag for all given header files. + + + + Now GmXML component restrict for eating white spaces + + + + + GNU Make-based build system + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/GROUP/syslibs_legacyminidomparser.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/GROUP/syslibs_legacyminidomparser.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ +component syslibs_legacyminidomparser +source \sf\os\xmlsrv\xml\legacyminidomparser +binary \sf\os\xmlsrv\xml\legacyminidomparser\GROUP all +exports \sf\os\xmlsrv\xml\legacyminidomparser\GROUP + +notes_source \component_defs\release.src + + +ipr E +ipr T \sf\os\xmlsrv\xml\legacyminidomparser\XMLParser\test + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/Rom/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/Rom/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Gmxml +// +// + +PRJ_EXPORTS + +../Rom/legacyminidomparser.iby /epoc32/rom/include/legacyminidomparser.iby + +PRJ_TESTEXPORTS + +../Rom/legacyminidomparsertest.iby /epoc32/rom/include/legacyminidomparsertest.iby + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/Rom/legacyminidomparser.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/Rom/legacyminidomparser.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LEGACYMINIDOMPARSER_IBY__ +#define __LEGACYMINIDOMPARSER_IBY__ + +file=ABI_DIR\BUILD_DIR\XMLDOM.dll System\libs\XMLDOM.dll +file=ABI_DIR\BUILD_DIR\xmlparser.dll System\libs\xmlparser.dll + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/Rom/legacyminidomparsertest.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/Rom/legacyminidomparsertest.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __LEGACYMINIDOMPARSERTEST_IBY__ +#define __LEGACYMINIDOMPARSERTEST_IBY__ + +#include + +file=ABI_DIR\BUILD_DIR\t_gmxmlparser.exe test\t_gmxmlparser.exe +file=ABI_DIR\BUILD_DIR\t_gmxmlfailure.exe test\t_gmxmlfailure.exe + +file=ABI_DIR\BUILD_DIR\t_smiltranslatortest.exe test\t_smiltranslatortest.exe + + +data=DATAZ_\gmxmltest.txt gmxmltest.txt + +// SMIL Input Valid +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\anchor_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\animation_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\area_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ascii_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ascii_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_order_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_order_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_order_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_order_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_var_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\att_var_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\audio_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\a_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\body_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_12.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_12.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_13.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_13.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_14.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_14.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_15.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_15.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_16.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_16.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_17.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_17.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_18.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_18.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_19.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_19.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_20.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_20.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_21.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_21.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_22.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_22.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_23.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_23.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_24.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_24.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_25.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_25.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_26.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_26.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_27.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_27.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_28.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_28.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_29.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_29.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_30.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_30.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\cdata_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\comments_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\comments_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\doctype_variation.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\doctype_variation.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\Entitiy_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\Entitiy_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_12.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_12.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_13.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_13.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_14.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_14.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_15.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_15.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_17.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_17.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_18.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_18.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_19.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_19.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_20.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_20.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_21.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_21.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_22.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_22.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_24.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_24.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_26.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_26.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_27.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_27.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_30.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_30.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_31.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_31.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\entity_ref_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\head_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\head_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\head_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\head_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\img_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC021337.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC021337.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC022160.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC022160.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC025788.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\INC025788.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\layout_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\layout_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\layout_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\layout_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\newline_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\newline_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\par_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\ref_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\region_att_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\root-layout_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\seq_struc_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\smil_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\smil_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\smil_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\smil_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\switch_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\textstream_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\text_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\utf8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\utf8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\video_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\whitespace_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\whitespace_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\whitespace_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\whitespace_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\xml_version_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\valid\xml_version_1.txt + + +// SMIL Input InValid +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_9.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\a_att_9.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\cdata_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\cdata_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\Entitiy_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\Entitiy_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\entity_ref_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_12.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_12.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_13.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_13.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_14.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_14.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_15.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_15.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_16.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_16.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_17.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_17.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_18.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_18.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_19.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_19.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_20.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_20.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_21.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_21.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_22.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_22.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_23.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_23.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_24.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_24.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_25.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_25.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_9.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\further_invalid_9.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\INC021591.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\INC021591.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\INC021675.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\INC021675.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_1.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_12.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_12.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_13.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_13.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_14.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_14.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_15.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_15.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_16.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_16.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_17.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_17.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_18.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_18.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_19.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_19.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_2.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_20.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_20.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_21.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_21.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_22.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_22.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_23.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_23.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_24.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_24.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_25.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_25.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_26.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_26.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_27.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_27.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_28.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_28.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_29.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_29.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_3.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_31.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_31.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_32.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_32.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_33.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_33.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_34.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_34.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_35.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_35.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_36.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_36.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_37.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_37.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_38.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_38.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_39.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_39.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_40.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_40.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_9.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\invalid_9.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_10.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_10.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_11.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_11.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_7.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_8.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_8.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_9.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\region_att_9.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_5.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_6.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\root-layout_att_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\switch_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\smil_input\invalid\switch_struc_4.txt + + + +// MMS Input valid +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\audio_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struct_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struct_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struct_5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\body_struct_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\head_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\img_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\layout_struc_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\metadata_att1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\metadata_att1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\meta_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\meta_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\meta_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\meta_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_prefetch.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_prefetch.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\par_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\prefetch_att4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_6.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\ref_att_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_6.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_att_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\region_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\root-layout_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\root-layout_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\root-layout_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\root-layout_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\smil_struc_5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\text_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\text_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\text_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\text_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\valid\transition_att_3.txt + + + +// MMS Input invalid +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\body_struc_4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\body_struc_4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\head_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\head_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_metadata_att1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_metadata_att1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_meta_att1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_meta_att1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att4.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att4.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att5.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid_transition_att5.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att1.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\invalid__prefetch_att3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_6.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_6.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_7.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\layout_struc_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\par_struc_3.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\par_struc_3.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\region_att_7.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\region_att_7.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\smil_struc_2.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\smil_struc_2.txt +data=DATAZ_\legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\text_struc_1.txt legacyminidomparsertest\SMIL_Test_Files\mms_input\invalid\text_struc_1.txt + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/GROUP/XMLDOM.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/GROUP/XMLDOM.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,49 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// xmldom.dll XML DOM support +// +// + +/** + @file +*/ + +TARGET xmldom.dll +TARGETTYPE dll + +CAPABILITY All -TCB +UID 0x1000008d 0x101F9117 +VENDORID 0x70000001 + +SOURCEPATH ../SRC +SOURCE GMXMLCDATASection.cpp +SOURCE GMXMLCharacterData.cpp +SOURCE GMXMLComment.cpp +SOURCE GMXMLDocument.cpp +SOURCE GMXMLDocumentElement.cpp +SOURCE GMXMLElement.cpp +SOURCE GMXMLNode.cpp +SOURCE GMXMLProcessingInstruction.cpp +SOURCE GMXMLText.cpp + + + +USERINCLUDE ../INC +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +LIBRARY euser.lib +LIBRARY bafl.lib + +DEFFILE V2_XMLDOM.DEF + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/GROUP/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/GROUP/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_PLATFORMS + DEFAULT + +PRJ_MMPFILES + XMLDOM.mmp + + +PRJ_EXPORTS + ../INC/GMXMLCDataSection.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlcdatasection.h) + ../INC/GMXMLCharacterData.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlcharacterdata.h) + ../INC/GMXMLComment.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlcomment.h) + ../INC/GMXMLDocument.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmldocument.h) + ../INC/GMxmldomconstants.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmldomconstants.h) + ../INC/GMXMLDocumentElement.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmldocumentelement.h) + ../INC/GMXMLElement.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlelement.h) + ../INC/GMXMLNode.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlnode.h) + ../INC/GMXMLProcessingInstruction.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlprocessinginstruction.h) + ../INC/GMXMLText.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmltext.h) + #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#ifdef SYMBIAN_OLD_EXPORT_LOCATION + ../INC/gmxmldummydtd.h /epoc32/include/gmxmldummydtd.h +#endif + #endif + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLCDataSection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLCDataSection.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,67 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#ifndef __GMXMLCDATA_H__ +#define __GMXMLCDATA_H__ + +#include + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +class CMDXMLCDATASection : public CMDXMLCharacterData +/** A CDATA section of an XML file. + +Objects of this type hold text, including characters that would otherwise +be regarded as markup. They cannot have child nodes. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLCDATASection, leaving the object on the + cleanup stack. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @leave KErrNoMemory Memory allocation failed + @return The new CMDXMCDATASection */ + IMPORT_C static CMDXMLCDATASection* NewLC( CMDXMLDocument* aOwnerDocument ); + + /** Allocates and constructs a new CMDXMLCDATASection. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @leave KErrNoMemory Memory allocation failed + @return The new CMDXMCDATASection */ + IMPORT_C static CMDXMLCDATASection* NewL( CMDXMLDocument* aOwnerDocument ); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLCDATASection(); + + +protected: + /* + * Constructor + * @param aOwnerDocument Pointer to the document at the root of the DOM tree + */ + CMDXMLCDATASection( CMDXMLDocument* aOwnerDocument ); +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLCharacterData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLCharacterData.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,104 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#ifndef __GMXMLCHARACTERDATA_H__ +#define __GMXMLCHARACTERDATA_H__ + +#include + +#include + +class CMDXMLCharacterData : public CMDXMLNode +/** Base class for text sections, such as CDATA sections, comments and processing +instructions, of an XML file. + +Objects with this interface contain text, but cannot have child nodes. +@publishedPartner +@released +*/ +{ +public: + /** Destructor. */ + IMPORT_C virtual ~CMDXMLCharacterData(); + + /** Gets the text of the section. + + @return The text of the section */ + IMPORT_C virtual TDesC& Data(); + + /** Sets the whole of the section text. + + @param aData Text to set + @leave KErrNoMemory Memory allocation failed */ + IMPORT_C virtual void SetDataL( TDesC& aData ); + + /** Gets the length of the section text. + + @return Returns the length of the text */ + IMPORT_C virtual TInt Length(); + + /** Appends text to the section. + + @param aData The text to append. + @leave KErrNoMemory Memory allocation failed */ + IMPORT_C virtual void AppendL( TDesC& aData ); + + /** Inserts text at a specified point in the section. + + @param aInsertPos The position at which to insert the text. 0 means insert + at the start. + @param aData Text to insert + @leave KErrNoMemory Memory allocation failed + @return Returns KErrNone if successful or KErrNotFound if the insert position + is out of range */ + IMPORT_C virtual TInt InsertL( TInt aInsertPos, TDesC& aData ); + + /** Replaces a block of text in the section. + + @param aInsertPos The position at which to insert the text. 0 means insert + at the start. + @param aLength The number of characters to replace + @param aData The text to insert + @leave KErrNoMemory Memory allocation failed + @return Returns KErrNone if successful or KErrNotFoundif the replace block + is out of range */ + IMPORT_C virtual TInt ReplaceL( TInt aInsertPos, TInt aLength, TDesC& aData ); + + + /** Check the children of this node for validity. + + For a character data section, there can be no children so this is always true. + + @return Always true. */ + IMPORT_C virtual TBool CheckChildren(); + +protected: + /* + * Constructor + * @param aNodeType The node type of the derived object + * @param aOwnerDocument The Document at the root of the DOM tree. + */ + CMDXMLCharacterData( TDOMNodeType aNodeType, CMDXMLDocument* aOwnerDocument ); + +private: + HBufC* iData; // Buffer to hold the actual text of the CDATA section +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLComment.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLComment.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,65 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#ifndef __GMXMLCOMMENT_H__ +#define __GMXMLCOMMENT_H__ + +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +class CMDXMLComment : public CMDXMLCharacterData +/** A comment section of an XML file. + +Objects with this interface contain text, but cannot have child nodes. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLComment, leaving the object on the cleanup + stack. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return New CMDXMComment + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLComment* NewLC( CMDXMLDocument* aOwnerDocument ); + + /** Allocates and constructs a new CMDXMLComment. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return New CMDXMComment + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLComment* NewL( CMDXMLDocument* aOwnerDocument ); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLComment(); + + +protected: + /* + * Constructor + * @param aOwnerDocument The document at the root of the DOM tree + */ + CMDXMLComment( CMDXMLDocument* aOwnerDocument ); +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLDocument.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,220 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the CMDXMLDocument class which +// is the root class for a Mini-DOM tree. +// +// +/** + * @file + * @publishedPartner + * @released + */ + +#ifndef __GMXMLDOCUMENT_H__ +#define __GMXMLDOCUMENT_H__ + +#include + +#include +#include + +class CMDXMLElement; +class MXMLDtd; + +/** +MXMLDtd is a mixin class. If User wants to derive from MXMLDtd class , +then one should not derive from any other class at the same time. +i.e A class can not derive from CBase at all using MXMLDtd. + +Interface for DTD defintion classes. +A class derived from this interface can be used by CMDXMLParser or CMDXMLComposer +to check that the data conforms to a specific DTD. +@publishedPartner +@released +*/ +class MXMLDtd + + { + +public: + /** Tests if an element name is valid in the DTD. + + @param aElement The element name to be tested + @return ETrue the if element name valid, else EFalse + @leave KErrNoMemory Out of memory */ + virtual TBool IsValidElementL(const TDesC& aElement) const = 0; + + /** Tests if an attribute name and value is valid in DTD. + + @param aElement The element to which the attributes belong + @param aAttribute The attribute to be tested + @param aAttributeValue The attribute value to be tested + @return KErrNone if the name and value are valid, KXMLBadAttributeName if the + attribute name is invalid, or KXMLBadAttributeValue if the attribute value + is invalid + @leave KErrNoMemory Out of memory */ + virtual TInt IsValidAttributeForElementL(const TDesC& aElement, const TDesC& aAttribute, const TDesC& aAttributeValue) const = 0; + + /** Tests if the parent/child relationship is valid in DTD. + + @param aParentElement The name of the parent element to be tested + @param aChildElements An array of child element names to be tested + @return ETrue if parent/child relationship is valid + @leave KErrNoMemory Out of memory */ + virtual TBool AreValidChildElementsL(const TDesC& aParentElement, const CDesCArray& aChildElements) const = 0; + + /** Tests it is valid for a particular element to have children. + + @param aElement The name of the element to be tested + @return ETrue if it is valid for the element to have children */ + virtual TBool CanElementHaveChildren(const TDesC& aElement) const = 0; + }; + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +class CMDXMLDocument : public CBase +/** An XML document. + +An object of this type owns the root element of a DOM tree and is not itself +an XML node. +@publishedPartner +@released + */ +{ +public: + + /** + Allocates and constructs a new CMDXMLDocument. + @param iDtdRepresentation DTD for the document + @return The new CMDXMLDocument object + @leave KErrNoMemory Out of memory + */ + IMPORT_C static CMDXMLDocument* NewL(MXMLDtd& iDtdRepresentation); + + + /** + Allocates and constructs a new CMDXMLDocument, leaving the object on the cleanup stack. + @param iDtdRepresentation DTD for the document + @return The new CMDXMLDocument object + @leave KErrNoMemory Out of memory + */ + IMPORT_C static CMDXMLDocument* NewLC(MXMLDtd& iDtdRepresentation); + + + /** Allocates and constructs a new CMDXMLDocument, without specifying a DTD. + + Documents created using this function will not be able to validate the XML. + + @return The new CMDXMLDocument + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLDocument* NewL(); + + + /** Allocates and constructs a new CMDXMLDocument, without specifying a DTD, + leaving the object on the cleanup stack. + + Documents created using this function will not be able to validate the XML. + + @return The new CMDXMLDocument + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLDocument* NewLC(); + + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLDocument(); + + /** Gets the root element of the DOM tree. + + @return The root element of the DOM tree */ + inline CMDXMLElement* DocumentElement() {return iRootElement;} + + + /** Sets the document's XML version processing instruction. + + @param aVersionTag The XML version processing instruction. This must begin + with , for example . + @return ETrue if successful, EFalse if the parameter format is not correct + @leave KErrNoMemory Out of memory */ + IMPORT_C TBool SetVersionTagL(const TDesC& aVersionTag); + + /** Sets the document's DOCTYPE declaration. + + @param aDocTypeTag The XML DOCTYPE declaration. This must begin. + @return ETrue if operation succeeds, EFalse if the parameter format is not + correct + @leave KErrNoMemory Out of memory */ + IMPORT_C TBool SetDocTypeTagL(const TDesC& aDocTypeTag); + + /** Tests whether an element name is valid for the document. + + @param aElement The element name to be tested + @return True the if element name valid, else false + @leave KErrNoMemory Out of memory */ + IMPORT_C TBool ValidElementNameL(const TDesC& aElement) const; + + /** + Tests whether it is valid for a particular element to have children. + @param aElement the name of the element to be tested + @return ETrue if it is valid for element to have children + */ + + IMPORT_C TBool CanElementHaveChildren(const TDesC& aElement) const; + /** Gets the document's XML version processing instruction. + + @return The document's XML version processing instruction. */ + inline const TDesC& VersionTag() const {return *iVersionTag;} + + /** Gets the document's DOCTYPE declaration. + + @return The document's DOCTYPE declaration. */ + inline const TDesC& DocTypeTag() const {return *iDocTypeTag;} + + /** Gets a reference to the MXMLDtd object to use for DTD validation checking. + + @return DTD */ + const MXMLDtd& CMDXMLDocument::DtdRepresentation() const; + + +private: + CMDXMLDocument(MXMLDtd& aDtdRepresentation); + CMDXMLDocument(); + + /* + * sets the root elememnt of the DOM tree. + */ + inline void SetDocumentElement(CMDXMLElement* aRootElement) {iRootElement = aRootElement;} + + void ConstructL(); + + IMPORT_C void PlaceholderForRemovedExport1(MXMLDtd& aDtdRepresentation); + IMPORT_C void PlaceholderForRemovedExport2(); + +private: + CMDXMLElement* iRootElement; // Root element node of the DOM tree + +protected: + /** XML Version text */ + HBufC* iVersionTag; // XML Version text + /** Document type text */ + HBufC* iDocTypeTag; // Document type text + +private: + MXMLDtd* iDtdRepresentation; + TBool iOwnsDtd; +}; + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLDocumentElement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLDocumentElement.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,65 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the CMDXMLDocumentElement class. +// +// + +/** + @file +*/ + +#ifndef __GMXMLDOCUMENTELEMENT_H__ +#define __GMXMLDOCUMENTELEMENT_H__ + +#include +#include + +class CMDXMLDocumentElement : public CMDXMLElement +/** A dummy XML element for use as the top level element by the document. + +This is required to handle parsing badly-formed XML documents. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLDocumentElement, leaving the object on + the cleanup stack. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @leave KErrNoMemory Out of memory + @return The new CMDXMLDocumentElement */ + IMPORT_C static CMDXMLDocumentElement* NewLC( CMDXMLDocument* aOwnerDocument); + + /** Allocates and constructs a new CMDXMLDocumentElement. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @leave KErrNoMemory Out of memory + @return The new CMDXMLDocumentElement */ + IMPORT_C static CMDXMLDocumentElement* NewL( CMDXMLDocument* aOwnerDocument); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLDocumentElement(); + + +protected: //construction + /* + * Constructor + * @param aOwnerDocument Pointer to the document at the root of the DOM tree - if NULL then assume this is the root + */ + CMDXMLDocumentElement( CMDXMLDocument* aOwnerDocument ); +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLElement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLElement.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,194 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the CMDXMLElement class. +// +// + +/** + @file +*/ + +#ifndef __GMXMLELEMENT_H__ +#define __GMXMLELEMENT_H__ + +#include +#include +#include + + +// forward references +class CMDXMLEntityConverter; +class CMDXMLComposer; + + +// Constants for the initial and terminal states +const TInt KXMLMinJump = 5; // Don't do binary chop below this size. Not a critical value. + +class CMDXMLElement : public CMDXMLNode +/** Generic XML element, and base class for particular XML element types. + +It provides access to the element tag name and its attribute list. Attributes are +stored as name-value pairs. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLElement, leaving the object on the cleanup + stack. + + @param aCanHaveChildren Set to true if the element can have children + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @param aTagName Name of the tag for the element + @leave KErrNoMemory Out of memory + @return The new CMDXMLElement */ + IMPORT_C static CMDXMLElement* NewLC( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument, TPtrC aTagName ); + + /** Allocates and constructs a new CMDXMLElement. + + @param aCanHaveChildren Set to true if the element can have children + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @param aTagName Name of the tag for the element + @leave KErrNoMemory Out of memory + @return The new CMDXMLElement */ + IMPORT_C static CMDXMLElement* NewL( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument, TPtrC aTagName ); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLElement(); + + // Attribute handling routines. + + /** Gets a specified attribute value. + + @param aAttributeName Name of the attribute to get + @param aAttributeValue On return, the value of the attribute + @return KErrNone if successful, KErrNotFound if the named attribute is not set. */ + IMPORT_C virtual TInt GetAttribute(const TDesC& aAttributeName, TPtrC& aAttributeValue ) const; + + /** Checks the validity of an attribute and adds it to the DOM if it's valid. + + @param aAttributeName Name of the attribute to set + @param aAttributeValue Value of the attribute + @leave KErrNoMemory Out of memory + @return KErrNone if successful, KErrNotSupported if an invalid attribute name + or attribute value. */ + IMPORT_C virtual TInt SetAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue); + + /** Checks the validity of an attribute and adds it to the DOM. The aStoreInvalid + parameter is used to control whether invalid attributes are added to the DOM. + @param aAttributeName Name of the attribute to set + @param aAttributeValue Value of the attribute + @param aStoreInvalid If set to EFalse only attributes that are found to be valid will be added to + the DOM. Set to ETrue to store all attributes in the DOM, even those that are invalid. + @leave KErrNoMemory Out of memory + @return KErrNone if successful, KErrNotSupported if an invalid attribute name + or attribute value. */ + IMPORT_C TInt SetAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue, TBool aStoreInvalid); + + /** Removes a specified attribute. + + @param aAttributeName Name of the attribute to remove + @return KErrNone if successful, KErrNotFound if the named attribute is not + present. */ + IMPORT_C virtual TInt RemoveAttribute(const TDesC& aAttributeName); + + /** Tests if a specified attribute is set. + + @param aAttributeName Name of the attribute to test + @return True if the named attribute has a value set, false if not */ + IMPORT_C virtual TBool IsAttributeSpecified(const TDesC& aAttributeName) const; + + + /** Checks the children of this node for validity. + + It checks that the list of child elements conforms to those allowed by the DTD. + + In a generic CMDXMLElement object, this is always true as it has no basis + for a meaningful check. As well as checking the list of direct children, it + calls CheckChildren() for each child element. It does not check child nodes + that are not elements, as they cannot have children. + + @return True if the node has valid children */ + IMPORT_C virtual TBool CheckChildren(); + +// maybe these should be node functions ? + /** Gets a pointer to the first child of a given type if any, otherwise returns + NULL. + + @param aElementType Name of element type to return + @return First child element */ + IMPORT_C CMDXMLElement* FirstChildOfType(const TDesC& aElementType); + + /** Gets a pointer to the last child of a given type if any, otherwise returns + NULL. + + @param aElementType Name of element type to return + @return Last child element */ + IMPORT_C CMDXMLElement* LastChildOfType(const TDesC& aElementType); + + + +protected: //construction + /** + * Constructor + * @param aCanHaveChildren Flag to indicate if the node represents a node which is allowed children + * @param aOwnerDocument Pointer to the document at the root of the DOM tree - if NULL then assume this is the root + */ + IMPORT_C CMDXMLElement( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument ); + + void ConstructL(); +protected: + /** + * Check the immediate children of this element - i.e. the first level of children only + * The default implementation returns true - derived classes can override with + * DTD-specific checks. + * @return True if immediate children are valid + */ + IMPORT_C virtual TBool CheckImmediateChildren(); + +private: + TBool DoCheckImmediateChildrenL(); + + +public: + /** Finds an attribute and returns the index of it. + + @param aAttName The attribute to search for + @return The index of the attribute if found, or KErrNotFound */ + IMPORT_C TInt FindIndex(const TDesC &aAttName); + + + /** Gets the name and value of an attribute at a given index. + + @param Index The array index of the element for which details are required + @param aAttributeName The attribute name returned + @param aAttributeValue The attribute value returned + @return KErrNone if index is valid, else KErrNotFound */ + IMPORT_C TInt AttributeDetails(TInt Index, TPtrC& aAttributeName, TPtrC& aAttributeValue); + + /** Gets the number of attributes that this element has. + + @return The number of attributes held by the element */ + IMPORT_C TInt NumAttributes(); + +protected: + /** Store attribute names */ + CDesCArraySeg* iDescAttName; // Store Attribute Names + /** Store attribute values */ + CDesCArraySeg* iDescAttValue; // Store Attribute Values + +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLNode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLNode.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,235 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the CMDXMLNode class which +// is the base class for the Mini-DOM. +// +// + +/** + @file +*/ + +#ifndef __GMXMLNODE_H__ +#define __GMXMLNODE_H__ + +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +// forward references +class CMDXMLComposer; +class CMDXMLDocument; +class CMDXMLEntityConverter; + +class CMDXMLNode : public CBase +/** Abstract base class for DOM node classes. + +It stores the node type and name, and manages a list of child nodes. The node +name and type are set in the derived class's constructor and cannot be changed. + +The list of child nodes is managed as a doubly-linked list, not an array +or similar structure. + +Derived classes that are not allowed children override the operations to manipulate +the child list. +@publishedPartner +@released +*/ +{ +public: + // XML DOM Node Types - The actual values are taken from the DOM definition but we only use some of them. + /** XML DOM node types. + + The values are taken from the DOM definition, but only some of them are used + for the SMIL API. +@publishedPartner +@released +*/ + enum TDOMNodeType + { + EElementNode=1, //< Element + ETextNode=3, //< Text + ECDATASectionNode=4, //< CDATA Section + EProcessingInstructionNode=7, //< Processing Instruction + ECommentNode=8, //< Comment + EDocumentNode=9 //< Document + }; + + /** Destructor. + + When a node is deleted, it: + + 1. links its previous and next siblings + + 2. deletes all its children + + 3. corrects its parents first and last child pointers if necessary */ + IMPORT_C virtual ~CMDXMLNode(); + + /** Gets the node type of the node. + + @return The node type of the node */ + inline TDOMNodeType NodeType() {return iNodeType;} + + /** Gets the name of the node. + + @return The name of the node */ + IMPORT_C TPtrC NodeName(); + + /** Tests if the node can have child nodes. + + @return True if the node can have child nodes, false otherwise */ + inline TBool CanHaveChildNodes() {return iCanHaveChildren;} + + /** Tests if the node has any child nodes. + + @return True if the node has any child nodes, false otherwise */ + inline TBool HasChildNodes() {return (iFirstChildPtr != NULL);} + + /** Gets a pointer to the document which is the owner of the DOM tree. + + @return A pointer to the document which is the owner of the DOM tree */ + inline CMDXMLDocument* OwnerDocument() {return (CMDXMLDocument*)iOwnerDocument;} + + /** Gets a pointer to the first child node, if any. + + @return A pointer to the first child node if any, otherwise NULL */ + inline CMDXMLNode* FirstChild() {return iFirstChildPtr;} + + /** Gets a pointer to the last child node, if any. + + @return A pointer to the last child node if any, otherwise NULL */ + inline CMDXMLNode* LastChild() {return iLastChildPtr;} + + /** Gets a pointer to the next sibling node, if any. + + @return A pointer to the next sibling node if any, otherwise NULL */ + inline CMDXMLNode* NextSibling() {return iNextSiblingPtr;} + + /** Gets a pointer to the previous sibling node, if any. + + @return A pointer to the previous sibling node if any, otherwise NULL */ + inline CMDXMLNode* PreviousSibling() {return iPrevSiblingPtr;} + + /** Gets a pointer to the parent node, if any. + + @return A pointer to the parent node if any, otherwise NULL (only at root + of tree) */ + inline CMDXMLNode* ParentNode() {return iParentPtr;} + + /** Gets the element type as an enumerated value. + + This function is quicker to use than NodeName(). + + @return A CMDXMLNode::TDomNodeType value identifying the node type */ + inline TInt ElementType() {return iElementType;} + + /** Removes a child from the list of child nodes. + + The child node is not deleted: that is the responsibility of the caller. + + @param aChildToRemove Pointer to child to remove from the list + @return KErrNone if sucessful or KErrNotFound if the referenced child node + is not found */ + IMPORT_C TInt RemoveChild(CMDXMLNode* aChildToRemove); + + /** Inserts a new child node at a specific point in the child list. + + @param aInsertBeforeChild Pointer to the element before which the new child + should be inserted. UseNULL to insert at the start of the list. + @param aChildToInsert Pointer to the new child node to insert + @return KErrNone if successful, KErrNotSupported if the node cannot have children + or KErrNotFound if it cannot find the child before which to insert */ + IMPORT_C TInt InsertBefore(CMDXMLNode* aInsertBeforeChild, CMDXMLNode* aChildToInsert); + + /** Appends a new child at the end of the child list. + + @param aChildToInsert Pointer to the new child node to append. + @return KErrNone if successful or KErrNotSupported if the node cannot have + children */ + IMPORT_C TInt AppendChild(CMDXMLNode* aChildToInsert); + + /** Inserts a new child node while removing an existing one. + + The old child is not deleted. + + @param aChildToInsert Pointer to the new child node to insert + @param aChildToReplace Pointer to the child node to be replaced + @return KErrNone if successful, KErrNotSupported if the node cannot have children + or KErrNotFound if it cannot find the child to replace. */ + IMPORT_C TInt ReplaceChild(CMDXMLNode* aChildToInsert, CMDXMLNode* aChildToReplace); + + + /** Checks the children of this node for validity. + + @return True if the children are valid according to the DTD. */ + IMPORT_C virtual TBool CheckChildren()=0; + +protected: + /* + * The node type will normally be hard-wired in any derived class constructor. + * The node name and HaveChildren flag will normally be hard-wired in a derived class constructor unless it + * covers a generic element. + * @param aNodeType The tpe of node to be created + * @param aCanHaveChildren Flag to indicate if the node represents a node which is allowed children + * @param aOwnerDocument Pointer to the document at the root of the DOM tree - if NULL then assume this is the root + */ + CMDXMLNode( TDOMNodeType aNodeType, TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument ); + +// make these public? sjr + /** + * Gets a pointer to the previous sibling node of the same type if any, + * otherwise returns NULL + * @return Previous sibling node + */ + IMPORT_C CMDXMLNode* PreviousSameTypeSibling(); + + /** + * Gets a pointer to the next sibling node of the same type if any, + * otherwise returns NULL + * @return Next sibling node + */ + IMPORT_C CMDXMLNode* NextSameTypeSibling(); + + /** + * Set the node name - normally on creation + * @param aNodeName The node name - commonly an element tag name - _not_ any unique identifier + * @leave Can Leave due to OOM + */ + IMPORT_C void SetNodeNameL(const TDesC& aNodeName); + + /** + * Sets the enumerated element type (same information as node name but faster to access) + */ + inline void SetElementType( TInt aElementType ) {iElementType = aElementType;} + +protected: + CMDXMLDocument* iOwnerDocument; //< Pointer to owning document + + +private: + TInt iElementType; // Enumerated element type + TDOMNodeType iNodeType; // Node type + HBufC* iNodeName; // Name of the node, e.g. element tag name - not unique id + CMDXMLNode* iParentPtr; // Pointer to parent node if any + CMDXMLNode* iFirstChildPtr; // Pointer to first child node if any + CMDXMLNode* iLastChildPtr; // Pointer to last child node if any + CMDXMLNode* iNextSiblingPtr; // Pointer to next sibling if any + CMDXMLNode* iPrevSiblingPtr; // Pointer to previous sibling if any + TBool iCanHaveChildren; // true if this node is allowed to have children +}; + +#endif +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLProcessingInstruction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLProcessingInstruction.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,65 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GMXMLProcessing Instruction.h +// +// + +/** + @file +*/ + +#ifndef __GMXMLPROCINSTR_H__ +#define __GMXMLPROCINSTR_H__ + +#include +#include + +class CMDXMLProcessingInstruction : public CMDXMLCharacterData +/** A processing instruction section of an XML file. + +It has text and a place in the object tree, but has no children. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLProcessingInstruction, leaving the object + on the cleanup stack. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return The new CMDXMLProcessingInstruction + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLProcessingInstruction* NewLC( CMDXMLDocument* aOwnerDocument ); + + /** Allocates and constructs a new CMDXMLProcessingInstruction. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return The new CMDXMLProcessingInstruction + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLProcessingInstruction* NewL( CMDXMLDocument* aOwnerDocument ); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLProcessingInstruction(); + + +protected: + /* + * Constructor + * @param aOwnerDocument The document at the root of the DOM tree + */ + CMDXMLProcessingInstruction( CMDXMLDocument* aOwnerDocument ); +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMXMLText.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMXMLText.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#ifndef __GMXMLTEXT_H__ +#define __GMXMLTEXT_H__ + +#include +#include + +class CMDXMLText : public CMDXMLCharacterData +/** A text section of an XML file. + +Objects of this type hold text. They cannot have child nodes. +@publishedPartner +@released +*/ +{ +public: + /** Allocates and constructs a new CMDXMLText, leaving the object on the cleanup + stack. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return The new CMDXMLText + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLText* NewLC( CMDXMLDocument* aOwnerDocument ); + + /** Allocates and constructs a new CMDXMLText. + + @param aOwnerDocument Pointer to the document at the root of the DOM tree + @return The new CMDXMLText + @leave KErrNoMemory Out of memory */ + IMPORT_C static CMDXMLText* NewL( CMDXMLDocument* aOwnerDocument ); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLText(); + + +protected: + /* + * Constructor + * @param aOwnerDocument The document at the root of the DOM tree + */ + CMDXMLText( CMDXMLDocument* aOwnerDocument ); +}; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/GMxmldomconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/GMxmldomconstants.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,61 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains generic XML constants +// +// + +/** + @file + @publishedPartner + @released +*/ + +#ifndef __GMXMLDOMCONSTANTS_H__ +#define __GMXMLDOMCONSTANTS_H__ + +#include + + +// Error codes +/** +* Starting value for all the component's error codes. +* @publishedPartner +* @released +*/ +const TInt KErrXMLBase = -9000; +/** +* XML attribute value error code. +* @publishedPartner +* @released +*/ +const TInt KErrXMLBadAttributeValue = KErrXMLBase - 1; +/** +* XML attribute name error code. +* @publishedPartner +* @released +*/ +const TInt KErrXMLBadAttributeName = KErrXMLBase - 2; +/** +* Invalid XML child element error code. +* @publishedPartner +* @released +*/ +const TInt KErrXMLInvalidChild = KErrXMLBase - 3; + + + +_LIT(KXMLDocumentElementNodeName, "documentelement"); + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/INC/gmxmldummydtd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/INC/gmxmldummydtd.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the CMDXMLDocument when no +// DTD is mentioned. +// +// +/** + * @file + * @internalComponent + * @released + */ + +#ifndef __GMXMLDUMMYDTD_H__ +#define __GMXMLDUMMYDTD_H__ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "GMXMLDocument.h" +#endif + +_LIT(KXMLCDATASectionNodeName, "#cdata-section"); +_LIT(KXMLCommentNodeName, "comment"); +_LIT(KXMLProcessingInstructionNodeName, "processing_instruction"); +_LIT(KXMLTextNodeName, "#text"); +_LIT(KXMLDefaultVersionTag, ""); +_LIT(KXMLDefaultDocTypeTag, ""); +_LIT(KXMLVersion, ""); +_LIT(KXMLDocumentTypes, " +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +EXPORT_C CMDXMLCDATASection* CMDXMLCDATASection::NewLC( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMCDATASection +// @leave can Leave due to OOM +// + { + CMDXMLCDATASection* secPtr = new(ELeave) CMDXMLCDATASection( aOwnerDocument ); + CleanupStack::PushL( secPtr ); + const TDesC& nodeName = KXMLCDATASectionNodeName; + secPtr->SetNodeNameL( nodeName ); + return secPtr; + } + +EXPORT_C CMDXMLCDATASection* CMDXMLCDATASection::NewL( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMCDATASection +// @leave can Leave due to OOM +// + { + CMDXMLCDATASection* secPtr = CMDXMLCDATASection::NewLC( aOwnerDocument ); + CleanupStack::Pop(1); // secPtr + return secPtr; + } + +CMDXMLCDATASection::CMDXMLCDATASection( CMDXMLDocument* aOwnerDocument ): +CMDXMLCharacterData( ECDATASectionNode, aOwnerDocument) +// +// Constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// + { + } + +EXPORT_C CMDXMLCDATASection::~CMDXMLCDATASection() + { + } + + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLCharacterData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLCharacterData.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,159 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLCharacterData.cpp +// @file +// This class represents a text section of an XML file - +// basically it is a chunk of text which has a place in the +// object tree but has no children. +// +// + +#include +#include +#include + +CMDXMLCharacterData::CMDXMLCharacterData( TDOMNodeType aNodeType, CMDXMLDocument* aOwnerDocument ): +CMDXMLNode( aNodeType, false, aOwnerDocument) +// +// Constructor +// @param aNodeType The node type of the derived object +// @param aOwnerDocument The Document at the root of the DOM tree. +// + { + } + +EXPORT_C CMDXMLCharacterData::~CMDXMLCharacterData() + { + delete iData; + } + +EXPORT_C TDesC& CMDXMLCharacterData::Data() +// +// @return Returns the text of the Character Data section +// + { + return *iData; + } + +EXPORT_C void CMDXMLCharacterData::SetDataL( TDesC& aData ) +// +// Sets the whole of the Character Data section text +// @param aData Text to set. +// @leave Can Leave due to OOM +// + { + if( iData != NULL ) + { + delete iData; + iData = NULL; + } + iData = aData.AllocL(); + } + +EXPORT_C TInt CMDXMLCharacterData::Length() +// +// @return Returns the length of the text +// + { + return iData->Length();; + } + +EXPORT_C void CMDXMLCharacterData::AppendL( TDesC& aData ) +// +// Appends text to the Character Data section +// @param aData Text to append +// @leave Can Leave due to OOM +// + { + TInt newLength = aData.Length() + iData->Length(); + if(newLength > iData->Des().MaxLength()) + { + HBufC* newData = HBufC::NewMaxL(newLength); + newData->Des().Copy(iData->Des()); + delete iData; + iData = newData; + } + iData->Des().Append(aData); + } + +EXPORT_C TInt CMDXMLCharacterData::InsertL( TInt aInsertPos, TDesC& aData ) +// +// Inserts text at a point in the Character Data section +// @param aInsertPos The position to insert the text (0 means insert at the start) +// @param aData Text to insert +// @leave Can Leave due to OOM +// @return Returns KErrNone if successful or KErrNotFound if the insert position is out of range +// + { + TInt retVal = KErrNone; + if((aInsertPos >= 0) && (aInsertPos < iData->Length())) + { + TInt newLength = aData.Length() + iData->Length(); + if(newLength > iData->Des().MaxLength()) + { + HBufC* newData = HBufC::NewMaxL(newLength); + newData->Des().Copy(iData->Des()); + delete iData; + iData = newData; + } + iData->Des().Insert(aInsertPos, aData); + } + else + { + retVal = KErrNotFound; + } + return retVal; + } + +EXPORT_C TInt CMDXMLCharacterData::ReplaceL( TInt aInsertPos, TInt aLength, TDesC& aData ) +// +// Replaces a block of text in the Character Data section +// @param aInsertPos The position to insert the text (0 means insert at the start) +// @param aLength The number of characters to replace +// @param aData Text to insert +// @leave Can Leave due to OOM +// @return Returns KErrNone if successful or KErrNotFound if the replace block is out of range +// + { + TInt retVal = KErrNone; + if((aInsertPos >= 0) && (aInsertPos < iData->Length()) && (aLength >= 0)) + { + TInt newLength = aData.Length() + iData->Length() - aLength; + if(newLength > iData->Des().MaxLength()) + { + HBufC* newData = HBufC::NewMaxL(newLength); + newData->Des().Copy(iData->Des()); + delete iData; + iData = newData; + } + iData->Des().Replace(aInsertPos, aLength, aData); + } + else + { + retVal = KErrNotFound; + } + return retVal; + } + +EXPORT_C TBool CMDXMLCharacterData::CheckChildren() +// +// Check the children of this node for legality - must be defined based on DTD. +// For a Character Data section there can be no children so this always returns true. +// @return True if the node has legitimate children +// + { + return true; + } + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLComment.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLComment.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,74 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLComment.cpp +// @file +// This class represents a Comment section of an XML file - +// basically it is a chunk of text which has a place in the +// object tree but has no children. +// +// + +#include +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +EXPORT_C CMDXMLComment* CMDXMLComment::NewLC( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMComment +// @leave can Leave due to OOM +// + { + CMDXMLComment* secPtr = new(ELeave) CMDXMLComment( aOwnerDocument ); + CleanupStack::PushL( secPtr ); + const TDesC& nodeName = KXMLCommentNodeName; + secPtr->SetNodeNameL( nodeName ); + return secPtr; + } + +EXPORT_C CMDXMLComment* CMDXMLComment::NewL( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLElement +// @leave can Leave due to OOM +// + { + CMDXMLComment* secPtr = CMDXMLComment::NewLC( aOwnerDocument ); + CleanupStack::Pop(1); // secPtr + return secPtr; + } + +CMDXMLComment::CMDXMLComment( CMDXMLDocument* aOwnerDocument ): +CMDXMLCharacterData( ECommentNode, aOwnerDocument) +// +// Constructor +// @param aOwnerDocument The document at the root of the DOM tree +// + { + } + +EXPORT_C CMDXMLComment::~CMDXMLComment() + { + } + + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLDocument.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,238 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLDocument.CPP +// @file +// This file contains the implementation of the CMDXMLDocument class which +// is the root class for a Mini-DOM tree. +// +// + +#include +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif +// +// Global functions // +// + + +CMDXMLDocument::CMDXMLDocument(MXMLDtd& aDtdRepresentation) : iDtdRepresentation(&aDtdRepresentation) +// +// Constructor +// + { + } + +CMDXMLDocument::CMDXMLDocument() +// +// Constructor +// + { + } + + +EXPORT_C CMDXMLDocument::~CMDXMLDocument() + { + delete iRootElement; + delete iVersionTag; + delete iDocTypeTag; + + if (iOwnsDtd) + // If the DTD is a dummy DTD created by this document then it should be deleted. + { + delete iDtdRepresentation; + } + } + +EXPORT_C CMDXMLDocument* CMDXMLDocument::NewL(MXMLDtd& aDtdRepresentation) +// +// Factory function +// @return Returns the created CMDXMLDocument +// @leave Can Leave due to OOM +// + { + CMDXMLDocument* self = CMDXMLDocument::NewLC(aDtdRepresentation); + CleanupStack::Pop(self); + return self; + } + + +EXPORT_C CMDXMLDocument* CMDXMLDocument::NewLC(MXMLDtd& aDtdRepresentation) +// +// Factory function +// @return Returns the created CMDXMLDocument +// @leave Can Leave due to OOM +// + { + CMDXMLDocument* self = new(ELeave) CMDXMLDocument(aDtdRepresentation); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +/** + * Factory function - Without taking a DTD + * Documents created using this function will not be able to validate the XML. + * @return Returns the created CMDXMLDocument + * @leave Can Leave due to OOM + */ +EXPORT_C CMDXMLDocument* CMDXMLDocument::NewL() + { + CMDXMLDocument* self = CMDXMLDocument::NewLC(); + CleanupStack::Pop(self); + return self; + } + + +/** + * Factory function - Without taking a DTD + * Documents created using this function will not be able to validate the XML. + * @return Returns the created CMDXMLDocument + * @leave Can Leave due to OOM + */ +EXPORT_C CMDXMLDocument* CMDXMLDocument::NewLC() + { + CMDXMLDocument* self = new(ELeave) CMDXMLDocument(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + + +void CMDXMLDocument::ConstructL() + { +// Default XML Version & Doc tags being set +// Can be reset externally + iVersionTag = TPtrC(KXMLDefaultVersionTag).AllocL(); + iDocTypeTag = TPtrC(KXMLDefaultDocTypeTag).AllocL(); + + iRootElement = CMDXMLDocumentElement::NewL(this); + + if (iDtdRepresentation == NULL) + // If no DTD has been provided then use the dummy DTD + { + iDtdRepresentation = new (ELeave) CMDXMLDummyDtd; + iOwnsDtd = ETrue; + } + } + + +EXPORT_C TBool CMDXMLDocument::SetVersionTagL(const TDesC& aVersionTag) +// +// @param replacement tag, this must be complete, starting +// @return ETrue if operation succeeds, EFalse if formal parameter does not +// begin with +// @leave can Leave due to OOM +// + { + TBool returnValue = EFalse; + + // if correct tag frame + if(aVersionTag.Left(TPtrC(KXMLVersion).Length()) == KXMLVersion + && aVersionTag.Right(TPtrC(KXMLEndTag).Length()) == KXMLEndTag) + { + delete iVersionTag; + iVersionTag = NULL; + iVersionTag = aVersionTag.AllocL(); + returnValue = ETrue; + } + + return returnValue; + } + +EXPORT_C TBool CMDXMLDocument::SetDocTypeTagL(const TDesC& aDocTypeTag) +// +// @param replacement tag, this must be complete, starting +// @return ETrue if operation succeeds, EFalse if formal parameter does not +// begin with IsValidElementL(aElement); + } + + +EXPORT_C TBool CMDXMLDocument::CanElementHaveChildren(const TDesC& aElement) const + { + return iDtdRepresentation->CanElementHaveChildren(aElement); + } + +EXPORT_C void CMDXMLDocument::PlaceholderForRemovedExport1(MXMLDtd& /*aDtdRepresentation*/) + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +EXPORT_C void CMDXMLDocument::PlaceholderForRemovedExport2() + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +const MXMLDtd& CMDXMLDocument::DtdRepresentation() const +// Returns a reference to the dtd class responsible for validation +// @return Returns a reference to MXMLDtd class that should be used for Dtd validation checking + { + return *iDtdRepresentation; + } + + +TBool CMDXMLDummyDtd::IsValidElementL(const TDesC& /*aElement*/) const + { + return ETrue; + } + +TInt CMDXMLDummyDtd::IsValidAttributeForElementL(const TDesC& /*aElement*/, const TDesC& /*aAttribute*/, const TDesC& /*aAttributeValue*/) const + { + return KErrNone; + } + +TBool CMDXMLDummyDtd::AreValidChildElementsL(const TDesC& /*aParentElement*/, const CDesCArray& /*aChildElements*/) const + { + return ETrue; + } + +TBool CMDXMLDummyDtd::CanElementHaveChildren(const TDesC& /*aElement*/) const + { + return ETrue; + } + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLDocumentElement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLDocumentElement.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLDocumentElement.CPP +// @file +// This file contains the implementation of the CMDXMLDocumentElement class. +// This class represents a generic XML element with attributes +// stored as name-value pairs. DTD-specific element classes +// will store their attributes as member variables. +// +// + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +EXPORT_C CMDXMLDocumentElement* CMDXMLDocumentElement::NewLC( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLDocumentElement +// @leave can Leave due to OOM +// + { + CMDXMLDocumentElement* elPtr = new(ELeave) CMDXMLDocumentElement( aOwnerDocument ); + CleanupStack::PushL( elPtr ); + elPtr->ConstructL(); + elPtr->SetNodeNameL( KXMLDocumentElementNodeName ); + return elPtr; + } + +EXPORT_C CMDXMLDocumentElement* CMDXMLDocumentElement::NewL( CMDXMLDocument* aOwnerDocument) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLDocumentElement +// @leave can Leave due to OOM +// + { + CMDXMLDocumentElement* elPtr = CMDXMLDocumentElement::NewLC( aOwnerDocument); + CleanupStack::Pop(1); // elPtr + return elPtr; + } + +CMDXMLDocumentElement::CMDXMLDocumentElement( CMDXMLDocument* aOwnerDocument ): +CMDXMLElement( ETrue, aOwnerDocument) +// +// Constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// + { + } + +EXPORT_C CMDXMLDocumentElement::~CMDXMLDocumentElement() + { + } + + + + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLElement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLElement.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,378 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLElement.CPP +// @file +// This file contains the implementation of the CMDXMLElement class. +// This class represents a generic XML element with attributes +// stored as name-value pairs. DTD-specific element classes +// will store their attributes as member variables. +// +// + +#include + +#include +#include +#include +#include + + +EXPORT_C CMDXMLElement* CMDXMLElement::NewLC( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument, TPtrC aTagName ) +// +// Two phase constructor +// @param aCanHaveChildren Flag to indicate if the node represents a node +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @param aTagName Name of the tag used to create the element +// @return Created CMDXMLElement +// @leave can Leave due to OOM +// + { + CMDXMLElement* elPtr = new(ELeave) CMDXMLElement( aCanHaveChildren, aOwnerDocument ); + CleanupStack::PushL( elPtr ); + elPtr->SetNodeNameL( aTagName ); + elPtr->ConstructL(); + return elPtr; + } + +EXPORT_C CMDXMLElement* CMDXMLElement::NewL( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument, TPtrC aTagName ) +// +// Two phase constructor +// @param aCanHaveChildren Flag to indicate if the node represents a node +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @param aTagName Name of the tag used to create the element +// @return Created CMDXMLElement +// @leave can Leave due to OOM +// + { + CMDXMLElement* elPtr = CMDXMLElement::NewLC( aCanHaveChildren, aOwnerDocument, aTagName ); + CleanupStack::Pop(elPtr); + return elPtr; + } + +EXPORT_C CMDXMLElement::CMDXMLElement( TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument ): +CMDXMLNode( EElementNode, aCanHaveChildren, aOwnerDocument) +// +// Constructor +// @param aCanHaveChildren Flag to indicate if the node represents a node which is allowed children +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// + { + // No other work to do. + } + +void CMDXMLElement::ConstructL() +/** + * 2nd-phase constructor. Initialises this object's member data. + * + * @leave KErrXxx Standard EPOC error codes if allocation or construction of the object's members fails + */ + { + iDescAttName = new (ELeave) CDesCArraySeg(1); + iDescAttValue = new (ELeave) CDesCArraySeg(1); + + } + +EXPORT_C CMDXMLElement::~CMDXMLElement() +/** + * C++ destructor + */ + { + // Delete the array of attribute name-value pairs. + if(iDescAttName) + delete iDescAttName; + + if(iDescAttValue) + delete iDescAttValue; + + } + + +EXPORT_C TInt CMDXMLElement::GetAttribute(const TDesC& aAttributeName, TPtrC& aAttributeValue) const +// +// Returns the attribute value if it is set. +// @param aAttributeName Name of attribute to return +// @param aAttributeValue Value of attribute returned +// @return Returns KErrNone if successful, KErrNotFound if the named attribute +// is not set or KErrNotSupported if the named attribute doesn't exist. +// + { + TInt returnValue = KErrNone; + + TInt index; + TInt attributeFound; + attributeFound = iDescAttName->Find(aAttributeName,index); + + if(attributeFound == 0) + { + aAttributeValue.Set(iDescAttValue->MdcaPoint(index)); + } + else + returnValue = KErrNotSupported; + + return returnValue; + + } + +EXPORT_C TInt CMDXMLElement::SetAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue) +// +// Sets the attribute value.if it is valid +// @param aAttributeName Name of attribute to set +// @param aAttributeValue Value of attribute +// @return Returns KErrNone if successful, KErrNotSupported if a DTD-specific class. +// @leave Can Leave due to OOM +// + { + return SetAttributeL(aAttributeName, aAttributeValue, EFalse); + } + +EXPORT_C TInt CMDXMLElement::SetAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue, TBool aStoreInvalid) +// +// Checks an attribute for validity and adds it to the DOM. The aStoreInvalid parameter is used to control whether invalid +// attributes are added to the DOM. +// @param aAttributeName Name of attribute to set +// @param aAttributeValue Value of attribute +// @param aStoreInvalid If set to ETrue all attributes will be stored in the DOM. Otherwise only those that are valid will be. +// @return Returns KErrNone if successful, KErrNotSupported if a DTD-specific class. +// @leave Can Leave due to OOM +// + { + TInt returnValue = (iOwnerDocument->DtdRepresentation()).IsValidAttributeForElementL(NodeName(), aAttributeName, aAttributeValue); + + if(returnValue == KErrNone || aStoreInvalid) + { + iDescAttName->AppendL(aAttributeName); + iDescAttValue->AppendL(aAttributeValue); + } + + return returnValue; + } + +EXPORT_C TInt CMDXMLElement::RemoveAttribute(const TDesC& aAttributeName) +// +// Removes the named attribute if present. +// @param aAttributeName Name of attribute to set +// @return Returns KErrNone if successful, KErrNotFound if the named attribute is not set, KErrNotSupported if a DTD-specific class. +// + { + TInt returnValue = KErrNone; + + TInt index; + TInt attributeFound; + attributeFound = iDescAttName->Find(aAttributeName,index); + + if(attributeFound == 0) + { + iDescAttName->Delete(index); + iDescAttValue->Delete(index); + } + else + returnValue = KErrNotFound; + + return returnValue; + } + + +EXPORT_C TBool CMDXMLElement::IsAttributeSpecified(const TDesC& aAttributeName) const +// +// Finds out whether or not the named attribute is set +// @param aAttributeName Name of attribute that is subject of the enquiry. +// @return true of the named attribute has a value set, false if not +// + { + TBool returnValue = EFalse; + + if(iDescAttName) + { + TInt index = 0; + TInt found = 0; + found = iDescAttName->Find(aAttributeName,index); + if(found == 0) + returnValue = ETrue; + } + + return returnValue; + } + + + + + +EXPORT_C TBool CMDXMLElement::CheckImmediateChildren() +// Check the immediate children of this element - i.e. the first level of children only +// If the document has not been constructed with a pointer to a MXMLDtd object then a default ETrue will be returned +// Otherwise the MXMLDtd object is used to validate immediate children - returns ETrue if valid +// @return True if immediate children are valid + { + TBool returnValue = ETrue; + TRAPD(error,returnValue = DoCheckImmediateChildrenL()); + if(error != KErrNone) + { + return EFalse; + } + return returnValue; + } + +TBool CMDXMLElement::DoCheckImmediateChildrenL() + { + TBool returnValue = ETrue; + + // Create an array of this elements immediate children + CDesCArray* children = new (ELeave) CDesCArrayFlat(3); + CleanupStack::PushL(children); + + if (HasChildNodes()) + { + CMDXMLNode* childPtr; + childPtr = FirstChild(); + // Cycle through the siblings + while (childPtr != NULL) + { + if( childPtr->NodeType() == EElementNode ) + children->AppendL(childPtr->NodeName()); + childPtr = childPtr->NextSibling(); + } + returnValue = OwnerDocument()->DtdRepresentation().AreValidChildElementsL(this->NodeName(),*children); + } + + // Do a DTD specific check to see if the children are valid + CleanupStack::PopAndDestroy(); // children + + return returnValue; + } + +EXPORT_C TBool CMDXMLElement::CheckChildren() +// +// Check the children of this node for legality - must be defined based on DTD. +// This function checks that the list of child elements +// conforms to those allowed by the DTD. +// As well as checking the list of direct children, it +// calls CheckChildren for each child element which is an +// element (it does not call this for child nodes which are +// not elements as they cannot have children). +// @return True if the node has legitimate children +// + { + TBool retVal= CheckImmediateChildren(); + if( retVal && HasChildNodes() ) + { + CMDXMLNode* childPtr; + childPtr = FirstChild(); + while((childPtr != NULL) && (retVal != false)) + { + if( childPtr->NodeType() == EElementNode ) + { + retVal = childPtr->CheckChildren(); + } + childPtr = childPtr->NextSibling(); + } + } + + return retVal; + } + + +EXPORT_C TInt CMDXMLElement::FindIndex(const TDesC &aAttName) +// +// Find an attribute and return the index of it +// @param aAttName the string to search for +// @return returns the index of the string if found or KErrNotFound +// + { + TInt index = KErrNotFound; + + if(iDescAttName) + { + TInt found = 0; + found = iDescAttName->Find(aAttName,index); + if(found != 0) + index = KErrNotFound; + } + + return index; + + + } + + +EXPORT_C TInt CMDXMLElement::AttributeDetails(TInt aIndex, TPtrC& aAttributeName, TPtrC& aAttributeValue) +// +// Retrieves the Name and Value of an attribute at a given index +// @param aIndex the array index of the element for which details are required +// @param aAttributeName the attribute name returned +// @param aAttributeValue the attribute value returned +// @return returns KErrNone if index is valid else KErrNotFound +// + + { + TInt error = KErrNone; + if (iDescAttName->Count() < aIndex) + error = KErrNotFound; + else + { + aAttributeValue.Set(iDescAttValue->MdcaPoint(aIndex)); + aAttributeName.Set(iDescAttName->MdcaPoint(aIndex)); + } + return error; + } + + + +EXPORT_C TInt CMDXMLElement::NumAttributes() +// +// Retrieves the Number od Attributes that this element has +// @return returns the number of attributes held by the element +// + { + return iDescAttName->Count(); + } + + +EXPORT_C CMDXMLElement* CMDXMLElement::FirstChildOfType(const TDesC& aElementType) +// @return Returns a pointer to the first child of a given type if any, otherwise returns NULL +// @param aElementType Name of element type to return + { + CMDXMLElement* retVal = NULL; + CMDXMLNode* nodePtr = FirstChild(); + while((nodePtr != NULL) && (nodePtr->NodeName()).Compare(aElementType) != 0) + { + nodePtr = nodePtr->NextSibling(); + } + if( nodePtr != NULL ) + { + retVal = (CMDXMLElement*)nodePtr; + } + return retVal; + + } + +EXPORT_C CMDXMLElement* CMDXMLElement::LastChildOfType(const TDesC& aElementType) +// @return Returns a pointer to the last child of a given type if any, otherwise returns NULL +// @param aElementType Name of element type to return + + { + CMDXMLElement* retVal = NULL; + CMDXMLNode* nodePtr = LastChild(); + while((nodePtr != NULL) && (nodePtr->NodeName()).Compare(aElementType) != 0) + { + nodePtr = nodePtr->PreviousSibling(); + } + if( nodePtr != NULL ) + { + retVal = (CMDXMLElement*)nodePtr; + } + return retVal; + } + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLNode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLNode.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,399 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLNode.CPP +// @file +// This file contains the implementation of the CMDXMLNode class which +// is the base class for the Mini-DOM. +// This class forms the basis for the Mini-DOM. It is a +// pure abstract class and it's sole concern is the node +// type and name and the management of the list of child +// nodes. +// The node name and type are set in the constructor and +// cannot be changed thereafter. +// The list of child nodes is managed as a doubly-linked +// list, not an array or similar structure. Derived +// classes which are not allowed children will override the +// operations to manipulate the child list. +// +// + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +CMDXMLNode::CMDXMLNode( TDOMNodeType aNodeType, TBool aCanHaveChildren, CMDXMLDocument* aOwnerDocument ): + iElementType(KXMLUndefinedElement), + iNodeType(aNodeType), + iCanHaveChildren(aCanHaveChildren) +// +// The node type will normally be hard-wired in any derived class constructor. +// The node name and HaveChildren flag will normally be hard-wired in a derived class constructor unless it +// covers a generic element. +// @param aNodeType The tpe of node to be created +// @param aCanHaveChildren Flag to indicate if the node represents a node which is allowed children +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// + { + iOwnerDocument = aOwnerDocument; + } + +EXPORT_C CMDXMLNode::~CMDXMLNode() +// +// When this node is deleted it will links its previous and next siblings across the gap, will +// delete all of its children and will correct its parents first and last child pointers if necessary. +// + { + // Perform housekeeping on parent and siblings - shouldn't be necessary as the links to + // this element should have been removed first or we are in a tree delete but + // let's be helpful anyway. + if((iNextSiblingPtr != NULL) && (iNextSiblingPtr->iPrevSiblingPtr == this)) + { + iNextSiblingPtr->iPrevSiblingPtr = iPrevSiblingPtr; + } + if((iPrevSiblingPtr != NULL) && (iPrevSiblingPtr->iNextSiblingPtr == this)) + { + iPrevSiblingPtr->iNextSiblingPtr = iNextSiblingPtr; + } + if( iParentPtr != NULL ) + { + if(iParentPtr->iFirstChildPtr == this) + { + iParentPtr->iFirstChildPtr = iNextSiblingPtr; + } + if(iParentPtr->iLastChildPtr == this) + { + iParentPtr->iLastChildPtr = iPrevSiblingPtr; + } + } + + // Delete all children + CMDXMLNode* childToDelete; + CMDXMLNode* nextChild; + childToDelete = iFirstChildPtr; + while( childToDelete != NULL ) + { + nextChild = childToDelete->iNextSiblingPtr; + delete childToDelete; + childToDelete = nextChild; + } + + delete iNodeName; + iNodeName = NULL; + } + +EXPORT_C void CMDXMLNode::SetNodeNameL( const TDesC& aNodeName) +// +// @param aNodeName The name of the node. +// @leave Can Leave due to OOM +// + { + iNodeName = HBufC::NewMaxL(aNodeName.Length()); + TPtr nodeAccess = iNodeName->Des(); + nodeAccess = aNodeName; + } + +EXPORT_C TPtrC CMDXMLNode::NodeName() +// +// @return Returns the name of the node +// + { + TPtrC retVal = iNodeName->Des(); + return retVal; + } + + +EXPORT_C CMDXMLNode* CMDXMLNode::PreviousSameTypeSibling() +// +// @return Returns a pointer to the previous sibling node of the same type if any, +// oherwise returns NULL +// + { + CMDXMLNode* nodePtr = iPrevSiblingPtr; + while((nodePtr != NULL) && nodePtr->iElementType != iElementType) + { + nodePtr = nodePtr->iPrevSiblingPtr; + } + return nodePtr; + } + +EXPORT_C CMDXMLNode* CMDXMLNode::NextSameTypeSibling() +// +// @return Returns a pointer to the next sibling node of the same type if any, +// oherwise returns NULL +// + { + CMDXMLNode* nodePtr = iNextSiblingPtr; + while((nodePtr != NULL) && nodePtr->iElementType != iElementType) + { + nodePtr = nodePtr->iNextSiblingPtr; + } + return nodePtr; + } + +EXPORT_C TInt CMDXMLNode::RemoveChild(CMDXMLNode* aChildToRemove) +// +// Removes a child from the list of child nodes. The child node is not deleted - that is the responsibility of the caller +// @param aChildToRemove Pointer to child to remove from the list +// @return Returns KERRNone if sucessful or KErrNotFound if the referenced child node is not found +// + { + TInt retVal=KErrNone; + + if(aChildToRemove == NULL) + { + retVal = KErrNotFound; + } + else if( !iCanHaveChildren ) + { + retVal = KErrXMLInvalidChild; + } + else if( aChildToRemove->iParentPtr != this ) + { + retVal = KErrNotFound; + } + else + { + if(iFirstChildPtr == NULL) + { + retVal = KErrNotFound; + } + else + { + if( aChildToRemove == iFirstChildPtr) + { + if( aChildToRemove == iLastChildPtr ) + { // Only child so just zero pointers + iFirstChildPtr = NULL; + iLastChildPtr = NULL; + } + else + { // First but not only child + iFirstChildPtr->iNextSiblingPtr->iPrevSiblingPtr = NULL; + iFirstChildPtr = iFirstChildPtr->iNextSiblingPtr; + } + } + else if( aChildToRemove == iLastChildPtr ) + { // Last but not only child + iLastChildPtr->iPrevSiblingPtr->iNextSiblingPtr = NULL; + iLastChildPtr = iLastChildPtr->iPrevSiblingPtr; + } + else + { // Not first or last so somewhere in the list + CMDXMLNode* nodeBefore = iFirstChildPtr; + while((nodeBefore->iNextSiblingPtr != NULL) && + (nodeBefore->iNextSiblingPtr != aChildToRemove)) + { + nodeBefore = nodeBefore->iNextSiblingPtr; + } + if( nodeBefore->iNextSiblingPtr != aChildToRemove ) + { + retVal = KErrNotFound; + } + else + { + nodeBefore->iNextSiblingPtr = aChildToRemove->iNextSiblingPtr; + aChildToRemove->iNextSiblingPtr->iPrevSiblingPtr = nodeBefore; + } + } + } + }//end if + + if( retVal == KErrNone ) + { // Having cleared this node off the list, clear its own pointers + aChildToRemove->iPrevSiblingPtr = NULL; + aChildToRemove->iNextSiblingPtr = NULL; + aChildToRemove->iParentPtr = NULL; + } + return retVal; + } + +EXPORT_C TInt CMDXMLNode::InsertBefore(CMDXMLNode* aInsertBeforeChild, CMDXMLNode* aChildToInsert) +// +// Inserts a new child node at a specific point in the child list. +// @param aInsertBeforeChild Pointer to the element before which the new child should be inserted (NULL to insert at the start of the list) +// @param aChildToInsert Pointer to the new child node to insert. +// @return Returns KErrNone if successful, KErrXMLInvalidChild if the node cannot have children or KErrNotFound if it cannot fnd the child before which to insert +// + { + TInt retVal = KErrNone; + + if(aChildToInsert == NULL) + { + retVal = KErrNotSupported; + } + else if( !iCanHaveChildren ) + { + retVal = KErrXMLInvalidChild ; + } + else if(iFirstChildPtr == NULL && aInsertBeforeChild != NULL) + { + retVal = KErrNotFound; + } + else if((aInsertBeforeChild == NULL) || (aInsertBeforeChild == iFirstChildPtr)) + { // Insert at start of list + aChildToInsert->iParentPtr = this; + if(iFirstChildPtr != NULL) + { + iFirstChildPtr->iPrevSiblingPtr = aChildToInsert; + aChildToInsert->iNextSiblingPtr = iFirstChildPtr; + } + else + { + iLastChildPtr = aChildToInsert; + aChildToInsert->iNextSiblingPtr = NULL; + } + iFirstChildPtr = aChildToInsert; + } + else + { // Find the insert before child as a check. + CMDXMLNode* nodeBefore = iFirstChildPtr; + while((nodeBefore->iNextSiblingPtr != NULL) && + (nodeBefore->iNextSiblingPtr != aInsertBeforeChild)) + { + nodeBefore = nodeBefore->iNextSiblingPtr; + } + if( nodeBefore->iNextSiblingPtr != aInsertBeforeChild ) + { + retVal = KErrNotFound; + } + else + { + aChildToInsert->iParentPtr = this; + aChildToInsert->iNextSiblingPtr = nodeBefore->iNextSiblingPtr; + aChildToInsert->iPrevSiblingPtr = nodeBefore; + nodeBefore->iNextSiblingPtr = aChildToInsert; + aChildToInsert->iNextSiblingPtr->iPrevSiblingPtr = aChildToInsert; + } + } + return retVal; + } + +EXPORT_C TInt CMDXMLNode::AppendChild(CMDXMLNode* aChildToInsert) +// +// Appends a new child at the end of the child list. +// @param aChildToInsert Pointer to the new child node to append. +// @return Returns KErrNone if successful or KErrXMLInvalidChild if the node cannot have children +// + { + TInt retVal = KErrNone; + + if(aChildToInsert == NULL) + { + retVal = KErrNotSupported; + } + else if( !iCanHaveChildren ) + { + retVal = KErrXMLInvalidChild; + } + else + { + if(iFirstChildPtr == NULL) + { + iFirstChildPtr = aChildToInsert; + } + + if(iLastChildPtr != NULL) + { + iLastChildPtr->iNextSiblingPtr = aChildToInsert; + } + + aChildToInsert->iPrevSiblingPtr = iLastChildPtr; + iLastChildPtr = aChildToInsert; + aChildToInsert->iParentPtr = this; + } + return retVal; + } + +EXPORT_C TInt CMDXMLNode::ReplaceChild(CMDXMLNode* aChildToInsert, CMDXMLNode* aChildToReplace) +// +// Inserts a new child node while removing an existing one. The old child is not deleted. +// @param aChildToInsert Pointer to the new child node to insert. +// @param aChildToReplace Pointer to the child node to be replaced. +// @return Returns KErrNone if successful, KErrXMLInvalidChild if the node cannot have children or KErrNotFound if it cannot fnd the child to replace. +// + { + TInt retVal = KErrNone; + + if(aChildToInsert == NULL) + { + retVal = KErrNotSupported; + } + else if(aChildToReplace == NULL) + { + retVal = KErrNotFound; + } + else if( !iCanHaveChildren ) + { + retVal = KErrXMLInvalidChild ; + } + else + { + if((aChildToReplace == iFirstChildPtr) && (aChildToReplace == iLastChildPtr)) + { // Replace only child + iFirstChildPtr = aChildToInsert; + iLastChildPtr = aChildToInsert; + } + else if(aChildToReplace == iFirstChildPtr) + { // Replace first but not only + aChildToInsert->iNextSiblingPtr = iFirstChildPtr->iNextSiblingPtr; + aChildToInsert->iNextSiblingPtr->iPrevSiblingPtr = aChildToInsert; + iFirstChildPtr = aChildToInsert; + } + else if(aChildToReplace == iLastChildPtr) + { // Replace Last but not only + aChildToInsert->iPrevSiblingPtr = iLastChildPtr->iPrevSiblingPtr; + aChildToInsert->iPrevSiblingPtr->iNextSiblingPtr = aChildToInsert; + iLastChildPtr = aChildToInsert; + } + else if(iFirstChildPtr != NULL) + { // Replace in the middle of the list + CMDXMLNode* nodeBefore = iFirstChildPtr; + while((nodeBefore->iNextSiblingPtr != NULL) && + (nodeBefore->iNextSiblingPtr != aChildToReplace)) + { + nodeBefore = nodeBefore->iNextSiblingPtr; + } + if( nodeBefore->iNextSiblingPtr != aChildToReplace ) + { + retVal = KErrNotFound; + } + else + { // found so just cross link + aChildToInsert->iNextSiblingPtr = aChildToReplace->iNextSiblingPtr; + aChildToInsert->iPrevSiblingPtr = aChildToReplace->iPrevSiblingPtr; + aChildToInsert->iPrevSiblingPtr->iNextSiblingPtr = aChildToInsert; + aChildToInsert->iNextSiblingPtr->iPrevSiblingPtr = aChildToInsert; + } + } + else + { + retVal = KErrNotFound; + } + } + + if( retVal == KErrNone ) + { // Clear out the replaced node + aChildToReplace->iPrevSiblingPtr = NULL; + aChildToReplace->iNextSiblingPtr = NULL; + aChildToReplace->iParentPtr = NULL; + // Point the new child at its parent + aChildToInsert->iParentPtr = this; + } + return retVal; + } + +// End Of File + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLProcessingInstruction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLProcessingInstruction.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLProcessingInstruction.cpp +// @file +// This class represents a CDATA section of an XML file - +// basically it is a chunk of text which has a place in the +// object tree but has no children. +// +// + +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +EXPORT_C CMDXMLProcessingInstruction* CMDXMLProcessingInstruction::NewLC( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMProcessingInstruction +// @leave can Leave due to OOM +// + { + CMDXMLProcessingInstruction* secPtr = new(ELeave) CMDXMLProcessingInstruction( aOwnerDocument ); + CleanupStack::PushL( secPtr ); + const TDesC& nodeName = KXMLProcessingInstructionNodeName; + secPtr->SetNodeNameL( nodeName ); + return secPtr; + } + +EXPORT_C CMDXMLProcessingInstruction* CMDXMLProcessingInstruction::NewL( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLElement +// @leave can Leave due to OOM +// + { + CMDXMLProcessingInstruction* secPtr = CMDXMLProcessingInstruction::NewLC( aOwnerDocument ); + CleanupStack::Pop(1); // secPtr + return secPtr; + } + +CMDXMLProcessingInstruction::CMDXMLProcessingInstruction( CMDXMLDocument* aOwnerDocument ): +CMDXMLCharacterData( EProcessingInstructionNode, aOwnerDocument) +// +// Constructor +// @param aOwnerDocument The document at the root of the DOM tree +// + { + } + +EXPORT_C CMDXMLProcessingInstruction::~CMDXMLProcessingInstruction() + { + } + + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/SRC/GMXMLText.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/SRC/GMXMLText.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,75 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLText.cpp +// @file +// This class represents a text section of an XML file - +// basically it is a chunk of text which has a place in the +// object tree but has no children. +// +// + +#include + +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +EXPORT_C CMDXMLText* CMDXMLText::NewLC( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLText +// @leave can Leave due to OOM +// + { + CMDXMLText* secPtr = new(ELeave) CMDXMLText( aOwnerDocument ); + CleanupStack::PushL( secPtr ); + const TDesC& nodeName = KXMLTextNodeName; + secPtr->SetNodeNameL( nodeName ); + return secPtr; + } + +EXPORT_C CMDXMLText* CMDXMLText::NewL( CMDXMLDocument* aOwnerDocument ) +// +// Two phase constructor +// @param aOwnerDocument Pointer to the document at the root of the DOM tree +// @return Created CMDXMLText +// @leave can Leave due to OOM +// + { + CMDXMLText* secPtr = CMDXMLText::NewLC( aOwnerDocument ); + CleanupStack::Pop(1); // secPtr + return secPtr; + } + +CMDXMLText::CMDXMLText( CMDXMLDocument* aOwnerDocument ): +CMDXMLCharacterData( ETextNode, aOwnerDocument) +// +// Constructor +// @param aOwnerDocument The document at the root of the DOM tree +// + { + } + +EXPORT_C CMDXMLText::~CMDXMLText() + { + } + + + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/bmarm/V2_XMLDOMU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/bmarm/V2_XMLDOMU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + PlaceholderForRemovedExport1__14CMDXMLDocumentR7MXMLDtd @ 1 NONAME R3UNUSED ; CMDXMLDocument::PlaceholderForRemovedExport1(MXMLDtd &) + AppendL__19CMDXMLCharacterDataR7TDesC16 @ 2 NONAME R3UNUSED ; CMDXMLCharacterData::AppendL(TDesC16 &) + AttributeDetails__13CMDXMLElementiR7TPtrC16T2 @ 3 NONAME ; CMDXMLElement::AttributeDetails(int, TPtrC16 &, TPtrC16 &) + CanElementHaveChildren__C14CMDXMLDocumentRC7TDesC16 @ 4 NONAME R3UNUSED ; CMDXMLDocument::CanElementHaveChildren(TDesC16 const &) const + CheckChildren__13CMDXMLElement @ 5 NONAME R3UNUSED ; CMDXMLElement::CheckChildren(void) + CheckChildren__19CMDXMLCharacterData @ 6 NONAME R3UNUSED ; CMDXMLCharacterData::CheckChildren(void) + CheckImmediateChildren__13CMDXMLElement @ 7 NONAME R3UNUSED ; CMDXMLElement::CheckImmediateChildren(void) + Data__19CMDXMLCharacterData @ 8 NONAME R3UNUSED ; CMDXMLCharacterData::Data(void) + E32Dll__F10TDllReason @ 9 NONAME R3UNUSED ABSENT ; E32Dll(TDllReason) + FindIndex__13CMDXMLElementRC7TDesC16 @ 10 NONAME R3UNUSED ; CMDXMLElement::FindIndex(TDesC16 const &) + GetAttribute__C13CMDXMLElementRC7TDesC16R7TPtrC16 @ 11 NONAME R3UNUSED ; CMDXMLElement::GetAttribute(TDesC16 const &, TPtrC16 &) const + InsertBefore__10CMDXMLNodeP10CMDXMLNodeT1 @ 12 NONAME R3UNUSED ; CMDXMLNode::InsertBefore(CMDXMLNode *, CMDXMLNode *) + InsertL__19CMDXMLCharacterDataiR7TDesC16 @ 13 NONAME R3UNUSED ; CMDXMLCharacterData::InsertL(int, TDesC16 &) + IsAttributeSpecified__C13CMDXMLElementRC7TDesC16 @ 14 NONAME R3UNUSED ; CMDXMLElement::IsAttributeSpecified(TDesC16 const &) const + Length__19CMDXMLCharacterData @ 15 NONAME R3UNUSED ; CMDXMLCharacterData::Length(void) + NewLC__10CMDXMLTextP14CMDXMLDocument @ 16 NONAME R3UNUSED ; CMDXMLText::NewLC(CMDXMLDocument *) + NewLC__13CMDXMLCommentP14CMDXMLDocument @ 17 NONAME R3UNUSED ; CMDXMLComment::NewLC(CMDXMLDocument *) + NewLC__13CMDXMLElementiP14CMDXMLDocumentG7TPtrC16 @ 18 NONAME ; CMDXMLElement::NewLC(int, CMDXMLDocument *, TPtrC16) + NewLC__14CMDXMLDocumentR7MXMLDtd @ 19 NONAME R3UNUSED ; CMDXMLDocument::NewLC(MXMLDtd &) + NewLC__18CMDXMLCDATASectionP14CMDXMLDocument @ 20 NONAME R3UNUSED ; CMDXMLCDATASection::NewLC(CMDXMLDocument *) + NewLC__21CMDXMLDocumentElementP14CMDXMLDocument @ 21 NONAME R3UNUSED ; CMDXMLDocumentElement::NewLC(CMDXMLDocument *) + NewLC__27CMDXMLProcessingInstructionP14CMDXMLDocument @ 22 NONAME R3UNUSED ; CMDXMLProcessingInstruction::NewLC(CMDXMLDocument *) + NewL__10CMDXMLTextP14CMDXMLDocument @ 23 NONAME R3UNUSED ; CMDXMLText::NewL(CMDXMLDocument *) + NewL__13CMDXMLCommentP14CMDXMLDocument @ 24 NONAME R3UNUSED ; CMDXMLComment::NewL(CMDXMLDocument *) + NewL__13CMDXMLElementiP14CMDXMLDocumentG7TPtrC16 @ 25 NONAME ; CMDXMLElement::NewL(int, CMDXMLDocument *, TPtrC16) + NewL__14CMDXMLDocumentR7MXMLDtd @ 26 NONAME R3UNUSED ; CMDXMLDocument::NewL(MXMLDtd &) + NewL__18CMDXMLCDATASectionP14CMDXMLDocument @ 27 NONAME R3UNUSED ; CMDXMLCDATASection::NewL(CMDXMLDocument *) + NewL__21CMDXMLDocumentElementP14CMDXMLDocument @ 28 NONAME R3UNUSED ; CMDXMLDocumentElement::NewL(CMDXMLDocument *) + NewL__27CMDXMLProcessingInstructionP14CMDXMLDocument @ 29 NONAME R3UNUSED ; CMDXMLProcessingInstruction::NewL(CMDXMLDocument *) + NextSameTypeSibling__10CMDXMLNode @ 30 NONAME R3UNUSED ; CMDXMLNode::NextSameTypeSibling(void) + NodeName__10CMDXMLNode @ 31 NONAME R3UNUSED ; CMDXMLNode::NodeName(void) + NumAttributes__13CMDXMLElement @ 32 NONAME R3UNUSED ; CMDXMLElement::NumAttributes(void) + PreviousSameTypeSibling__10CMDXMLNode @ 33 NONAME R3UNUSED ; CMDXMLNode::PreviousSameTypeSibling(void) + RemoveAttribute__13CMDXMLElementRC7TDesC16 @ 34 NONAME R3UNUSED ; CMDXMLElement::RemoveAttribute(TDesC16 const &) + RemoveChild__10CMDXMLNodeP10CMDXMLNode @ 35 NONAME R3UNUSED ; CMDXMLNode::RemoveChild(CMDXMLNode *) + ReplaceChild__10CMDXMLNodeP10CMDXMLNodeT1 @ 36 NONAME R3UNUSED ; CMDXMLNode::ReplaceChild(CMDXMLNode *, CMDXMLNode *) + ReplaceL__19CMDXMLCharacterDataiiR7TDesC16 @ 37 NONAME ; CMDXMLCharacterData::ReplaceL(int, int, TDesC16 &) + SetAttributeL__13CMDXMLElementRC7TDesC16T1 @ 38 NONAME R3UNUSED ; CMDXMLElement::SetAttributeL(TDesC16 const &, TDesC16 const &) + SetDataL__19CMDXMLCharacterDataR7TDesC16 @ 39 NONAME R3UNUSED ; CMDXMLCharacterData::SetDataL(TDesC16 &) + SetDocTypeTagL__14CMDXMLDocumentRC7TDesC16 @ 40 NONAME R3UNUSED ; CMDXMLDocument::SetDocTypeTagL(TDesC16 const &) + SetNodeNameL__10CMDXMLNodeRC7TDesC16 @ 41 NONAME R3UNUSED ; CMDXMLNode::SetNodeNameL(TDesC16 const &) + SetVersionTagL__14CMDXMLDocumentRC7TDesC16 @ 42 NONAME R3UNUSED ; CMDXMLDocument::SetVersionTagL(TDesC16 const &) + ValidElementNameL__C14CMDXMLDocumentRC7TDesC16 @ 43 NONAME R3UNUSED ; CMDXMLDocument::ValidElementNameL(TDesC16 const &) const + "_._10CMDXMLNode" @ 44 NONAME R3UNUSED ; CMDXMLNode::~CMDXMLNode(void) + "_._10CMDXMLText" @ 45 NONAME R3UNUSED ; CMDXMLText::~CMDXMLText(void) + "_._13CMDXMLComment" @ 46 NONAME R3UNUSED ; CMDXMLComment::~CMDXMLComment(void) + "_._13CMDXMLElement" @ 47 NONAME R3UNUSED ; CMDXMLElement::~CMDXMLElement(void) + "_._14CMDXMLDocument" @ 48 NONAME R3UNUSED ; CMDXMLDocument::~CMDXMLDocument(void) + "_._18CMDXMLCDATASection" @ 49 NONAME R3UNUSED ; CMDXMLCDATASection::~CMDXMLCDATASection(void) + "_._19CMDXMLCharacterData" @ 50 NONAME R3UNUSED ; CMDXMLCharacterData::~CMDXMLCharacterData(void) + "_._21CMDXMLDocumentElement" @ 51 NONAME R3UNUSED ; CMDXMLDocumentElement::~CMDXMLDocumentElement(void) + "_._27CMDXMLProcessingInstruction" @ 52 NONAME R3UNUSED ; CMDXMLProcessingInstruction::~CMDXMLProcessingInstruction(void) + __13CMDXMLElementiP14CMDXMLDocument @ 53 NONAME R3UNUSED ; CMDXMLElement::CMDXMLElement(int, CMDXMLDocument *) + AppendChild__10CMDXMLNodeP10CMDXMLNode @ 54 NONAME R3UNUSED ; CMDXMLNode::AppendChild(CMDXMLNode *) + FirstChildOfType__13CMDXMLElementRC7TDesC16 @ 55 NONAME R3UNUSED ; CMDXMLElement::FirstChildOfType(TDesC16 const &) + LastChildOfType__13CMDXMLElementRC7TDesC16 @ 56 NONAME R3UNUSED ; CMDXMLElement::LastChildOfType(TDesC16 const &) + NewLC__14CMDXMLDocument @ 57 NONAME R3UNUSED ; CMDXMLDocument::NewLC(void) + NewL__14CMDXMLDocument @ 58 NONAME R3UNUSED ; CMDXMLDocument::NewL(void) + PlaceholderForRemovedExport2__14CMDXMLDocument @ 59 NONAME R3UNUSED ; CMDXMLDocument::PlaceholderForRemovedExport2(void) + SetAttributeL__13CMDXMLElementRC7TDesC16T1i @ 60 NONAME ; CMDXMLElement::SetAttributeL(TDesC16 const &, TDesC16 const &, int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/bmarm/XMLDOMu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/bmarm/XMLDOMu.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + PlaceholderForRemovedExport1__14CMDXMLDocumentR7MXMLDtd @ 1 NONAME R3UNUSED ; CMDXMLDocument::PlaceholderForRemovedExport1(MXMLDtd &) + AppendL__19CMDXMLCharacterDataR7TDesC16 @ 2 NONAME R3UNUSED ; CMDXMLCharacterData::AppendL(TDesC16 &) + AttributeDetails__13CMDXMLElementiR7TPtrC16T2 @ 3 NONAME ; CMDXMLElement::AttributeDetails(int, TPtrC16 &, TPtrC16 &) + CanElementHaveChildren__C14CMDXMLDocumentRC7TDesC16 @ 4 NONAME R3UNUSED ; CMDXMLDocument::CanElementHaveChildren(TDesC16 const &) const + CheckChildren__13CMDXMLElement @ 5 NONAME R3UNUSED ; CMDXMLElement::CheckChildren(void) + CheckChildren__19CMDXMLCharacterData @ 6 NONAME R3UNUSED ; CMDXMLCharacterData::CheckChildren(void) + CheckImmediateChildren__13CMDXMLElement @ 7 NONAME R3UNUSED ; CMDXMLElement::CheckImmediateChildren(void) + Data__19CMDXMLCharacterData @ 8 NONAME R3UNUSED ; CMDXMLCharacterData::Data(void) + E32Dll__F10TDllReason @ 9 NONAME R3UNUSED ; E32Dll(TDllReason) + FindIndex__13CMDXMLElementRC7TDesC16 @ 10 NONAME R3UNUSED ; CMDXMLElement::FindIndex(TDesC16 const &) + GetAttribute__C13CMDXMLElementRC7TDesC16R7TPtrC16 @ 11 NONAME R3UNUSED ; CMDXMLElement::GetAttribute(TDesC16 const &, TPtrC16 &) const + InsertBefore__10CMDXMLNodeP10CMDXMLNodeT1 @ 12 NONAME R3UNUSED ; CMDXMLNode::InsertBefore(CMDXMLNode *, CMDXMLNode *) + InsertL__19CMDXMLCharacterDataiR7TDesC16 @ 13 NONAME R3UNUSED ; CMDXMLCharacterData::InsertL(int, TDesC16 &) + IsAttributeSpecified__C13CMDXMLElementRC7TDesC16 @ 14 NONAME R3UNUSED ; CMDXMLElement::IsAttributeSpecified(TDesC16 const &) const + Length__19CMDXMLCharacterData @ 15 NONAME R3UNUSED ; CMDXMLCharacterData::Length(void) + NewLC__10CMDXMLTextP14CMDXMLDocument @ 16 NONAME R3UNUSED ; CMDXMLText::NewLC(CMDXMLDocument *) + NewLC__13CMDXMLCommentP14CMDXMLDocument @ 17 NONAME R3UNUSED ; CMDXMLComment::NewLC(CMDXMLDocument *) + NewLC__13CMDXMLElementiP14CMDXMLDocumentG7TPtrC16 @ 18 NONAME ; CMDXMLElement::NewLC(int, CMDXMLDocument *, TPtrC16) + NewLC__14CMDXMLDocumentR7MXMLDtd @ 19 NONAME R3UNUSED ; CMDXMLDocument::NewLC(MXMLDtd &) + NewLC__18CMDXMLCDATASectionP14CMDXMLDocument @ 20 NONAME R3UNUSED ; CMDXMLCDATASection::NewLC(CMDXMLDocument *) + NewLC__21CMDXMLDocumentElementP14CMDXMLDocument @ 21 NONAME R3UNUSED ; CMDXMLDocumentElement::NewLC(CMDXMLDocument *) + NewLC__27CMDXMLProcessingInstructionP14CMDXMLDocument @ 22 NONAME R3UNUSED ; CMDXMLProcessingInstruction::NewLC(CMDXMLDocument *) + NewL__10CMDXMLTextP14CMDXMLDocument @ 23 NONAME R3UNUSED ; CMDXMLText::NewL(CMDXMLDocument *) + NewL__13CMDXMLCommentP14CMDXMLDocument @ 24 NONAME R3UNUSED ; CMDXMLComment::NewL(CMDXMLDocument *) + NewL__13CMDXMLElementiP14CMDXMLDocumentG7TPtrC16 @ 25 NONAME ; CMDXMLElement::NewL(int, CMDXMLDocument *, TPtrC16) + NewL__14CMDXMLDocumentR7MXMLDtd @ 26 NONAME R3UNUSED ; CMDXMLDocument::NewL(MXMLDtd &) + NewL__18CMDXMLCDATASectionP14CMDXMLDocument @ 27 NONAME R3UNUSED ; CMDXMLCDATASection::NewL(CMDXMLDocument *) + NewL__21CMDXMLDocumentElementP14CMDXMLDocument @ 28 NONAME R3UNUSED ; CMDXMLDocumentElement::NewL(CMDXMLDocument *) + NewL__27CMDXMLProcessingInstructionP14CMDXMLDocument @ 29 NONAME R3UNUSED ; CMDXMLProcessingInstruction::NewL(CMDXMLDocument *) + NextSameTypeSibling__10CMDXMLNode @ 30 NONAME R3UNUSED ; CMDXMLNode::NextSameTypeSibling(void) + NodeName__10CMDXMLNode @ 31 NONAME R3UNUSED ; CMDXMLNode::NodeName(void) + NumAttributes__13CMDXMLElement @ 32 NONAME R3UNUSED ; CMDXMLElement::NumAttributes(void) + PreviousSameTypeSibling__10CMDXMLNode @ 33 NONAME R3UNUSED ; CMDXMLNode::PreviousSameTypeSibling(void) + RemoveAttribute__13CMDXMLElementRC7TDesC16 @ 34 NONAME R3UNUSED ; CMDXMLElement::RemoveAttribute(TDesC16 const &) + RemoveChild__10CMDXMLNodeP10CMDXMLNode @ 35 NONAME R3UNUSED ; CMDXMLNode::RemoveChild(CMDXMLNode *) + ReplaceChild__10CMDXMLNodeP10CMDXMLNodeT1 @ 36 NONAME R3UNUSED ; CMDXMLNode::ReplaceChild(CMDXMLNode *, CMDXMLNode *) + ReplaceL__19CMDXMLCharacterDataiiR7TDesC16 @ 37 NONAME ; CMDXMLCharacterData::ReplaceL(int, int, TDesC16 &) + SetAttributeL__13CMDXMLElementRC7TDesC16T1 @ 38 NONAME R3UNUSED ; CMDXMLElement::SetAttributeL(TDesC16 const &, TDesC16 const &) + SetDataL__19CMDXMLCharacterDataR7TDesC16 @ 39 NONAME R3UNUSED ; CMDXMLCharacterData::SetDataL(TDesC16 &) + SetDocTypeTagL__14CMDXMLDocumentRC7TDesC16 @ 40 NONAME R3UNUSED ; CMDXMLDocument::SetDocTypeTagL(TDesC16 const &) + SetNodeNameL__10CMDXMLNodeRC7TDesC16 @ 41 NONAME R3UNUSED ; CMDXMLNode::SetNodeNameL(TDesC16 const &) + SetVersionTagL__14CMDXMLDocumentRC7TDesC16 @ 42 NONAME R3UNUSED ; CMDXMLDocument::SetVersionTagL(TDesC16 const &) + ValidElementNameL__C14CMDXMLDocumentRC7TDesC16 @ 43 NONAME R3UNUSED ; CMDXMLDocument::ValidElementNameL(TDesC16 const &) const + "_._10CMDXMLNode" @ 44 NONAME R3UNUSED ; CMDXMLNode::~CMDXMLNode(void) + "_._10CMDXMLText" @ 45 NONAME R3UNUSED ; CMDXMLText::~CMDXMLText(void) + "_._13CMDXMLComment" @ 46 NONAME R3UNUSED ; CMDXMLComment::~CMDXMLComment(void) + "_._13CMDXMLElement" @ 47 NONAME R3UNUSED ; CMDXMLElement::~CMDXMLElement(void) + "_._14CMDXMLDocument" @ 48 NONAME R3UNUSED ; CMDXMLDocument::~CMDXMLDocument(void) + "_._18CMDXMLCDATASection" @ 49 NONAME R3UNUSED ; CMDXMLCDATASection::~CMDXMLCDATASection(void) + "_._19CMDXMLCharacterData" @ 50 NONAME R3UNUSED ; CMDXMLCharacterData::~CMDXMLCharacterData(void) + "_._21CMDXMLDocumentElement" @ 51 NONAME R3UNUSED ; CMDXMLDocumentElement::~CMDXMLDocumentElement(void) + "_._27CMDXMLProcessingInstruction" @ 52 NONAME R3UNUSED ; CMDXMLProcessingInstruction::~CMDXMLProcessingInstruction(void) + __13CMDXMLElementiP14CMDXMLDocument @ 53 NONAME R3UNUSED ; CMDXMLElement::CMDXMLElement(int, CMDXMLDocument *) + AppendChild__10CMDXMLNodeP10CMDXMLNode @ 54 NONAME R3UNUSED ; CMDXMLNode::AppendChild(CMDXMLNode *) + FirstChildOfType__13CMDXMLElementRC7TDesC16 @ 55 NONAME R3UNUSED ; CMDXMLElement::FirstChildOfType(TDesC16 const &) + LastChildOfType__13CMDXMLElementRC7TDesC16 @ 56 NONAME R3UNUSED ; CMDXMLElement::LastChildOfType(TDesC16 const &) + NewLC__14CMDXMLDocument @ 57 NONAME R3UNUSED ; CMDXMLDocument::NewLC(void) + NewL__14CMDXMLDocument @ 58 NONAME R3UNUSED ; CMDXMLDocument::NewL(void) + PlaceholderForRemovedExport2__14CMDXMLDocument @ 59 NONAME R3UNUSED ; CMDXMLDocument::PlaceholderForRemovedExport2(void) + SetAttributeL__13CMDXMLElementRC7TDesC16T1i @ 60 NONAME ; CMDXMLElement::SetAttributeL(TDesC16 const &, TDesC16 const &, int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/bwins/V2_XMLDOMU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/bwins/V2_XMLDOMU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + ?PlaceholderForRemovedExport1@CMDXMLDocument@@AAEXAAVMXMLDtd@@@Z @ 1 NONAME ; private: void __thiscall CMDXMLDocument::PlaceholderForRemovedExport1(class MXMLDtd &) + ??0CMDXMLElement@@IAE@HPAVCMDXMLDocument@@@Z @ 2 NONAME ; protected: __thiscall CMDXMLElement::CMDXMLElement(int,class CMDXMLDocument *) + ??1CMDXMLCDATASection@@UAE@XZ @ 3 NONAME ; public: virtual __thiscall CMDXMLCDATASection::~CMDXMLCDATASection(void) + ??1CMDXMLCharacterData@@UAE@XZ @ 4 NONAME ; public: virtual __thiscall CMDXMLCharacterData::~CMDXMLCharacterData(void) + ??1CMDXMLComment@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CMDXMLComment::~CMDXMLComment(void) + ??1CMDXMLDocument@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CMDXMLDocument::~CMDXMLDocument(void) + ??1CMDXMLDocumentElement@@UAE@XZ @ 7 NONAME ; public: virtual __thiscall CMDXMLDocumentElement::~CMDXMLDocumentElement(void) + ??1CMDXMLElement@@UAE@XZ @ 8 NONAME ; public: virtual __thiscall CMDXMLElement::~CMDXMLElement(void) + ??1CMDXMLNode@@UAE@XZ @ 9 NONAME ; public: virtual __thiscall CMDXMLNode::~CMDXMLNode(void) + ??1CMDXMLProcessingInstruction@@UAE@XZ @ 10 NONAME ; public: virtual __thiscall CMDXMLProcessingInstruction::~CMDXMLProcessingInstruction(void) + ??1CMDXMLText@@UAE@XZ @ 11 NONAME ; public: virtual __thiscall CMDXMLText::~CMDXMLText(void) + ?AppendChild@CMDXMLNode@@QAEHPAV1@@Z @ 12 NONAME ; public: int __thiscall CMDXMLNode::AppendChild(class CMDXMLNode *) + ?AppendL@CMDXMLCharacterData@@UAEXAAVTDesC16@@@Z @ 13 NONAME ; public: virtual void __thiscall CMDXMLCharacterData::AppendL(class TDesC16 &) + ?AttributeDetails@CMDXMLElement@@QAEHHAAVTPtrC16@@0@Z @ 14 NONAME ; public: int __thiscall CMDXMLElement::AttributeDetails(int,class TPtrC16 &,class TPtrC16 &) + ?CanElementHaveChildren@CMDXMLDocument@@QBEHABVTDesC16@@@Z @ 15 NONAME ; public: int __thiscall CMDXMLDocument::CanElementHaveChildren(class TDesC16 const &)const + ?CheckChildren@CMDXMLCharacterData@@UAEHXZ @ 16 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::CheckChildren(void) + ?CheckChildren@CMDXMLElement@@UAEHXZ @ 17 NONAME ; public: virtual int __thiscall CMDXMLElement::CheckChildren(void) + ?CheckImmediateChildren@CMDXMLElement@@MAEHXZ @ 18 NONAME ; protected: virtual int __thiscall CMDXMLElement::CheckImmediateChildren(void) + ?Data@CMDXMLCharacterData@@UAEAAVTDesC16@@XZ @ 19 NONAME ; public: virtual class TDesC16 & __thiscall CMDXMLCharacterData::Data(void) + ?E32Dll@@YAHW4TDllReason@@@Z @ 20 NONAME ABSENT ; int __cdecl E32Dll(enum TDllReason) + ?FindIndex@CMDXMLElement@@QAEHABVTDesC16@@@Z @ 21 NONAME ; public: int __thiscall CMDXMLElement::FindIndex(class TDesC16 const &) + ?FirstChildOfType@CMDXMLElement@@QAEPAV1@ABVTDesC16@@@Z @ 22 NONAME ; public: class CMDXMLElement * __thiscall CMDXMLElement::FirstChildOfType(class TDesC16 const &) + ?GetAttribute@CMDXMLElement@@UBEHABVTDesC16@@AAVTPtrC16@@@Z @ 23 NONAME ; public: virtual int __thiscall CMDXMLElement::GetAttribute(class TDesC16 const &,class TPtrC16 &)const + ?InsertBefore@CMDXMLNode@@QAEHPAV1@0@Z @ 24 NONAME ; public: int __thiscall CMDXMLNode::InsertBefore(class CMDXMLNode *,class CMDXMLNode *) + ?InsertL@CMDXMLCharacterData@@UAEHHAAVTDesC16@@@Z @ 25 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::InsertL(int,class TDesC16 &) + ?IsAttributeSpecified@CMDXMLElement@@UBEHABVTDesC16@@@Z @ 26 NONAME ; public: virtual int __thiscall CMDXMLElement::IsAttributeSpecified(class TDesC16 const &)const + ?LastChildOfType@CMDXMLElement@@QAEPAV1@ABVTDesC16@@@Z @ 27 NONAME ; public: class CMDXMLElement * __thiscall CMDXMLElement::LastChildOfType(class TDesC16 const &) + ?Length@CMDXMLCharacterData@@UAEHXZ @ 28 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::Length(void) + ?NewL@CMDXMLCDATASection@@SAPAV1@PAVCMDXMLDocument@@@Z @ 29 NONAME ; public: static class CMDXMLCDATASection * __cdecl CMDXMLCDATASection::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLComment@@SAPAV1@PAVCMDXMLDocument@@@Z @ 30 NONAME ; public: static class CMDXMLComment * __cdecl CMDXMLComment::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLDocument@@SAPAV1@AAVMXMLDtd@@@Z @ 31 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewL(class MXMLDtd &) + ?NewL@CMDXMLDocumentElement@@SAPAV1@PAVCMDXMLDocument@@@Z @ 32 NONAME ; public: static class CMDXMLDocumentElement * __cdecl CMDXMLDocumentElement::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLElement@@SAPAV1@HPAVCMDXMLDocument@@VTPtrC16@@@Z @ 33 NONAME ; public: static class CMDXMLElement * __cdecl CMDXMLElement::NewL(int,class CMDXMLDocument *,class TPtrC16) + ?NewL@CMDXMLProcessingInstruction@@SAPAV1@PAVCMDXMLDocument@@@Z @ 34 NONAME ; public: static class CMDXMLProcessingInstruction * __cdecl CMDXMLProcessingInstruction::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLText@@SAPAV1@PAVCMDXMLDocument@@@Z @ 35 NONAME ; public: static class CMDXMLText * __cdecl CMDXMLText::NewL(class CMDXMLDocument *) + ?NewLC@CMDXMLCDATASection@@SAPAV1@PAVCMDXMLDocument@@@Z @ 36 NONAME ; public: static class CMDXMLCDATASection * __cdecl CMDXMLCDATASection::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLComment@@SAPAV1@PAVCMDXMLDocument@@@Z @ 37 NONAME ; public: static class CMDXMLComment * __cdecl CMDXMLComment::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLDocument@@SAPAV1@AAVMXMLDtd@@@Z @ 38 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewLC(class MXMLDtd &) + ?NewLC@CMDXMLDocumentElement@@SAPAV1@PAVCMDXMLDocument@@@Z @ 39 NONAME ; public: static class CMDXMLDocumentElement * __cdecl CMDXMLDocumentElement::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLElement@@SAPAV1@HPAVCMDXMLDocument@@VTPtrC16@@@Z @ 40 NONAME ; public: static class CMDXMLElement * __cdecl CMDXMLElement::NewLC(int,class CMDXMLDocument *,class TPtrC16) + ?NewLC@CMDXMLProcessingInstruction@@SAPAV1@PAVCMDXMLDocument@@@Z @ 41 NONAME ; public: static class CMDXMLProcessingInstruction * __cdecl CMDXMLProcessingInstruction::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLText@@SAPAV1@PAVCMDXMLDocument@@@Z @ 42 NONAME ; public: static class CMDXMLText * __cdecl CMDXMLText::NewLC(class CMDXMLDocument *) + ?NextSameTypeSibling@CMDXMLNode@@IAEPAV1@XZ @ 43 NONAME ; protected: class CMDXMLNode * __thiscall CMDXMLNode::NextSameTypeSibling(void) + ?NodeName@CMDXMLNode@@QAE?AVTPtrC16@@XZ @ 44 NONAME ; public: class TPtrC16 __thiscall CMDXMLNode::NodeName(void) + ?NumAttributes@CMDXMLElement@@QAEHXZ @ 45 NONAME ; public: int __thiscall CMDXMLElement::NumAttributes(void) + ?PreviousSameTypeSibling@CMDXMLNode@@IAEPAV1@XZ @ 46 NONAME ; protected: class CMDXMLNode * __thiscall CMDXMLNode::PreviousSameTypeSibling(void) + ?RemoveAttribute@CMDXMLElement@@UAEHABVTDesC16@@@Z @ 47 NONAME ; public: virtual int __thiscall CMDXMLElement::RemoveAttribute(class TDesC16 const &) + ?RemoveChild@CMDXMLNode@@QAEHPAV1@@Z @ 48 NONAME ; public: int __thiscall CMDXMLNode::RemoveChild(class CMDXMLNode *) + ?ReplaceChild@CMDXMLNode@@QAEHPAV1@0@Z @ 49 NONAME ; public: int __thiscall CMDXMLNode::ReplaceChild(class CMDXMLNode *,class CMDXMLNode *) + ?ReplaceL@CMDXMLCharacterData@@UAEHHHAAVTDesC16@@@Z @ 50 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::ReplaceL(int,int,class TDesC16 &) + ?SetAttributeL@CMDXMLElement@@UAEHABVTDesC16@@0@Z @ 51 NONAME ; public: virtual int __thiscall CMDXMLElement::SetAttributeL(class TDesC16 const &,class TDesC16 const &) + ?SetDataL@CMDXMLCharacterData@@UAEXAAVTDesC16@@@Z @ 52 NONAME ; public: virtual void __thiscall CMDXMLCharacterData::SetDataL(class TDesC16 &) + ?SetDocTypeTagL@CMDXMLDocument@@QAEHABVTDesC16@@@Z @ 53 NONAME ; public: int __thiscall CMDXMLDocument::SetDocTypeTagL(class TDesC16 const &) + ?SetNodeNameL@CMDXMLNode@@IAEXABVTDesC16@@@Z @ 54 NONAME ; protected: void __thiscall CMDXMLNode::SetNodeNameL(class TDesC16 const &) + ?SetVersionTagL@CMDXMLDocument@@QAEHABVTDesC16@@@Z @ 55 NONAME ; public: int __thiscall CMDXMLDocument::SetVersionTagL(class TDesC16 const &) + ?ValidElementNameL@CMDXMLDocument@@QBEHABVTDesC16@@@Z @ 56 NONAME ; public: int __thiscall CMDXMLDocument::ValidElementNameL(class TDesC16 const &)const + ?PlaceholderForRemovedExport2@CMDXMLDocument@@AAEXXZ @ 57 NONAME ; private: void __thiscall CMDXMLDocument::PlaceholderForRemovedExport2(void) + ?NewL@CMDXMLDocument@@SAPAV1@XZ @ 58 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewL(void) + ?NewLC@CMDXMLDocument@@SAPAV1@XZ @ 59 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewLC(void) + ?SetAttributeL@CMDXMLElement@@QAEHABVTDesC16@@0H@Z @ 60 NONAME ; int CMDXMLElement::SetAttributeL(class TDesC16 const &, class TDesC16 const &, int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/bwins/XMLDOMU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/bwins/XMLDOMU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + ?PlaceholderForRemovedExport1@CMDXMLDocument@@AAEXAAVMXMLDtd@@@Z @ 1 NONAME ; private: void __thiscall CMDXMLDocument::PlaceholderForRemovedExport1(class MXMLDtd &) + ??0CMDXMLElement@@IAE@HPAVCMDXMLDocument@@@Z @ 2 NONAME ; protected: __thiscall CMDXMLElement::CMDXMLElement(int,class CMDXMLDocument *) + ??1CMDXMLCDATASection@@UAE@XZ @ 3 NONAME ; public: virtual __thiscall CMDXMLCDATASection::~CMDXMLCDATASection(void) + ??1CMDXMLCharacterData@@UAE@XZ @ 4 NONAME ; public: virtual __thiscall CMDXMLCharacterData::~CMDXMLCharacterData(void) + ??1CMDXMLComment@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CMDXMLComment::~CMDXMLComment(void) + ??1CMDXMLDocument@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CMDXMLDocument::~CMDXMLDocument(void) + ??1CMDXMLDocumentElement@@UAE@XZ @ 7 NONAME ; public: virtual __thiscall CMDXMLDocumentElement::~CMDXMLDocumentElement(void) + ??1CMDXMLElement@@UAE@XZ @ 8 NONAME ; public: virtual __thiscall CMDXMLElement::~CMDXMLElement(void) + ??1CMDXMLNode@@UAE@XZ @ 9 NONAME ; public: virtual __thiscall CMDXMLNode::~CMDXMLNode(void) + ??1CMDXMLProcessingInstruction@@UAE@XZ @ 10 NONAME ; public: virtual __thiscall CMDXMLProcessingInstruction::~CMDXMLProcessingInstruction(void) + ??1CMDXMLText@@UAE@XZ @ 11 NONAME ; public: virtual __thiscall CMDXMLText::~CMDXMLText(void) + ?AppendChild@CMDXMLNode@@QAEHPAV1@@Z @ 12 NONAME ; public: int __thiscall CMDXMLNode::AppendChild(class CMDXMLNode *) + ?AppendL@CMDXMLCharacterData@@UAEXAAVTDesC16@@@Z @ 13 NONAME ; public: virtual void __thiscall CMDXMLCharacterData::AppendL(class TDesC16 &) + ?AttributeDetails@CMDXMLElement@@QAEHHAAVTPtrC16@@0@Z @ 14 NONAME ; public: int __thiscall CMDXMLElement::AttributeDetails(int,class TPtrC16 &,class TPtrC16 &) + ?CanElementHaveChildren@CMDXMLDocument@@QBEHABVTDesC16@@@Z @ 15 NONAME ; public: int __thiscall CMDXMLDocument::CanElementHaveChildren(class TDesC16 const &)const + ?CheckChildren@CMDXMLCharacterData@@UAEHXZ @ 16 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::CheckChildren(void) + ?CheckChildren@CMDXMLElement@@UAEHXZ @ 17 NONAME ; public: virtual int __thiscall CMDXMLElement::CheckChildren(void) + ?CheckImmediateChildren@CMDXMLElement@@MAEHXZ @ 18 NONAME ; protected: virtual int __thiscall CMDXMLElement::CheckImmediateChildren(void) + ?Data@CMDXMLCharacterData@@UAEAAVTDesC16@@XZ @ 19 NONAME ; public: virtual class TDesC16 & __thiscall CMDXMLCharacterData::Data(void) + ?E32Dll@@YAHW4TDllReason@@@Z @ 20 NONAME ; int __cdecl E32Dll(enum TDllReason) + ?FindIndex@CMDXMLElement@@QAEHABVTDesC16@@@Z @ 21 NONAME ; public: int __thiscall CMDXMLElement::FindIndex(class TDesC16 const &) + ?FirstChildOfType@CMDXMLElement@@QAEPAV1@ABVTDesC16@@@Z @ 22 NONAME ; public: class CMDXMLElement * __thiscall CMDXMLElement::FirstChildOfType(class TDesC16 const &) + ?GetAttribute@CMDXMLElement@@UBEHABVTDesC16@@AAVTPtrC16@@@Z @ 23 NONAME ; public: virtual int __thiscall CMDXMLElement::GetAttribute(class TDesC16 const &,class TPtrC16 &)const + ?InsertBefore@CMDXMLNode@@QAEHPAV1@0@Z @ 24 NONAME ; public: int __thiscall CMDXMLNode::InsertBefore(class CMDXMLNode *,class CMDXMLNode *) + ?InsertL@CMDXMLCharacterData@@UAEHHAAVTDesC16@@@Z @ 25 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::InsertL(int,class TDesC16 &) + ?IsAttributeSpecified@CMDXMLElement@@UBEHABVTDesC16@@@Z @ 26 NONAME ; public: virtual int __thiscall CMDXMLElement::IsAttributeSpecified(class TDesC16 const &)const + ?LastChildOfType@CMDXMLElement@@QAEPAV1@ABVTDesC16@@@Z @ 27 NONAME ; public: class CMDXMLElement * __thiscall CMDXMLElement::LastChildOfType(class TDesC16 const &) + ?Length@CMDXMLCharacterData@@UAEHXZ @ 28 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::Length(void) + ?NewL@CMDXMLCDATASection@@SAPAV1@PAVCMDXMLDocument@@@Z @ 29 NONAME ; public: static class CMDXMLCDATASection * __cdecl CMDXMLCDATASection::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLComment@@SAPAV1@PAVCMDXMLDocument@@@Z @ 30 NONAME ; public: static class CMDXMLComment * __cdecl CMDXMLComment::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLDocument@@SAPAV1@AAVMXMLDtd@@@Z @ 31 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewL(class MXMLDtd &) + ?NewL@CMDXMLDocumentElement@@SAPAV1@PAVCMDXMLDocument@@@Z @ 32 NONAME ; public: static class CMDXMLDocumentElement * __cdecl CMDXMLDocumentElement::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLElement@@SAPAV1@HPAVCMDXMLDocument@@VTPtrC16@@@Z @ 33 NONAME ; public: static class CMDXMLElement * __cdecl CMDXMLElement::NewL(int,class CMDXMLDocument *,class TPtrC16) + ?NewL@CMDXMLProcessingInstruction@@SAPAV1@PAVCMDXMLDocument@@@Z @ 34 NONAME ; public: static class CMDXMLProcessingInstruction * __cdecl CMDXMLProcessingInstruction::NewL(class CMDXMLDocument *) + ?NewL@CMDXMLText@@SAPAV1@PAVCMDXMLDocument@@@Z @ 35 NONAME ; public: static class CMDXMLText * __cdecl CMDXMLText::NewL(class CMDXMLDocument *) + ?NewLC@CMDXMLCDATASection@@SAPAV1@PAVCMDXMLDocument@@@Z @ 36 NONAME ; public: static class CMDXMLCDATASection * __cdecl CMDXMLCDATASection::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLComment@@SAPAV1@PAVCMDXMLDocument@@@Z @ 37 NONAME ; public: static class CMDXMLComment * __cdecl CMDXMLComment::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLDocument@@SAPAV1@AAVMXMLDtd@@@Z @ 38 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewLC(class MXMLDtd &) + ?NewLC@CMDXMLDocumentElement@@SAPAV1@PAVCMDXMLDocument@@@Z @ 39 NONAME ; public: static class CMDXMLDocumentElement * __cdecl CMDXMLDocumentElement::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLElement@@SAPAV1@HPAVCMDXMLDocument@@VTPtrC16@@@Z @ 40 NONAME ; public: static class CMDXMLElement * __cdecl CMDXMLElement::NewLC(int,class CMDXMLDocument *,class TPtrC16) + ?NewLC@CMDXMLProcessingInstruction@@SAPAV1@PAVCMDXMLDocument@@@Z @ 41 NONAME ; public: static class CMDXMLProcessingInstruction * __cdecl CMDXMLProcessingInstruction::NewLC(class CMDXMLDocument *) + ?NewLC@CMDXMLText@@SAPAV1@PAVCMDXMLDocument@@@Z @ 42 NONAME ; public: static class CMDXMLText * __cdecl CMDXMLText::NewLC(class CMDXMLDocument *) + ?NextSameTypeSibling@CMDXMLNode@@IAEPAV1@XZ @ 43 NONAME ; protected: class CMDXMLNode * __thiscall CMDXMLNode::NextSameTypeSibling(void) + ?NodeName@CMDXMLNode@@QAE?AVTPtrC16@@XZ @ 44 NONAME ; public: class TPtrC16 __thiscall CMDXMLNode::NodeName(void) + ?NumAttributes@CMDXMLElement@@QAEHXZ @ 45 NONAME ; public: int __thiscall CMDXMLElement::NumAttributes(void) + ?PreviousSameTypeSibling@CMDXMLNode@@IAEPAV1@XZ @ 46 NONAME ; protected: class CMDXMLNode * __thiscall CMDXMLNode::PreviousSameTypeSibling(void) + ?RemoveAttribute@CMDXMLElement@@UAEHABVTDesC16@@@Z @ 47 NONAME ; public: virtual int __thiscall CMDXMLElement::RemoveAttribute(class TDesC16 const &) + ?RemoveChild@CMDXMLNode@@QAEHPAV1@@Z @ 48 NONAME ; public: int __thiscall CMDXMLNode::RemoveChild(class CMDXMLNode *) + ?ReplaceChild@CMDXMLNode@@QAEHPAV1@0@Z @ 49 NONAME ; public: int __thiscall CMDXMLNode::ReplaceChild(class CMDXMLNode *,class CMDXMLNode *) + ?ReplaceL@CMDXMLCharacterData@@UAEHHHAAVTDesC16@@@Z @ 50 NONAME ; public: virtual int __thiscall CMDXMLCharacterData::ReplaceL(int,int,class TDesC16 &) + ?SetAttributeL@CMDXMLElement@@UAEHABVTDesC16@@0@Z @ 51 NONAME ; public: virtual int __thiscall CMDXMLElement::SetAttributeL(class TDesC16 const &,class TDesC16 const &) + ?SetDataL@CMDXMLCharacterData@@UAEXAAVTDesC16@@@Z @ 52 NONAME ; public: virtual void __thiscall CMDXMLCharacterData::SetDataL(class TDesC16 &) + ?SetDocTypeTagL@CMDXMLDocument@@QAEHABVTDesC16@@@Z @ 53 NONAME ; public: int __thiscall CMDXMLDocument::SetDocTypeTagL(class TDesC16 const &) + ?SetNodeNameL@CMDXMLNode@@IAEXABVTDesC16@@@Z @ 54 NONAME ; protected: void __thiscall CMDXMLNode::SetNodeNameL(class TDesC16 const &) + ?SetVersionTagL@CMDXMLDocument@@QAEHABVTDesC16@@@Z @ 55 NONAME ; public: int __thiscall CMDXMLDocument::SetVersionTagL(class TDesC16 const &) + ?ValidElementNameL@CMDXMLDocument@@QBEHABVTDesC16@@@Z @ 56 NONAME ; public: int __thiscall CMDXMLDocument::ValidElementNameL(class TDesC16 const &)const + ?PlaceholderForRemovedExport2@CMDXMLDocument@@AAEXXZ @ 57 NONAME ; private: void __thiscall CMDXMLDocument::PlaceholderForRemovedExport2(void) + ?NewL@CMDXMLDocument@@SAPAV1@XZ @ 58 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewL(void) + ?NewLC@CMDXMLDocument@@SAPAV1@XZ @ 59 NONAME ; public: static class CMDXMLDocument * __cdecl CMDXMLDocument::NewLC(void) + ?SetAttributeL@CMDXMLElement@@QAEHABVTDesC16@@0H@Z @ 60 NONAME ; int CMDXMLElement::SetAttributeL(class TDesC16 const &, class TDesC16 const &, int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/eabi/V2_XMLDOMu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/eabi/V2_XMLDOMu.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,101 @@ +EXPORTS + _Z6E32Dll10TDllReason @ 1 NONAME ABSENT + _ZN10CMDXMLNode11AppendChildEPS_ @ 2 NONAME + _ZN10CMDXMLNode11RemoveChildEPS_ @ 3 NONAME + _ZN10CMDXMLNode12InsertBeforeEPS_S0_ @ 4 NONAME + _ZN10CMDXMLNode12ReplaceChildEPS_S0_ @ 5 NONAME + _ZN10CMDXMLNode12SetNodeNameLERK7TDesC16 @ 6 NONAME + _ZN10CMDXMLNode19NextSameTypeSiblingEv @ 7 NONAME + _ZN10CMDXMLNode23PreviousSameTypeSiblingEv @ 8 NONAME + _ZN10CMDXMLNode8NodeNameEv @ 9 NONAME + _ZN10CMDXMLNodeD0Ev @ 10 NONAME + _ZN10CMDXMLNodeD1Ev @ 11 NONAME + _ZN10CMDXMLNodeD2Ev @ 12 NONAME + _ZN10CMDXMLText4NewLEP14CMDXMLDocument @ 13 NONAME + _ZN10CMDXMLText5NewLCEP14CMDXMLDocument @ 14 NONAME + _ZN10CMDXMLTextD0Ev @ 15 NONAME + _ZN10CMDXMLTextD1Ev @ 16 NONAME + _ZN10CMDXMLTextD2Ev @ 17 NONAME + _ZN13CMDXMLComment4NewLEP14CMDXMLDocument @ 18 NONAME + _ZN13CMDXMLComment5NewLCEP14CMDXMLDocument @ 19 NONAME + _ZN13CMDXMLCommentD0Ev @ 20 NONAME + _ZN13CMDXMLCommentD1Ev @ 21 NONAME + _ZN13CMDXMLCommentD2Ev @ 22 NONAME + _ZN13CMDXMLElement13CheckChildrenEv @ 23 NONAME + _ZN13CMDXMLElement13NumAttributesEv @ 24 NONAME + _ZN13CMDXMLElement13SetAttributeLERK7TDesC16S2_ @ 25 NONAME + _ZN13CMDXMLElement13SetAttributeLERK7TDesC16S2_i @ 26 NONAME + _ZN13CMDXMLElement15LastChildOfTypeERK7TDesC16 @ 27 NONAME + _ZN13CMDXMLElement15RemoveAttributeERK7TDesC16 @ 28 NONAME + _ZN13CMDXMLElement16AttributeDetailsEiR7TPtrC16S1_ @ 29 NONAME + _ZN13CMDXMLElement16FirstChildOfTypeERK7TDesC16 @ 30 NONAME + _ZN13CMDXMLElement22CheckImmediateChildrenEv @ 31 NONAME + _ZN13CMDXMLElement4NewLEiP14CMDXMLDocument7TPtrC16 @ 32 NONAME + _ZN13CMDXMLElement5NewLCEiP14CMDXMLDocument7TPtrC16 @ 33 NONAME + _ZN13CMDXMLElement9FindIndexERK7TDesC16 @ 34 NONAME + _ZN13CMDXMLElementC1EiP14CMDXMLDocument @ 35 NONAME + _ZN13CMDXMLElementC2EiP14CMDXMLDocument @ 36 NONAME + _ZN13CMDXMLElementD0Ev @ 37 NONAME + _ZN13CMDXMLElementD1Ev @ 38 NONAME + _ZN13CMDXMLElementD2Ev @ 39 NONAME + _ZN14CMDXMLDocument14SetDocTypeTagLERK7TDesC16 @ 40 NONAME + _ZN14CMDXMLDocument14SetVersionTagLERK7TDesC16 @ 41 NONAME + _ZN14CMDXMLDocument28PlaceholderForRemovedExport1ER7MXMLDtd @ 42 NONAME + _ZN14CMDXMLDocument28PlaceholderForRemovedExport2Ev @ 43 NONAME + _ZN14CMDXMLDocument4NewLER7MXMLDtd @ 44 NONAME + _ZN14CMDXMLDocument4NewLEv @ 45 NONAME + _ZN14CMDXMLDocument5NewLCER7MXMLDtd @ 46 NONAME + _ZN14CMDXMLDocument5NewLCEv @ 47 NONAME + _ZN14CMDXMLDocumentD0Ev @ 48 NONAME + _ZN14CMDXMLDocumentD1Ev @ 49 NONAME + _ZN14CMDXMLDocumentD2Ev @ 50 NONAME + _ZN18CMDXMLCDATASection4NewLEP14CMDXMLDocument @ 51 NONAME + _ZN18CMDXMLCDATASection5NewLCEP14CMDXMLDocument @ 52 NONAME + _ZN18CMDXMLCDATASectionD0Ev @ 53 NONAME + _ZN18CMDXMLCDATASectionD1Ev @ 54 NONAME + _ZN18CMDXMLCDATASectionD2Ev @ 55 NONAME + _ZN19CMDXMLCharacterData13CheckChildrenEv @ 56 NONAME + _ZN19CMDXMLCharacterData4DataEv @ 57 NONAME + _ZN19CMDXMLCharacterData6LengthEv @ 58 NONAME + _ZN19CMDXMLCharacterData7AppendLER7TDesC16 @ 59 NONAME + _ZN19CMDXMLCharacterData7InsertLEiR7TDesC16 @ 60 NONAME + _ZN19CMDXMLCharacterData8ReplaceLEiiR7TDesC16 @ 61 NONAME + _ZN19CMDXMLCharacterData8SetDataLER7TDesC16 @ 62 NONAME + _ZN19CMDXMLCharacterDataD0Ev @ 63 NONAME + _ZN19CMDXMLCharacterDataD1Ev @ 64 NONAME + _ZN19CMDXMLCharacterDataD2Ev @ 65 NONAME + _ZN21CMDXMLDocumentElement4NewLEP14CMDXMLDocument @ 66 NONAME + _ZN21CMDXMLDocumentElement5NewLCEP14CMDXMLDocument @ 67 NONAME + _ZN21CMDXMLDocumentElementD0Ev @ 68 NONAME + _ZN21CMDXMLDocumentElementD1Ev @ 69 NONAME + _ZN21CMDXMLDocumentElementD2Ev @ 70 NONAME + _ZN27CMDXMLProcessingInstruction4NewLEP14CMDXMLDocument @ 71 NONAME + _ZN27CMDXMLProcessingInstruction5NewLCEP14CMDXMLDocument @ 72 NONAME + _ZN27CMDXMLProcessingInstructionD0Ev @ 73 NONAME + _ZN27CMDXMLProcessingInstructionD1Ev @ 74 NONAME + _ZN27CMDXMLProcessingInstructionD2Ev @ 75 NONAME + _ZNK13CMDXMLElement12GetAttributeERK7TDesC16R7TPtrC16 @ 76 NONAME + _ZNK13CMDXMLElement20IsAttributeSpecifiedERK7TDesC16 @ 77 NONAME + _ZNK14CMDXMLDocument17ValidElementNameLERK7TDesC16 @ 78 NONAME + _ZNK14CMDXMLDocument22CanElementHaveChildrenERK7TDesC16 @ 79 NONAME + _ZTI10CMDXMLNode @ 80 NONAME ; ## + _ZTI10CMDXMLText @ 81 NONAME ; ## + _ZTI13CMDXMLComment @ 82 NONAME ; ## + _ZTI13CMDXMLElement @ 83 NONAME ; ## + _ZTI14CMDXMLDocument @ 84 NONAME ; ## + _ZTI18CMDXMLCDATASection @ 85 NONAME ; ## + _ZTI19CMDXMLCharacterData @ 86 NONAME ; ## + _ZTI21CMDXMLDocumentElement @ 87 NONAME ; ## + _ZTI27CMDXMLProcessingInstruction @ 88 NONAME ; ## + _ZTV10CMDXMLNode @ 89 NONAME ; ## + _ZTV10CMDXMLText @ 90 NONAME ; ## + _ZTV13CMDXMLComment @ 91 NONAME ; ## + _ZTV13CMDXMLElement @ 92 NONAME ; ## + _ZTV14CMDXMLDocument @ 93 NONAME ; ## + _ZTV18CMDXMLCDATASection @ 94 NONAME ; ## + _ZTV19CMDXMLCharacterData @ 95 NONAME ; ## + _ZTV21CMDXMLDocumentElement @ 96 NONAME ; ## + _ZTV27CMDXMLProcessingInstruction @ 97 NONAME ; ## + _ZTI14CMDXMLDummyDtd @ 98 NONAME ; ## + _ZTV14CMDXMLDummyDtd @ 99 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLDom/eabi/XMLDOMu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLDom/eabi/XMLDOMu.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,101 @@ +EXPORTS + _Z6E32Dll10TDllReason @ 1 NONAME + _ZN10CMDXMLNode11AppendChildEPS_ @ 2 NONAME + _ZN10CMDXMLNode11RemoveChildEPS_ @ 3 NONAME + _ZN10CMDXMLNode12InsertBeforeEPS_S0_ @ 4 NONAME + _ZN10CMDXMLNode12ReplaceChildEPS_S0_ @ 5 NONAME + _ZN10CMDXMLNode12SetNodeNameLERK7TDesC16 @ 6 NONAME + _ZN10CMDXMLNode19NextSameTypeSiblingEv @ 7 NONAME + _ZN10CMDXMLNode23PreviousSameTypeSiblingEv @ 8 NONAME + _ZN10CMDXMLNode8NodeNameEv @ 9 NONAME + _ZN10CMDXMLNodeD0Ev @ 10 NONAME + _ZN10CMDXMLNodeD1Ev @ 11 NONAME + _ZN10CMDXMLNodeD2Ev @ 12 NONAME + _ZN10CMDXMLText4NewLEP14CMDXMLDocument @ 13 NONAME + _ZN10CMDXMLText5NewLCEP14CMDXMLDocument @ 14 NONAME + _ZN10CMDXMLTextD0Ev @ 15 NONAME + _ZN10CMDXMLTextD1Ev @ 16 NONAME + _ZN10CMDXMLTextD2Ev @ 17 NONAME + _ZN13CMDXMLComment4NewLEP14CMDXMLDocument @ 18 NONAME + _ZN13CMDXMLComment5NewLCEP14CMDXMLDocument @ 19 NONAME + _ZN13CMDXMLCommentD0Ev @ 20 NONAME + _ZN13CMDXMLCommentD1Ev @ 21 NONAME + _ZN13CMDXMLCommentD2Ev @ 22 NONAME + _ZN13CMDXMLElement13CheckChildrenEv @ 23 NONAME + _ZN13CMDXMLElement13NumAttributesEv @ 24 NONAME + _ZN13CMDXMLElement13SetAttributeLERK7TDesC16S2_ @ 25 NONAME + _ZN13CMDXMLElement13SetAttributeLERK7TDesC16S2_i @ 26 NONAME + _ZN13CMDXMLElement15LastChildOfTypeERK7TDesC16 @ 27 NONAME + _ZN13CMDXMLElement15RemoveAttributeERK7TDesC16 @ 28 NONAME + _ZN13CMDXMLElement16AttributeDetailsEiR7TPtrC16S1_ @ 29 NONAME + _ZN13CMDXMLElement16FirstChildOfTypeERK7TDesC16 @ 30 NONAME + _ZN13CMDXMLElement22CheckImmediateChildrenEv @ 31 NONAME + _ZN13CMDXMLElement4NewLEiP14CMDXMLDocument7TPtrC16 @ 32 NONAME + _ZN13CMDXMLElement5NewLCEiP14CMDXMLDocument7TPtrC16 @ 33 NONAME + _ZN13CMDXMLElement9FindIndexERK7TDesC16 @ 34 NONAME + _ZN13CMDXMLElementC1EiP14CMDXMLDocument @ 35 NONAME + _ZN13CMDXMLElementC2EiP14CMDXMLDocument @ 36 NONAME + _ZN13CMDXMLElementD0Ev @ 37 NONAME + _ZN13CMDXMLElementD1Ev @ 38 NONAME + _ZN13CMDXMLElementD2Ev @ 39 NONAME + _ZN14CMDXMLDocument14SetDocTypeTagLERK7TDesC16 @ 40 NONAME + _ZN14CMDXMLDocument14SetVersionTagLERK7TDesC16 @ 41 NONAME + _ZN14CMDXMLDocument28PlaceholderForRemovedExport1ER7MXMLDtd @ 42 NONAME + _ZN14CMDXMLDocument28PlaceholderForRemovedExport2Ev @ 43 NONAME + _ZN14CMDXMLDocument4NewLER7MXMLDtd @ 44 NONAME + _ZN14CMDXMLDocument4NewLEv @ 45 NONAME + _ZN14CMDXMLDocument5NewLCER7MXMLDtd @ 46 NONAME + _ZN14CMDXMLDocument5NewLCEv @ 47 NONAME + _ZN14CMDXMLDocumentD0Ev @ 48 NONAME + _ZN14CMDXMLDocumentD1Ev @ 49 NONAME + _ZN14CMDXMLDocumentD2Ev @ 50 NONAME + _ZN18CMDXMLCDATASection4NewLEP14CMDXMLDocument @ 51 NONAME + _ZN18CMDXMLCDATASection5NewLCEP14CMDXMLDocument @ 52 NONAME + _ZN18CMDXMLCDATASectionD0Ev @ 53 NONAME + _ZN18CMDXMLCDATASectionD1Ev @ 54 NONAME + _ZN18CMDXMLCDATASectionD2Ev @ 55 NONAME + _ZN19CMDXMLCharacterData13CheckChildrenEv @ 56 NONAME + _ZN19CMDXMLCharacterData4DataEv @ 57 NONAME + _ZN19CMDXMLCharacterData6LengthEv @ 58 NONAME + _ZN19CMDXMLCharacterData7AppendLER7TDesC16 @ 59 NONAME + _ZN19CMDXMLCharacterData7InsertLEiR7TDesC16 @ 60 NONAME + _ZN19CMDXMLCharacterData8ReplaceLEiiR7TDesC16 @ 61 NONAME + _ZN19CMDXMLCharacterData8SetDataLER7TDesC16 @ 62 NONAME + _ZN19CMDXMLCharacterDataD0Ev @ 63 NONAME + _ZN19CMDXMLCharacterDataD1Ev @ 64 NONAME + _ZN19CMDXMLCharacterDataD2Ev @ 65 NONAME + _ZN21CMDXMLDocumentElement4NewLEP14CMDXMLDocument @ 66 NONAME + _ZN21CMDXMLDocumentElement5NewLCEP14CMDXMLDocument @ 67 NONAME + _ZN21CMDXMLDocumentElementD0Ev @ 68 NONAME + _ZN21CMDXMLDocumentElementD1Ev @ 69 NONAME + _ZN21CMDXMLDocumentElementD2Ev @ 70 NONAME + _ZN27CMDXMLProcessingInstruction4NewLEP14CMDXMLDocument @ 71 NONAME + _ZN27CMDXMLProcessingInstruction5NewLCEP14CMDXMLDocument @ 72 NONAME + _ZN27CMDXMLProcessingInstructionD0Ev @ 73 NONAME + _ZN27CMDXMLProcessingInstructionD1Ev @ 74 NONAME + _ZN27CMDXMLProcessingInstructionD2Ev @ 75 NONAME + _ZNK13CMDXMLElement12GetAttributeERK7TDesC16R7TPtrC16 @ 76 NONAME + _ZNK13CMDXMLElement20IsAttributeSpecifiedERK7TDesC16 @ 77 NONAME + _ZNK14CMDXMLDocument17ValidElementNameLERK7TDesC16 @ 78 NONAME + _ZNK14CMDXMLDocument22CanElementHaveChildrenERK7TDesC16 @ 79 NONAME + _ZTI10CMDXMLNode @ 80 NONAME ; ## + _ZTI10CMDXMLText @ 81 NONAME ; ## + _ZTI13CMDXMLComment @ 82 NONAME ; ## + _ZTI13CMDXMLElement @ 83 NONAME ; ## + _ZTI14CMDXMLDocument @ 84 NONAME ; ## + _ZTI18CMDXMLCDATASection @ 85 NONAME ; ## + _ZTI19CMDXMLCharacterData @ 86 NONAME ; ## + _ZTI21CMDXMLDocumentElement @ 87 NONAME ; ## + _ZTI27CMDXMLProcessingInstruction @ 88 NONAME ; ## + _ZTV10CMDXMLNode @ 89 NONAME ; ## + _ZTV10CMDXMLText @ 90 NONAME ; ## + _ZTV13CMDXMLComment @ 91 NONAME ; ## + _ZTV13CMDXMLElement @ 92 NONAME ; ## + _ZTV14CMDXMLDocument @ 93 NONAME ; ## + _ZTV18CMDXMLCDATASection @ 94 NONAME ; ## + _ZTV19CMDXMLCharacterData @ 95 NONAME ; ## + _ZTV21CMDXMLDocumentElement @ 96 NONAME ; ## + _ZTV27CMDXMLProcessingInstruction @ 97 NONAME ; ## + _ZTI14CMDXMLDummyDtd @ 98 NONAME ; ## + _ZTV14CMDXMLDummyDtd @ 99 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/GROUP/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/GROUP/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,372 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + ../INC/GMXMLComposer.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlcomposer.h) + ../INC/GMXMLParser.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(gmxmlparser.h) + ../INC/GMXMLConstants.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlconstants.h) + ../INC/GMXMLEntityConverter.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gmxmlentityconverter.h) + +PRJ_MMPFILES + xmlparser.mmp + +PRJ_TESTMMPFILES + ../test/t_GmxmlParser.mmp + ../test/t_GmxmlFailure.mmp + ../test/t_smiltranslatortest.mmp + +PRJ_TESTEXPORTS +../test/GmxmlTest.txt z:/gmxmltest.txt + + + + + +// SMIL Input valid +../test/SMIL_Test_Files/smil_input/valid/anchor_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/anchor_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/anchor_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/anchor_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/anchor_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/anchor_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/anchor_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/anchor_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/anchor_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/anchor_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/animation_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/animation_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/animation_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/animation_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/animation_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/animation_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/animation_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/animation_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/animation_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/animation_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/area_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/area_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/area_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/area_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/area_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/area_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/area_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/area_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/area_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/area_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/ascii_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ascii_1.txt +../test/SMIL_Test_Files/smil_input/valid/att_order_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/att_order_1.txt +../test/SMIL_Test_Files/smil_input/valid/att_order_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/att_order_2.txt +../test/SMIL_Test_Files/smil_input/valid/att_var_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/att_var_1.txt +../test/SMIL_Test_Files/smil_input/valid/audio_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/audio_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/audio_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/audio_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/audio_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/audio_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/audio_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/audio_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/audio_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/audio_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/a_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/a_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/a_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/a_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/a_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/a_struc_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_struc_1.txt +../test/SMIL_Test_Files/smil_input/valid/a_struc_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_struc_2.txt +../test/SMIL_Test_Files/smil_input/valid/a_struc_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_struc_3.txt +../test/SMIL_Test_Files/smil_input/valid/a_struc_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/a_struc_4.txt +../test/SMIL_Test_Files/smil_input/valid/body_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/body_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/body_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/body_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/body_struc_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/body_struc_1.txt +../test/SMIL_Test_Files/smil_input/valid/body_struc_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/body_struc_2.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_1.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_10.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_11.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_12.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_12.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_13.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_13.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_14.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_14.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_15.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_15.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_16.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_16.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_17.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_17.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_18.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_18.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_19.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_19.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_2.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_20.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_20.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_21.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_21.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_22.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_22.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_23.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_23.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_24.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_24.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_25.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_25.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_26.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_26.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_27.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_27.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_28.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_28.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_29.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_29.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_3.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_30.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_30.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_4.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_5.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_6.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_7.txt +../test/SMIL_Test_Files/smil_input/valid/cdata_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/cdata_8.txt +../test/SMIL_Test_Files/smil_input/valid/comments_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/comments_1.txt +../test/SMIL_Test_Files/smil_input/valid/doctype_variation.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/doctype_variation.txt +../test/SMIL_Test_Files/smil_input/valid/entitiy_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entitiy_1.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_1.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_10.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_11.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_12.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_12.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_13.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_13.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_14.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_14.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_15.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_15.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_17.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_17.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_18.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_18.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_19.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_19.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_2.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_20.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_20.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_21.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_21.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_22.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_22.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_24.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_24.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_26.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_26.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_27.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_27.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_3.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_30.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_30.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_31.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_31.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_4.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_5.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_6.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_7.txt +../test/SMIL_Test_Files/smil_input/valid/entity_ref_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/entity_ref_8.txt +../test/SMIL_Test_Files/smil_input/valid/head_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/head_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/head_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/head_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/img_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/img_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/img_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/img_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/img_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/img_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/img_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/img_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/img_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/img_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/inc021337.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/inc021337.txt +../test/SMIL_Test_Files/smil_input/valid/inc022160.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/inc022160.txt +../test/SMIL_Test_Files/smil_input/valid/inc025788.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/inc025788.txt +../test/SMIL_Test_Files/smil_input/valid/layout_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/layout_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/layout_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/layout_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/newline_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/newline_1.txt +../test/SMIL_Test_Files/smil_input/valid/par_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/par_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/par_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/par_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/par_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/par_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/par_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/par_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/par_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/par_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/ref_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ref_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/ref_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ref_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/ref_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ref_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/ref_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ref_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/ref_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/ref_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/region_att_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/region_att_6.txt +../test/SMIL_Test_Files/smil_input/valid/root-layout_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/root-layout_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/root-layout_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/root-layout_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/root-layout_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/root-layout_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/seq_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/seq_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/seq_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/seq_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/seq_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_1.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_2.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_3.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_4.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_5.txt +../test/SMIL_Test_Files/smil_input/valid/seq_struc_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/seq_struc_6.txt +../test/SMIL_Test_Files/smil_input/valid/smil_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/smil_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/smil_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/smil_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/switch_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/switch_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/switch_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/switch_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/switch_struc_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/switch_struc_1.txt +../test/SMIL_Test_Files/smil_input/valid/switch_struc_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/switch_struc_2.txt +../test/SMIL_Test_Files/smil_input/valid/switch_struc_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/switch_struc_3.txt +../test/SMIL_Test_Files/smil_input/valid/textstream_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/textstream_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/textstream_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/textstream_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/textstream_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/textstream_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/textstream_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/textstream_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/textstream_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/textstream_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/text_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/text_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/text_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/text_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/text_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/text_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/text_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/text_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/text_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/text_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/utf8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/utf8.txt +../test/SMIL_Test_Files/smil_input/valid/video_att_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/video_att_1.txt +../test/SMIL_Test_Files/smil_input/valid/video_att_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/video_att_2.txt +../test/SMIL_Test_Files/smil_input/valid/video_att_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/video_att_3.txt +../test/SMIL_Test_Files/smil_input/valid/video_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/video_att_4.txt +../test/SMIL_Test_Files/smil_input/valid/video_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/video_att_5.txt +../test/SMIL_Test_Files/smil_input/valid/whitespace_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/whitespace_1.txt +../test/SMIL_Test_Files/smil_input/valid/whitespace_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/whitespace_2.txt +../test/SMIL_Test_Files/smil_input/valid/xml_version_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/valid/xml_version_1.txt + +// SMIL Input invalid +../test/SMIL_Test_Files/smil_input/invalid/a_att_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_10.txt +../test/SMIL_Test_Files/smil_input/invalid/a_att_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_11.txt +../test/SMIL_Test_Files/smil_input/invalid/a_att_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_6.txt +../test/SMIL_Test_Files/smil_input/invalid/a_att_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_7.txt +../test/SMIL_Test_Files/smil_input/invalid/a_att_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_8.txt +../test/SMIL_Test_Files/smil_input/invalid/a_att_9.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/a_att_9.txt +../test/SMIL_Test_Files/smil_input/invalid/cdata_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/cdata_1.txt +../test/SMIL_Test_Files/smil_input/invalid/empty.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/empty.txt +../test/SMIL_Test_Files/smil_input/invalid/entitiy_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/entitiy_2.txt +../test/SMIL_Test_Files/smil_input/invalid/entity_ref_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/entity_ref_1.txt +../test/SMIL_Test_Files/smil_input/invalid/entity_ref_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/entity_ref_2.txt +../test/SMIL_Test_Files/smil_input/invalid/entity_ref_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/entity_ref_3.txt +../test/SMIL_Test_Files/smil_input/invalid/entity_ref_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/entity_ref_4.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_1.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_10.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_11.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_12.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_12.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_13.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_13.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_14.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_14.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_15.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_15.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_16.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_16.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_17.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_17.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_18.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_18.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_19.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_19.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_2.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_20.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_20.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_21.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_21.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_22.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_22.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_23.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_23.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_24.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_24.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_25.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_25.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_3.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_4.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_5.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_6.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_7.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_8.txt +../test/SMIL_Test_Files/smil_input/invalid/further_invalid_9.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/further_invalid_9.txt +../test/SMIL_Test_Files/smil_input/invalid/inc021591.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/inc021591.txt +../test/SMIL_Test_Files/smil_input/invalid/inc021675.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/inc021675.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_1.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_1.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_10.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_11.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_12.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_12.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_13.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_13.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_14.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_14.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_15.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_15.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_16.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_16.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_17.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_17.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_18.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_18.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_19.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_19.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_2.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_2.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_20.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_20.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_21.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_21.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_22.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_22.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_23.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_23.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_24.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_24.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_25.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_25.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_26.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_26.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_27.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_27.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_28.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_28.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_29.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_29.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_3.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_3.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_31.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_31.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_32.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_32.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_33.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_33.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_34.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_34.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_35.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_35.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_36.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_36.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_37.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_37.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_38.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_38.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_39.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_39.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_4.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_40.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_40.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_5.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_6.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_7.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_8.txt +../test/SMIL_Test_Files/smil_input/invalid/invalid_9.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/invalid_9.txt +../test/SMIL_Test_Files/smil_input/invalid/region_att_10.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/region_att_10.txt +../test/SMIL_Test_Files/smil_input/invalid/region_att_11.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/region_att_11.txt +../test/SMIL_Test_Files/smil_input/invalid/region_att_7.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/region_att_7.txt +../test/SMIL_Test_Files/smil_input/invalid/region_att_8.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/region_att_8.txt +../test/SMIL_Test_Files/smil_input/invalid/region_att_9.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/region_att_9.txt +../test/SMIL_Test_Files/smil_input/invalid/root-layout_att_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/root-layout_att_4.txt +../test/SMIL_Test_Files/smil_input/invalid/root-layout_att_5.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/root-layout_att_5.txt +../test/SMIL_Test_Files/smil_input/invalid/root-layout_att_6.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/root-layout_att_6.txt +../test/SMIL_Test_Files/smil_input/invalid/switch_struc_4.txt z:/legacyminidomparsertest/smil_test_files/smil_input/invalid/switch_struc_4.txt + +// MMS Input valid +../test/SMIL_Test_Files/mms_input/valid/audio_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/audio_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/audio_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/audio_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/audio_att_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/audio_att_3.txt +../test/SMIL_Test_Files/mms_input/valid/body_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/body_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/body_struc_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/body_struc_2.txt +../test/SMIL_Test_Files/mms_input/valid/body_struc_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/body_struc_3.txt +../test/SMIL_Test_Files/mms_input/valid/head_struct_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/head_struct_4.txt +../test/SMIL_Test_Files/mms_input/valid/head_struct_5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/head_struct_5.txt +../test/SMIL_Test_Files/mms_input/valid/head_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/head_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/head_struc_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/head_struc_3.txt +../test/SMIL_Test_Files/mms_input/valid/img_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/img_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/img_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/img_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/img_att_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/img_att_3.txt +../test/SMIL_Test_Files/mms_input/valid/img_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/img_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/layout_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/layout_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/layout_struc_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/layout_struc_3.txt +../test/SMIL_Test_Files/mms_input/valid/layout_struc_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/layout_struc_4.txt +../test/SMIL_Test_Files/mms_input/valid/layout_struc_5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/layout_struc_5.txt +../test/SMIL_Test_Files/mms_input/valid/metadata_att1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/metadata_att1.txt +../test/SMIL_Test_Files/mms_input/valid/meta_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/meta_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/meta_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/meta_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/par_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/par_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/par_prefetch.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_prefetch.txt +../test/SMIL_Test_Files/mms_input/valid/par_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/par_struc_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_struc_2.txt +../test/SMIL_Test_Files/mms_input/valid/par_struc_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/par_struc_4.txt +../test/SMIL_Test_Files/mms_input/valid/prefetch_att1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/prefetch_att1.txt +../test/SMIL_Test_Files/mms_input/valid/prefetch_att2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/prefetch_att2.txt +../test/SMIL_Test_Files/mms_input/valid/prefetch_att3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/prefetch_att3.txt +../test/SMIL_Test_Files/mms_input/valid/prefetch_att4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/prefetch_att4.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_3.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_4.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_5.txt +../test/SMIL_Test_Files/mms_input/valid/ref_att_6.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/ref_att_6.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_3.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_4.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_5.txt +../test/SMIL_Test_Files/mms_input/valid/region_att_6.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_att_6.txt +../test/SMIL_Test_Files/mms_input/valid/region_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/region_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/root-layout_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/root-layout_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/root-layout_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/root-layout_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/smil_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/smil_struc_1.txt +../test/SMIL_Test_Files/mms_input/valid/smil_struc_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/smil_struc_3.txt +../test/SMIL_Test_Files/mms_input/valid/smil_struc_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/smil_struc_4.txt +../test/SMIL_Test_Files/mms_input/valid/smil_struc_5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/smil_struc_5.txt +../test/SMIL_Test_Files/mms_input/valid/text_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/text_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/text_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/text_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/transition_att_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/transition_att_1.txt +../test/SMIL_Test_Files/mms_input/valid/transition_att_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/transition_att_2.txt +../test/SMIL_Test_Files/mms_input/valid/transition_att_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/valid/transition_att_3.txt + +// MMS Input invalid +../test/SMIL_Test_Files/mms_input/invalid/body_struc_4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/body_struc_4.txt +../test/SMIL_Test_Files/mms_input/invalid/head_struc_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/head_struc_2.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_metadata_att1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_metadata_att1.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_meta_att1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_meta_att1.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_transition_att2.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_transition_att3.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att4.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_transition_att4.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att5.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid_transition_att5.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid__prefetch_att1.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid__prefetch_att2.txt +../test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/invalid__prefetch_att3.txt +../test/SMIL_Test_Files/mms_input/invalid/layout_struc_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/layout_struc_2.txt +../test/SMIL_Test_Files/mms_input/invalid/layout_struc_6.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/layout_struc_6.txt +../test/SMIL_Test_Files/mms_input/invalid/layout_struc_7.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/layout_struc_7.txt +../test/SMIL_Test_Files/mms_input/invalid/par_struc_3.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/par_struc_3.txt +../test/SMIL_Test_Files/mms_input/invalid/region_att_7.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/region_att_7.txt +../test/SMIL_Test_Files/mms_input/invalid/smil_struc_2.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/smil_struc_2.txt +../test/SMIL_Test_Files/mms_input/invalid/text_struc_1.txt z:/legacyminidomparsertest/smil_test_files/mms_input/invalid/text_struc_1.txt + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/GROUP/xmlparser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/GROUP/xmlparser.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// xmlparser.dll XML parser +// +// +/** + @file +*/ + +TARGET xmlparser.dll +TARGETTYPE dll + +CAPABILITY All -TCB +UID 0x1000008d 0x101F9118 +VENDORID 0x70000001 + +SOURCEPATH ../SRC +SOURCE GMXMLComposer.cpp +SOURCE GMXMLEntityConverter.cpp +SOURCE GMXMLParser.cpp +SOURCE GMXMLFileDataSource.cpp + +USERINCLUDE ../INC ../../XMLDom/INC +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY charconv.lib +LIBRARY bafl.lib +LIBRARY xmldom.lib + +#ifdef WINSCW +DEFFILE V2_XMLPARSER.DEF +#else +DEFFILE v2_xmlparser.DEF +#endif + +SOURCEPATH ../STRINGS +START STRINGTABLE XMLEntityReferences.st + EXPORTPATH /epoc32/include +END +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/INC/GMXMLComposer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/INC/GMXMLComposer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,317 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the generic CMDXMLComposer class +// which is responsible for creating an XML file +// from a given DOM structure. +// +// + +/** + @file +*/ + + +#ifndef __GMXMLCOMPOSER_H__ +#define __GMXMLCOMPOSER_H__ + +#include +#include +#include +#include + +//forward reference +class CMDXMLDocument; +class CMDXMLEntityConverter; +class CMDXMLNode; + +class MMDXMLComposerObserver +/** Abstract observer interface for notification when XML composition is complete. + +It should be implemented by users of CMDXMLComposer. + +@publishedPartner +@released +*/ + { +public: + /** + Call back function used to inform a client of the composer that the composer has completed. + */ + virtual void ComposeFileCompleteL() = 0; + }; + + +class CMDXMLComposer: public CActive +/** Creates an XML file from a given DOM structure. + @publishedPartner + @released + */ + { +public: + /** Destructor. */ + IMPORT_C ~CMDXMLComposer(); + + /** Allocates and constructs a new XML composer. + + @param aComposerObserver Composer observer + @leave KErrNoMemory Out of memory + @return New XML composer */ + IMPORT_C static CMDXMLComposer* NewL(MMDXMLComposerObserver* aComposerObserver); + + /** Allocates and constructs a new XML composer. + + @param aComposerObserver Composer observer + @param aOutputProlog Whether to output Version and Doctype tags. + @leave KErrNoMemory Out of memory + @return New XML composer */ + IMPORT_C static CMDXMLComposer* NewL(MMDXMLComposerObserver* aComposerObserver, TBool aOutputProlog); + + + /** Allocates and constructs a new XML composer, leaving the object on the cleanup + stack. + + @leave KErrNoMemory Out of memory + @param aComposerObserver Composer observer + @return New XML composer */ + IMPORT_C static CMDXMLComposer* NewLC(MMDXMLComposerObserver* aComposerObserver); + + /** Allocates and constructs a new XML composer, leaving the object on the cleanup + stack. + + @leave KErrNoMemory Out of memory + @param aComposerObserver Composer observer + @param aOutputProlog Whether to output Version and Doctype tags. + @return New XML composer */ + IMPORT_C static CMDXMLComposer* NewLC(MMDXMLComposerObserver* aComposerObserver, TBool aOutputProlog); + + /** Starts file composition. + + This function must not be called when file sizing is in progress. If it is necessary to calulate + the size and generate the XML simultaneously then two instances of the composer should be used, + one for sizing and one for composition. + + @param aRFs A file server session + @param aFileToCompose Name of the file to create + @param aDocument The document object to compose to the file + @param aFileType Type of the output file + @return KErrNone if successful */ + IMPORT_C TInt ComposeFile(RFs aRFs, const TDesC& aFileToCompose, CMDXMLDocument* aDocument, TXMLFileType aFileType); + + IMPORT_C TInt ComposeFile(RFile& aFileHandleToCompose, CMDXMLDocument* aDocument, TXMLFileType aFileType); + + /** Starts calculating the size of the XML output without actually writing it to the file. + + File size calculation is asyncronous, the size value is only updated when ComposeFileComplete + is called on the MMDXMLComposerObserver passed in in the NewL. + + This function must not be called when file composition or another sizing operation is + in progress. If it is necessary to calulate the size and generate the XML simultaneously + then two instances of the composer should be used, one for sizing and one for composition. + + @param aSize Will be set to the size of the XML document when composition has completed. + @param aDocument The document object to size + @param aFileType Type of the output file, required because it will affect the size of the XML + @return KErrNone if successful */ + + IMPORT_C TInt CalculateFileSize(TInt& aSize, CMDXMLDocument* aDocument, TXMLFileType aFileType); + + /** Gets the composer's last error. + + @return Error code */ + IMPORT_C TInt Error() const; + + /** + Get the severity of the most severe error found. + @return the maximum error severity + */ + IMPORT_C TXMLErrorCodeSeverity ErrorSeverity() const; + + //Defect fix for INC036136 - Enable the use of custom entity converters in GMXML + /** Outputs raw data. + it's only intended to be used from within a custom entity converter as + it relies on a Composer sesssion already being in progress + + @param aData Data to output + @return KErrNone if successful, otherwise a file writing error. + */ + IMPORT_C TInt OutputDataL(const TDesC& aData); + + /** + * Sets the entity converter to be used + * and take ownership of the passed entity converter + * @param aEntityConverter The entity converter to be used + */ + IMPORT_C void SetEntityConverter(CMDXMLEntityConverter* aEntityConverter); + //End Defect fix for INC036136 + +public: // public functions used by other classes within the .dll, not for Export. + /** Gets the entity converter used by the composer. + + @return The entity converter used by the composer. */ + IMPORT_C CMDXMLEntityConverter* EntityConverter() const; + + /** Outputs a comment. + + @param aComment Comment to output + @return KErrNone if successful, otherwise a file writing error. */ + TInt OutputCommentL(const TDesC& aComment); + + /** Outputs a processing instruction. + + @param aInstruction Processing instruction text to output + @return KErrNone if successful, otherwise a file writing error. */ + TInt OutputProcessingInstructionL(const TDesC& aInstruction); + + /** Outputs a CDATA section. + + @param aCDataSection CDATA section to output + @return KErrNone if successful, otherwise a file writing error. */ + TInt OutputCDataSectionL(const TDesC& aCDataSection); + + + /** Outputs a start of element tag. + + @param aElementName The name of the tag to output + @return KErrNone if successful, otherwise a file writing error. */ + IMPORT_C TInt OutputStartOfElementTagL(const TDesC& aElementName); + + /** Outputs an end of element start tag ( iOutputBuffer; + RFs iRFs; // File system to use + TBool iOutputProlog; // Whether to output Version and Doctype tags + + TInt iSizeTally; + TInt* iSize; + TBool iOnlyCalculatingSize; + +#ifdef _DEBUG + TInt iIndentationLevel; +#endif + }; + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/INC/GMXMLConstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/INC/GMXMLConstants.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,141 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains generic XML constants +// +// + +/** + @file +*/ + +#ifndef __GMXMLCONSTANTS_H__ +#define __GMXMLCONSTANTS_H__ + +#include +#include + +/** XML file type options. +@publishedPartner +@released +*/ +enum TXMLFileType + { + /** ASCII file. */ + EAscii = 1, + /** Unicode file. */ + EUnicode = 2, + /** UTF8 file. */ + EUtf8 = 3 + }; + +const TInt KReadBufferLen = 1024; +const TInt KWriteBufferLen = 1024; + +// Error codes +/** XML element nesting error code. */ +const TInt KErrXMLBadNesting = KErrXMLBase - 4; +/** XML element incomplete error code. */ +const TInt KErrXMLIncomplete = KErrXMLBase - 5; +/** XML element name error code. */ +const TInt KErrXMLBadElementName = KErrXMLBase - 6; +/** Error code that indicates that more than one DOCTYPE tag has been encountered: +the first one encountered will be used. */ +const TInt KErrXMLDuplicateDocTypeTags = KErrXMLBase - 7; +/** Error code that indicates that more than one XML version tag has been encountered: +the first one encountered will be used. */ +const TInt KErrXMLDuplicateVersionTags = KErrXMLBase - 8; +/** Error code that indicates that more than one element has been encountered at +the root of the document (there should be a single element). The resulting +tree may be confused, but is provided rather than being discarded. */ +const TInt KErrXMLDuplicateRootElements = KErrXMLBase - 9; +/** Error code that indicates that no DOCTYPE tag was encountered. */ +const TInt KErrXMLMissingDocTypeTag = KErrXMLBase - 10; +/** Error code that indicates that no XML version tag was encountered. */ +const TInt KErrXMLMissingVersionTag = KErrXMLBase - 11; +/** Error code that indicates that an element has two or more entries for the same +attribute. */ +const TInt KErrXMLDuplicateAttributeName = KErrXMLBase - 12; +/** Error code that indicates there is no single root element. + +This may be the result of two of more root elements being added incorrectly, +or a missing root element leading to the child elements being assumed to be +root nodes. */ +const TInt KErrXMLMultipleRootElements = KErrXMLBase - 13; +/** Error code that indicates spurious characters have been found. + +This may occur as the result of a missing or an extra attribute or element +delimiter. */ +const TInt KErrXMLCorruptFile = KErrXMLBase - 14; +/** Error code that indicates a built-in entity or element / attribute delimiter +is at an inappropriate place. */ +const TInt KErrXMLIllegalCharacter = KErrXMLBase - 15; +const TInt KErrXMLBadEntity = KErrXMLBase - 16; +/** Error code that indicates an element was found to be invalid by the DTD */ +const TInt KErrXMLInvalidElement = KErrXMLBase - 17; +/** Error code that indicates an attribute was found to be invalid by the DTD */ +const TInt KErrXMLInvalidAttribute = KErrXMLBase - 18; + +/** Severity levels for XML composer and parser errors. +@publishedPartner +@released +*/ +enum TXMLErrorCodeSeverity + { + /** Fatal error. */ + EXMLFatal, + /** Severity level cannot be determined. */ + EXMLIndeterminate, + /** Recoverable error. */ + EXMLWorkable, + /** No error. */ + EXMLNone + }; + + +_LIT(KNewLine, "\r\n"); + +#ifdef _DEBUG + _LIT(KTab, " "); +#endif + +_LIT(KXMLSemiColon, ";"); +_LIT(KXMLDecimalId, "&#"); +_LIT(KXMLHexidecimalId, "&#x"); +_LIT(KXMLStartComment, ""); +_LIT(KXMLStartEndTag, ""); +_LIT(KXMLStartProcessingInstruction, ""); +_LIT(KXMLStartCDataSection, ""); + +_LIT(KBackSlash, "\\"); +_LIT(KDash, "-"); +_LIT(KExclamation, "!"); +_LIT(KForwardSlash, "/"); +_LIT(KEqualSign, "="); +_LIT(KLeftArrow, "<"); +_LIT(KRightArrow, ">"); +_LIT(KAmpersand, "&"); +_LIT(KApostrophe, "\'"); +_LIT(KQuotation, "\""); +_LIT(KSingleSpace, " "); + + +const TInt KNominalTagLength = 256; +const TInt KStartPosition = -1; + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/INC/GMXMLEntityConverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/INC/GMXMLEntityConverter.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file +*/ + +#ifndef __GMXMLENTITYCONVERTER_H__ +#define __GMXMLENTITYCONVERTER_H__ + +#include +#include + + +class CMDXMLEntityConverter: public CBase +/** + * This class represents a generic entity converter for an XML parser or composer. + * It is responsible for converting entity references to text and vice-versa. + * @publishedPartner + * @released + */ + { +public: + /** + * Constructor + */ + IMPORT_C CMDXMLEntityConverter(); + + /** Destructor. */ + IMPORT_C virtual ~CMDXMLEntityConverter(); + + /** + * Takes a block of text and converts any entity references found to the + * appropriate text. Because built-in and character entity references are + * longer than the replacement text, this takes place in-situ. + * @param aTextToConvert Text to be converted - replacement text goes + * out in the same + * @return Returns KErrNone if successful or no entity found + * @return Returns KErrXMLBadEntity if malformed entity found + */ + TInt EntityToTextL(TDes& aTextToConvert); + + /** + * Outputs a block of text to a composer with offending characters replaced by + * entity references. + * @param aComposer the composer to be used for output + * @param aTextToConvert The text to be converted. + * @return Returns KErrNone if succcessful or a file write error + * @leave can Leave due to OOM + */ + IMPORT_C virtual TInt OutputComposedTextL( CMDXMLComposer* aComposer, const TDesC& aTextToConvert ); + +protected: + /** + * DTD Specific entity to text converter + * Takes a block of text and converts any entity references found to the + * appropriate text. We hope that this can happen in-situ. + * @param aTextToConvert Text to be converted - replacement text goes + * out in the same + * @return Returns KErrNone if successful or no entity found + * @return Returns KErrXMLBadEntity if malformed entity found + */ + virtual TInt DTDEntityToText(TDes& aTextToConvert); + +private: + /** + * Replaces the built in entity reference with its replacement text. + * @param aTextToConvert An entity reference to convert. This should begin with & + * and end with ;. + * @return Returns KErrNone if successful + * @return Returns KErrUnsupported if aTextToConvert contains no recognised entity references + * @return Returns KErrOverflow or KErrGeneral if the character reference couldn't be parsed + */ + TInt ConvertEntityRefL(TDes& aTextToConvert); + + }; + + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/INC/GMXMLFileDataSource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/INC/GMXMLFileDataSource.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,70 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GMXMLFILEDDATASOURCE.H +// This file contains the declaration of the specific CMDXMLParserFileDataSource class +// which is used by the XML Parser when the file based API is used. +// +// + +/** + @file +*/ + + +#ifndef __GMXMLFILEDATASOURCE_H__ +#define __GMXMLFILEDATASOURCE_H__ + +class CMDXMLParserFileDataSource : public CBase, public MMDXMLParserDataProvider + { +public: + virtual void GetData(TPtrC8 &aPtr, TRequestStatus &aStatus); + virtual void Disconnect(); + + /** Creates and Initialises the data provider with a specified XML file. + + @param aRFs File server session + @param aFileToParse The file name to parse + */ + static CMDXMLParserFileDataSource *NewL(RFs aRFs, const TDesC& aFileToParse); + static CMDXMLParserFileDataSource *NewLC(RFs aRFs, const TDesC& aFileToParse); + + static CMDXMLParserFileDataSource* NewL(RFile& aFileHandleToParse); + + ~CMDXMLParserFileDataSource(); + +private: + CMDXMLParserFileDataSource(); + + /** Second phase constructor. + */ + void ConstructL(RFs aRFs, const TDesC& aFileToParse); + + void ConstructL(RFile& aFileHandleToParse); + +private: + + enum EInternalState + { + KInit = 0, + KDataSent, + KDone, + KError + }; + + TInt iState; + RFile iXMLFile; + HBufC8* iXMLFileBuffer; + }; + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/INC/GMXMLParser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/INC/GMXMLParser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,510 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the declaration of the generic CMDXMLParser class +// which is responsible for creating a DOM structure +// from a given XML file. +// +// + +/** + @file +*/ + +#ifndef __GMXMLPARSER_H__ +#define __GMXMLPARSER_H__ + +#include +#include +#include +#include + +//forward reference +class CMDXMLDocument; +class CMDXMLEntityConverter; +class CMDXMLElement; +class MXMLDtd; + + + +class MMDXMLParserObserver +/** Abstract observer interface for notification when XML parsing is complete. + +It should be implemented by users of CMDXMLParser +@publishedAll +@released*/ + { +public: + /** + Call back function used to inform a client of the Parser when a parsing operation completes. + */ + virtual void ParseFileCompleteL() = 0; + }; + +class MMDXMLParserDataProvider +/** Abstract data source interface for XML data source. + +The user of CMDXMLParser must build one of these to encapsulate the data source +that they wish to parse. CMDXMLParser implements a file-based data source to +implement the functionality of the ParseFile function. + +@publishedAll +@released*/ + { +public: + /** Status codes returned by GetData() implementations. */ + enum TDataProviderResults + { + KMoreData, //< Returned by the interface implementation when it is returning more data. + KDataStreamError, //< Returned by the interface when an unrecoverable error prevents obtaining more data. A recoverable error should be represented by KDataNotReady. + KDataStreamEnd //< Returned by the interface when there is no more data to come. + }; + +public: + /** + The XML Parser calls this on a specific data provider to get more data + when required. + + Note that the TPtrC supplied may be used by the parser at any time + between the return of this call and the next call that the parser + makes out. + + Your data provider must not move the data pointed to until the + parser has indicated that it's done with that block by asking for + another. + + Ownership of the data pointed to remains with the data provider. + + + General comments on efficiency + ------------------------------ + + The parser is designed such that it processes the whole data block + provided in one go. It will automatically become asynchronous when + another block is required - the data provider only needs to supply + data. + + Because of this design, it allows the data provider to indirectly + control the amount of processing time that will be needed + in a single block. + + It is a good idea to balance the need for the fastest possible + processing with the need for client application responsiveness by + ensuring that the amount of data passed in a single block is not + too large. However, it is worth bearing in mind that the parser + will convert UTF8 data streams in blocks of 32 characters, and + supplying blocks of smaller length than this will result in a + slight loss of efficiency. + + @param aPtr On return, the data provided + @param aStatus Asynchronous status to be completed by the function with a + TDataProviderResults value + */ + virtual void GetData(TPtrC8 &aPtr, TRequestStatus &aStatus) = 0; + /** + Called to indicate that use of the data source is complete. + */ + virtual void Disconnect() = 0; + }; + +class CMDXMLParserFileDataSource; + +class CMDXMLParser: public CActive +/** Creates a DOM structure from a given XML file. + +The parsing operation is asynchronous and is initiated by a call to ParseFile(). +On completion, the created DOM document can be retrieved through DetachXMLDoc(). + +Note the following ownership rules for the DOM document: + +1. calling DetachXMLDoc() transfers ownership of the document to the client + +2. if the parser is asked to parse a new file while it still owns an existing +DOM document, it will delete the old document. + +@publishedAll +@released +*/ + { +public: + /** Allocates and constructs a new XML parser, specifying a DTD. + + @param aParserObserver XML parser observer + @leave KErrNoMemory Out of memory + @return New XML parser */ + IMPORT_C static CMDXMLParser* NewL(MMDXMLParserObserver* aParserObserver); + + /** Allocates and constructs a new XML parser, specifying a DTD. + + @param aParserObserver XML parser observer + @param aDtdRepresentation DTD validator + @leave KErrNoMemory Out of memory + @return New XML parser */ + IMPORT_C static CMDXMLParser* NewL(MMDXMLParserObserver* aParserObserver, MXMLDtd* aDtdRepresentation); + + /** Allocates and constructs a new XML parser, leaving the object on the cleanup + stack. + + @param aParserObserver XML parser observer + @leave KErrNoMemory Out of memory + @return New XML parser */ + IMPORT_C static CMDXMLParser* NewLC(MMDXMLParserObserver* aParserObserver); + + /** Allocates and constructs a new XML parser, leaving the object on the cleanup + stack. + + @param aParserObserver XML parser observer + @param aDtdRepresentation DTD validator + @leave KErrNoMemory Out of memory + @return New XML parser */ + IMPORT_C static CMDXMLParser* NewLC(MMDXMLParserObserver* aParserObserver, MXMLDtd* aDtdRepresentation); + + + /** Destructor. */ + IMPORT_C ~CMDXMLParser(); + + /** Gets the last error found by the parser. + + @return Error code + */ + IMPORT_C TInt Error() const; + + /** + Get the severity of the most severe error found. + @return the maximum error severity + */ + IMPORT_C TXMLErrorCodeSeverity ErrorSeverity() const; + + /** Gets the created DOM. + + This should be called after the conclusion of the parser process. + + Note that the function sets the internal variable pointing to the document + to NULL, so this function can only be called once per file parse. The caller + takes ownership of the document, and must delete it when its use is complete. + + @return The created DOM */ + IMPORT_C CMDXMLDocument* DetachXMLDoc(); + + /** Parses a specified XML file into a DOM object tree. + + @param aRFs File server session + @param aFileToParse The file name to parse + @return KErrNone if success or a file read error code */ + IMPORT_C TInt ParseFile(RFs aRFs, const TDesC& aFileToParse); + + IMPORT_C TInt ParseFile(RFile& aFileHandleToParse); + + /** Parses a specified XML Data Source into a DOM object tree. + Use ParseSourceL() function in preference to ParseSource() + @param aSource MMDXMLParserDataProvider pointer + */ + inline void ParseSource(MMDXMLParserDataProvider *aSource) + { + TRAP_IGNORE(ParseSourceL(aSource)); + } + + /** Parses a specified XML Data Source into a DOM object tree. + @param aSource MMDXMLParserDataProvider pointer + */ + IMPORT_C void ParseSourceL(MMDXMLParserDataProvider *aSource); + + /** Defines input stream character widths. */ + enum TMDXMLParserInputCharWidth + { + EAscii = 0x01, //< ASCII + EUnicode = 0x02 // iUnicodeConversion; // buffer to temporarily hold the results of conversion from UTF8 to Unicode + TInt iUnicodeConversionLen; // number of characters stored in our intermediate buffer + TInt iUnicodeReadPos; // next character to send from our intermediate buffer + TBuf<1> iSpareChar; + + /* member variables used when parsing a local file */ + TDesC *iFileToParse; + RFs iRFs; + RFile iFileHandleToParse; + + TBool iEndOfTag; + + /* member variables used in DoParseLoopL() */ + TBool iOpened; + TBool iClosed; + CMDXMLElement* iNewElement; + CMDXMLElement* iParentElement; + HBufC* iText; + enum EParserStates + { + KInitFromFile, + KDetermineCharset, + KWaitingForData, + KParseData, + KSpanDataGap, + KFinished + }; + + EParserStates iState; + EParserStates iPreviousState; + TInt iSuspiciousCharacter; + TBool iStoreInvalid; // controls whether invalid elements and attributes are stored in the DOM. + TBool iPreserve; + + }; + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/SRC/GMXMLComposer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/SRC/GMXMLComposer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1201 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GMXMLCOMPOSE.CPP +// @file +// This file contains the declaration of the generic CMDXMLComposer class +// which is responsible for creating an XML file +// from a given DOM structure. +// +// + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +_LIT(KXmlQuotation, """); + +// +// CMDXMLComposer // +// + +CMDXMLComposer::CMDXMLComposer(MMDXMLComposerObserver* aComposerObserver) : CActive(EPriorityNormal) +// +// Constructor +// + { + iComposerObserver = aComposerObserver; + iOutputProlog = ETrue; + CActiveScheduler::Add(this); + } + +CMDXMLComposer::CMDXMLComposer(MMDXMLComposerObserver* aComposerObserver, TBool aOutputProlog) : CActive(EPriorityNormal), + iOutputProlog(aOutputProlog) +// +// Constructor +// + { + iComposerObserver = aComposerObserver; + CActiveScheduler::Add(this); + } +//================================================================================== + +EXPORT_C CMDXMLComposer::~CMDXMLComposer() + { + Cancel(); + delete iEntityConverter; + delete iCharconv; + + iXMLFile.Close(); + } + +//================================================================================== + +void CMDXMLComposer::BaseConstructL() + { + iCharconv = CCnvCharacterSetConverter::NewL(); + iCharconv->SetDowngradeForExoticLineTerminatingCharacters( + CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed); + } + +//================================================================================== + +EXPORT_C CMDXMLComposer* CMDXMLComposer::NewL(MMDXMLComposerObserver* aComposerObserver) +// +// Two phase static factory function constructor +// @param aEntityStrings the string table which lists the entity references and conversion +// @return Created CMDXMLComposer +// @leave can Leave due to OOM +// + { + CMDXMLComposer* self = NewLC(aComposerObserver); + CleanupStack::Pop(self); + return self; + } + +//================================================================================== + +EXPORT_C CMDXMLComposer* CMDXMLComposer::NewL(MMDXMLComposerObserver* aComposerObserver, TBool aOutputProlog) +// +// Two phase static factory function constructor +// @param aEntityStrings the string table which lists the entity references and conversion +// @param aOutputProlog Whether the Doctype and Version tags should be output. This is +// provided for MMS conformance. +// @return Created CMDXMLComposer +// @leave can Leave due to OOM +// + { + CMDXMLComposer* self = NewLC(aComposerObserver, aOutputProlog); + CleanupStack::Pop(self); + return self; + } + +//================================================================================== + +EXPORT_C CMDXMLComposer* CMDXMLComposer::NewLC(MMDXMLComposerObserver* aComposerObserver) +// +// Two phase static factory function constructor +// @param aEntityStrings the string table which lists the entity references and conversion +// @return Created CMDXMLComposer +// @leave can Leave due to OOM +// + { + CMDXMLComposer* self = new (ELeave) CMDXMLComposer(aComposerObserver); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +//================================================================================== + +EXPORT_C CMDXMLComposer* CMDXMLComposer::NewLC(MMDXMLComposerObserver* aComposerObserver, TBool aOutputProlog) +// +// Two phase static factory function constructor +// @param aEntityStrings the string table which lists the entity references and conversion +// @param aOutputProlog Whether the Doctype and Version tags should be output. This is +// provided for MMS conformance. +// @return Created CMDXMLComposer +// @leave can Leave due to OOM +// + { + CMDXMLComposer* self = new (ELeave) CMDXMLComposer(aComposerObserver, aOutputProlog); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +//================================================================================== + +void CMDXMLComposer::ConstructL() +// +// Second stage constructor +// @param aEntityStrings the string table which lists the entity references and conversion +// + { + BaseConstructL(); + CMDXMLEntityConverter* entityConverter = new(ELeave) CMDXMLEntityConverter(); + SetEntityConverter(entityConverter); + } + + +//================================================================================== + +void CMDXMLComposer::InitialiseCompose(CMDXMLDocument* aDocument, TXMLFileType aFileType) + { + Cancel(); + + iError = KErrNone; + iSeverity = EXMLNone; + iOutputBuffer.Zero(); + + iXMLDoc = aDocument; + iFileType = aFileType; + + iOnlyCalculatingSize = EFalse; + iSizeTally = 0; + } + +EXPORT_C TInt CMDXMLComposer::ComposeFile(RFs aRFs, const TDesC& aFileToCompose, CMDXMLDocument* aDocument, TXMLFileType aFileType) +/** Starts file composition. + +This function can not be called if there is an outstanding size calculation or compose +operation in progress. If it is necessary to run two asynchronous operations in parallel +then two instances of the CMDXMLComposer are needed. + +@param aRFS File system to use +@param aFileToCompose Name of file to create +@param aDocument The document object to compose to the file +@return KERRNone if successful +**/ + { + InitialiseCompose(aDocument, aFileType); + iRFs = aRFs; + TInt error = KErrNone; + + if(iXMLDoc == NULL) + { + error = KErrNotSupported; + } + else + { + switch(iFileType) + { + case EAscii: + { + error = iXMLFile.Replace(aRFs, aFileToCompose, EFileWrite | EFileStream); + break; + } + case EUnicode: + error = iXMLFile.Replace(aRFs, aFileToCompose, EFileWrite | EFileStream); + if(error == KErrNone) + { + // append Unicode File identifier to start of output text + iOutputBuffer.Append(CEditableText::EByteOrderMark); + } + break; + case EUtf8: + { + error = iXMLFile.Replace(aRFs, aFileToCompose, EFileWrite | EFileStream); + break; + } + default: + error = KErrNotSupported; + break; + } + } + + if(error == KErrNone) + { + SetActive(); + TRequestStatus* s=&iStatus; + User::RequestComplete(s, KErrNone); + } + else + { + SetError(error, EXMLFatal); + } + + return error; + } + +/** Starts file composition to an open file handle. + +This function must not be called when file sizing is in progress. If it is necessary to calulate +the size and generate the XML simultaneously then two instances of the composer should be used, +one for sizing and one for composition. + +@param aFileHandleToCompose An open file handle to write to. Ownership of the file handle is passed even if an error occurs. +@param aDocument The document object to compose to the file. +@param aFileType Type of the output file. +@return KErrNone if successful. +*/ +EXPORT_C TInt CMDXMLComposer::ComposeFile(RFile& aFileHandleToCompose, CMDXMLDocument* aDocument, TXMLFileType aFileType) + { + InitialiseCompose(aDocument, aFileType); + iXMLFile = aFileHandleToCompose; + TInt error = KErrNone; + + if(iXMLDoc == NULL) + { + error = KErrNotSupported; + } + else + { + switch(iFileType) + { + case EUnicode: + { + // append Unicode File identifier to start of output text + iOutputBuffer.Append(CEditableText::EByteOrderMark); + } + case EAscii: + case EUtf8: + break; + + default: + error = KErrNotSupported; + break; + } + } + + if(error == KErrNone) + { + iStatus = KRequestPending; + SetActive(); + TRequestStatus* s=&iStatus; + User::RequestComplete(s, KErrNone); + } + else + { + iXMLFile.Close(); + SetError(error, EXMLFatal); + } + + return error; + } + +//================================================================================== + +/** Starts calculating the size of the XML output without actually writing it to the file. + +This process is asyncronous, the size value is only updated when ComposeFileComplete +is called on the MMDXMLComposerObserver passed in in the NewL. + +This function can not be called if there is an outstanding size calculation or compose +operation in progress. If it is necessary to run two asynchronous operations in parallel +then two instances of CMDXMLComposer are needed. + +@param aSize Will be set to the size of the XML document when composition has completed. +@param aDocument The document object to size +@param aFileType Type of the output file, required because it will affect the size of the XML +@return KErrNone if successful */ + +EXPORT_C TInt CMDXMLComposer::CalculateFileSize(TInt& aSize, CMDXMLDocument* aDocument, TXMLFileType aFileType) + { + Cancel(); + + iError = KErrNone; + iSeverity = EXMLNone; + iOutputBuffer.Zero(); + + iXMLDoc = aDocument; + iFileType = aFileType; + TInt error = KErrNone; + + if (iFileType == EUnicode) + { + // The size tally must be incremented by two characters because the unicode byte marker + // gets added in the ComposeFile function that does not get called when we are calculating + // the size. + iSizeTally = 2; + } + else + { + iSizeTally = 0; + } + + iSize = &aSize; + iOnlyCalculatingSize = ETrue; + + if(iXMLDoc == NULL) + { + error = KErrNotSupported; + } + + if(error == KErrNone) + { + SetActive(); + TRequestStatus* s=&iStatus; + User::RequestComplete(s, KErrNone); + } + else + { + SetError(error, EXMLFatal); + } + + return error; + } + +//================================================================================== + +EXPORT_C TInt CMDXMLComposer::Error() const + { + return iError; + } + +//================================================================================== + +EXPORT_C TXMLErrorCodeSeverity CMDXMLComposer::ErrorSeverity() const + { + return iSeverity; + } + +//================================================================================== + +EXPORT_C CMDXMLEntityConverter* CMDXMLComposer::EntityConverter() const + { + return iEntityConverter; + } + +//================================================================================== + +TInt CMDXMLComposer::OutputCommentL(const TDesC& aComment) +// +// Output a comment +// @param aComment the comment text to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KNewLine); + } + +#ifdef _DEBUG + for(TInt loopIndex = 0; loopIndex < iIndentationLevel; loopIndex++) + { + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KTab); + } + } +#endif + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLStartComment); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aComment); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLEndComment); + } + + return error; + } + +//================================================================================== + +TInt CMDXMLComposer::OutputProcessingInstructionL(const TDesC& aInstruction) +// +// Output a Processing Instruction +// @param aInstruction the Processing Instruction text to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KNewLine); + } + +#ifdef _DEBUG + for(TInt loopIndex = 0; loopIndex < iIndentationLevel; loopIndex++) + { + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KTab); + } + } +#endif + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLStartProcessingInstruction); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aInstruction); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLEndProcessingInstruction); + } + + return error; + } + + +//================================================================================== + +TInt CMDXMLComposer::OutputCDataSectionL(const TDesC& aCDataSection) +// +// Output a CDataSection +// @param aCDataSection the data section text to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + +#ifdef _DEBUG + for(TInt loopIndex = 0; loopIndex < iIndentationLevel; loopIndex++) + { + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KTab); + } + } +#endif + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLStartCDataSection); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aCDataSection); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLEndCDataSection); + } + + return error; + } + +//================================================================================== +//Defect fix for INC036136- Enable the use of custom entity converters in GMXML + +EXPORT_C TInt CMDXMLComposer::OutputDataL(const TDesC& aData) +// +// Output raw data +// it's only intended to be used from within a custom entity converter as +// it relies on a Composer sesssion already being in progress +// @param the data to be output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + + if(iSeverity != EXMLFatal) + { + if(aData.Find(KQuotation) != KErrNotFound) + { + error = ReplaceXmlCharactersL(aData, KQuotation); + } + else + { + error = WriteFileL(aData); + } + } + + return error; + } + +//================================================================================== +/* Before writing to xml file, search for special character like quotation ("). + if it exist then replace it with " and then write it to xml file. + Refer section 5 of below URL for more information. + http://www.xmlnews.org/docs/xml-basics.html + @param aXmlData the data to be output + @param aString the special character to search in aXmlData + @return KERRNone if successful, otherwise a file writing error. */ + +TInt CMDXMLComposer::ReplaceXmlCharactersL(const TDesC16& aXmlData, const TDesC& aString) + { + TInt xmlDataIndex; + const TDesC& quot = KXmlQuotation; + HBufC16* xmlData = aXmlData.AllocL(); + + while((xmlDataIndex = (xmlData->Des()).Find(aString)) != KErrNotFound) + { + HBufC16* temp = HBufC::NewLC(((xmlData->Des()).Length() - 1) + quot.Length()); + TPtr16 tempPtr = temp->Des(); + tempPtr.Append((xmlData->Des()).Left(xmlDataIndex)); + tempPtr.Append(quot); + tempPtr.Append((xmlData->Des()).Right((xmlData->Des()).Length() - (xmlDataIndex + 1))); + delete xmlData; + xmlData = NULL; + xmlData = tempPtr.AllocL(); + CleanupStack::PopAndDestroy(); // temp + } + TInt error = WriteFileL((xmlData->Des())); + delete xmlData; + xmlData = NULL; + return error; + } + +//================================================================================== + +EXPORT_C void CMDXMLComposer::SetEntityConverter(CMDXMLEntityConverter* aEntityConverter) +/* + * Sets the entity converter to be used + * and take ownership of the passed entity converter + * @param aEntityConverter The entity converter to be used + */ + { + delete iEntityConverter; + iEntityConverter = aEntityConverter; + } + +//End Defect fix for INC036136 +//================================================================================== + +EXPORT_C TInt CMDXMLComposer::OutputStartOfElementTagL(const TDesC& aElementName) +// +// Output a start of element tag +// @param aElementName the name of the tag to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + +#ifdef _DEBUG + for(TInt loopIndex = 0; loopIndex < iIndentationLevel; loopIndex++) + { + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KTab); + } + } + iIndentationLevel++; +#endif + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLStartTag); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aElementName); + } + + return error; + } + +//================================================================================== + +EXPORT_C TInt CMDXMLComposer::OutputEndOfElementTagL(const TBool aHasChildren) +// +// Output an end of element start tag +// @param aHasChildren true if the element has children +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + + if(iSeverity != EXMLFatal) + { + if(aHasChildren) + { + error = WriteFileL(KXMLEndTag); + } + else + { + error = WriteFileL(KXMLEndStartTag); + + #ifdef _DEBUG + iIndentationLevel--; + #endif + } + } + + return error; + } + +//================================================================================== + +TInt CMDXMLComposer::OutputEndTagL(const TDesC& aElementName) +// +// Output an end of element tag +// @param aElementName the name of the tag to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + +#ifdef _DEBUG + iIndentationLevel--; + for(TInt loopIndex = 0; loopIndex < iIndentationLevel; loopIndex++) + { + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KTab); + } + } +#endif + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLStartEndTag); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aElementName); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KXMLEndTag); + } + + return error; + } + + + + + +//================================================================================== + +EXPORT_C TInt CMDXMLComposer::OutputAttributeL(const TDesC& aAttributeName, const TDesC& aAttributeValue) +// +// Output an attribute - name and value. +// @param aAttributeName the name of the attribute to output +// @param aAttributeValue the text of the attribute value to output +// @return KERRNone if successful, otherwise a file writing error. +// + { + TInt error = KErrNone; + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KSingleSpace); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(aAttributeName); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KEqualSign); + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KQuotation); + } + + if(iSeverity != EXMLFatal) + { + // Work along the attribute value in sections. We have two markers in the attribute, + // one at the beginning of the section we're working on and one at the end. Initially + // beginSection is the start of the string, 0, the end of the section is the first + // CDataSection we find. + // beginSection is an offset within the string, endSection is an offset from that + TInt beginSection = 0; + TInt endSection = aAttributeValue.Find(KXMLStartCDataSection); + + // We've found at least one CDataSection + while(endSection != KErrNotFound) + { + // Entity convert this plain text section + TPtrC plainText = aAttributeValue.Mid(beginSection, endSection); + error = iEntityConverter->OutputComposedTextL(this, plainText); + + // Move on our markers. We start the new section at the end of the old one. + beginSection += endSection; + // The end of this section is the end of the CDataSection + endSection = TPtrC(aAttributeValue.Mid(beginSection)).Find(KXMLEndCDataSection); + if(endSection != KErrNotFound) + { + // The CDataSection ends at the beginning of the end tag, so we need to add + // on the length of the end tag before outputting it without conversion + endSection += TPtrC(KXMLEndCDataSection).Length(); + OutputDataL(aAttributeValue.Mid(beginSection, endSection)); + + // Now move on our markers again. Start at the end of the CDataSection, and + // continue to the beginning of the next one. + beginSection += endSection; + endSection = TPtrC(aAttributeValue.Mid(beginSection)).Find(KXMLStartCDataSection); + } + else + { + // There's an unterminated CDataSection in our attribute + error = KErrXMLBadAttributeValue; + } + } + + // There are no more CDataSections, entity convert the rest of the string + if(!error) + { + error = iEntityConverter->OutputComposedTextL(this, aAttributeValue.Mid(beginSection)); + } + } + + if(iSeverity != EXMLFatal) + { + error = WriteFileL(KQuotation); + } + + return error; + } + +//================================================================================== + +EXPORT_C TInt CMDXMLComposer::RunError(TInt aError) +// +// RunError function inherited from CActive base class - intercepts any Leave from +// the RunL() function, sets an appropriate errorcode and calls ComposeFileCompleteL +// + { + iSeverity = EXMLFatal; + iError = aError; + iXMLFile.Close(); + TRAPD(err, iComposerObserver->ComposeFileCompleteL()); + return err; + } + +//================================================================================== + +EXPORT_C void CMDXMLComposer::DoCancel() +// +// DoCancel function inherited from CActive base class +// + { + iXMLFile.Close(); + } + +//================================================================================== + +void CMDXMLComposer::RunL() +// +// RunL function inherited from CActive base class - does the actual composition +// @leave can Leave due to OOM +// + { + // If this is an ASCII file then check that we can load the character set converter + if(iSeverity != EXMLFatal) + { + if(iFileType == EAscii) + { + if (iCharconv->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, iRFs)!= + CCnvCharacterSetConverter::EAvailable) + { + SetError( KErrNotSupported, EXMLFatal); + } + } + } + + if(iSeverity != EXMLFatal) + { + #ifdef _DEBUG + iIndentationLevel = 0; + #endif + + CMDXMLElement* parentElement = iXMLDoc->DocumentElement(); + + TInt error = KErrNone; + + if(!parentElement->CheckChildren()) + { + error = KErrNotSupported; + SetError(KErrXMLInvalidChild, EXMLWorkable); + } + + if(iOutputProlog) + { + // Output document level information if required. MMS conformance requires no Version + // or DocType tag, so we may not want to output them. + if(iSeverity != EXMLFatal) + { + WriteFileL(iXMLDoc->VersionTag()); + } + if(iSeverity != EXMLFatal) + { + WriteFileL(KNewLine); + } + if(iSeverity != EXMLFatal) + { + WriteFileL(iXMLDoc->DocTypeTag()); + } + if(iSeverity != EXMLFatal) + { + WriteFileL(KNewLine); + } + } + + // Output the contents of the DOM tree + if(iSeverity != EXMLFatal) + { + error = ComposeL(); + if(iSeverity != EXMLFatal) + { + if(error != KErrNone) + { + SetError(error, EXMLIndeterminate); + } + + WriteFileL(KNewLine); + } + } + + if(iSeverity != EXMLFatal) + { + error = FlushOutputBufferL(); + + if(error != KErrNone) + { + SetError(error, EXMLIndeterminate); + } + } + } + + iXMLFile.Close(); + + if (iOnlyCalculatingSize) + { + *iSize = iSizeTally; + } + + iComposerObserver->ComposeFileCompleteL(); + } + + +TInt CMDXMLComposer::ComposeL() +// +// Function to output the contents of the node as XML to some output stream. +// @param aComposer The composer to use - provides access to output and entity conversion +// @return Returns KerrNone if successful or a file write error +// @leave Can Leave due to OOM. +// + { + CMDXMLNode* nextPtr; + TInt error = KErrNone; + nextPtr = iXMLDoc->DocumentElement()->FirstChild(); + + + while(error == KErrNone && nextPtr != NULL) + { + // compose the start tag of the current element + error = ComposeStartTagL(*nextPtr); + + if(error == KErrNone) + { + // move to the first child is there is one + if(nextPtr->FirstChild() != NULL) + { + nextPtr = nextPtr->FirstChild(); + } + else + { + // EndTag is only output if HasChildNodes() == TRUE + error = ComposeEndTagL(*nextPtr); + + // move to the next sibling if exists + if(nextPtr->NextSibling() != NULL) + { + nextPtr = nextPtr->NextSibling(); + } + + // no siblings, move back to parent and close parent tag + else + { + // might need to go up several layers so WHILE rather than IF + while(nextPtr != NULL && nextPtr->NextSibling() == NULL && error == KErrNone) + { + nextPtr = nextPtr->ParentNode(); + if(nextPtr != NULL) + { + error = ComposeEndTagL(*nextPtr); + } + } + + // if we've stopped at an element with further siblings + if(nextPtr != NULL && nextPtr->NextSibling() != NULL) + { + nextPtr = nextPtr->NextSibling(); + } + } + } + } + } + + return error; + } + + +EXPORT_C TInt CMDXMLComposer::ComposeStartTagL(CMDXMLNode& aNode) + // + // Outputs a start tag for the node which includes the + // tag name and all attribute name value pairs currently + // specified. If the node is an empty node then it + // makes the tag an empty node tag, otherwise it creates + // a start tag. + // @param aNode The Node for which the start tag is being written + // @return Returns KerrNone if successful or a file write error + // + { + TInt error = KErrNone; + + switch (aNode.NodeType()) + { + case CMDXMLNode::ETextNode: + error = iEntityConverter->OutputComposedTextL(this, ((CMDXMLText&)aNode).Data()); + break; + case CMDXMLNode::ECDATASectionNode: + error = OutputCDataSectionL(((CMDXMLCDATASection&)aNode).Data()); + // does nothing + break; + case CMDXMLNode::EProcessingInstructionNode: + error = OutputProcessingInstructionL(((CMDXMLProcessingInstruction&)aNode).Data()); + break; + case CMDXMLNode::ECommentNode: + error = OutputCommentL(((CMDXMLComment&)aNode).Data()); + break; + case CMDXMLNode::EDocumentNode: + // does nothing + break; + case CMDXMLNode::EElementNode: + error = OutputStartOfElementTagL(aNode.NodeName()); + TInt attIndex; + // Output all attributes in a loop + for(attIndex = 0 ; (error == KErrNone && attIndex < ((CMDXMLElement&)aNode).NumAttributes()); attIndex ++ ) + { + TPtrC attributeValue; + TPtrC attributeName; + error = ((CMDXMLElement&)aNode).AttributeDetails(attIndex, attributeName, attributeValue); + if(error == KErrNone) + error = OutputAttributeL(attributeName, attributeValue); + } + + + if( error == KErrNone ) + { + error = OutputEndOfElementTagL(aNode.HasChildNodes()); + } + break; + default: + // does nothing + break; + + + } + + return error; + } + +EXPORT_C TInt CMDXMLComposer::ComposeEndTagL(CMDXMLNode& aNode) +// +// Outputs an end tag for the node. +// @param aNode the node for which the tag is being written. +// @return Returns KerrNone if successful or a file write error +// + { + TInt error = KErrNone; + + if (aNode.NodeType() == CMDXMLNode::EElementNode && aNode.NodeName() != KXMLDocumentElementNodeName) + { + if(aNode.HasChildNodes()) + { + error = OutputEndTagL(aNode.NodeName()); + } + } + + + return error; + } + +//================================================================================== + +TInt CMDXMLComposer::WriteFileL(const TDesC& aStringToWrite) +// +// Function to write string to required file format - handles format conversion +// @param aStringToWrite the string to output +// @return returns KERRNone if successful or a file write error. +// + { + TInt error = KErrNone; + TInt outputBufferLength = iOutputBuffer.Length(); + TInt additionalLength = aStringToWrite.Length(); + + if(outputBufferLength + additionalLength <= KWriteBufferLen) + { + iOutputBuffer.Append(aStringToWrite); + } + else + { + iOutputBuffer.Append(aStringToWrite.Left(KWriteBufferLen - outputBufferLength)); + error = FlushOutputBufferL(); + iOutputBuffer.Zero(); + WriteFileL(aStringToWrite.Right(additionalLength - (KWriteBufferLen - outputBufferLength))); + } + + return error; + } + +//================================================================================== +#define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size())) + +TInt CMDXMLComposer::FlushOutputBufferL() +// +// Function to write string to required file format - handles format conversion +// @param aStringToWrite the string to output +// @return returns KERRNone if successful or a file write or conversion error. +// + { + TInt error = KErrNone; + + if (!iOnlyCalculatingSize) + { + if(iXMLFile.SubSessionHandle() == KNullHandle) + { + return KErrBadHandle; + } + } + + // All text is processed internally as unicode. If we've been asked to output + // another format (Ascii or Utf-8) we need to translate it to that format using + // charconv before writing the file. + switch(iFileType) + { + case EAscii: + case EUtf8: + { + // We need to convert in a loop as charconv only allows 25 untranslatable + // characters per block of text. convResult tells us how many characters + // were left untranslated at the end of iOutputBuffer so we only look at + // that many characters on the right hand of iOutputBuffer. Initially we + // don't have any characters translated so convResult is the length of + // iOutputBuffer. Each time through the loop write out the chunk we've + // converted. If there's an error writing the file or doing the character + // conversion we give up. + TInt convResult = iOutputBuffer.Length(); + while((convResult > 0) && (error == KErrNone)) + { + HBufC8* narrow = HBufC8::NewLC(convResult); + TPtr8 narrowPtr = narrow->Des(); + if(iFileType == EAscii) + { + convResult = iCharconv->ConvertFromUnicode(narrowPtr, iOutputBuffer.Right(convResult)); + } + else // iFileType == EUtf8 + { + convResult = CnvUtfConverter::ConvertFromUnicodeToUtf8(narrowPtr, iOutputBuffer.Right(convResult)); + } + + if(convResult >= 0) + { + iSizeTally += narrow->Size(); + + if (!iOnlyCalculatingSize) + { + error = iXMLFile.Write(narrow->Des()); + } + } + else + { + error = convResult; + } + CleanupStack::PopAndDestroy(narrow); + } + break; + } + + case EUnicode: + { + TPtrC output16 = iOutputBuffer; + TPtrC8 output = DES_AS_8_BIT(output16); + + iSizeTally += output.Size(); + + if (!iOnlyCalculatingSize) + { + error = iXMLFile.Write(output); + } + + break; + } + + default: + error = KErrNotSupported; + break; + } + + if(error != KErrNone) + { + SetError(error, EXMLFatal); + } + + return error; + } + +//================================================================================== + +EXPORT_C void CMDXMLComposer::SetError(const TInt aErrorCode, const TXMLErrorCodeSeverity aSeverity) +// +// Sets iError to new errorcode if more serious than any error so far encountered +// + { + if(iSeverity > aSeverity) + { + iSeverity = aSeverity; + iError = aErrorCode; + } + } + +EXPORT_C void CMDXMLComposer::PlaceholderForRemovedExport1(MMDXMLComposerObserver* /*aComposerObserver*/) + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +EXPORT_C void CMDXMLComposer::PlaceholderForRemovedExport2() + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +EXPORT_C void CMDXMLComposer::PlaceholderForRemovedExport3() + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +// End of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/SRC/GMXMLEntityConverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/SRC/GMXMLEntityConverter.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,293 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// MDXMLEntityConverter.cpp +// @file +// This class represents a generic entity converter for an XML parser or composer. +// +// + +#include +#include + +#include +#include +#include +#include "xmlentityreferences.h" + +const TInt KMaxBuiltinEntityLength = 20; + +// +// CMDXMLEntityConverter // +// + +EXPORT_C CMDXMLEntityConverter::CMDXMLEntityConverter() +// +// Constructor +// + { + } + +EXPORT_C CMDXMLEntityConverter::~CMDXMLEntityConverter() + { + } + +//================================================================================== + +TInt CMDXMLEntityConverter::EntityToTextL(TDes& aTextToConvert) +// +// Takes a block of text and converts any entity references found to the +// appropriate text. Because built-in and character entity references are +// longer than the replacement text, this takes place in-situ. +// @param aTextToConvert Text to be converted - replacement text goes +// out in the same +// + { + TInt error = KErrNone; + TInt beginEntityOffset = 0; + TInt beginSearchOffset = 0; + TPtrC searchPtr = TPtrC(aTextToConvert); + + // Need to convert all entity refs in this bit of data. Don't want to convert + // things more than once so we keep a marker and move it on so each time round + // the loop we start looking for entity references after the end of the previous + // one. + while((beginEntityOffset = searchPtr.Locate('&')) != KErrNotFound) + { + searchPtr.Set(aTextToConvert.Mid(beginSearchOffset + beginEntityOffset)); + TInt endEntityOffset = searchPtr.Locate(';'); + if(endEntityOffset == KErrNotFound) + { + // No point continuing past here - even if we find more & they can't be + // terminated either. + error = KErrXMLBadEntity; + break; + } + endEntityOffset += beginEntityOffset; + // Can't construct a modifiable descriptor that's just part of another one. Looks + // like we need to copy the section containing the reference and twiddle that, then + // copy the result back if it's valid. + HBufC* entityRef = searchPtr.Mid(0, (endEntityOffset - beginEntityOffset)+1).AllocLC(); + TInt convertErr = KErrNone; + TPtr entityRefDes = entityRef->Des(); + if((convertErr = ConvertEntityRefL(entityRefDes)) == KErrNotSupported) + { + convertErr = DTDEntityToText(entityRefDes); + } + + if(!convertErr) + { + // We need to replace this section of aTextToConvert with entityRefDes + // we don't know whether DTDEntityToText has actually changed anything - + // because of constraints on the published behaviour of DTDEntityToText we + // can't compel DTDEntityToText to return KErrUnsupported - it thinks it + // could be dealing with multiple entity refs and just cos it doesn't support + // one of them doesn't mean it doesn't support the rest. Probably true that + // the entity ref will be a builtin, so won't need to call DTDEntityToText + // anyway. ConvertEntityRefL will return KErrNone only if it converted so + // we probably won't be copying things gratuitously in the common case. + aTextToConvert.Replace(beginEntityOffset + beginSearchOffset, (endEntityOffset - beginEntityOffset)+1, entityRefDes); + } + else + { + error = KErrXMLBadEntity; + } + + beginSearchOffset += beginEntityOffset + entityRefDes.Length(); + searchPtr.Set(aTextToConvert.Mid(beginSearchOffset)); + CleanupStack::PopAndDestroy(entityRef); + } + + return error; + } + +//================================================================================== + +EXPORT_C TInt CMDXMLEntityConverter::OutputComposedTextL( CMDXMLComposer* aComposer, const TDesC& aTextToConvert) +// +// Outputs a block of text to a composer with offending characters replaced by +// entity references. +// @param aComposer the composer to be used for output +// @param aTextToConvert The text to be converted. +// @return Returns KErrNone if successful or a file write error +// @leave can Leave due to OOM +// + { + TBuf<1> oneChar; + TInt offset = 0; + TInt error = KErrNone; + TInt textLen = aTextToConvert.Length(); + + while(error == KErrNone && (offset < textLen)) + { + oneChar = aTextToConvert.Mid(offset, 1); + offset++; + + // Built in entities + RStringPool pool; + CleanupClosePushL(pool); + pool.OpenL(XMLEntityReferences::Table); + + + TBool found = EFalse; + for (TUint i=0; i buf; + buf.Copy(entity.DesC()); + TLex string(buf); + + TPtrC entityRef = string.NextToken(); + if(oneChar.Compare(string.NextToken()) == 0) + { + error = aComposer->OutputDataL(entityRef); + found = ETrue; + break; + } + + } + + CleanupStack::PopAndDestroy(); // close pool + + if(!found) + error = aComposer->OutputDataL(oneChar); + else + found = EFalse; + + } + + return error; + } + +//================================================================================== + +TInt CMDXMLEntityConverter::DTDEntityToText(TDes& /*aTextToConvert*/) +// +// DTD Specific entity to text converter +// Takes a block of text and converts any entity references found to the +// appropriate text. We hope that this can happen in-situ. +// @param aTextToConvert Text to be converted - replacement text goes +// out in the same +// + { // Nothing in the generic case. + return KErrNone; + } + +//================================================================================== + +TInt CMDXMLEntityConverter::ConvertEntityRefL(TDes& aTextToConvert) + { +#ifdef _DEBUG + _LIT(KEntityConverter, "GMXML Entity Converter"); + __ASSERT_ALWAYS(aTextToConvert.Length() > 1, User::Panic(KEntityConverter, KErrArgument)); +#endif + + TInt err = KErrNotSupported; + TBool charRef = EFalse; + TInt idLen = 0; + TRadix elementRadix = EDecimal; + + if(aTextToConvert.Find(KXMLHexidecimalId) != KErrNotFound) + { + charRef = ETrue; + idLen = TPtrC(KXMLHexidecimalId).Length(); + elementRadix = EHex; + } + else if(aTextToConvert.Find(KXMLDecimalId) != KErrNotFound) + { + charRef = ETrue; + idLen = TPtrC(KXMLDecimalId).Length(); + elementRadix = EDecimal; + } + + if(charRef) + { + // Character entities + /* + algorithm explanation: + The entity reference in the descriptor holding the string is known by it's positions. + offset = offset to beginning of '&#x' from start of supplied descriptor. (0 indicates start of descriptor) + entitylen = offset to ';' character from the start of the entity reference. + + the length of the entity preamble (&#x in this case) is known. + + The algorithm assigns the required portion of the descriptor to a TLex16 object so that the + value of the code can be read out. + + The math for the assign is as follows: + start of number = offset + length of preamble + num of characters to take = entityLen - length of preamble + + The entity is then deleted from the string, and the new code is inserted in the + correct location. + The deleted characters are 'entityLen' charcters from 'offset'. + + + e.g. for the string + + offset = 16 + entitylen = 5 + string assigned to lexer = '77' + code = 0x77 (extracted from lexer) + + descriptor after delete operation: + + + + array dereference fills in the descriptor such that the ampersand is replaced. + + */ + TInt entityLen = aTextToConvert.Length(); + + TLex16 element; + element.Assign(aTextToConvert.Mid(idLen, (entityLen - idLen))); + + TUint16 code; + err = element.Val(code, elementRadix); + + if(!err) + { + aTextToConvert.Delete(1, entityLen); + aTextToConvert[0] = code; + } + } + else + { + // Built in entities + RStringPool pool; + CleanupClosePushL(pool); + pool.OpenL(XMLEntityReferences::Table); + + + for (TUint i=0; (i buf; + buf.Copy(entity.DesC()); + TLex string(buf); + + TPtrC token = string.NextToken(); + TInt offset; + if((offset = aTextToConvert.Find(token)) != KErrNotFound) + { + aTextToConvert.Replace(offset, token.Length(), string.NextToken()); + err = KErrNone; + } + } + CleanupStack::PopAndDestroy(); //close pool + } + + return err; + } + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/SRC/GMXMLFileDataSource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/SRC/GMXMLFileDataSource.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,139 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file +// This file contains the definition of the CMDXMLParserFileDataSource class +// which is responsible for feeding the data source interface from a given XML file. +// The headers for this class exist in the XMLParser.h header file so that the old +// file-based interface can be implemented using the data source API without removing +// source compatibility for older code. +// +// + + +#include +#include +#include "GMXMLFileDataSource.h" + +CMDXMLParserFileDataSource *CMDXMLParserFileDataSource::NewLC(RFs aRFs, const TDesC& aFileToParse) + { + CMDXMLParserFileDataSource* self = new (ELeave) CMDXMLParserFileDataSource(); + CleanupStack::PushL(self); + self->ConstructL(aRFs, aFileToParse); + return self; + } + +CMDXMLParserFileDataSource *CMDXMLParserFileDataSource::NewL(RFs aRFs, const TDesC& aFileToParse) + { + CMDXMLParserFileDataSource *self = NewLC(aRFs, aFileToParse); + CleanupStack::Pop(); + return self; + } + +CMDXMLParserFileDataSource* CMDXMLParserFileDataSource::NewL(RFile& aFileHandleToParse) + { + CMDXMLParserFileDataSource* me = new(ELeave) CMDXMLParserFileDataSource(); + CleanupStack::PushL(me); + me->ConstructL(aFileHandleToParse); + CleanupStack::Pop(me); + return me; + } + +void CMDXMLParserFileDataSource::ConstructL(RFile& aFileHandleToParse) + { + // take ownership of file handle + iXMLFile = aFileHandleToParse; + + // Calculate size of file + TInt fileSize; + User::LeaveIfError(iXMLFile.Size(fileSize)); + + // make buffer + iXMLFileBuffer = HBufC8::NewL(fileSize); + TPtr8 tmpbuffer(iXMLFileBuffer->Des()); + + // read file into buffer + User::LeaveIfError(iXMLFile.Read(tmpbuffer, fileSize)); + iState = KInit; + + iXMLFile.Close(); + } + + +CMDXMLParserFileDataSource::~CMDXMLParserFileDataSource() + { + iXMLFile.Close(); + delete iXMLFileBuffer; + } + +CMDXMLParserFileDataSource::CMDXMLParserFileDataSource() : iState(KError), iXMLFileBuffer(0) + { + } + +void CMDXMLParserFileDataSource::ConstructL(RFs aRFs, const TDesC& aFileToParse) + { + User::LeaveIfError(iXMLFile.Open(aRFs, aFileToParse, EFileRead | EFileShareReadersOnly)); + + // Calculate size of file + TInt fileSize; + User::LeaveIfError(iXMLFile.Size(fileSize)); + + // make buffer + iXMLFileBuffer = HBufC8::NewLC(fileSize); + TPtr8 tmpbuffer(iXMLFileBuffer->Des()); + + // read file into buffer + User::LeaveIfError(iXMLFile.Read(tmpbuffer, fileSize)); + iState = KInit; + + iXMLFile.Close(); + + CleanupStack::Pop(); // memory buffer + } + +void CMDXMLParserFileDataSource::GetData(TPtrC8 &aPtr, TRequestStatus &aStatus) + { + TRequestStatus *s = &aStatus; + switch(iState) + { + case KInit: + aPtr.Set(iXMLFileBuffer->Des()); + iState = KDataSent; + User::RequestComplete(s, KMoreData); + break; + + case KDataSent: + delete iXMLFileBuffer; + iXMLFileBuffer = 0; + iState = KDone; + User::RequestComplete(s, KDataStreamEnd); + break; + + case KDone: + User::RequestComplete(s, KDataStreamEnd); + break; + + default: + User::RequestComplete(s, KDataStreamError); + break; + }; + } + +void CMDXMLParserFileDataSource::Disconnect() + { + delete iXMLFileBuffer; + iXMLFileBuffer = 0; + iState = KDone; + } + +// End of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/SRC/GMXMLParser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/SRC/GMXMLParser.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1962 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file +// This file contains the definition of the generic CMDXMLParser class +// which is responsible for creating a DOM structure +// from a given XML file. +// +// + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GMXMLFileDataSource.h" +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "gmxmldummydtd.h" +#endif + +const TInt KGMXMLDefaultTextBufferSize = 1024; +const TInt KUTF8EdgeBufferLen = 6; + +// +// Global functions // +// + + +//================================================================================== + +// +//CMDXParser // +// +//================================================================================== + +void CMDXMLParser::Panic(TPanicCode aReason) const + { + _LIT(KClassName, "CMDXMLParser"); + User::Panic(KClassName, aReason); + } + +EXPORT_C CMDXMLParser* CMDXMLParser::NewL(MMDXMLParserObserver* aParserObserver) +// +// Two phase static factory function constructor +// @return Created CMDXMLParser +// @leave can Leave due to OOM +// + { + CMDXMLParser* self = NewLC(aParserObserver); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CMDXMLParser* CMDXMLParser::NewL(MMDXMLParserObserver* aParserObserver, MXMLDtd* aDtdRepresentation) +// +// Two phase static factory function constructor +// @return Created CMDXMLParser +// @param aDtdRepresentation specid DTD represention class to be used for validation +// @leave can Leave due to OOM +// + { + CMDXMLParser* self = NewLC(aParserObserver, aDtdRepresentation); + CleanupStack::Pop(); + return self; + } + + +//================================================================================== + +EXPORT_C CMDXMLParser* CMDXMLParser::NewLC(MMDXMLParserObserver* aParserObserver) +// +// Two phase static factory function constructor +// @return Created CMDXMLParser +// @leave can Leave due to OOM +// + { + CMDXMLParser* self = new (ELeave) CMDXMLParser(aParserObserver); + CleanupStack::PushL(self); + // This overload of NewLC doesn't take a MXMLDtd*, but we need to provide one to + // ConstructL where ownership is taken if we do have one. Just pass NULL. + self->ConstructL(NULL); + return self; + } + +EXPORT_C CMDXMLParser* CMDXMLParser::NewLC(MMDXMLParserObserver* aParserObserver, MXMLDtd* aDtdRepresentation) +// +// Two phase static factory function constructor +// @return Created CMDXMLParser +// @param aDtdRepresentation specid DTD represention class to be used for validation +// @leave can Leave due to OOM +// + { + CMDXMLParser* self = new (ELeave) CMDXMLParser(aParserObserver); + CleanupStack::PushL(self); + self->ConstructL(aDtdRepresentation); + return self; + } + + +//================================================================================== + +void CMDXMLParser::ConstructL(MXMLDtd* aDtdRepresentation) +// +// Second stage constructor +// @param aDtdRepresentation The DTD to be used for validation +// @leave can Leave due to OOM +// + { + CMDXMLEntityConverter* entityConverter = new(ELeave) CMDXMLEntityConverter(); + SetEntityConverter(entityConverter); + + // This doesn't leave, but if CMDXMLParser::NewLC() Leaves after taking ownership + // of this we'll get a double deletion as the caller will have pushed + // aDtdRepresentation onto the CleanupStack. As such we can only take ownership + // once we are sure we aren't going to leave. + iDtdRepresentation = aDtdRepresentation; + } + +CMDXMLParser::CMDXMLParser(MMDXMLParserObserver* aParserObserver) + : CActive(EPriorityNormal) +// +// Constructor +// + { + iParserObserver = aParserObserver; + iStoreInvalid = ETrue; + CActiveScheduler::Add(this); + } + +//================================================================================== + +EXPORT_C CMDXMLParser::~CMDXMLParser() + { + Cancel(); + delete iBomBuffer; + if( iFileSource == NULL ) + { + // iFileSource has not been allocated yet, so the file path or file + // handle are still owned + if( iFileToParse!=NULL ) + delete iFileToParse; + else + iFileHandleToParse.Close(); + } + else + { + delete iFileSource; + } + delete iUTF8EdgeBuffer; + delete iXMLDoc; + delete iEntityConverter; + delete iElementTag; + delete iDtdRepresentation; + delete iText; + } + +//================================================================================== +//Defect fix for INC036136- Enable the use of custom entity converters in GMXML +EXPORT_C void CMDXMLParser::SetEntityConverter(CMDXMLEntityConverter* aEntityConverter) +/* + * Sets the entity converter to be used + * and take ownership of the passed entity converter + * @param aEntityConverter The entity converter to be used + */ + { + delete iEntityConverter; + iEntityConverter = aEntityConverter; + } +//End Defect fix for INC036136 +//================================================================================== + +EXPORT_C void CMDXMLParser::SetStoreInvalid(TBool aStoreInvalid) + { + iStoreInvalid = aStoreInvalid; + } + +//================================================================================== +// Defect fix for INC105134 - GmXML consumes whitespace characters +//================================================================================== +EXPORT_C void CMDXMLParser::SetWhiteSpaceHandlingMode(TBool aPreserve) + { + iPreserve = aPreserve; + } + +// End Defect fix for INC105134 +//================================================================================== +EXPORT_C CMDXMLDocument* CMDXMLParser::DetachXMLDoc() +// +// @return CMDXMLDocument* to the created DOM, should be called after the +// conclusion of the parser process. Note that internal variable pointing to +// the document is set to NULL so this function can only be called once per file +// parse. Client application must take ownership of document for cleanup purposes. +// + { + CMDXMLDocument* returnDoc = iXMLDoc; + iXMLDoc = NULL; + return returnDoc; + } + +//================================================================================== + +CMDXMLEntityConverter* CMDXMLParser::EntityConverter() +// +// @return the CMDXMLEntityConverter for use in converting built in entity +// and character entities back to their original format +// + { + return iEntityConverter; + } + +//================================================================================== + +EXPORT_C TInt CMDXMLParser::ParseFile(RFs aRFs, const TDesC& aFileToParse) +// +// ParseFile opens a file ready for parsing +// @param aRFs a resource file session used for file I/O +// @param aFileToParse the file name to parse +// @return KErrNone if all OK or file read error code +// + { + //Find out whether the file exists. If not dont start the active object + if(!BaflUtils::FileExists(aRFs,aFileToParse)) + { + return KErrNotFound; + } + else + { + //Check whether the file is locked by any other process + RFile tempFile; + TInt err=tempFile.Open(aRFs, aFileToParse, EFileRead | EFileShareReadersOnly); + if(err!=KErrNone) + { + return err; + } + tempFile.Close(); + } + Cancel(); + iSuspiciousCharacter = KErrNotFound; + iError = KErrNone; + iSeverity = EXMLNone; + iDocTypeSet = EFalse; + iVersionSet = EFalse; + + /* We need to open our file in a leave-safe place as it involves + a heap alloc, and so we'll set up the AO to do that when it runs next. + */ + delete iFileToParse; + iFileToParse = aFileToParse.Alloc(); + if(iFileToParse == NULL) + { + return KErrNoMemory; + } + + iRFs = aRFs; + iState = KInitFromFile; + + SetActive(); + TRequestStatus* s=&iStatus; + User::RequestComplete(s, KErrNone); + + return KErrNone; + } + +/** +Parses a specified XML file into a DOM object tree. + +Parses a specified XML file into a DOM object tree using an open file handle. The +parser takes ownership of the open file handle and will close handle when completed. + +@param aFileHandleToParse An open file handle for the file to parse. Ownership of the + file handle is passed. +@return KErrNone if successful. +*/ +EXPORT_C TInt CMDXMLParser::ParseFile(RFile& aFileHandleToParse) + { + iFileHandleToParse = aFileHandleToParse; + + Cancel(); + iSuspiciousCharacter = KErrNotFound; + iError = KErrNone; + iSeverity = EXMLNone; + iDocTypeSet = EFalse; + iVersionSet = EFalse; + + iState = KInitFromFile; + + iStatus = KRequestPending; + SetActive(); + TRequestStatus* s=&iStatus; + User::RequestComplete(s, KErrNone); + + return KErrNone; + } +//================================================================================== + +EXPORT_C void CMDXMLParser::ParseSourceL(MMDXMLParserDataProvider *aSource) + { + iSuspiciousCharacter = KErrNotFound; + iError = KErrNone; + iSeverity = EXMLNone; + iDocTypeSet = EFalse; + iVersionSet = EFalse; + + iDataSource = aSource; + PrepareForReuseL(); + GetMoreData(); + } + +//================================================================================== + +void CMDXMLParser::PrepareForReuseL() + { + Cancel(); + + iError = KErrNone; + iSeverity = EXMLNone; + iDocTypeSet = EFalse; + iVersionSet = EFalse; + iBytesPerChar = 0; + iNextChar = 0; + iInputBytesRemaining = 0; + iOpened = EFalse; + iClosed = EFalse; + iNewElement = NULL; + iParentElement = NULL; + delete iUTF8EdgeBuffer; + iUTF8EdgeBuffer = NULL; + delete iBomBuffer; + iBomBuffer = NULL; + + CreateDocumentL(); + iState = KDetermineCharset; + } + +//================================================================================== +TBool CMDXMLParser::DetectFileType() +// +// Detects the type of a data source - can be Unicode, UTF-8 or ASCII (because ASCII is +// a subset of UTF-8). +// If the file is empty it is assumed to be Utf-8. + { + TBuf8<3> bom; + + // Read the first 3 bytes of the file. These contain any BOM present. If it turns out + // there's not a bom we leave the pointer untouched so we can parse these bytes + // as usual. + if(iInputBufferPtr.Length() < 3) + return EFalse; + else + bom.Copy(iInputBufferPtr.Left(3)); + + TInt hichar = (CEditableText::EByteOrderMark & 0xFF00)>>8; + TInt lochar = CEditableText::EByteOrderMark & 0xFF; + + if((bom[0] == 0xEF) && (bom[1] == 0xBB) && (bom[2] == 0xBF)) + { + // Utf-8 with a bom. We don't want to parse the bom, so add 3 bytes offset to the read pos. + iBytesPerChar = 1; + iNextChar = 3; + } + else + { + if((bom[0] == lochar) && (bom[1] == hichar)) + { + // Little Endian Unicode. Move the read position on 2 bytes to ignore the bom. + iBytesPerChar = 2; + // would normally skip first 2 characters + iNextChar = 2; + } + else if((bom[0] == hichar) && (bom[1] == lochar)) + { + // We have a bom, but it indicates endianess opposite to that of the platform. We + // don't currently support this so set an error. + SetError(KErrNotSupported, EXMLFatal); + } + else + { + // Default to Utf-8 + iBytesPerChar = 1; + } + } + return ETrue; + } + +//================================================================================== + +EXPORT_C void CMDXMLParser::DoCancel() +// +// DoCancel function inherited from CActive base class +// + { + if (iDataSource) + { + iDataSource->Disconnect(); + iDataSource = NULL; + } + } + +//================================================================================== + +EXPORT_C TInt CMDXMLParser::RunError(TInt aError) +// +// RunError function inherited from CActive base class - intercepts any Leave from +// the RunL() function, sets an appropriate errorcode and calls ParseFileCompleteL +// + { + if(iDataSource) + { + iDataSource->Disconnect(); + iDataSource = NULL; + } + + iSeverity = EXMLFatal; + iError = aError; + if (iFileToParse) + { + delete iFileToParse; + iFileToParse = NULL; + } + else if( iFileSource==NULL ) + { + // iFileSource is not set so the ownership of the file handle has not been passed + iFileHandleToParse.Close(); + } + + __ASSERT_DEBUG(iParserObserver != NULL, Panic(ENullMemVarParserObserver)); + TRAPD(err, iParserObserver->ParseFileCompleteL()); + return err; + } + +//================================================================================== + +TBool CMDXMLParser::DoParseLoopL() +// +// RunL function inherited from CActive base class - carries out the actual parsing. +// @leave can Leave due to OOM +// + { + TBuf<1> singleChar; + TGetCharReturn getCharReturn = KError; + TInt error; + + while(iSeverity != EXMLFatal && (getCharReturn = GetChar(singleChar), getCharReturn == KCharReturned) ) + { + +#if 0 // THIS NEEDS TO BE REMOVED - IT'S A VERY HANDY DEBUGGING TOOL WHEN YOU'RE MANUALLY DOING + // BYTE ORDERING ON MISALIGNED STREAMS THOUGH... + { +#define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size())) + + RFs aRFs; + RFile aFile; + _LIT(KFileName, "c:\\documents\\SMIL_Test_Files\\echoOutput.txt"); + TPtrC file; + TInt err; + + file.Set(KFileName); + + aRFs.Connect(); + + err = aFile.Open(aRFs, file, EFileWrite); + if(err != KErrNone) + err = aFile.Create(aRFs, file, EFileWrite); + + err = 0; + aFile.Seek(ESeekEnd, err); + aFile.Write(DES_AS_8_BIT(singleChar)); + aFile.Close(); + aRFs.Close(); + } +#endif + if((!iOpened) && singleChar != KXMLStartTag) + { + HandleTextL(singleChar); + } + + if((iOpened) || (singleChar == KXMLStartTag)) + { + if(singleChar == KXMLStartTag) + { + if(iOpened) + { + if((iSuspiciousCharacter == KErrNotFound)) + { + iSuspiciousCharacter = iElementTag->Length(); + } + } + else + { + AddTextL(iParentElement); + iOpened = ETrue; + } + } + else if(singleChar == KXMLEndTag) + { + if(iSuspiciousCharacter != KErrNotFound) + { + TPtrC suspiciousSection = iElementTag->Mid(iSuspiciousCharacter); + if( CheckForStartCData(suspiciousSection) == 0 ) + { + TInt endCDataLen = TPtrC(KXMLEndCDataSection).Length(); + // The suspicious character begins a CDataSection. Check if + // this End Tag is closing it. + if( suspiciousSection.Right(endCDataLen - 1) + == TPtrC(KXMLEndCDataSection).Left(endCDataLen - 1) ) + { + // Any dodgy characters began the CDataSection or were in it + iSuspiciousCharacter = KErrNotFound; + } + } + else if( suspiciousSection.Find(KXMLStartComment) == 0 ) + { + // The suspicious character begins a comment. Check if + // this End Tag is closing it. + TInt endCommentLen = TPtrC(KXMLEndComment).Length(); + if( suspiciousSection.Right(endCommentLen - 1) + == TPtrC(KXMLEndComment).Left(endCommentLen - 1) ) + { + // Any dodgy characters began the comment or were in it + iSuspiciousCharacter = KErrNotFound; + } + } + else if((CheckForStartCData(*iElementTag) == 0) || (iElementTag->Find(KXMLStartComment) == 0)) + { + // this tag is a CDataSection or comment, we're allowed < + iSuspiciousCharacter = KErrNotFound; + iClosed = ETrue; + } + else + { + // The < was spurious, set an error and close the tag as normal + SetError(KErrXMLIllegalCharacter, EXMLWorkable); + iClosed = ETrue; + iSuspiciousCharacter = KErrNotFound; + } + } + else + { + iClosed = ETrue; + } + } + + // ensure descriptor doesn't overflow end and panics + if(iElementTag->Length() == iElementTag->Des().MaxLength()) + { + iElementTag = iElementTag->ReAllocL(iElementTag->Length() + KNominalTagLength); + } + + iElementTag->Des().Append(singleChar); + + // if tag is complete and needs adding to the DOM? + if(iClosed) + { + if( !CommentL(iParentElement) + && !CDataSectionL(iParentElement) + && !VersionIDL() + && !DocTypeL() + && !ProcessingInstructionL(iParentElement) ) + { + // is this a regular closing tag + if + (iElementTag->Left(2) == KXMLStartEndTag) + { + error = ParseElementEndTag(*iParentElement, iElementTag->Des()); + if(error == KErrNone) + { + if(iParentElement->ParentNode() == NULL) + { + SetError(KErrXMLBadNesting, EXMLIndeterminate); + } + else + { + iParentElement = (CMDXMLElement*) iParentElement->ParentNode(); + } + } + else if(error == KErrNotFound) + { + CMDXMLElement* tempElement = (CMDXMLElement*) iParentElement->ParentNode(); + TInt searchResult = KErrNotFound; + + while(tempElement != NULL && + searchResult == KErrNotFound && + tempElement->NodeName() != KXMLDocumentElementNodeName) + { + searchResult = ParseElementEndTag(*tempElement,iElementTag->Des()); + if(searchResult == KErrNone) + { + iParentElement = tempElement; + SetError(KErrXMLBadNesting, EXMLIndeterminate); + } + else + { + tempElement = (CMDXMLElement*) tempElement->ParentNode(); + } + } + if(searchResult != KErrNone) + { + SetError(KErrXMLBadNesting, EXMLIndeterminate); + } + } + else + { + SetError(error, EXMLIndeterminate); + } + } + // if a new element start tag or start/end tag + else + { + // NOTE ParseStartTagL destroys iElementTag + // so following check must be done first + + // if not single tag with close + if(!(iElementTag->Right(2) == KXMLEndStartTag)) + { + iNewElement = ParseStartTagL(); + CleanupStack::PushL(iNewElement); + error = iParentElement->AppendChild(iNewElement); + + if(error == KErrNone) + { + CleanupStack::Pop(); // iNewElement + iParentElement = (CMDXMLElement*) iParentElement->LastChild(); + } + else + { + SetError(error, EXMLWorkable); + CleanupStack::PopAndDestroy(iNewElement); // iNewElement + } + } + else + { + iNewElement = ParseStartTagL(); + CleanupStack::PushL(iNewElement); + error = iParentElement->AppendChild(iNewElement); + + if(error == KErrNone) + { + CleanupStack::Pop(iNewElement); // iNewElement + } + else + { + SetError(error, EXMLWorkable); + CleanupStack::PopAndDestroy(iNewElement); // iNewElement + } + } + } + iEndOfTag = ETrue; + } + + if(iEndOfTag) + { + iEndOfTag = EFalse; + iOpened = iClosed = EFalse; + iElementTag->Des().Zero(); + + // reduce size of ElementTag if increased beyond normal limits on last pass + if(iElementTag->Des().MaxLength() > KNominalTagLength) + { + iElementTag = iElementTag->ReAllocL(KNominalTagLength); + } + } + } + } + } // END OF WHILE LOOP + + if(getCharReturn == KError) + { + return EFalse; + } + else + { + // GetChar returned KWEaitForChar + // GetChar handles pushing the state and requesting more data for us, so we just go active. + return ETrue; + } + } + + + + +//================================================================================== + +void CMDXMLParser::RunL() + { + TRequestStatus* s=&iStatus; + TInt err = s->Int(); + + switch(iState) + { + case KInitFromFile: + delete iFileSource; + iFileSource = NULL; + if( iFileToParse == NULL ) + { + // iFileToParse is not set, file was passed by open file handle. + iFileSource = CMDXMLParserFileDataSource::NewL(iFileHandleToParse); + } + else + { + iFileSource = CMDXMLParserFileDataSource::NewL(iRFs, *iFileToParse); + + delete iFileToParse; + iFileToParse = NULL; + } + + ParseSource(iFileSource); // will go active itself + break; + + case KDetermineCharset: + if(!iBytesPerChar) + { + if(DetectFileType()) + { + iState = KParseData; + SetActive(); + User::RequestComplete(s, KErrNone); + } + else + { + if(!iBomBuffer) + { + iBomBuffer = HBufC8::NewL(KUTF8EdgeBufferLen); + } + + TPtr8 bomDes(iBomBuffer->Des()); + TInt newLength = bomDes.Length() + iCurrentInputBufferLen; + iBomBuffer->ReAlloc(newLength); + + bomDes.Append(iInputBufferPtr); + if(iBomBuffer->Length() >=3) + { + iInputBufferPtr.Set(bomDes); + iCurrentInputBufferLen = newLength; + + SetActive(); + User::RequestComplete(s, KErrNone); + } + else + { + GetMoreData(); + } + } + } + else + { + iState = KParseData; + SetActive(); + User::RequestComplete(s, KErrNone); + } + break; + + case KWaitingForData: + switch(err) + { + case MMDXMLParserDataProvider::KMoreData: + // We got more data this time, make sure all the parameters are correct. + iCurrentInputBufferLen = iInputBufferPtr.Length(); + + iState = iPreviousState; + SetActive(); + User::RequestComplete(s, KErrNone); + break; + + case MMDXMLParserDataProvider::KDataStreamEnd: + iState = KFinished; + SetActive(); + User::RequestComplete(s, KErrNone); + break; + + default: + case MMDXMLParserDataProvider::KDataStreamError: + User::Leave(KErrCorrupt); + break; + } + + break; + + case KParseData: + if(!iParentElement) // initialise the parsing + { + iOpened = EFalse; + iClosed = EFalse; + // If we're going through the tag and find a < we don't know whether + // it will be valid (eg it starts a CDataSection) or whether it's an + // illegal character. Store its index so that when we're a bit further + // along in the string we can check whether it was allowed and if not + // set an Illegal Character error. + delete iNewElement; + iNewElement = NULL; + + __ASSERT_DEBUG(iXMLDoc != NULL, Panic(ENullMemVarXMLDoc)); + iParentElement = iXMLDoc->DocumentElement(); + + delete iElementTag; + iElementTag = NULL; + iElementTag = HBufC::NewL(KNominalTagLength); + } + + if(!iBytesPerChar) + { + // assume ascii/UTF8 + iBytesPerChar = 1; + } + + if(!DoParseLoopL()) + iState = KFinished; + + break; + + case KFinished: + // Check for any errors that we can pick up now, like missing doctype, or incomplete content + CheckForErrors(); + + // we want to leave this instance in a safe state where it can be restarted again with a single call to ParseSource. + // cannot delete this element, as it belongs to the document... + iParentElement = NULL; + iState = KDetermineCharset; + + iDataSource->Disconnect(); + iDataSource=NULL; + __ASSERT_DEBUG(iParserObserver != NULL, Panic(ENullMemVarParserObserver)); + iParserObserver->ParseFileCompleteL(); + break; + + default: + User::Leave(KErrUnknown); + break; + } + } + +void CMDXMLParser::CheckForErrors() + { + if(iError == KErrNone) + { + if(iParentElement) + { + // if iParentElement is not pointing to dummy root node, there has been a problem + if( (iParentElement == NULL) || (iParentElement->NodeName() != KXMLDocumentElementNodeName) ) + { + SetError(KErrXMLIncomplete, EXMLWorkable); + } + else if(!iParentElement->CheckChildren()) + { + SetError(KErrXMLInvalidChild, EXMLWorkable); + } + else if(iParentElement->FirstChild() != NULL) + { + // multiple real (not dummy) root elements + TInt count = 0; + CMDXMLNode* iterator = iParentElement->FirstChild(); + do + { + if(iterator->NodeType() == CMDXMLNode::EElementNode) + { + count++; + } + iterator = iterator->NextSibling(); + } + while(iterator != NULL); + + if(count != 1) + { + SetError(KErrXMLMultipleRootElements, EXMLWorkable); + } + } + } + } + if(iError == KErrNone && !iDocTypeSet) + { + SetError(KErrXMLMissingDocTypeTag, EXMLWorkable); + } + + if(iError == KErrNone && !iVersionSet) + { + SetError(KErrXMLMissingVersionTag, EXMLWorkable); + } + } + + +void CMDXMLParser::CreateDocumentL() +// +// Creates a generic or DTD-specific document object +// @leave can Leave due to OOM +// + { + delete iXMLDoc; + iXMLDoc = NULL; + + if (iDtdRepresentation != NULL) + iXMLDoc = CMDXMLDocument::NewL(*iDtdRepresentation); + else + iXMLDoc = CMDXMLDocument::NewL(); + } + + +//================================================================================== + +TBool CMDXMLParser::DocTypeL() +// +// @return Returns true if the current tag is a doctype tag and sets the +// Document DocType member accordingly on the first pass of this function. +// + { + TBool returnValue = EFalse; + TInt tagIdLen = TPtrC(KXMLDocumentTypes).Length(); + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + if(iElementTag->Length() > tagIdLen + && iElementTag->Left(tagIdLen) == KXMLDocumentTypes) + { + if(iDocTypeSet) + { + SetError(KErrXMLDuplicateDocTypeTags, EXMLWorkable); + } + else + { + iXMLDoc->SetDocTypeTagL(iElementTag->Des()); + iDocTypeSet = ETrue; + } + returnValue = ETrue; + iEndOfTag = ETrue; + } + + return returnValue; + } + +//================================================================================== + +TBool CMDXMLParser::ProcessingInstructionL(CMDXMLElement* aParentElement) +// +// creates a new processing instruction if necessary and adds to document +// @return Returns true if the current tag is a processing instruction +// + { + TBool returnValue = EFalse; + TInt startPILen = TPtrC(KXMLStartProcessingInstruction).Length(); + TInt endPILen = TPtrC(KXMLEndProcessingInstruction).Length(); + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + if((iElementTag->Left(startPILen) == KXMLStartProcessingInstruction) && + (iElementTag->Right(endPILen) == KXMLEndProcessingInstruction)) + { + if(aParentElement != NULL) + { + CMDXMLProcessingInstruction* inst = CMDXMLProcessingInstruction::NewLC(iXMLDoc); + + TPtrC instStr = iElementTag->Des().Mid(startPILen, + iElementTag->Length() - (startPILen + endPILen)); + inst->SetDataL(instStr); + + __ASSERT_DEBUG(aParentElement != NULL, Panic(ENullParameterParentElement)); + TInt error = aParentElement->AppendChild(inst); + CleanupStack::Pop(inst); + + if(error != KErrNone) + { + SetError(error, EXMLWorkable); + } + } + + returnValue = ETrue; + iEndOfTag = ETrue; + } + + return returnValue; + } + + +//================================================================================== + +TBool CMDXMLParser::CDataSectionL(CMDXMLElement* aParentElement) +// +// creates a new CDataSection if necessary and adds to document +// @return Returns true if the current tag is a CDataSection +// + { + TBool returnValue = EFalse; + TInt instLen = TPtrC(KXMLStartCDataSection).Length(); + TInt endCDataLen = TPtrC(KXMLEndCDataSection).Length(); + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + if (iElementTag->Left(instLen) == KXMLStartCDataSection) + { + returnValue = ETrue; + if ((iElementTag->Right(endCDataLen) == KXMLEndCDataSection) && (aParentElement != NULL)) + { + CMDXMLCDATASection* inst = CMDXMLCDATASection::NewLC(iXMLDoc); + + TPtrC instStr = iElementTag->Des().Mid(instLen, + iElementTag->Length() - (instLen + endCDataLen)); + inst->SetDataL(instStr); + + __ASSERT_DEBUG(aParentElement != NULL, Panic(ENullParameterParentElement)); + TInt error = aParentElement->AppendChild(inst); + CleanupStack::Pop(); // inst + + if(error != KErrNone) + { + SetError(error, EXMLWorkable); + } + } + iEndOfTag = ETrue; + } + + return returnValue; + } + + +//================================================================================== + +TBool CMDXMLParser::VersionIDL() +// +// @return returns true if the current tag is a version id tag and sets the +// Document Version member accordingly on the first pass of this function. +// + { + TBool returnValue = EFalse; + TInt tagIdLen = TPtrC(KXMLVersion).Length(); + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + if(iElementTag->Length() > tagIdLen + && iElementTag->Left(tagIdLen) == KXMLVersion) + { + if(iVersionSet) + { + SetError(KErrXMLDuplicateVersionTags, EXMLWorkable); + } + else + { + iXMLDoc->SetVersionTagL(iElementTag->Des()); + iVersionSet = ETrue; + } + returnValue = ETrue; + iEndOfTag = ETrue; + } + + return returnValue; + } + +//================================================================================== + +TBool CMDXMLParser::CommentL(CMDXMLElement* aParentElement) +// +// creates a new comment if necessary and adds to document +// @return returns true if the current tag is a comment tag +// + { + TBool returnValue = EFalse; + TInt commentLen = TPtrC(KXMLStartComment).Length(); + TInt endCommentLen = TPtrC(KXMLEndComment).Length(); + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + if (iElementTag->Left(commentLen) == KXMLStartComment) + { + returnValue = ETrue; + if ((aParentElement != NULL) && (iElementTag->Right(endCommentLen) == KXMLEndComment)) + { + CMDXMLComment* comment = CMDXMLComment::NewLC(iXMLDoc); + + TPtrC commentStr = iElementTag->Des().Mid(commentLen, + iElementTag->Length() - (commentLen + endCommentLen)); + comment->SetDataL(commentStr); + + __ASSERT_DEBUG(aParentElement != NULL, Panic(ENullParameterParentElement)); + TInt error = aParentElement->AppendChild(comment); + CleanupStack::Pop(); // comment + + if(error != KErrNone) + { + SetError(error, EXMLWorkable); + } + iEndOfTag = ETrue; + } + } + + return returnValue; + } + +//================================================================================== + +EXPORT_C void CMDXMLParser::SetSourceCharacterWidth(TMDXMLParserInputCharWidth aWidth) + { + iBytesPerChar = aWidth; + } + +//================================================================================== + +void CMDXMLParser::GetMoreData() + { + + // Prepare these variables. + iNextChar = 0; // reading from the start of the buffer + iCurrentInputBufferLen = 0; // we have no characters in the buffer + iUnicodeConversion.Zero(); // we have no characters in our UTF8->Unicode Conversion buffer. + iUnicodeConversionLen = 0; + iUnicodeReadPos = 0; + + // Request more data from the data provider + __ASSERT_DEBUG(iDataSource != NULL, Panic(ENullMemVarDataSource)); + iDataSource->GetData(iInputBufferPtr, iStatus); + SetActive(); + iPreviousState = iState; + iState = KWaitingForData; + } + +//================================================================================== + +CMDXMLParser::TGetCharReturn CMDXMLParser::GetDoubleByteChar(TDes& aChar) + // when inputing we have a pointer to an 8 bit buffer (iInputBufferPtr), for unicode + // input we point a 16 bit descriptor (tempUnicodeInput) at the 8 bit buffer to + // enable us to read the 2 x 8 bit chars as a single 16 bit char. + // However it isn't always this simple as the data provider interface makes no guarantees + // on the alignment of this data. It's perfectly possible for it to end up with a unicode + // character where the high byte comes from the previous buffer and the low byte comes from + // the current one. This will put the rest of the current buffer out of line, and also all + // subsequent buffers unless an odd length buffer is provided. Hopfully this won't happen often. + { + aChar.Zero(); + + if(iUnicodeInputMisaligned) + { + TUint16 tempOut; + TUint8* tempRead; + tempRead = (TUint8*)(iInputBufferPtr.Ptr()) + iNextChar; + + if(iCurrentInputBufferLen - iNextChar >=1) + { + // if we saved a byte last time, lets use that first + if(iSpareChar.Length()) + { + tempOut = iSpareChar[0]; + iSpareChar.Zero(); + } + else if(iCurrentInputBufferLen - iNextChar >=2) + { + // we didn't save a byte, so we read from the stream. + tempOut = *tempRead; + tempRead++; + iNextChar++; + } + else + { + // our input stream must have been an odd length - this might cause alignment problems, + // so we need to start reading bytewise for a while + iUnicodeInputMisaligned = ETrue; + + TUint8* tempRead = (TUint8*)(iInputBufferPtr.Ptr()) + iNextChar; + TUint16 tempVal = (TUint16)(*tempRead << 8); + iSpareChar.Copy(&tempVal,1); + + GetMoreData(); + return KWaitForChar; + + } + + // second byte (high byte) of our output comes from the input stream in all cases. + tempOut |= ((*tempRead & 0xFF) << 8); + iNextChar++; + + TPtrC16 readDes(&tempOut, 1); + aChar = readDes.Left(1); + } + } + else if(iCurrentInputBufferLen - iNextChar >= 2) + { + // we may be in a position where we don't know we're going to lose a byte + // so we'll test for that ahead of time, and then handle that in the normal way + + // if we execute this, it means that we have two bytes available to read. + const TUint16* word = reinterpret_cast((iInputBufferPtr.Ptr() + iNextChar)); + TPtrC16 tempUnicodeInput(word, 2); + aChar = tempUnicodeInput.Left(1); + iNextChar+=2; + return KCharReturned; + } + + TInt bytesRemaining = iCurrentInputBufferLen - iNextChar; + + switch(bytesRemaining) + { + case 1: + { + // our input stream must have been an odd length - this might cause alignment problems, + // so we need to start reading bytewise for a while + + TUint8* tempRead = (TUint8*)(iInputBufferPtr.Ptr()) + iNextChar; + TUint16 tempVal = *tempRead; + iSpareChar.Copy(&tempVal,1); + iUnicodeInputMisaligned = ETrue; + iNextChar++; + if(!aChar.Length()) + { + GetMoreData(); + return KWaitForChar; + } + } + break; + case 0: + { + // we're at the end of this block, and it's turned out to be re-aligned. + // we can read subsequent blocks in 16-bit chunks. + iUnicodeInputMisaligned = EFalse; + } + break; + } + + return KCharReturned; + } + +//================================================================================== + +CMDXMLParser::TGetCharReturn CMDXMLParser::GetSingleByteChar(TDes& aChar) + { + // We have UTF8/ASCII Source, and we must need to convert some more if we got here. + iUnicodeConversion.Zero(); + iUnicodeConversionLen = 0; + iUnicodeReadPos = 0; + + // if we are not operating out of the edge buffer yet, work on the real one + if(!iUTF8EdgeBuffer) + { + // This is an 8 bit encoding, probably UTF-8, but could be ASCII. Because + // ASCII is valid UTF-8 we can just convert what we have to Unicode. + // We're going to convert a number of characters at a time here. + TInt inputBytesRemaining = iCurrentInputBufferLen - iNextChar; + TInt convResult; + TPtrC8 tempPtr( (TUint8*)(iInputBufferPtr.Ptr()) + iNextChar, inputBytesRemaining ); + + convResult = CnvUtfConverter::ConvertToUnicodeFromUtf8(iUnicodeConversion, tempPtr); + if((convResult >= 0) || (convResult == KErrCorrupt)) + { + // Sometimes the UTF8 decoder might return corrupt if it only gets a single character + // in this case we ignore the error and report that we have converted 0 characters + if (convResult == KErrCorrupt) + convResult = tempPtr.Length(); + + // This is the number of bytes converted. + // Keep an eye out in case there is no change in the character consumed count. + TInt bytesConverted = inputBytesRemaining - convResult; + + // We consumed characters. Make our input buffer read position correct. + iNextChar += bytesConverted; + + // Make our intermediate buffering correct and return the first character out of our buffer + // subsequent calls will just return characters from this buffer. + iUnicodeConversionLen = iUnicodeConversion.Length(); + aChar = iUnicodeConversion.Left(1); + iUnicodeReadPos = 1; + + if(convResult && convResult < KUTF8EdgeBufferLen) + { + TUint8* multiByteCheck = (TUint8*)(iInputBufferPtr.Ptr()) + iNextChar; + + // There is a possibility that we've got an edge case here + //check if our left over character is in fact UTF8. + if((0x80 & *multiByteCheck) != 0) + { + // Shift 'convResult' characters off into the edge buffer. + delete iUTF8EdgeBuffer; + iUTF8EdgeBuffer = HBufC8::New(KUTF8EdgeBufferLen); + *iUTF8EdgeBuffer = iInputBufferPtr.Right(convResult); + + TUint8 bitMask = 0x80; + TInt byteCount = 0; + while(bitMask && (bitMask & (iUTF8EdgeBuffer->Des()[0])) != 0) + { + bitMask >>= 1; + byteCount++; + }; + + if(!bitMask) + { + // the utf8 stream appears to be corrupt. + SetError(KError, EXMLFatal); + return KError; + } + // we need to find byteCount characters to make up the character currently stored in the edge + // buffer. + iRequiredUTF8Bytes = byteCount - iUTF8EdgeBuffer->Length(); + + // set the variables up so that we return any converted characters, and then begin work + // on the edge buffer (where we've already cached the remaining bytes if any) + // NOTE: We will return all the characters which we preconverted into iUnicodeConversion *before* + // we begin dealing with the edge buffer, because of the structure of this function. + iNextChar = iCurrentInputBufferLen; + + if (bytesConverted == 0) + // If no bytes were converted then there is nothing to return, + // we need to wait for more data and then conbine it with what we have + // just put on the edge buffer. + { + // need more bytes to finish this character. + GetMoreData(); + return KWaitForChar; + } + } + } + } + + else + { + return KError; // something failed in the UTF8 Converter. + } + } + else + { + // We are converting the UTF8 Edge Buffer. We know that in it's current state, it + // can't be converted to Unicode. + // Decide if we have enough characters in our current input stream to convert to an + // output character (or two) yet. + + if(iUTF8EdgeBuffer->Length() >= KUTF8EdgeBufferLen) + { + // our edge buffer reached the maximum length for a UTF8 character + // and we haven't managed to convert a unicode output. + // this means that the input stream is corrupt. + delete iUTF8EdgeBuffer; + iUTF8EdgeBuffer = NULL; + + // Report a fatal error. + SetError(KError, EXMLFatal); + return KError; + } + else + { + TInt convResult; + + // we know how many bytes are required in order to complete the utf8 buffer + TInt bytesAvailable = iCurrentInputBufferLen - iNextChar; + + if(bytesAvailable >= iRequiredUTF8Bytes) + { + // we have enough bytes to complete this character. + // Go ahead and convert then return it. + iUTF8EdgeBuffer->Des().Append(iInputBufferPtr.Mid(iNextChar, iRequiredUTF8Bytes)); + iUnicodeConversion.Zero(); + convResult = CnvUtfConverter::ConvertToUnicodeFromUtf8(iUnicodeConversion, iUTF8EdgeBuffer->Des()); + + // regardless if we managed to convert this buffer or not, we don't need it any more. + delete iUTF8EdgeBuffer; + iUTF8EdgeBuffer = NULL; + + // make sure we report any error in the conversion + if(convResult != 0) + { + // we either incorrectly calculated the required number of bytes or the + // stream is corrupt. Either way we have a fatal error. + SetError(KError, EXMLFatal); + return KError; + } + + // Make our intermediate buffering correct and return the first character out of our buffer + // subsequent calls will just return characters from this buffer. + iUnicodeConversionLen = iUnicodeConversion.Length(); + aChar = iUnicodeConversion.Left(1); + iUnicodeReadPos = 1; + + // set up the main input buffers so that the next char comes from the input stream. + iNextChar += iRequiredUTF8Bytes; + iRequiredUTF8Bytes = 0; + } + else + { + // we haven't got enough bytes to complete this character, store the + // available byte(s) and request more data. + iUTF8EdgeBuffer->Des().Append(iInputBufferPtr.Mid(iNextChar, bytesAvailable)); + + // Move the next character index on for as many bytes as we have just added to the edge buffer + iNextChar += bytesAvailable; + // We can reduce the number of bytes require by the number of bytes added to the edge buffer + iRequiredUTF8Bytes -= bytesAvailable; + + // need more bytes to finish this character. + GetMoreData(); + return KWaitForChar; + } + } + } + + return KCharReturned; + } + +//================================================================================== + +CMDXMLParser::TGetCharReturn CMDXMLParser::GetChar(TDes& aChar) +// +// Fetch one character from the input file +// @param aChar the returned character. +// @return returns true if a character returned or false if the file is finished +// + { + // first test - see if we're providing preconverted characters. + if(iUnicodeConversionLen && iUnicodeReadPos < iUnicodeConversionLen) + { + // return one of the preconverted chars. + aChar = iUnicodeConversion.Mid(iUnicodeReadPos, 1); + iUnicodeReadPos++; + + return KCharReturned; + } + + // Second test - see if we require more data. If we have converted data and we require + // more data, this code is not intelligent enough to request data from the provider + // early, but that's ok. + + // Buffer length held as a member variable for performance reasons + // this function will be accessed thousands of times + if(iCurrentInputBufferLen <= iNextChar) + { + GetMoreData(); + return KWaitForChar; + } + + // return the character, handling any of the buffer shuffling we need to do. + if(iBytesPerChar == 2) + return GetDoubleByteChar(aChar); + else + return GetSingleByteChar(aChar); + } + +//================================================================================== + +CMDXMLElement* CMDXMLParser::ParseStartTagL() +// +// Parse a start of element tag and create an element with attributes set. +// @return Returns a pointer to the created element +// @leave can Leave due to OOM +// + { + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + + // there must be at least two angle brackets and a single character to be meaningful + if(iElementTag->Length() < 3) + return NULL; + + CMDXMLElement* newElement = NULL; + TPtr elementTagPtr = iElementTag->Des(); + + // remove the angle brackets and trim white space + if(iElementTag->Right(TPtrC(KXMLEndStartTag).Length()) == KXMLEndStartTag) + elementTagPtr = iElementTag->Left(iElementTag->Length() - TPtrC(KXMLEndStartTag).Length()); + else + elementTagPtr = iElementTag->Left(iElementTag->Length() - TPtrC(KXMLEndTag).Length()); + + elementTagPtr = iElementTag->Right(iElementTag->Length() - TPtrC(KXMLStartTag).Length()); + elementTagPtr.Trim(); + + // find out where the name ends and the attributes begin + TLex16 element(elementTagPtr); + element.SkipCharacters(); + TInt endOfName = element.Offset(); + + // separate out the name from the attributes + HBufC* elementName = (iElementTag->Left(endOfName)).AllocLC(); + TPtr elementNamePtr = elementName->Des(); + elementNamePtr.TrimRight(); + + TInt error = KErrNone; + + __ASSERT_DEBUG(iXMLDoc != NULL, Panic(ENullMemVarXMLDoc)); + + TBool validElement = iXMLDoc->ValidElementNameL(elementNamePtr); + if(validElement || iStoreInvalid) + { + // remove the actual name from the tag so we only pass on the attributes + elementTagPtr = iElementTag->Right(iElementTag->Length() - endOfName); + elementTagPtr.TrimLeft(); + newElement = CMDXMLElement::NewLC(iXMLDoc->CanElementHaveChildren(elementNamePtr), iXMLDoc, elementNamePtr); + + error = ParseElementAttributesL(*newElement, elementTagPtr); + CleanupStack::Pop(); + } + if(!validElement) + { + error = KErrXMLInvalidElement; + } + + CleanupStack::PopAndDestroy(elementName); // elementName + + if(error != KErrNone) + { + SetError(error, EXMLWorkable); + } + + return newElement; + + } + + +TInt CMDXMLParser::ParseElementAttributesL(CMDXMLElement& aElement, TDes& aTagToParse) +// +// This function is used to parse the attributes. +// @param aElement The element to which the attributes belong +// @param aTagToParse The tag to be parsed +// @return Returns KErrNone if both attribute name & value are valid +// KErrXMLBadAttributeName if attribute name is invalid or KErrXMLBadAttributeValue is invalid +// @leave can Leave due to OOM +// + { + TInt error = KErrNone; + TInt attributeError = KErrNone; + HBufC* attributeName = NULL; + HBufC* attributeValue = NULL; + TBuf<1> attributeDelimiter; // may be " or ' + TInt offset = KErrNone; + + offset = aTagToParse.Find(KEqualSign); + while(offset != KErrNotFound) + { + attributeName = TPtrC(aTagToParse.Left(offset)).AllocLC(); + TPtr attributeNamePtr = attributeName->Des(); + attributeNamePtr.TrimRight(); // remove white space that existed between name and equal sign + + // remove current attribute name and equal sign from string + aTagToParse = aTagToParse.Right(aTagToParse.Length() - (offset + 1)); + aTagToParse.TrimLeft(); // remove white space that existed between equal sign and delimiter + + if(error == KErrNone && aTagToParse.Length() < 2) // a name must be at followed by at least 2 delimiters + { + error = KErrXMLBadAttributeName; + // In this case, there is insufficient tag left to contain any more attributes + } + else if(error == KErrNone && aElement.IsAttributeSpecified(*attributeName)) + { + error = KErrXMLDuplicateAttributeName; + // We need to remove the attribute value from the tag string or it will be + // picked up as part of the next attribute name. + attributeDelimiter = aTagToParse.Left(1); + + // Check in case we've got a missing " at the beginning of the attribute. If + // we do, we need to try a different strategy to find the end of this attribute + if (attributeDelimiter != KQuotation && attributeDelimiter != KApostrophe) + { + offset = LocateNextAttribute(aTagToParse); + } + else + { + // remove start delimiter then search for next one (end delimiter) + aTagToParse = aTagToParse.Right(aTagToParse.Length() - 1); + offset = FindDelimiter(aTagToParse, attributeDelimiter); + } + + if(offset != KErrNotFound) + { + // remove current attribute value and delimiter + aTagToParse = aTagToParse.Right(aTagToParse.Length() - (offset + 1)); + aTagToParse.TrimLeft(); // remove white space that existed between delimiter and next name + } + } + else + { + attributeDelimiter = aTagToParse.Left(1); + + if (attributeDelimiter != KQuotation && attributeDelimiter != KApostrophe) + { + // This attribute doesn't have a valid delimiter. Try and find the beginning of the next + // attribute and just cut this one. + TInt nextAttribute = LocateNextAttribute(aTagToParse); + if(nextAttribute > 0) + { + // Add one to next attribute because the offset includes the whitespace before it + aTagToParse = aTagToParse.Right(aTagToParse.Length() - (nextAttribute + 1)); + } + + if (error == KErrNone) + { + error = KErrXMLBadAttributeValue; + } + } + else + { + // remove start delimiter then search for next one (end delimiter) + aTagToParse = aTagToParse.Right(aTagToParse.Length() - 1); + + offset = FindDelimiter(aTagToParse, attributeDelimiter); + if(offset != KErrNotFound) + { + attributeValue = TPtrC(aTagToParse.Left(offset)).AllocLC(); + TPtr attributeValuePtr = attributeValue->Des(); + attributeValuePtr.TrimRight(); // remove white space that existed between value and delimiter + + // remove current attribute value and delimiter + aTagToParse = aTagToParse.Right(aTagToParse.Length() - (offset + 1)); + aTagToParse.TrimLeft(); // remove white space that existed between delimiter and next name + + // Entity convert this attribute + attributeError = ParseSingleAttributeL(attributeValuePtr); + if( attributeError != KErrNone && error == KErrNone) + { + error = attributeError; + } + + attributeError = aElement.SetAttributeL(*attributeName, *attributeValue, iStoreInvalid); + if( attributeError != KErrNone && error == KErrNone) + { + error = KErrXMLInvalidAttribute; + } + CleanupStack::PopAndDestroy(attributeValue); //attributeValue + } + else if(error == KErrNone) + { + error = KErrXMLBadAttributeValue; + } + } + } + + // next attribute pair + offset = aTagToParse.Find(KEqualSign); + CleanupStack::PopAndDestroy(attributeName); //attributeName + } + + if(error == KErrNone && aTagToParse.Length() != 0) + { + error = KErrXMLBadAttributeValue; + } + + return error; + } + +TInt CMDXMLParser::LocateNextAttribute(const TDesC& aTagToParse) + { + // Find the next attribute by looking for an = then search back for a ' '. + // This is useful when you've hit rubbish parsing the content of a start tag + // and are looking for somewhere sensible to start. + TInt nextAttribute = KErrNotFound; + TInt offset = aTagToParse.Find(KEqualSign); + + // If the = is the first character then there isn't space for a ' ' so + // don't bother looking + if(offset > 0) + { + TPtrC invalidText = aTagToParse.Left(offset); + nextAttribute = invalidText.LocateReverse(' '); + } + + return nextAttribute; + } + +TInt CMDXMLParser::ParseElementEndTag(CMDXMLElement& aElement, const TDesC& aTagToParse) +// +// Parses an end tag. In fact, at this point the end tag must match +// the tag name of the start tag. +// @param aTagToParse Text of the end tag. +// @return Returns KErrNone if the end tag matches the start tag or KErrNotFound if there is a mismatch. +// + { + // The tag should be of the form '' where tag is the name of this element so we will + // check and strip off the surrounding and then compare the remains with this # + // node name. + TInt retVal = KErrNone; + if( aTagToParse.Length() != (aElement.NodeName().Length()+3)) + { + retVal = KErrNotFound; + } + else + { + TInt startEndTagLen = TPtrC(KXMLStartEndTag).Length(); + TInt endTagLen = TPtrC(KXMLEndTag).Length(); + + if((aTagToParse.Left(startEndTagLen).Compare(KXMLStartEndTag) == 0) && + (aTagToParse.Right(endTagLen).Compare(KXMLEndTag) == 0)) + { + if(aElement.NodeName().Compare(aTagToParse.Mid(2, + aTagToParse.Length() - (startEndTagLen + endTagLen))) != 0) + { + retVal = KErrNotFound; + } + } + } + return retVal; + } + + +//================================================================================== + +EXPORT_C void CMDXMLParser::SetError(const TInt aErrorCode, const TXMLErrorCodeSeverity aSeverity) +// +// Sets iError to new errorcode if more serious than any error so far encountered +// + { + if(iSeverity > aSeverity) + { + iSeverity = aSeverity; + iError = aErrorCode; + } + } + +//================================================================================== + +EXPORT_C TInt CMDXMLParser::Error() const + { + return iError; + } + +//================================================================================== + +EXPORT_C TXMLErrorCodeSeverity CMDXMLParser::ErrorSeverity() const + { + return iSeverity; + } + +//================================================================================== + +void CMDXMLParser::HandleTextL(TDes& aChar) +// +// Called when a character is read in and found to bo outside of an element tag +// + { + // Save the text in a buffer. + // This text will get added as as a child element when the next tag is encounted. + if (iText == NULL) + iText = HBufC::NewL(KGMXMLDefaultTextBufferSize); + + if (iText->Length() == iText->Des().MaxLength()) + // The buffer will overflow if we add another character. + // Need to reallocate. + { + iText = iText->ReAllocL(iText->Des().MaxLength() + KGMXMLDefaultTextBufferSize); + } + + iText->Des().Append(aChar); + } + +TBool CMDXMLParser::EndOfCDataSection() + { + TBool endOfCData = EFalse; + TPtrC cdataEndSection(KXMLEndCDataSection); + TInt instLen = TPtrC(KXMLEndCDataSection).Length()-1; + + __ASSERT_DEBUG(iElementTag != NULL, Panic(ENullMemVarElementTag)); + if(iElementTag->Right(instLen) == cdataEndSection.Left(instLen)) + { + if(iElementTag->Left(instLen) == KXMLStartCDataSection) + endOfCData = ETrue; + } + + return endOfCData; + } + +TInt CMDXMLParser::CheckForStartCData(const TDesC& aTextToCheck) + { + TInt index; + index = aTextToCheck.Find(KXMLStartCDataSection); + return index; + } + +TInt CMDXMLParser::FindDelimiter(TDesC& aDataToSearch, TDesC& aDelimiterToFind) + { + TInt currentOffset = 0; + TInt nextDelimiter = KErrNotFound; + TBool valid = EFalse; + TPtrC unsearchedData(aDataToSearch); + + while (!valid && ((nextDelimiter = unsearchedData.Find(aDelimiterToFind)) != KErrNotFound)) + { + // If this isn't the first time round the loop (When currentOffset == 0) we're moved + // our attention to the character after the delimiter we found, so add one to currentOffset + if(currentOffset != 0) + { + currentOffset += 1; + } + // We have a delimiter, add the position of this to currentOffset + currentOffset += nextDelimiter; + + // Check whether this delimiter is in a CDataSection, it's valid if it isn't + TPtrC delimiterToCheck = aDataToSearch.Left(currentOffset); + valid = !InCDataSection(delimiterToCheck); + + // Move on to the next section of text in case this one wasn't valid + unsearchedData.Set(aDataToSearch.Mid(currentOffset + 1)); + } + + if ((nextDelimiter == KErrNotFound) && (!valid)) + { + return KErrNotFound; + } + else + { + return currentOffset; + } + } + +void CMDXMLParser::AddTextL(CMDXMLElement* aParentElement) + { + if ((aParentElement != NULL) && (iText != NULL)) + // Add any buffered text to the parent element unless it contains only whitespace + { + // Strip off any leading whitespace + TInt stripCounter = 0; + + if (!iPreserve) // GmXML consumes whitespace characters + { + TBool endOfWhitespace = EFalse; + while ((stripCounter < iText->Length()) && (!endOfWhitespace)) + { + // If character is not 0x20 (space) and not between 0x09 and 0x0d + // it isn't whitespace + if( ((*iText)[stripCounter] != 0x20) && + !((*iText)[stripCounter] >= 0x09 && (*iText)[stripCounter] <= 0x0d)) + { + endOfWhitespace = ETrue; + } + else + { + stripCounter++; + } + } + } + + HBufC* strippedText = TPtrC(iText->Right(iText->Length() - stripCounter)).AllocLC(); + + if (strippedText->Length() > 0) + // If there is anything left of the stripped text then entity convert and add it. + { + TPtr toConvert = strippedText->Des(); + TInt error = iEntityConverter->EntityToTextL(toConvert); + if( error != KErrNone ) + { + SetError(error, EXMLIndeterminate); + } + CMDXMLText* textElement = CMDXMLText::NewLC(iXMLDoc); + textElement->SetDataL(*strippedText); + CleanupStack::Pop(textElement); + TInt err = aParentElement->AppendChild(textElement); + if(err != KErrNone) + { + SetError(err, EXMLWorkable); + } + } + + CleanupStack::PopAndDestroy(strippedText); + iText->Des().Zero(); + } + } + +TBool CMDXMLParser::InCDataSection(TDesC& aDataToSearch) + { + TBool inCDataSection = EFalse; + TInt startCData = CheckForStartCData(aDataToSearch); + TInt endCData = 0; + + while ((startCData != KErrNotFound) && !inCDataSection) + { + // We only want to look for the end of the CDataSection in the part of + // aDataToSearch after the start of the CDataSection. We know that the + // first (TPtrC)KXMLStartCDataSection.Length() of the data we're looking + // at won't match because it's the start tag, but it's probably more + // efficient to check the extra few characters than to work out the + // length of the tag so we can ignore them. + startCData += endCData; + TPtrC afterStart = aDataToSearch.Mid(startCData); + endCData = afterStart.Find(KXMLEndCDataSection); + if (endCData == KErrNotFound) + { + // We haven't found a match for the start of the CDataSection so + // we must still be in it -> "<" is valid. + inCDataSection = ETrue; + } + else + { + // We found a match for the start of the CDataSection. Check to + // see if another one has started since then. + endCData += startCData; + TPtrC afterEnd = aDataToSearch.Mid(endCData); + startCData = CheckForStartCData(afterEnd); + } + } + + return inCDataSection; + } + +TInt CMDXMLParser::ParseSingleAttributeL(TDes& aAttributeValue) + { + TInt error = KErrNone; + TInt beginSection = 0; + TInt endSection = aAttributeValue.Find(KXMLStartCDataSection); + + // We've found at least one CDataSection + while(endSection != KErrNotFound) + { + // Entity convert this plain text section + HBufC* textToConvert = TPtrC(aAttributeValue.Mid(beginSection, endSection)).AllocLC(); + TPtr toConvert = textToConvert->Des(); + error = iEntityConverter->EntityToTextL(toConvert); + aAttributeValue.Replace(beginSection, endSection, *textToConvert); + CleanupStack::PopAndDestroy(textToConvert); + + // Move on our markers. We start the new section at the end of the old one. + beginSection += endSection; + // The end of this new section is the end of the CDataSection + endSection = TPtrC(aAttributeValue.Mid(beginSection)).Find(KXMLEndCDataSection); + + if(endSection != KErrNotFound) + { + // Now move on our markers again. Start at the end of the CDataSection, + // plus the length of the end tag, and continue to the beginning of the next one. + beginSection += endSection + TPtrC(KXMLEndCDataSection).Length(); + endSection = TPtrC(aAttributeValue.Mid(beginSection)).Find(KXMLStartCDataSection); + } + else + { + // There's an unterminated CDataSection in our attribute + error = KErrXMLBadAttributeValue; + } + } + + // There are no more CDataSections, entity convert the rest of the string + if(!error) + { + HBufC* textToConvert = TPtrC(aAttributeValue.Mid(beginSection)).AllocLC(); + TPtr toConvert = textToConvert->Des(); + error = iEntityConverter->EntityToTextL(toConvert); + aAttributeValue.Replace(beginSection, (aAttributeValue.Length()-beginSection), *textToConvert); + CleanupStack::PopAndDestroy(textToConvert); + } + + return error; + } + + +EXPORT_C void CMDXMLParser::PlaceholderForRemovedExport1(MMDXMLParserObserver* /*aParserObserver*/) + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +EXPORT_C void CMDXMLParser::PlaceholderForRemovedExport2(MMDXMLParserObserver* /*aParserObserver*/, MXMLDtd* /*aDtdRepresentation*/) + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +EXPORT_C void CMDXMLParser::PlaceholderForRemovedExport3() + { + User::Panic(KLDRIMPORT, KLdrImportedOrdinalDoesNotExist); + } + +// End of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/STRINGS/SMILAttributes.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/STRINGS/SMILAttributes.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,289 @@ +# Copyright (c) Symbian Software Ltd 2008. All rights reserved. +!/** +!An Example String Table +!@publishedAll +!@released +!*/ +# XML String table +fstringtable SMILAttributes +# +# Standard SMIL Element, Attributes & Values +# +EAAccessKey a accesskey +EAActuate a actuate onLoad onRequest +EAAlt a alt +EABegin a begin +EAClass a class +EADestinationLevel a destinationLevel +EADestinationPlaystate a destinationPlaystate pause play stop +EADur a dur +EAEnd a end +EAExternal a external false true +EAFill a fill freeze hold remove transition +EAHref a href +EAId a id +EAMax a max +EAMin a min +EARepeatCount a repeatCount +EARepeatDur a repeatDur +EAShow a show new pause replace +EASourceLevel a sourceLevel +EASourcePlaystate a sourcePlaystate pause play stop +EATabIndex a tabindex +EATarget a target +EATitle a title +EAXMLLang a xml:lang +EAnchorBaseAccessKey anchorBase accesskey +EAnchorBaseActuate anchorBase actuate onLoad onRequest +EAnchorBaseAlt anchorBase alt +EAnchorBaseBegin anchorBase begin +EAnchorBaseClass anchorBase class +EAnchorBaseCoOrds anchorBase coords +EAnchorBaseDestLevel anchorBase destinationLevel +EAnchorBaseDestinationPlaystate anchorBase destinationPlaystate pause play stop +EAnchorBaseDur anchorBase dur +EAnchorBaseEnd anchorBase end +EAnchorBaseEndsync anchorBase endsync +EAnchorBaseExternal anchorBase external false true +EAnchorBaseFill anchorBase fill hold freeze remove transition +EAnchorBaseHRef anchorBase href +EAnchorBaseId anchorBase id +EAnchorBaseMax anchorBase max +EAnchorBaseMin anchorBase min +EAnchorBase anchorBase nohref nohref +EAnchorBaseRepeat anchorBase repeat +EAnchorBaseRepeatCnt anchorBase repeatCount +EAnchorBaseRepeatDur anchorBase repeatDur +EAnchorBaseShape anchorBase shape circle default poly rect +EAnchorBaseShow anchorBase show new pause replace +EAnchorBaseSkipContent anchorBase skip-content false true +EAnchorBaseSourceLev anchorBase sourceLevel +EAnchorBaseSourcePlaystate anchorBase sourcePlaystate pause play stop +EAnchorBaseTabIndex anchorBase tabindex +EAnchorBaseTarget anchorBase target +EAnchorBaseTitle anchorBase title +EAnchorBaseXMLLang anchorBase xml:lang +EBodyClass body class +EBodyId body id +EBodyTitle body title +EBodyXMLLang body xml:lang +EHeadClass head class +EHeadId head id +EHeadTitle head title +EHeadXMLLang head xml:lang +ELayoutClass layout class +ELayoutId layout id +ELayoutSysAudioDesc layout systemAudioDesc off on +ELayoutSysBitrate layout systemBitrate +ELayoutSysCPU layout systemCPU +ELayoutSysCaptions layout systemCaptions off on +ELayoutSysComp layout systemComponent +ELayoutSysLang layout systemLanguage +ELayoutSysOS layout systemOperatingSystem +ELayoutSysOverCap layout systemOverdubOrSubtitle overdub subtitle +ELayoutSysReq layout systemRequired +ELayoutSysScrnDepth layout systemScreenDepth +ELayoutSysScrnSize layout systemScreenSize +ELayoutTitle layout title +ElayoutType layout type +ELayoutXMLLang layout xml:lang +EMediaAbstract media abstract +EMediaAlt media alt +EMediaAuthor media author +EMediaBegin media begin +EMediaClass media class +EMediaClipHypBegin media clip-begin +EMediaClipHypEnd media clip-end +EMediaClipBegin media clipBegin +EMediaClipEnd media clipEnd +EMediaCopyright media copyright +EMediaCustomTest media customTest +EMediaDur media dur +EMediaEnd media end +EMediaEndsync media endsync +EMediaFill media fill freeze hold remove transition +EMediaId media id +EMediaLongDesc media longdesc +EMediaMax media max +EMediaMin media min +EMediaReadIndex media readIndex +EMediaRegion media region +EMediaRepeat media repeat +EMediaRepeatCount media repeatCount +EMediaRepeatDur media repeatDur +EMediaSrc media src +EMediaSysHypBitrate media system-bitrate +EMediaSysHypCap media system-captions +EMediaSysHypLang media system-language +EMediaSysHypOverCap media system-overdub-or-caption caption overdub +EMediaSysHypReq media system-required +EMediaSysHypScrnDepth media system-screen-depth +EMediaSysHypScrnSize media system-screen-size +EMediaSysAudioDesc media systemAudioDesc off on +EMediaSysBitrate media systemBitrate +EMediaSysCPU media systemCPU +EMediaSysCaptions media systemCaptions off on +EMediaSysComp media systemComponent +EMediaSysLang media systemLanguage +EMediaSysOS media systemOperatingSystem +EMediaSysOverCap media systemOverdubOrSubtitle overdub subtitle +EMediaSysReq media systemRequired +EMediaSysScrnDepth media systemScreenDepth +EMediaSysScrnSize media systemScreenSize +EMediaTitle media title +EMediaTransIn media transIn +EMediaTransOut media transOut +EMediaType media type +EMediaXMLLang media xml:lang +EMetaClass meta class +EMetaContent meta content +EMetaId meta id +EMetaName meta name +EMetaSkipContent meta skip-content false true +EMetaTitle meta title +EMetaXMLLang meta xml:lang +EMetadataClass metadata class +EMetadataId metadata id +EMetadataSkipContent metadata skip-content false true +EMetadataTitle metadata title +EMetadataXMLLang metadata xml:lang +EPrefetchBandwith prefetch bandwidth +EPrefetchClass prefetch class +EPrefetchId prefetch id +EPrefetchMediaSize prefetch mediaSize +EPrefetchMediaTime prefetch mediaTime +EPrefetchSkipContent prefetch skip-content false true +EPrefetchSrc prefetch src +EPrefetchSysAudioDesc prefetch systemAudioDesc off on +EPrefetchSysBitrate prefetch systemBitrate +EPrefetchSysCPU prefetch systemCPU +EPrefetchSysCaptions prefetch systemCaptions off on +EPrefetchSysComp prefetch systemComponent +EPrefetchSysLang prefetch systemLanguage +EPrefetchSysOS prefetch systemOperatingSystem +EPrefetchSysOvrdubSub prefetch systemOverdubOrSubtitle +EPrefetchSysRequired prefetch systemRequired +EPrefetchSysScrnDepth prefetch systemScreenDepth +EPrefetchSysScrnSize prefetch systemScreenSize +EPrefetchTitle prefetch title +EPrefetchXMLLang prefetch xml:lang +ERegionBGHypCol region background-color +ERegionBGCol region backgroundColor +ERegionBottom region bottom +ERegionClass region class +ERegionClose region close never whenNotActive +ERegionFit region fit fill hidden meet scroll slice +ERegionHeight region height +ERegionId region id +ERegionLeft region left +ERegionOpen region open always whenActive +ERegionRegionName region regionName +ERegionRight region right +ERegionShowBG region showBackground always whenActive +ERegionSkipContent region skip-content false true +ERegionTitle region title +ERegionTop region top +ERegionWidth region width +ERegionXMLLang region xml:lang +ERegionZIndex region z-index +ERootLayoutBGHypCol root-layout background-color +ERootLayoutBGCol root-layout backgroundColor +ERootLayoutClass root-layout class +ERootLayoutClose root-layout close never whenNotActive +ERootLayoutHeight root-layout height +ERootLayoutId root-layout id +ERootLayoutOpen root-layout open always whenActive +ERootLayoutSkipContent root-layout skip-content false true +ERootLayoutTitle root-layout title +ERootLayoutWidth root-layout width +ERootLayoutXMLLang root-layout xml:lang +ESMILClass smil class +ESMILId smil id +ESMILSysAudioDesc smil systemAudioDesc off on +ESMILSysBitrate smil systemBitrate +ESMILSysCPU smil systemCPU +ESMILSysCaptions smil systemCaptions off on +ESMILSysComp smil systemComponent +ESMILSysLang smil systemLanguage +ESMILSysOS smil systemOperatingSystem +ESMILSysOverCap smil systemOverdubOrSubtitle overdub subtitle +ESMILSysReq smil systemRequired +ESMILSysScrnDepth smil systemScreenDepth +ESMILSysScrnSize smil systemScreenSize +ESMILTitle smil title +ESMILXMLLang smil xml:lang +ESMILXMLNS smil xmlns +ESwitchClass switch class +ESwitchId switch id +ESwitchSysAudioDesc switch systemAudioDesc off on +ESwitchSysBitrate switch systemBitrate +ESwitchSysCPU switch systemCPU +ESwitchSysCaptions switch systemCaptions off on +ESwitchSysComp switch systemComponent +ESwitchSysLang switch systemLanguage +ESwitchSysOS switch systemOperatingSystem +ESwitchSysOverCap switch systemOverdubOrSubtitle overdub subtitle +ESwitchSysReq switch systemRequired +ESwitchSysScrnDepth switch systemScreenDepth +ESwitchSysScrnSize switch systemScreenSize +ESwitchTitle switch title +ESwitchXMLLang switch xml:lang +ETimingAbstract timing abstract +ETimingAuthor timing author +ETimingBegin timing begin +ETimingClass timing class +ETimingCopyright timing copyright +ETimingCustomTest timing customTest +ETimingDur timing dur +ETimingEnd timing end +ETimingEndSync timing endsync +ETimingFill timing fill freeze hold remove transition +ETimingId timing id +ETimingMax timing max +ETimingMin timing min +ETimingRepeat timing repeat +ETimingRepeatCount timing repeatCount +ETimingRepeatDur timing repeatDur +ETimingSysHypBitRate timing system-bitrate +ETimingSysHypCaptions timing system-captions on off +ETimingSysHypLang timing system-language +ETimingSysHypOverCap timing system-overdub-or-caption caption overdub +ETimingSysHypReq timing system-required +ETimingSysHypScrnDepth timing system-screen-depth +ETimingSysHypScrnSize timing system-screen-size +ETimingSysAudioDesc timing systemAudioDesc off on +ETimingSysBitrate timing systemBitrate +ETimingSysCPU timing systemCPU +ETimingSysCaptions timing systemCaptions off on +ETimingSysComp timing systemComponent +ETimingSysLang timing systemLanguage +ETimingSysOS timing systemOperatingSystem +ETimingSysOverdubSub timing systemOverdubOrSubtitle +ETimingSysReq timing systemRequired +ETimingSysScrnDepth timing systemScreenDepth +ETimingSysScrnSize timing systemScreenSize +ETimingTitle timing title +ETimingXMLLAng timing xml:lang +ETransitionClass transition class +ETransitionDirecton transition direction forward reverse +ETransitionDur transition dur +ETransitionEndProg transition endProgress +ETransitionFadeCol transition fadeColor +ETransitionId transition id +ETransitionSkipContent transition skip-content false true +ETransitionStartProg transition startProgress +ETransitionSubtype transition subtype +ETransitionSysAudioDesc transition systemAudioDesc off on +ETransitionSysBitrate transition systemBitrate +ETransitionSysCPU transition systemCPU +ETransitionSysCaptions transition systemCaptions off on +ETransitionSysComp transition systemComponent +ETransitionSysLang transition systemLanguage +ETransitionSysOS transition systemOperatingSystem +ETransitionSysOvrdubSub transition systemOverdubOrSubtitle +ETransitionSysRequired transition systemRequired +ETransitionSysScrnDepth transition systemScreenDepth +ETransitionSysScrnSize transition systemScreenSize +ETransitionTitle transition title +ETransitionType transition type +ETransitionXMLLang transition xml:lang diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/STRINGS/SMILElements.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/STRINGS/SMILElements.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +# Copyright (c) Symbian Software Ltd 2008. All rights reserved. +!/** +!An Example String Table +!@publishedAll +!@released +!*/ +# XML String table +fstringtable SMILElements +# +# Standard SMIL Elements +# +Ea a +EAnchor anchor +EAnimate animate +EAnimateColor animateColor +EAnimateMotion animateMotion +EAnimation animation +EArea area +EAudio audio +EBody body +EBrush brush +ECustomAttributes customAttributes +ECustomTest customTest +EExcl excl +EHead head +EImg img +ELayout layout +EMeta meta +EMetadata metadata +EPar par +EParam param +EPrefetch prefetch +EpriorityClass priorityClass +ERef ref +ERegion region +ERegPoint regPoint +ERootLayout root-layout +ESeq seq +ESmil smil +ESwitch switch +EText text +ETextstream textstream +ETopLayout topLayout +ETransition transition +ETransitionFilter transitionFilter +EVideo video diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/STRINGS/SMILGenericElements.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/STRINGS/SMILGenericElements.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +# Copyright (c) Symbian Software Ltd 2008. All rights reserved. +!/** +!An Example String Table +!@publishedAll +!@released +!*/ +# XML String table +fstringtable SMILGenericElements +# +# Standard SMIL Elements & Generic Equivalent +# +EAnchorBase anchor anchorBase +EAnimationBase animation media +EAreaBase area anchorBase +EAudioBase audio media +EImgBase img media +EParBase par timing +ERefBase ref media +ESeqBase seq timing +ETextBase text media +ETextstreamBase textstream media +EVideoBase video media diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/STRINGS/XMLEntityReferences.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/STRINGS/XMLEntityReferences.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ +# XML String table +fstringtable XMLEntityReferences +# +# Standard XML Entity References +# These are assumed to have a maximum length of 20 in the generic +# entity converter. If any built in entity reference is added +# with a length greater than 20 the value of KMaxBuiltinEntityLength +# in GMXMLEntityConverter.cpp will need to be modified. +# +ELT < < +EAmp & & +EGt > > +EDbleQuote " \" +ESingleQuote ' ' diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bmarm/V2_XMLPARSERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bmarm/V2_XMLPARSERU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + __21CMDXMLEntityConverter @ 1 NONAME R3UNUSED ; CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ComposeEndTagL__14CMDXMLComposerR10CMDXMLNode @ 2 NONAME R3UNUSED ; CMDXMLComposer::ComposeEndTagL(CMDXMLNode &) + ComposeFile__14CMDXMLComposerG3RFsRC7TDesC16P14CMDXMLDocument12TXMLFileType @ 3 NONAME ; CMDXMLComposer::ComposeFile(RFs, TDesC16 const &, CMDXMLDocument *, TXMLFileType) + ComposeStartTagL__14CMDXMLComposerR10CMDXMLNode @ 4 NONAME R3UNUSED ; CMDXMLComposer::ComposeStartTagL(CMDXMLNode &) + DetachXMLDoc__12CMDXMLParser @ 5 NONAME R3UNUSED ; CMDXMLParser::DetachXMLDoc(void) + DoCancel__12CMDXMLParser @ 6 NONAME R3UNUSED ; CMDXMLParser::DoCancel(void) + DoCancel__14CMDXMLComposer @ 7 NONAME R3UNUSED ; CMDXMLComposer::DoCancel(void) + E32Dll__F10TDllReason @ 8 NONAME R3UNUSED ABSENT ; E32Dll(TDllReason) + NewLC__12CMDXMLParserP20MMDXMLParserObserver @ 9 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *) + NewLC__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 10 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *, MXMLDtd *) + NewLC__14CMDXMLComposerP22MMDXMLComposerObserver @ 11 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserver @ 12 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *, MXMLDtd *) + NewL__14CMDXMLComposerP22MMDXMLComposerObserver @ 14 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *) + OutputAttributeL__14CMDXMLComposerRC7TDesC16T1 @ 15 NONAME R3UNUSED ; CMDXMLComposer::OutputAttributeL(TDesC16 const &, TDesC16 const &) + OutputComposedTextL__21CMDXMLEntityConverterP14CMDXMLComposerRC7TDesC16 @ 16 NONAME R3UNUSED ; CMDXMLEntityConverter::OutputComposedTextL(CMDXMLComposer *, TDesC16 const &) + OutputEndOfElementTagL__14CMDXMLComposeri @ 17 NONAME R3UNUSED ; CMDXMLComposer::OutputEndOfElementTagL(int) + OutputStartOfElementTagL__14CMDXMLComposerRC7TDesC16 @ 18 NONAME R3UNUSED ; CMDXMLComposer::OutputStartOfElementTagL(TDesC16 const &) + ParseFile__12CMDXMLParserG3RFsRC7TDesC16 @ 19 NONAME R3UNUSED ; CMDXMLParser::ParseFile(RFs, TDesC16 const &) + RunError__12CMDXMLParseri @ 20 NONAME R3UNUSED ; CMDXMLParser::RunError(int) + RunError__14CMDXMLComposeri @ 21 NONAME R3UNUSED ; CMDXMLComposer::RunError(int) + PlaceholderForRemovedExport3__14CMDXMLComposer @ 22 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport3(void) + SetError__12CMDXMLParseri21TXMLErrorCodeSeverity @ 23 NONAME R3UNUSED ; CMDXMLParser::SetError(int, TXMLErrorCodeSeverity) + SetError__14CMDXMLComposeri21TXMLErrorCodeSeverity @ 24 NONAME R3UNUSED ; CMDXMLComposer::SetError(int, TXMLErrorCodeSeverity) + "_._12CMDXMLParser" @ 25 NONAME R3UNUSED ; CMDXMLParser::~CMDXMLParser(void) + "_._14CMDXMLComposer" @ 26 NONAME R3UNUSED ; CMDXMLComposer::~CMDXMLComposer(void) + "_._21CMDXMLEntityConverter" @ 27 NONAME R3UNUSED ; CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + PlaceholderForRemovedExport1__12CMDXMLParserP20MMDXMLParserObserver @ 28 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport1(MMDXMLParserObserver *) + PlaceholderForRemovedExport2__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 29 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport2(MMDXMLParserObserver *, MXMLDtd *) + PlaceholderForRemovedExport1__14CMDXMLComposerP22MMDXMLComposerObserver @ 30 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport1(MMDXMLComposerObserver *) + PlaceholderForRemovedExport2__14CMDXMLComposer @ 31 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport2(void) + PlaceholderForRemovedExport3__12CMDXMLParser @ 32 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport3(void) + Error__C12CMDXMLParser @ 33 NONAME R3UNUSED ; CMDXMLParser::Error(void) const + Error__C14CMDXMLComposer @ 34 NONAME R3UNUSED ; CMDXMLComposer::Error(void) const + EntityConverter__C14CMDXMLComposer @ 35 NONAME R3UNUSED ; CMDXMLComposer::EntityConverter(void) const + NewLC__14CMDXMLComposerP22MMDXMLComposerObserveri @ 36 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *, int) + NewL__14CMDXMLComposerP22MMDXMLComposerObserveri @ 37 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *, int) + CalculateFileSize__14CMDXMLComposerRiP14CMDXMLDocument12TXMLFileType @ 38 NONAME ; CMDXMLComposer::CalculateFileSize(int &, CMDXMLDocument *, TXMLFileType) + OutputDataL__14CMDXMLComposerRC7TDesC16 @ 39 NONAME R3UNUSED ; CMDXMLComposer::OutputDataL(TDesC16 const &) + SetEntityConverter__12CMDXMLParserP21CMDXMLEntityConverter @ 40 NONAME R3UNUSED ; CMDXMLParser::SetEntityConverter(CMDXMLEntityConverter *) + SetEntityConverter__14CMDXMLComposerP21CMDXMLEntityConverter @ 41 NONAME R3UNUSED ; CMDXMLComposer::SetEntityConverter(CMDXMLEntityConverter *) + ErrorSeverity__C12CMDXMLParser @ 42 NONAME R3UNUSED ; CMDXMLParser::ErrorSeverity(void) const + ErrorSeverity__C14CMDXMLComposer @ 43 NONAME R3UNUSED ; CMDXMLComposer::ErrorSeverity(void) const + ParseSource__12CMDXMLParserP24MMDXMLParserDataProvider @ 44 NONAME R3UNUSED ; CMDXMLParser::ParseSource(MMDXMLParserDataProvider *) + SetSourceCharacterWidth__12CMDXMLParserQ212CMDXMLParser26TMDXMLParserInputCharWidth @ 45 NONAME R3UNUSED ; CMDXMLParser::SetSourceCharacterWidth(CMDXMLParser::TMDXMLParserInputCharWidth) SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bmarm/XMLPARSERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bmarm/XMLPARSERU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + __21CMDXMLEntityConverter @ 1 NONAME R3UNUSED ; CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ComposeEndTagL__14CMDXMLComposerR10CMDXMLNode @ 2 NONAME R3UNUSED ; CMDXMLComposer::ComposeEndTagL(CMDXMLNode &) + ComposeFile__14CMDXMLComposerG3RFsRC7TDesC16P14CMDXMLDocument12TXMLFileType @ 3 NONAME ; CMDXMLComposer::ComposeFile(RFs, TDesC16 const &, CMDXMLDocument *, TXMLFileType) + ComposeStartTagL__14CMDXMLComposerR10CMDXMLNode @ 4 NONAME R3UNUSED ; CMDXMLComposer::ComposeStartTagL(CMDXMLNode &) + DetachXMLDoc__12CMDXMLParser @ 5 NONAME R3UNUSED ; CMDXMLParser::DetachXMLDoc(void) + DoCancel__12CMDXMLParser @ 6 NONAME R3UNUSED ; CMDXMLParser::DoCancel(void) + DoCancel__14CMDXMLComposer @ 7 NONAME R3UNUSED ; CMDXMLComposer::DoCancel(void) + E32Dll__F10TDllReason @ 8 NONAME R3UNUSED ; E32Dll(TDllReason) + NewLC__12CMDXMLParserP20MMDXMLParserObserver @ 9 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *) + NewLC__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 10 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *, MXMLDtd *) + NewLC__14CMDXMLComposerP22MMDXMLComposerObserver @ 11 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserver @ 12 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *, MXMLDtd *) + NewL__14CMDXMLComposerP22MMDXMLComposerObserver @ 14 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *) + OutputAttributeL__14CMDXMLComposerRC7TDesC16T1 @ 15 NONAME R3UNUSED ; CMDXMLComposer::OutputAttributeL(TDesC16 const &, TDesC16 const &) + OutputComposedTextL__21CMDXMLEntityConverterP14CMDXMLComposerRC7TDesC16 @ 16 NONAME R3UNUSED ; CMDXMLEntityConverter::OutputComposedTextL(CMDXMLComposer *, TDesC16 const &) + OutputEndOfElementTagL__14CMDXMLComposeri @ 17 NONAME R3UNUSED ; CMDXMLComposer::OutputEndOfElementTagL(int) + OutputStartOfElementTagL__14CMDXMLComposerRC7TDesC16 @ 18 NONAME R3UNUSED ; CMDXMLComposer::OutputStartOfElementTagL(TDesC16 const &) + ParseFile__12CMDXMLParserG3RFsRC7TDesC16 @ 19 NONAME R3UNUSED ; CMDXMLParser::ParseFile(RFs, TDesC16 const &) + RunError__12CMDXMLParseri @ 20 NONAME R3UNUSED ; CMDXMLParser::RunError(int) + RunError__14CMDXMLComposeri @ 21 NONAME R3UNUSED ; CMDXMLComposer::RunError(int) + PlaceholderForRemovedExport3__14CMDXMLComposer @ 22 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport3(void) + SetError__12CMDXMLParseri21TXMLErrorCodeSeverity @ 23 NONAME R3UNUSED ; CMDXMLParser::SetError(int, TXMLErrorCodeSeverity) + SetError__14CMDXMLComposeri21TXMLErrorCodeSeverity @ 24 NONAME R3UNUSED ; CMDXMLComposer::SetError(int, TXMLErrorCodeSeverity) + "_._12CMDXMLParser" @ 25 NONAME R3UNUSED ; CMDXMLParser::~CMDXMLParser(void) + "_._14CMDXMLComposer" @ 26 NONAME R3UNUSED ; CMDXMLComposer::~CMDXMLComposer(void) + "_._21CMDXMLEntityConverter" @ 27 NONAME R3UNUSED ; CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + PlaceholderForRemovedExport1__12CMDXMLParserP20MMDXMLParserObserver @ 28 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport1(MMDXMLParserObserver *) + PlaceholderForRemovedExport2__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 29 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport2(MMDXMLParserObserver *, MXMLDtd *) + PlaceholderForRemovedExport1__14CMDXMLComposerP22MMDXMLComposerObserver @ 30 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport1(MMDXMLComposerObserver *) + PlaceholderForRemovedExport2__14CMDXMLComposer @ 31 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport2(void) + PlaceholderForRemovedExport3__12CMDXMLParser @ 32 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport3(void) + Error__C12CMDXMLParser @ 33 NONAME R3UNUSED ; CMDXMLParser::Error(void) const + Error__C14CMDXMLComposer @ 34 NONAME R3UNUSED ; CMDXMLComposer::Error(void) const + EntityConverter__C14CMDXMLComposer @ 35 NONAME R3UNUSED ; CMDXMLComposer::EntityConverter(void) const + NewLC__14CMDXMLComposerP22MMDXMLComposerObserveri @ 36 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *, int) + NewL__14CMDXMLComposerP22MMDXMLComposerObserveri @ 37 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *, int) + CalculateFileSize__14CMDXMLComposerRiP14CMDXMLDocument12TXMLFileType @ 38 NONAME ; CMDXMLComposer::CalculateFileSize(int &, CMDXMLDocument *, TXMLFileType) + OutputDataL__14CMDXMLComposerRC7TDesC16 @ 39 NONAME R3UNUSED ; CMDXMLComposer::OutputDataL(TDesC16 const &) + SetEntityConverter__12CMDXMLParserP21CMDXMLEntityConverter @ 40 NONAME R3UNUSED ; CMDXMLParser::SetEntityConverter(CMDXMLEntityConverter *) + SetEntityConverter__14CMDXMLComposerP21CMDXMLEntityConverter @ 41 NONAME R3UNUSED ; CMDXMLComposer::SetEntityConverter(CMDXMLEntityConverter *) + ErrorSeverity__C12CMDXMLParser @ 42 NONAME R3UNUSED ; CMDXMLParser::ErrorSeverity(void) const + ErrorSeverity__C14CMDXMLComposer @ 43 NONAME R3UNUSED ; CMDXMLComposer::ErrorSeverity(void) const + ParseSource__12CMDXMLParserP24MMDXMLParserDataProvider @ 44 NONAME R3UNUSED ; CMDXMLParser::ParseSource(MMDXMLParserDataProvider *) + SetSourceCharacterWidth__12CMDXMLParserQ212CMDXMLParser26TMDXMLParserInputCharWidth @ 45 NONAME R3UNUSED ; CMDXMLParser::SetSourceCharacterWidth(CMDXMLParser::TMDXMLParserInputCharWidth) SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bmarm/v1.5_xmlparserU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bmarm/v1.5_xmlparserU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + __21CMDXMLEntityConverter @ 1 NONAME R3UNUSED ; CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ComposeEndTagL__14CMDXMLComposerR10CMDXMLNode @ 2 NONAME R3UNUSED ; CMDXMLComposer::ComposeEndTagL(CMDXMLNode &) + ComposeFile__14CMDXMLComposerG3RFsRC7TDesC16P14CMDXMLDocument12TXMLFileType @ 3 NONAME ; CMDXMLComposer::ComposeFile(RFs, TDesC16 const &, CMDXMLDocument *, TXMLFileType) + ComposeStartTagL__14CMDXMLComposerR10CMDXMLNode @ 4 NONAME R3UNUSED ; CMDXMLComposer::ComposeStartTagL(CMDXMLNode &) + DetachXMLDoc__12CMDXMLParser @ 5 NONAME R3UNUSED ; CMDXMLParser::DetachXMLDoc(void) + DoCancel__12CMDXMLParser @ 6 NONAME R3UNUSED ; CMDXMLParser::DoCancel(void) + DoCancel__14CMDXMLComposer @ 7 NONAME R3UNUSED ; CMDXMLComposer::DoCancel(void) + E32Dll__F10TDllReason @ 8 NONAME R3UNUSED ABSENT ; E32Dll(TDllReason) + NewLC__12CMDXMLParserP20MMDXMLParserObserver @ 9 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *) + NewLC__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 10 NONAME R3UNUSED ; CMDXMLParser::NewLC(MMDXMLParserObserver *, MXMLDtd *) + NewLC__14CMDXMLComposerP22MMDXMLComposerObserver @ 11 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserver @ 12 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *) + NewL__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME R3UNUSED ; CMDXMLParser::NewL(MMDXMLParserObserver *, MXMLDtd *) + NewL__14CMDXMLComposerP22MMDXMLComposerObserver @ 14 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *) + OutputAttributeL__14CMDXMLComposerRC7TDesC16T1 @ 15 NONAME R3UNUSED ; CMDXMLComposer::OutputAttributeL(TDesC16 const &, TDesC16 const &) + OutputComposedTextL__21CMDXMLEntityConverterP14CMDXMLComposerRC7TDesC16 @ 16 NONAME R3UNUSED ; CMDXMLEntityConverter::OutputComposedTextL(CMDXMLComposer *, TDesC16 const &) + OutputEndOfElementTagL__14CMDXMLComposeri @ 17 NONAME R3UNUSED ; CMDXMLComposer::OutputEndOfElementTagL(int) + OutputStartOfElementTagL__14CMDXMLComposerRC7TDesC16 @ 18 NONAME R3UNUSED ; CMDXMLComposer::OutputStartOfElementTagL(TDesC16 const &) + ParseFile__12CMDXMLParserG3RFsRC7TDesC16 @ 19 NONAME R3UNUSED ; CMDXMLParser::ParseFile(RFs, TDesC16 const &) + RunError__12CMDXMLParseri @ 20 NONAME R3UNUSED ; CMDXMLParser::RunError(int) + RunError__14CMDXMLComposeri @ 21 NONAME R3UNUSED ; CMDXMLComposer::RunError(int) + PlaceholderForRemovedExport3__14CMDXMLComposer @ 22 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport3(void) + SetError__12CMDXMLParseri21TXMLErrorCodeSeverity @ 23 NONAME R3UNUSED ; CMDXMLParser::SetError(int, TXMLErrorCodeSeverity) + SetError__14CMDXMLComposeri21TXMLErrorCodeSeverity @ 24 NONAME R3UNUSED ; CMDXMLComposer::SetError(int, TXMLErrorCodeSeverity) + "_._12CMDXMLParser" @ 25 NONAME R3UNUSED ; CMDXMLParser::~CMDXMLParser(void) + "_._14CMDXMLComposer" @ 26 NONAME R3UNUSED ; CMDXMLComposer::~CMDXMLComposer(void) + "_._21CMDXMLEntityConverter" @ 27 NONAME R3UNUSED ; CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + PlaceholderForRemovedExport1__12CMDXMLParserP20MMDXMLParserObserver @ 28 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport1(MMDXMLParserObserver *) + PlaceholderForRemovedExport2__12CMDXMLParserP20MMDXMLParserObserverP7MXMLDtd @ 29 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport2(MMDXMLParserObserver *, MXMLDtd *) + PlaceholderForRemovedExport1__14CMDXMLComposerP22MMDXMLComposerObserver @ 30 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport1(MMDXMLComposerObserver *) + PlaceholderForRemovedExport2__14CMDXMLComposer @ 31 NONAME R3UNUSED ; CMDXMLComposer::PlaceholderForRemovedExport2(void) + PlaceholderForRemovedExport3__12CMDXMLParser @ 32 NONAME R3UNUSED ; CMDXMLParser::PlaceholderForRemovedExport3(void) + Error__C12CMDXMLParser @ 33 NONAME R3UNUSED ; CMDXMLParser::Error(void) const + Error__C14CMDXMLComposer @ 34 NONAME R3UNUSED ; CMDXMLComposer::Error(void) const + EntityConverter__C14CMDXMLComposer @ 35 NONAME R3UNUSED ; CMDXMLComposer::EntityConverter(void) const + NewLC__14CMDXMLComposerP22MMDXMLComposerObserveri @ 36 NONAME R3UNUSED ; CMDXMLComposer::NewLC(MMDXMLComposerObserver *, int) + NewL__14CMDXMLComposerP22MMDXMLComposerObserveri @ 37 NONAME R3UNUSED ; CMDXMLComposer::NewL(MMDXMLComposerObserver *, int) + CalculateFileSize__14CMDXMLComposerRiP14CMDXMLDocument12TXMLFileType @ 38 NONAME ; CMDXMLComposer::CalculateFileSize(int &, CMDXMLDocument *, TXMLFileType) + OutputDataL__14CMDXMLComposerRC7TDesC16 @ 39 NONAME R3UNUSED ; CMDXMLComposer::OutputDataL(TDesC16 const &) + SetEntityConverter__12CMDXMLParserP21CMDXMLEntityConverter @ 40 NONAME R3UNUSED ; CMDXMLParser::SetEntityConverter(CMDXMLEntityConverter *) + SetEntityConverter__14CMDXMLComposerP21CMDXMLEntityConverter @ 41 NONAME R3UNUSED ; CMDXMLComposer::SetEntityConverter(CMDXMLEntityConverter *) + ErrorSeverity__C12CMDXMLParser @ 42 NONAME R3UNUSED ; CMDXMLParser::ErrorSeverity(void) const + ErrorSeverity__C14CMDXMLComposer @ 43 NONAME R3UNUSED ; CMDXMLComposer::ErrorSeverity(void) const + ParseSource__12CMDXMLParserP24MMDXMLParserDataProvider @ 44 NONAME R3UNUSED ; CMDXMLParser::ParseSource(MMDXMLParserDataProvider *) + SetSourceCharacterWidth__12CMDXMLParserQ212CMDXMLParser26TMDXMLParserInputCharWidth @ 45 NONAME R3UNUSED ; CMDXMLParser::SetSourceCharacterWidth(CMDXMLParser::TMDXMLParserInputCharWidth) SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + SetStoreInvalid__12CMDXMLParseri @ 46 NONAME R3UNUSED ; CMDXMLParser::SetStoreInvalid(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bwins/V2_XMLPARSERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bwins/V2_XMLPARSERU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +EXPORTS + ?PlaceholderForRemovedExport1@CMDXMLComposer@@AAEXPAVMMDXMLComposerObserver@@@Z @ 1 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport1(class MMDXMLComposerObserver *) + ??0CMDXMLEntityConverter@@QAE@XZ @ 2 NONAME ; public: __thiscall CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ?PlaceholderForRemovedExport1@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@@Z @ 3 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport1(class MMDXMLParserObserver *) + ?PlaceholderForRemovedExport2@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 4 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport2(class MMDXMLParserObserver *,class MXMLDtd *) + ??1CMDXMLComposer@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CMDXMLComposer::~CMDXMLComposer(void) + ??1CMDXMLEntityConverter@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + ??1CMDXMLParser@@UAE@XZ @ 7 NONAME ; public: virtual __thiscall CMDXMLParser::~CMDXMLParser(void) + ?PlaceholderForRemovedExport2@CMDXMLComposer@@AAEXXZ @ 8 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport2(void) + ?ComposeEndTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 9 NONAME ; private: int __thiscall CMDXMLComposer::ComposeEndTagL(class CMDXMLNode &) + ?ComposeFile@CMDXMLComposer@@QAEHVRFs@@ABVTDesC16@@PAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 10 NONAME ; public: int __thiscall CMDXMLComposer::ComposeFile(class RFs,class TDesC16 const &,class CMDXMLDocument *,enum TXMLFileType) + ?ComposeStartTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 11 NONAME ; private: int __thiscall CMDXMLComposer::ComposeStartTagL(class CMDXMLNode &) + ?DetachXMLDoc@CMDXMLParser@@QAEPAVCMDXMLDocument@@XZ @ 12 NONAME ; public: class CMDXMLDocument * __thiscall CMDXMLParser::DetachXMLDoc(void) + ?DoCancel@CMDXMLComposer@@EAEXXZ @ 13 NONAME ; private: virtual void __thiscall CMDXMLComposer::DoCancel(void) + ?DoCancel@CMDXMLParser@@EAEXXZ @ 14 NONAME ; private: virtual void __thiscall CMDXMLParser::DoCancel(void) + ?E32Dll@@YAHW4TDllReason@@@Z @ 15 NONAME ABSENT ; int __cdecl E32Dll(enum TDllReason) + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 16 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 17 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 18 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *,class MXMLDtd *) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 19 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 20 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 21 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *,class MXMLDtd *) + ?OutputAttributeL@CMDXMLComposer@@QAEHABVTDesC16@@0@Z @ 22 NONAME ; public: int __thiscall CMDXMLComposer::OutputAttributeL(class TDesC16 const &,class TDesC16 const &) + ?OutputComposedTextL@CMDXMLEntityConverter@@UAEHPAVCMDXMLComposer@@ABVTDesC16@@@Z @ 23 NONAME ; public: virtual int __thiscall CMDXMLEntityConverter::OutputComposedTextL(class CMDXMLComposer *,class TDesC16 const &) + ?OutputEndOfElementTagL@CMDXMLComposer@@QAEHH@Z @ 24 NONAME ; public: int __thiscall CMDXMLComposer::OutputEndOfElementTagL(int) + ?OutputStartOfElementTagL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 25 NONAME ; public: int __thiscall CMDXMLComposer::OutputStartOfElementTagL(class TDesC16 const &) + ?ParseFile@CMDXMLParser@@QAEHVRFs@@ABVTDesC16@@@Z @ 26 NONAME ; public: int __thiscall CMDXMLParser::ParseFile(class RFs,class TDesC16 const &) + ?RunError@CMDXMLComposer@@EAEHH@Z @ 27 NONAME ; private: virtual int __thiscall CMDXMLComposer::RunError(int) + ?RunError@CMDXMLParser@@EAEHH@Z @ 28 NONAME ; private: virtual int __thiscall CMDXMLParser::RunError(int) + ?PlaceholderForRemovedExport3@CMDXMLComposer@@AAEXXZ @ 29 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport3(void) + ?PlaceholderForRemovedExport3@CMDXMLParser@@AAEXXZ @ 30 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport3(void) + ?SetError@CMDXMLComposer@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 31 NONAME ; private: void __thiscall CMDXMLComposer::SetError(int,enum TXMLErrorCodeSeverity) + ?SetError@CMDXMLParser@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 32 NONAME ; private: void __thiscall CMDXMLParser::SetError(int,enum TXMLErrorCodeSeverity) + ?Error@CMDXMLComposer@@QBEHXZ @ 33 NONAME ; int CMDXMLComposer::Error(void) const + ?Error@CMDXMLParser@@QBEHXZ @ 34 NONAME ; int CMDXMLParser::Error(void) const + ?EntityConverter@CMDXMLComposer@@QBEPAVCMDXMLEntityConverter@@XZ @ 35 NONAME ; public: class CMDXMLEntityConverter * __thiscall CMDXMLComposer::EntityConverter(void)const + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 36 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *,int) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 37 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *,int) + ?CalculateFileSize@CMDXMLComposer@@QAEHAAHPAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 38 NONAME ; public: int __thiscall CMDXMLComposer::CalculateFileSize(int &,class CMDXMLDocument *,enum TXMLFileType) + ?OutputDataL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 39 NONAME ; public: int __thiscall CMDXMLComposer::OutputDataL(class TDesC16 const &) + ?SetEntityConverter@CMDXMLComposer@@QAEXPAVCMDXMLEntityConverter@@@Z @ 40 NONAME ; public: void __thiscall CMDXMLComposer::SetEntityConverter(class CMDXMLEntityConverter *) + ?SetEntityConverter@CMDXMLParser@@QAEXPAVCMDXMLEntityConverter@@@Z @ 41 NONAME ; public: void __thiscall CMDXMLParser::SetEntityConverter(class CMDXMLEntityConverter *) + ?ErrorSeverity@CMDXMLComposer@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 42 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLComposer::ErrorSeverity(void)const + ?ErrorSeverity@CMDXMLParser@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 43 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLParser::ErrorSeverity(void)const + ?ParseSourceL@CMDXMLParser@@QAEXPAVMMDXMLParserDataProvider@@@Z @ 44 NONAME ; void CMDXMLParser::ParseSourceL(class MMDXMLParserDataProvider *) + ?SetSourceCharacterWidth@CMDXMLParser@@QAEXW4TMDXMLParserInputCharWidth@1@@Z @ 45 NONAME ; public: void __thiscall CMDXMLParser::SetSourceCharacterWidth(enum CMDXMLParser::TMDXMLParserInputCharWidth) + ?SetStoreInvalid@CMDXMLParser@@QAEXH@Z @ 46 NONAME ; void CMDXMLParser::SetStoreInvalid(int) + ?ComposeFile@CMDXMLComposer@@QAEHAAVRFile@@PAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 47 NONAME ; int CMDXMLComposer::ComposeFile(class RFile &, class CMDXMLDocument *, enum TXMLFileType) + ?ParseFile@CMDXMLParser@@QAEHAAVRFile@@@Z @ 48 NONAME ; int CMDXMLParser::ParseFile(class RFile &) + ?SetWhiteSpaceHandlingMode@CMDXMLParser@@QAEXH@Z @ 49 NONAME ; void CMDXMLParser::SetWhiteSpaceHandlingMode(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bwins/XMLPARSERU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bwins/XMLPARSERU.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + ?PlaceholderForRemovedExport1@CMDXMLComposer@@AAEXPAVMMDXMLComposerObserver@@@Z @ 1 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport1(class MMDXMLComposerObserver *) + ??0CMDXMLEntityConverter@@QAE@XZ @ 2 NONAME ; public: __thiscall CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ?PlaceholderForRemovedExport1@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@@Z @ 3 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport1(class MMDXMLParserObserver *) + ?PlaceholderForRemovedExport2@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 4 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport2(class MMDXMLParserObserver *,class MXMLDtd *) + ??1CMDXMLComposer@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CMDXMLComposer::~CMDXMLComposer(void) + ??1CMDXMLEntityConverter@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + ??1CMDXMLParser@@UAE@XZ @ 7 NONAME ; public: virtual __thiscall CMDXMLParser::~CMDXMLParser(void) + ?PlaceholderForRemovedExport2@CMDXMLComposer@@AAEXXZ @ 8 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport2(void) + ?ComposeEndTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 9 NONAME ; private: int __thiscall CMDXMLComposer::ComposeEndTagL(class CMDXMLNode &) + ?ComposeFile@CMDXMLComposer@@QAEHVRFs@@ABVTDesC16@@PAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 10 NONAME ; public: int __thiscall CMDXMLComposer::ComposeFile(class RFs,class TDesC16 const &,class CMDXMLDocument *,enum TXMLFileType) + ?ComposeStartTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 11 NONAME ; private: int __thiscall CMDXMLComposer::ComposeStartTagL(class CMDXMLNode &) + ?DetachXMLDoc@CMDXMLParser@@QAEPAVCMDXMLDocument@@XZ @ 12 NONAME ; public: class CMDXMLDocument * __thiscall CMDXMLParser::DetachXMLDoc(void) + ?DoCancel@CMDXMLComposer@@EAEXXZ @ 13 NONAME ; private: virtual void __thiscall CMDXMLComposer::DoCancel(void) + ?DoCancel@CMDXMLParser@@EAEXXZ @ 14 NONAME ; private: virtual void __thiscall CMDXMLParser::DoCancel(void) + ?E32Dll@@YAHW4TDllReason@@@Z @ 15 NONAME ; int __cdecl E32Dll(enum TDllReason) + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 16 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 17 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 18 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *,class MXMLDtd *) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 19 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 20 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 21 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *,class MXMLDtd *) + ?OutputAttributeL@CMDXMLComposer@@QAEHABVTDesC16@@0@Z @ 22 NONAME ; public: int __thiscall CMDXMLComposer::OutputAttributeL(class TDesC16 const &,class TDesC16 const &) + ?OutputComposedTextL@CMDXMLEntityConverter@@UAEHPAVCMDXMLComposer@@ABVTDesC16@@@Z @ 23 NONAME ; public: virtual int __thiscall CMDXMLEntityConverter::OutputComposedTextL(class CMDXMLComposer *,class TDesC16 const &) + ?OutputEndOfElementTagL@CMDXMLComposer@@QAEHH@Z @ 24 NONAME ; public: int __thiscall CMDXMLComposer::OutputEndOfElementTagL(int) + ?OutputStartOfElementTagL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 25 NONAME ; public: int __thiscall CMDXMLComposer::OutputStartOfElementTagL(class TDesC16 const &) + ?ParseFile@CMDXMLParser@@QAEHVRFs@@ABVTDesC16@@@Z @ 26 NONAME ; public: int __thiscall CMDXMLParser::ParseFile(class RFs,class TDesC16 const &) + ?RunError@CMDXMLComposer@@EAEHH@Z @ 27 NONAME ; private: virtual int __thiscall CMDXMLComposer::RunError(int) + ?RunError@CMDXMLParser@@EAEHH@Z @ 28 NONAME ; private: virtual int __thiscall CMDXMLParser::RunError(int) + ?PlaceholderForRemovedExport3@CMDXMLComposer@@AAEXXZ @ 29 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport3(void) + ?PlaceholderForRemovedExport3@CMDXMLParser@@AAEXXZ @ 30 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport3(void) + ?SetError@CMDXMLComposer@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 31 NONAME ; private: void __thiscall CMDXMLComposer::SetError(int,enum TXMLErrorCodeSeverity) + ?SetError@CMDXMLParser@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 32 NONAME ; private: void __thiscall CMDXMLParser::SetError(int,enum TXMLErrorCodeSeverity) + ?Error@CMDXMLComposer@@QBEHXZ @ 33 NONAME ; int CMDXMLComposer::Error(void) const + ?Error@CMDXMLParser@@QBEHXZ @ 34 NONAME ; int CMDXMLParser::Error(void) const + ?EntityConverter@CMDXMLComposer@@QBEPAVCMDXMLEntityConverter@@XZ @ 35 NONAME ; public: class CMDXMLEntityConverter * __thiscall CMDXMLComposer::EntityConverter(void)const + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 36 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *,int) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 37 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *,int) + ?CalculateFileSize@CMDXMLComposer@@QAEHAAHPAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 38 NONAME ; public: int __thiscall CMDXMLComposer::CalculateFileSize(int &,class CMDXMLDocument *,enum TXMLFileType) + ?OutputDataL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 39 NONAME ; public: int __thiscall CMDXMLComposer::OutputDataL(class TDesC16 const &) + ?SetEntityConverter@CMDXMLComposer@@QAEXPAVCMDXMLEntityConverter@@@Z @ 40 NONAME ; public: void __thiscall CMDXMLComposer::SetEntityConverter(class CMDXMLEntityConverter *) + ?SetEntityConverter@CMDXMLParser@@QAEXPAVCMDXMLEntityConverter@@@Z @ 41 NONAME ; public: void __thiscall CMDXMLParser::SetEntityConverter(class CMDXMLEntityConverter *) + ?ErrorSeverity@CMDXMLComposer@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 42 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLComposer::ErrorSeverity(void)const + ?ErrorSeverity@CMDXMLParser@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 43 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLParser::ErrorSeverity(void)const + ?ParseSource@CMDXMLParser@@QAEXPAVMMDXMLParserDataProvider@@@Z @ 44 NONAME ; public: void __thiscall CMDXMLParser::ParseSource(class MMDXMLParserDataProvider *) + ?SetSourceCharacterWidth@CMDXMLParser@@QAEXW4TMDXMLParserInputCharWidth@1@@Z @ 45 NONAME ; public: void __thiscall CMDXMLParser::SetSourceCharacterWidth(enum CMDXMLParser::TMDXMLParserInputCharWidth) + ?SetStoreInvalid@CMDXMLParser@@QAEXH@Z @ 46 NONAME ; void CMDXMLParser::SetStoreInvalid(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/bwins/v1.5_xmlparserU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/bwins/v1.5_xmlparserU.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + ?PlaceholderForRemovedExport1@CMDXMLComposer@@AAEXPAVMMDXMLComposerObserver@@@Z @ 1 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport1(class MMDXMLComposerObserver *) + ??0CMDXMLEntityConverter@@QAE@XZ @ 2 NONAME ; public: __thiscall CMDXMLEntityConverter::CMDXMLEntityConverter(void) + ?PlaceholderForRemovedExport1@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@@Z @ 3 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport1(class MMDXMLParserObserver *) + ?PlaceholderForRemovedExport2@CMDXMLParser@@AAEXPAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 4 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport2(class MMDXMLParserObserver *,class MXMLDtd *) + ??1CMDXMLComposer@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall CMDXMLComposer::~CMDXMLComposer(void) + ??1CMDXMLEntityConverter@@UAE@XZ @ 6 NONAME ; public: virtual __thiscall CMDXMLEntityConverter::~CMDXMLEntityConverter(void) + ??1CMDXMLParser@@UAE@XZ @ 7 NONAME ; public: virtual __thiscall CMDXMLParser::~CMDXMLParser(void) + ?PlaceholderForRemovedExport2@CMDXMLComposer@@AAEXXZ @ 8 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport2(void) + ?ComposeEndTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 9 NONAME ; private: int __thiscall CMDXMLComposer::ComposeEndTagL(class CMDXMLNode &) + ?ComposeFile@CMDXMLComposer@@QAEHVRFs@@ABVTDesC16@@PAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 10 NONAME ; public: int __thiscall CMDXMLComposer::ComposeFile(class RFs,class TDesC16 const &,class CMDXMLDocument *,enum TXMLFileType) + ?ComposeStartTagL@CMDXMLComposer@@AAEHAAVCMDXMLNode@@@Z @ 11 NONAME ; private: int __thiscall CMDXMLComposer::ComposeStartTagL(class CMDXMLNode &) + ?DetachXMLDoc@CMDXMLParser@@QAEPAVCMDXMLDocument@@XZ @ 12 NONAME ; public: class CMDXMLDocument * __thiscall CMDXMLParser::DetachXMLDoc(void) + ?DoCancel@CMDXMLComposer@@EAEXXZ @ 13 NONAME ; private: virtual void __thiscall CMDXMLComposer::DoCancel(void) + ?DoCancel@CMDXMLParser@@EAEXXZ @ 14 NONAME ; private: virtual void __thiscall CMDXMLParser::DoCancel(void) + ?E32Dll@@YAHW4TDllReason@@@Z @ 15 NONAME ABSENT ; int __cdecl E32Dll(enum TDllReason) + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 16 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 17 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *) + ?NewL@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 18 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewL(class MMDXMLParserObserver *,class MXMLDtd *) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@@Z @ 19 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@@Z @ 20 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *) + ?NewLC@CMDXMLParser@@SAPAV1@PAVMMDXMLParserObserver@@PAVMXMLDtd@@@Z @ 21 NONAME ; public: static class CMDXMLParser * __cdecl CMDXMLParser::NewLC(class MMDXMLParserObserver *,class MXMLDtd *) + ?OutputAttributeL@CMDXMLComposer@@QAEHABVTDesC16@@0@Z @ 22 NONAME ; public: int __thiscall CMDXMLComposer::OutputAttributeL(class TDesC16 const &,class TDesC16 const &) + ?OutputComposedTextL@CMDXMLEntityConverter@@UAEHPAVCMDXMLComposer@@ABVTDesC16@@@Z @ 23 NONAME ; public: virtual int __thiscall CMDXMLEntityConverter::OutputComposedTextL(class CMDXMLComposer *,class TDesC16 const &) + ?OutputEndOfElementTagL@CMDXMLComposer@@QAEHH@Z @ 24 NONAME ; public: int __thiscall CMDXMLComposer::OutputEndOfElementTagL(int) + ?OutputStartOfElementTagL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 25 NONAME ; public: int __thiscall CMDXMLComposer::OutputStartOfElementTagL(class TDesC16 const &) + ?ParseFile@CMDXMLParser@@QAEHVRFs@@ABVTDesC16@@@Z @ 26 NONAME ; public: int __thiscall CMDXMLParser::ParseFile(class RFs,class TDesC16 const &) + ?RunError@CMDXMLComposer@@EAEHH@Z @ 27 NONAME ; private: virtual int __thiscall CMDXMLComposer::RunError(int) + ?RunError@CMDXMLParser@@EAEHH@Z @ 28 NONAME ; private: virtual int __thiscall CMDXMLParser::RunError(int) + ?PlaceholderForRemovedExport3@CMDXMLComposer@@AAEXXZ @ 29 NONAME ; private: void __thiscall CMDXMLComposer::PlaceholderForRemovedExport3(void) + ?PlaceholderForRemovedExport3@CMDXMLParser@@AAEXXZ @ 30 NONAME ; private: void __thiscall CMDXMLParser::PlaceholderForRemovedExport3(void) + ?SetError@CMDXMLComposer@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 31 NONAME ; private: void __thiscall CMDXMLComposer::SetError(int,enum TXMLErrorCodeSeverity) + ?SetError@CMDXMLParser@@AAEXHW4TXMLErrorCodeSeverity@@@Z @ 32 NONAME ; private: void __thiscall CMDXMLParser::SetError(int,enum TXMLErrorCodeSeverity) + ?Error@CMDXMLComposer@@QBEHXZ @ 33 NONAME ; int CMDXMLComposer::Error(void) const + ?Error@CMDXMLParser@@QBEHXZ @ 34 NONAME ; int CMDXMLParser::Error(void) const + ?EntityConverter@CMDXMLComposer@@QBEPAVCMDXMLEntityConverter@@XZ @ 35 NONAME ; public: class CMDXMLEntityConverter * __thiscall CMDXMLComposer::EntityConverter(void)const + ?NewL@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 36 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewL(class MMDXMLComposerObserver *,int) + ?NewLC@CMDXMLComposer@@SAPAV1@PAVMMDXMLComposerObserver@@H@Z @ 37 NONAME ; public: static class CMDXMLComposer * __cdecl CMDXMLComposer::NewLC(class MMDXMLComposerObserver *,int) + ?CalculateFileSize@CMDXMLComposer@@QAEHAAHPAVCMDXMLDocument@@W4TXMLFileType@@@Z @ 38 NONAME ; public: int __thiscall CMDXMLComposer::CalculateFileSize(int &,class CMDXMLDocument *,enum TXMLFileType) + ?OutputDataL@CMDXMLComposer@@QAEHABVTDesC16@@@Z @ 39 NONAME ; public: int __thiscall CMDXMLComposer::OutputDataL(class TDesC16 const &) + ?SetEntityConverter@CMDXMLComposer@@QAEXPAVCMDXMLEntityConverter@@@Z @ 40 NONAME ; public: void __thiscall CMDXMLComposer::SetEntityConverter(class CMDXMLEntityConverter *) + ?SetEntityConverter@CMDXMLParser@@QAEXPAVCMDXMLEntityConverter@@@Z @ 41 NONAME ; public: void __thiscall CMDXMLParser::SetEntityConverter(class CMDXMLEntityConverter *) + ?ErrorSeverity@CMDXMLComposer@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 42 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLComposer::ErrorSeverity(void)const + ?ErrorSeverity@CMDXMLParser@@QBE?AW4TXMLErrorCodeSeverity@@XZ @ 43 NONAME ; public: enum TXMLErrorCodeSeverity __thiscall CMDXMLParser::ErrorSeverity(void)const + ?ParseSource@CMDXMLParser@@QAEXPAVMMDXMLParserDataProvider@@@Z @ 44 NONAME ; public: void __thiscall CMDXMLParser::ParseSource(class MMDXMLParserDataProvider *) + ?SetSourceCharacterWidth@CMDXMLParser@@QAEXW4TMDXMLParserInputCharWidth@1@@Z @ 45 NONAME ; public: void __thiscall CMDXMLParser::SetSourceCharacterWidth(enum CMDXMLParser::TMDXMLParserInputCharWidth) + ?SetStoreInvalid@CMDXMLParser@@QAEXH@Z @ 46 NONAME ; void CMDXMLParser::SetStoreInvalid(int) + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/eabi/v1.5_xmlparseru.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/eabi/v1.5_xmlparseru.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +EXPORTS + _Z6E32Dll10TDllReason @ 1 NONAME ABSENT + _ZN12CMDXMLParser11ParseSourceEP24MMDXMLParserDataProvider @ 2 NONAME + _ZN12CMDXMLParser12DetachXMLDocEv @ 3 NONAME + _ZN12CMDXMLParser15SetStoreInvalidEi @ 4 NONAME + _ZN12CMDXMLParser18SetEntityConverterEP21CMDXMLEntityConverter @ 5 NONAME + _ZN12CMDXMLParser23SetSourceCharacterWidthENS_26TMDXMLParserInputCharWidthE @ 6 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport1EP20MMDXMLParserObserver @ 7 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport2EP20MMDXMLParserObserverP7MXMLDtd @ 8 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport3Ev @ 9 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserver @ 10 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserverP7MXMLDtd @ 11 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserver @ 12 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME + _ZN12CMDXMLParser8DoCancelEv @ 14 NONAME + _ZN12CMDXMLParser8RunErrorEi @ 15 NONAME + _ZN12CMDXMLParser8SetErrorEi21TXMLErrorCodeSeverity @ 16 NONAME + _ZN12CMDXMLParser9ParseFileE3RFsRK7TDesC16 @ 17 NONAME + _ZN12CMDXMLParserD0Ev @ 18 NONAME + _ZN12CMDXMLParserD1Ev @ 19 NONAME + _ZN12CMDXMLParserD2Ev @ 20 NONAME + _ZN14CMDXMLComposer11ComposeFileE3RFsRK7TDesC16P14CMDXMLDocument12TXMLFileType @ 21 NONAME + _ZN14CMDXMLComposer11OutputDataLERK7TDesC16 @ 22 NONAME + _ZN14CMDXMLComposer14ComposeEndTagLER10CMDXMLNode @ 23 NONAME + _ZN14CMDXMLComposer16ComposeStartTagLER10CMDXMLNode @ 24 NONAME + _ZN14CMDXMLComposer16OutputAttributeLERK7TDesC16S2_ @ 25 NONAME + _ZN14CMDXMLComposer17CalculateFileSizeERiP14CMDXMLDocument12TXMLFileType @ 26 NONAME + _ZN14CMDXMLComposer18SetEntityConverterEP21CMDXMLEntityConverter @ 27 NONAME + _ZN14CMDXMLComposer22OutputEndOfElementTagLEi @ 28 NONAME + _ZN14CMDXMLComposer24OutputStartOfElementTagLERK7TDesC16 @ 29 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport1EP22MMDXMLComposerObserver @ 30 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport2Ev @ 31 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport3Ev @ 32 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserver @ 33 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserveri @ 34 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserver @ 35 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserveri @ 36 NONAME + _ZN14CMDXMLComposer8DoCancelEv @ 37 NONAME + _ZN14CMDXMLComposer8RunErrorEi @ 38 NONAME + _ZN14CMDXMLComposer8SetErrorEi21TXMLErrorCodeSeverity @ 39 NONAME + _ZN14CMDXMLComposerD0Ev @ 40 NONAME + _ZN14CMDXMLComposerD1Ev @ 41 NONAME + _ZN14CMDXMLComposerD2Ev @ 42 NONAME + _ZN21CMDXMLEntityConverter19OutputComposedTextLEP14CMDXMLComposerRK7TDesC16 @ 43 NONAME + _ZN21CMDXMLEntityConverterC1Ev @ 44 NONAME + _ZN21CMDXMLEntityConverterC2Ev @ 45 NONAME + _ZN21CMDXMLEntityConverterD0Ev @ 46 NONAME + _ZN21CMDXMLEntityConverterD1Ev @ 47 NONAME + _ZN21CMDXMLEntityConverterD2Ev @ 48 NONAME + _ZNK12CMDXMLParser13ErrorSeverityEv @ 49 NONAME + _ZNK12CMDXMLParser5ErrorEv @ 50 NONAME + _ZNK14CMDXMLComposer13ErrorSeverityEv @ 51 NONAME + _ZNK14CMDXMLComposer15EntityConverterEv @ 52 NONAME + _ZNK14CMDXMLComposer5ErrorEv @ 53 NONAME + _ZTI12CMDXMLParser @ 54 NONAME ; ## + _ZTI14CMDXMLComposer @ 55 NONAME ; ## + _ZTI21CMDXMLEntityConverter @ 56 NONAME ; ## + _ZTV12CMDXMLParser @ 57 NONAME ; ## + _ZTV14CMDXMLComposer @ 58 NONAME ; ## + _ZTV21CMDXMLEntityConverter @ 59 NONAME ; ## + _ZTI26CMDXMLParserFileDataSource @ 60 NONAME ; ## + _ZTV26CMDXMLParserFileDataSource @ 61 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/eabi/v2_xmlparseru.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/eabi/v2_xmlparseru.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +EXPORTS + _Z6E32Dll10TDllReason @ 1 NONAME ABSENT + _ZN12CMDXMLParser12ParseSourceLEP24MMDXMLParserDataProvider @ 2 NONAME + _ZN12CMDXMLParser12DetachXMLDocEv @ 3 NONAME + _ZN12CMDXMLParser15SetStoreInvalidEi @ 4 NONAME + _ZN12CMDXMLParser18SetEntityConverterEP21CMDXMLEntityConverter @ 5 NONAME + _ZN12CMDXMLParser23SetSourceCharacterWidthENS_26TMDXMLParserInputCharWidthE @ 6 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport1EP20MMDXMLParserObserver @ 7 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport2EP20MMDXMLParserObserverP7MXMLDtd @ 8 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport3Ev @ 9 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserver @ 10 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserverP7MXMLDtd @ 11 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserver @ 12 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME + _ZN12CMDXMLParser8DoCancelEv @ 14 NONAME + _ZN12CMDXMLParser8RunErrorEi @ 15 NONAME + _ZN12CMDXMLParser8SetErrorEi21TXMLErrorCodeSeverity @ 16 NONAME + _ZN12CMDXMLParser9ParseFileE3RFsRK7TDesC16 @ 17 NONAME + _ZN12CMDXMLParserD0Ev @ 18 NONAME + _ZN12CMDXMLParserD1Ev @ 19 NONAME + _ZN12CMDXMLParserD2Ev @ 20 NONAME + _ZN14CMDXMLComposer11ComposeFileE3RFsRK7TDesC16P14CMDXMLDocument12TXMLFileType @ 21 NONAME + _ZN14CMDXMLComposer11OutputDataLERK7TDesC16 @ 22 NONAME + _ZN14CMDXMLComposer14ComposeEndTagLER10CMDXMLNode @ 23 NONAME + _ZN14CMDXMLComposer16ComposeStartTagLER10CMDXMLNode @ 24 NONAME + _ZN14CMDXMLComposer16OutputAttributeLERK7TDesC16S2_ @ 25 NONAME + _ZN14CMDXMLComposer17CalculateFileSizeERiP14CMDXMLDocument12TXMLFileType @ 26 NONAME + _ZN14CMDXMLComposer18SetEntityConverterEP21CMDXMLEntityConverter @ 27 NONAME + _ZN14CMDXMLComposer22OutputEndOfElementTagLEi @ 28 NONAME + _ZN14CMDXMLComposer24OutputStartOfElementTagLERK7TDesC16 @ 29 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport1EP22MMDXMLComposerObserver @ 30 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport2Ev @ 31 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport3Ev @ 32 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserver @ 33 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserveri @ 34 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserver @ 35 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserveri @ 36 NONAME + _ZN14CMDXMLComposer8DoCancelEv @ 37 NONAME + _ZN14CMDXMLComposer8RunErrorEi @ 38 NONAME + _ZN14CMDXMLComposer8SetErrorEi21TXMLErrorCodeSeverity @ 39 NONAME + _ZN14CMDXMLComposerD0Ev @ 40 NONAME + _ZN14CMDXMLComposerD1Ev @ 41 NONAME + _ZN14CMDXMLComposerD2Ev @ 42 NONAME + _ZN21CMDXMLEntityConverter19OutputComposedTextLEP14CMDXMLComposerRK7TDesC16 @ 43 NONAME + _ZN21CMDXMLEntityConverterC1Ev @ 44 NONAME + _ZN21CMDXMLEntityConverterC2Ev @ 45 NONAME + _ZN21CMDXMLEntityConverterD0Ev @ 46 NONAME + _ZN21CMDXMLEntityConverterD1Ev @ 47 NONAME + _ZN21CMDXMLEntityConverterD2Ev @ 48 NONAME + _ZNK12CMDXMLParser13ErrorSeverityEv @ 49 NONAME + _ZNK12CMDXMLParser5ErrorEv @ 50 NONAME + _ZNK14CMDXMLComposer13ErrorSeverityEv @ 51 NONAME + _ZNK14CMDXMLComposer15EntityConverterEv @ 52 NONAME + _ZNK14CMDXMLComposer5ErrorEv @ 53 NONAME + _ZTI12CMDXMLParser @ 54 NONAME ; ## + _ZTI14CMDXMLComposer @ 55 NONAME ; ## + _ZTI21CMDXMLEntityConverter @ 56 NONAME ; ## + _ZTV12CMDXMLParser @ 57 NONAME ; ## + _ZTV14CMDXMLComposer @ 58 NONAME ; ## + _ZTV21CMDXMLEntityConverter @ 59 NONAME ; ## + _ZTI26CMDXMLParserFileDataSource @ 60 NONAME ; ## + _ZTV26CMDXMLParserFileDataSource @ 61 NONAME ; ## + _ZN12CMDXMLParser9ParseFileER5RFile @ 62 NONAME + _ZN14CMDXMLComposer11ComposeFileER5RFileP14CMDXMLDocument12TXMLFileType @ 63 NONAME + _ZN12CMDXMLParser25SetWhiteSpaceHandlingModeEi @ 64 NONAME + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/eabi/xmlparseru.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/eabi/xmlparseru.DEF Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +EXPORTS + _Z6E32Dll10TDllReason @ 1 NONAME + _ZN12CMDXMLParser11ParseSourceEP24MMDXMLParserDataProvider @ 2 NONAME + _ZN12CMDXMLParser12DetachXMLDocEv @ 3 NONAME + _ZN12CMDXMLParser15SetStoreInvalidEi @ 4 NONAME + _ZN12CMDXMLParser18SetEntityConverterEP21CMDXMLEntityConverter @ 5 NONAME + _ZN12CMDXMLParser23SetSourceCharacterWidthENS_26TMDXMLParserInputCharWidthE @ 6 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport1EP20MMDXMLParserObserver @ 7 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport2EP20MMDXMLParserObserverP7MXMLDtd @ 8 NONAME + _ZN12CMDXMLParser28PlaceholderForRemovedExport3Ev @ 9 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserver @ 10 NONAME + _ZN12CMDXMLParser4NewLEP20MMDXMLParserObserverP7MXMLDtd @ 11 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserver @ 12 NONAME + _ZN12CMDXMLParser5NewLCEP20MMDXMLParserObserverP7MXMLDtd @ 13 NONAME + _ZN12CMDXMLParser8DoCancelEv @ 14 NONAME + _ZN12CMDXMLParser8RunErrorEi @ 15 NONAME + _ZN12CMDXMLParser8SetErrorEi21TXMLErrorCodeSeverity @ 16 NONAME + _ZN12CMDXMLParser9ParseFileE3RFsRK7TDesC16 @ 17 NONAME + _ZN12CMDXMLParserD0Ev @ 18 NONAME + _ZN12CMDXMLParserD1Ev @ 19 NONAME + _ZN12CMDXMLParserD2Ev @ 20 NONAME + _ZN14CMDXMLComposer11ComposeFileE3RFsRK7TDesC16P14CMDXMLDocument12TXMLFileType @ 21 NONAME + _ZN14CMDXMLComposer11OutputDataLERK7TDesC16 @ 22 NONAME + _ZN14CMDXMLComposer14ComposeEndTagLER10CMDXMLNode @ 23 NONAME + _ZN14CMDXMLComposer16ComposeStartTagLER10CMDXMLNode @ 24 NONAME + _ZN14CMDXMLComposer16OutputAttributeLERK7TDesC16S2_ @ 25 NONAME + _ZN14CMDXMLComposer17CalculateFileSizeERiP14CMDXMLDocument12TXMLFileType @ 26 NONAME + _ZN14CMDXMLComposer18SetEntityConverterEP21CMDXMLEntityConverter @ 27 NONAME + _ZN14CMDXMLComposer22OutputEndOfElementTagLEi @ 28 NONAME + _ZN14CMDXMLComposer24OutputStartOfElementTagLERK7TDesC16 @ 29 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport1EP22MMDXMLComposerObserver @ 30 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport2Ev @ 31 NONAME + _ZN14CMDXMLComposer28PlaceholderForRemovedExport3Ev @ 32 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserver @ 33 NONAME + _ZN14CMDXMLComposer4NewLEP22MMDXMLComposerObserveri @ 34 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserver @ 35 NONAME + _ZN14CMDXMLComposer5NewLCEP22MMDXMLComposerObserveri @ 36 NONAME + _ZN14CMDXMLComposer8DoCancelEv @ 37 NONAME + _ZN14CMDXMLComposer8RunErrorEi @ 38 NONAME + _ZN14CMDXMLComposer8SetErrorEi21TXMLErrorCodeSeverity @ 39 NONAME + _ZN14CMDXMLComposerD0Ev @ 40 NONAME + _ZN14CMDXMLComposerD1Ev @ 41 NONAME + _ZN14CMDXMLComposerD2Ev @ 42 NONAME + _ZN21CMDXMLEntityConverter19OutputComposedTextLEP14CMDXMLComposerRK7TDesC16 @ 43 NONAME + _ZN21CMDXMLEntityConverterC1Ev @ 44 NONAME + _ZN21CMDXMLEntityConverterC2Ev @ 45 NONAME + _ZN21CMDXMLEntityConverterD0Ev @ 46 NONAME + _ZN21CMDXMLEntityConverterD1Ev @ 47 NONAME + _ZN21CMDXMLEntityConverterD2Ev @ 48 NONAME + _ZNK12CMDXMLParser13ErrorSeverityEv @ 49 NONAME + _ZNK12CMDXMLParser5ErrorEv @ 50 NONAME + _ZNK14CMDXMLComposer13ErrorSeverityEv @ 51 NONAME + _ZNK14CMDXMLComposer15EntityConverterEv @ 52 NONAME + _ZNK14CMDXMLComposer5ErrorEv @ 53 NONAME + _ZTI12CMDXMLParser @ 54 NONAME ; ## + _ZTI14CMDXMLComposer @ 55 NONAME ; ## + _ZTI21CMDXMLEntityConverter @ 56 NONAME ; ## + _ZTV12CMDXMLParser @ 57 NONAME ; ## + _ZTV14CMDXMLComposer @ 58 NONAME ; ## + _ZTV21CMDXMLEntityConverter @ 59 NONAME ; ## + _ZTI26CMDXMLParserFileDataSource @ 60 NONAME ; ## + _ZTV26CMDXMLParserFileDataSource @ 61 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/GmxmlTest.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/GmxmlTest.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +This is a test file for t_gmxmlfailure test harness. \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,324 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +#include "GmxmlTestUtils.h" + + +_LIT(KMsvTestFileOutputBase,"MsgLogs"); + +// this is used if we can't find MsgLogs anywhere +_LIT(KMsvTestFileDefaultOutputBase,"\\MsgLogs\\"); +_LIT(KMsvPathSep,"\\"); +#define KMaxLogLineLength 256 + + + +// +// +// CTestTimer +// +// + + CTestTimer::CTestTimer() +: CTimer(EPriorityLow) + {} + + void CTestTimer::RunL() + { + if (!iReport) + { + CActiveScheduler::Stop(); + } + else + { + User::RequestComplete(iReport, iStatus.Int()); + iReport = NULL; + } + } + + CTestTimer* CTestTimer::NewL() + { + CTestTimer* self = new(ELeave) CTestTimer(); + CleanupStack::PushL(self); + self->ConstructL(); // CTimer + CActiveScheduler::Add(self); + CleanupStack::Pop(); + return self; + } + + void CTestTimer::AfterReq(TTimeIntervalMicroSeconds32 aSec, TRequestStatus& aStatus) + { + iReport = &aStatus; + aStatus = KRequestPending; + After(aSec); + } + + +// +// +// CTestUtils +// +// + + CTestUtils::CTestUtils(RTest& aRTest) +: iRTest(aRTest), iLogToConsole(ETrue), iLogToFile(ETrue) + { + TBuf<256> command; + User::CommandLine(command); + + command.Trim(); + SetRunAuto(command.FindF(KTestShowMenu) == KErrNotFound); + + if (!RunAuto()) + iRTest.Printf(_L("Not Run Auto. Command line: %S\n"), &command); + } + + CTestUtils::~CTestUtils() + { + CloseMainLog(); + iFs.Close(); + } + + void CTestUtils::ConstructL() + { + User::LeaveIfError(iFs.Connect()); + OpenMainLogL(); + WriteToLog(KTestHeader); + } + + void CTestUtils::Printf(TRefByValue aFmt,...) + { + // Print to the log file. + TTestOverflow overflow(*this); + VA_LIST list; + VA_START(list, aFmt); + TBuf<0x100> aBuf; + aBuf.AppendFormatList(aFmt, list, &overflow); + + if (iLogToConsole) + { + iRTest.Printf(aBuf); + } + + if (iLogToFile) + { + WriteComment(aBuf); + } + } + + + void CTestUtils::CreateAllTestDirectories() + { + TChar driveChar=RFs::GetSystemDriveChar(); + TBuf<2> systemDrive; + systemDrive.Append(driveChar); + systemDrive.Append(KDriveDelimiter); + + iFs.SetSessionPath(systemDrive); + + if (!iFs.MkDir(KLogsDir)) + { + Printf(_L("Created c:\\logs\\ directory\n")); + } + } + + TInt CTestUtils::ResolveLogFile(const TDesC& aFileName, TParse& aParseOut) + { + TFileName* savedPath = new TFileName; + TFileName* fileName = new TFileName; + if ((savedPath == NULL) || (fileName == NULL)) + return KErrNoMemory; + + fileName->Append(KMsvPathSep); + fileName->Append(KMsvTestFileOutputBase); + fileName->Append(KMsvPathSep); + + // file finder will look in the session drive first, then Y->A,Z + // so set session drive to Y (save old and restore it afterwards) + iFs.SessionPath(*savedPath); + _LIT(KTopDrive,"Y:\\"); + iFs.SetSessionPath(KTopDrive); + TFindFile file_finder(iFs); + TInt err = file_finder.FindByDir(*fileName,KNullDesC); + + if(err==KErrNone) + { + fileName->Copy(file_finder.File()); + AppendTestName(*fileName); + fileName->Append(KMsvPathSep); + fileName->Append(aFileName); + iFs.MkDirAll(*fileName); + aParseOut.Set(*fileName,NULL,NULL); + } + iFs.SetSessionPath(*savedPath); + delete savedPath; + delete fileName; + return(err); + } + + TBool CTestUtils::RunAuto() const + { + return iRunAuto; +} + + void CTestUtils::SetRunAuto(TBool aRunAuto) + { + iRunAuto = aRunAuto; + } + + +// appends ...log to aFileName; +void CTestUtils::AppendVariantName(TDes& aFileName) + { +#if (defined(__THUMB__) || defined(__MARM_THUMB__)) + aFileName.Append(_L(".THUMB.")); +#endif +#if (defined(__ARMI__) || defined(__MARM_ARMI__)) + aFileName.Append(_L(".ARMI.")); +#endif +#if (defined(__ARM4__) || defined(__MISA__) || defined(__MARM_ARM4__)) + aFileName.Append(_L(".ARM4.")); +#endif +#if defined(__WINSCW__) + aFileName.Append(_L(".WINSCW.")); +#else +#if defined(__WINS__) + aFileName.Append(_L(".WINS.")); +#endif +#endif + +#if defined(_DEBUG) + aFileName.Append(_L("DEB.")); +#else + aFileName.Append(_L("REL.")); +#endif + aFileName.Append(_L("LOG")); + } + +// appends the test harness name to aFileName +void CTestUtils::AppendTestName(TDes &aFileName) + { + TInt start = RProcess().FileName().LocateReverse('\\'); + TInt end = RProcess().FileName().LocateReverse('.'); + + if (end == KErrNotFound) + end = RProcess().FileName().Length(); + + aFileName.Append(RProcess().FileName().Mid(start + 1, end - start - 1)); + } + + + +TInt CTestUtils::OpenMainLogL() + { + _LIT(KDisplayLogFile,"Log File %S\n"); + TParse loglocation; + TFileName logfile; + TInt err=ResolveLogFile(KNullDesC, loglocation); + if(err!=KErrNone) + { + TChar driveChar=RFs::GetSystemDriveChar(); + TBuf<2> systemDrive; + systemDrive.Append(driveChar); + systemDrive.Append(KDriveDelimiter); + TPath pathName(systemDrive) ; + pathName.Append(KMsvTestFileDefaultOutputBase); + iFs.MkDirAll(pathName); + err=ResolveLogFile(KNullDesC, loglocation); + } + User::LeaveIfError(err); + logfile.Copy(loglocation.FullName()); + logfile.Delete(logfile.Length()-1,1); + AppendVariantName(logfile); + iRTest.Printf(KDisplayLogFile, &logfile); + iFs.MkDirAll(logfile); + + iLogBuf=HBufC::NewL(KMaxLogLineLength); + iLogBuf8=HBufC8::NewL(KMaxLogLineLength); + return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny)); + } + +void CTestUtils::CloseMainLog() + { + delete iLogBuf; + iLogBuf=0; + delete iLogBuf8; + iLogBuf8=0; + + iFile.Close(); + } + + + void CTestUtils::TestStart(TInt aTest, const TDesC& aTestDescription) + { + WriteToLog(KTestStartingWithDesc, aTest, &aTestDescription); + } + + + void CTestUtils::TestFinish(TInt aTest, TInt aError) + { + aError ? + WriteToLog(KTestFailed, aTest, aError) + : WriteToLog(KTestPassed, aTest); + } + + + void CTestUtils::TestHarnessCompleted() + { + WriteToLog(KTestHarnessCompleted); + } + + void CTestUtils::TestHarnessFailed(TInt aError) + { + WriteToLog(KTestHarnessFailed, aError); + } + + void CTestUtils::WriteComment(const TDesC& aComment) + { + /* Prepends KTestCommentPrepend to aComment, then writes it to aFlogger */ + + TBuf<0x100> buf; + buf.Copy(aComment); + buf.Trim(); + buf.Insert(0,KTestCommentPrepend); + WriteToLog(buf); + } + +void CTestUtils::WriteToLog(TRefByValue aFmt,...) + { + + _LIT(KDateFormatString, "%D%M%*Y%1%/1%2%/2%3 %H%:1%T%:2%S "); + _LIT(Kcr,"\r\n"); + iLogBuf->Des().Zero(); + TTime date; + date.HomeTime(); + TBuf<18> dateString; + + TRAPD(error,date.FormatL(dateString,(KDateFormatString))); + if(error) + { + dateString.Copy(_L("Invalid Date")); + } + iLogBuf->Des().Copy(dateString); + + VA_LIST list; + VA_START(list,aFmt); + + iLogBuf->Des().AppendFormatList(aFmt,list); + iLogBuf->Des().Append(Kcr); + iLogBuf8->Des().Copy(*iLogBuf); + iFile.Write(*iLogBuf8); + } diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,144 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef GMXML_TEST_UTILS_H_ +#define GMXML_TEST_UTILS_H_ + +#include +#include +#include + + +// Constants + +//Test Harness Logging + +#define KLogsDir _L("c:\\logs\\") +#define KTestHeader _L("Test Results") +#define KTestStartingWithDesc _L("Test %d Starting (%S)") +#define KTestPassed _L("Test %d OK") +#define KTestFailed _L("Test %d FAILED (error = %d)") +#define KTestHarnessCompleted _L("Tests Completed") +#define KTestHarnessFailed _L("Tests FAILED (error = %d)") +#define KTestCommentPrepend _L(" ") + +#define KTestShowMenu _L("/manual") + + +// +// +// CTestTimer +// +// + +class CTestTimer : public CTimer + { +public: + static CTestTimer* NewL(); + void AfterReq(TTimeIntervalMicroSeconds32 aSec, TRequestStatus& aStatus); +protected: + CTestTimer(); + void RunL(); + +private: + TRequestStatus* iReport; + }; + +// +// +// CTestUtils +// +// + +class CTestUtils : public CBase + { +public: +//File Logging + + void TestStart(TInt aTest, const TDesC& aTestDescription); + void TestFinish(TInt aTest, TInt aError = KErrNone); + void TestHarnessCompleted(); + void TestHarnessFailed(TInt aError); + void WriteComment(const TDesC& aComment); + + +//Test Utils + + virtual void CreateAllTestDirectories(); + + // File location + + + TInt ResolveLogFile(const TDesC& aFileName, TParse& aParseOut); + + void Printf(TRefByValue aFmt,...); //prints to RTest and LogFile, depending on iLogToConsole and iLogToFile + + + inline RTest& Test() const; + + TBool RunAuto() const; + void SetRunAuto(TBool aRunAuto = ETrue); + +public: + +protected: + virtual void ConstructL(); + CTestUtils(RTest& aRTest); + ~CTestUtils(); + + + virtual void Panic(TInt aPanic) = 0; + + void AppendTestName(TDes &aFileName); + void AppendVariantName(TDes& aFileName); + + TInt OpenMainLogL(); + void CloseMainLog(); + void WriteToLog(TRefByValue aFmt,...); + + + +protected: + + RFs iFs; + RFile iFile; + RTest& iRTest; + TBool iLogToConsole; + TBool iLogToFile; + + TBool iRunAuto; + HBufC* iLogBuf; + HBufC8* iLogBuf8; + + }; + +class TTestOverflow : public TDes16Overflow + { +public: + TTestOverflow(CTestUtils& aTest) + : iTest(aTest) {}; + + // TDes16Overflow pure virtual + virtual void Overflow(TDes16& /*aDes*/) {iTest.Printf(_L("ERROR: Printf Overflow\n")); iTest.Test()(EFalse);}; + +private: + CTestUtils& iTest; + }; + + + +#include "GmxmlTestUtils.inl" + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/GmxmlTestUtils.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,20 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GMXMLTESTUTILS.INL +// + +RTest& CTestUtils::Test() const + { + return iRTest; + } diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/GmxmlTestsetup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/GmxmlTestsetup.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,150 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __GMXMLTESTSETUP_H__ +#define __GMXMLTESTSETUP_H__ + +#include +#include "GmxmlTestUtils.h" + +// The following must be defined by the test exe +GLREF_D RTest test; +LOCAL_C void doTestsL(); + +// Globals +CTrapCleanup* theCleanup = NULL; + +TInt TestNum = 0; +class CGenericTestUtils; +CGenericTestUtils* theUtils = NULL; + +// Constants + +// Useful macros +TInt theError; + + +//********************************** +// CGenericTestUtils +//********************************** + +class CGenericTestUtils : public CTestUtils + { +public: + static CGenericTestUtils* NewL(RTest& aTest); + CGenericTestUtils(RTest& aTest); + void Panic(TInt aPanic); + // +public: + static void CreateDataFilesL(const TDesC& aFilename, const TDesC& aMtmName, TUid aUid); + static TBool WaitForKeyL(TTimeIntervalMicroSeconds32 aDelay, TKeyCode* aKeyCode = NULL); + static void Start(const TDesC& aDes); + static void Next(const TDesC& aDes); + static void Complete(); + static void End(); + }; + +CGenericTestUtils* CGenericTestUtils::NewL(RTest& aTest) + { + CGenericTestUtils* self = new(ELeave)CGenericTestUtils(aTest); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; + } + +CGenericTestUtils::CGenericTestUtils(RTest& aTest) +: CTestUtils(aTest) + { + } + +void CGenericTestUtils::Panic(TInt) + { + test(EFalse); + } + +void CGenericTestUtils::Start(const TDesC& aDes) + { + test.Start(aDes); + theUtils->TestStart(++TestNum, aDes); + } + +void CGenericTestUtils::Next(const TDesC& aDes) + { + test.Next(aDes); + theUtils->TestStart(++TestNum, aDes); + } + +void CGenericTestUtils::Complete() + { + theUtils->TestFinish(TestNum, KErrNone); + } + +void CGenericTestUtils::End() + { + test.End(); + } + +//********************************** +// Global +//********************************** + +LOCAL_C void SetupL() + { +// CActiveScheduler::Install(theScheduler = new(ELeave)CTestScheduler); + + // Create test class + theUtils = CGenericTestUtils::NewL(test); + +// test.Printf(_L("Cleaning Message Folder\n")); +// CGenericTestUtils::CleanMessageFolderL(); +// CGenericTestUtils::SetDriveL(EDriveC); +// CGenericTestUtils::SetDebugL(ETrue); + + } + +LOCAL_C void Close(TInt aRet) + { + if (theUtils) + { + if (!aRet) + theUtils->TestHarnessCompleted(); + else + theUtils->TestHarnessFailed(aRet); + } + delete theUtils; + } + +LOCAL_C void doMainL() + { + SetupL(); + doTestsL(); + } + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + theCleanup=CTrapCleanup::New(); + TRAPD(ret,doMainL()); + Close(ret); + delete theCleanup; + test.Console()->SetPos(0, 13); + test.End(); + test.Close(); + __UHEAP_MARKEND; + return(KErrNone); + } + +#endif diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/body_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/body_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/head_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/head_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid__prefetch_att3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_meta_att1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_meta_att1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_metadata_att1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_metadata_att1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/invalid_transition_att5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/layout_struc_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/par_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/par_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/region_att_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/region_att_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/smil_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/smil_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/text_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Invalid/text_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/audio_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/body_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struct_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struct_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struct_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/head_struct_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/img_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/layout_struc_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/meta_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/meta_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/meta_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/meta_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/metadata_att1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/metadata_att1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_prefetch.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_prefetch.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/par_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/prefetch_att4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/ref_att_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_att_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/region_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/root-layout_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/root-layout_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/root-layout_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/root-layout_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/smil_struc_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/text_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/text_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/text_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/text_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + First image diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/MMS_Output/Valid/transition_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_9.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/a_att_9.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/cdata_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/cdata_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/empty.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/empty.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entitiy_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entitiy_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/entity_ref_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_16.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_16.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + < diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + "http://www.example.org/presentationB#next"> + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_23.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_23.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + " + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_25.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_25.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_9.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/further_invalid_9.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/inc021591.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/inc021591.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/inc021675.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/inc021675.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + Ice cream< factory: photo diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_16.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_16.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + picture of an ice cream factory" alt="Ice cream factory: photo" author="J. Smith" + copyright="Copyright (c) 1999-2000 Symbian Ltd. All rights reserved." + longdesc="http://www.example.org/IceCreamFactory.html" src="Photo1.jpg" type="jpg" dur="1000s" + repeatCount="1.0" repeatDur="1000s" begin="0s" end="1000s" min="1000s" max="1000s" fill="remove" + systemBitrate="28800" systemCaptions="on" systemLanguage="en" systemOverdubOrSubtitle="overdub" + systemRequired="aNamespacePrefix" systemScreenSize="640X480" systemScreenDepth="16" systemAudioDesc="on" + systemOperatingSystem="symbianos" systemCPU="arm32" + systemComponent="http://www.example.org/SomeCodec" region="Image"/> + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_23.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_23.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_25.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_25.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_26.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_26.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_27.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_27.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_28.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_28.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_29.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_29.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + Ice cream factory: photo diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_31.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_31.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + // This is a "landscape" screen + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_32.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_32.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_33.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_33.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_34.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_34.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_35.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_35.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_36.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_36.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_37.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_37.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_38.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_38.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_39.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_39.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + Ice cream factory: photo diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_40.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_40.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,9 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_9.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/invalid_9.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_9.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/region_att_9.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/root-layout_att_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/switch_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Invalid/switch_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/a_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/anchor_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/animation_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/area_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ascii_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ascii_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_order_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_order_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_order_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_order_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_var_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/att_var_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/audio_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/body_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,9 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_16.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_16.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_23.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_23.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_25.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_25.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_26.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_26.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_27.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_27.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_28.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_28.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_29.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_29.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_30.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_30.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/cdata_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/comments_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/comments_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/doctype_variation.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/doctype_variation.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entitiy_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entitiy_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_26.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_26.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_27.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_27.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_30.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_30.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_31.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_31.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/entity_ref_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/head_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/head_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/head_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/head_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + Ice cream factory: photo diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/img_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc021337.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc021337.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc022160.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc022160.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,13 @@ + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc025788.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/inc025788.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ + + + + Characters that need to be escaped: < &. Characters that can be escaped ' ('), > (>) and " ("). + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/layout_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/layout_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/layout_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/layout_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/newline_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/newline_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,10 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/par_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/ref_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/region_att_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,12 @@ + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/root-layout_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/seq_struc_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/smil_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/smil_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/smil_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/smil_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,8 @@ + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/switch_struc_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/text_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/textstream_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/utf8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/utf8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/video_att_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/whitespace_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/whitespace_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/whitespace_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/whitespace_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,9 @@ + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/xml_version_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/SMIL_Output/Valid/xml_version_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,7 @@ + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/body_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/body_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/head_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/head_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid__prefetch_att3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_meta_att1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_meta_att1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_metadata_att1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_metadata_att1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/invalid_transition_att5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/layout_struc_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/par_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/par_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/region_att_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/region_att_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/smil_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/smil_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/text_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/invalid/text_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/audio_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/body_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struct_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struct_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struct_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/head_struct_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/img_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/layout_struc_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/meta_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/meta_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/meta_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/meta_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/metadata_att1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/metadata_att1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_prefetch.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_prefetch.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/par_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/prefetch_att4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/ref_att_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_att_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/region_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/root-layout_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/root-layout_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/root-layout_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/root-layout_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/smil_struc_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/text_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/text_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/text_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/text_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/mms_input/valid/transition_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_10.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_10.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_11.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_11.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_8.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_8.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_9.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/a_att_9.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/cdata_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/cdata_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/empty.txt diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entitiy_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entitiy_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/entity_ref_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_10.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_10.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_11.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_11.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_12.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_12.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_13.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_13.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_14.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_14.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_15.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_15.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_16.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_16.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_17.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_17.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_18.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_18.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_19.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_19.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_20.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_20.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_21.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_21.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_22.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_22.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_23.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_23.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_24.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_24.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_25.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_25.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_8.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_8.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_9.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/further_invalid_9.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/inc021591.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/inc021591.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/inc021675.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/inc021675.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_10.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_10.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_11.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_11.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_12.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_12.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_13.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_13.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_14.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_14.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_15.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_15.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_16.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_16.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_17.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_17.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_18.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_18.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_19.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_19.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_20.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_20.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_21.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_21.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_22.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_22.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_23.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_23.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_24.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_24.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_25.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_25.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_26.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_26.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_27.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_27.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_28.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_28.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_29.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_29.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_31.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_31.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_32.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_32.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_33.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_33.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_34.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_34.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_35.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_35.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_36.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_36.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_37.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_37.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_38.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_38.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_39.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_39.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_40.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_40.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_8.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_8.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_9.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/invalid_9.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_10.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_10.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_11.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_11.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_7.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_7.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_8.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_8.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_9.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/region_att_9.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/root-layout_att_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/switch_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/invalid/switch_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/a_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/anchor_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/animation_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/area_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ascii_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ascii_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_order_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_order_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_order_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_order_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_var_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/att_var_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/audio_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/body_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_16.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_16.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_23.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_23.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_25.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_25.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_26.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_26.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_27.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_27.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_28.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_28.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_29.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_29.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_30.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_30.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + sentation" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + ]]>esentation" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + < <>"<"><>"<">>>"<<"""<"<>]]>esentation" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + sBLink" title="Presentation" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/cdata_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + "<"<">"<>""]]>resentation"<">"" ]]>" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/comments_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/comments_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/doctype_variation.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/doctype_variation.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entitiy_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entitiy_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_1.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_10.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_10.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_11.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_11.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_12.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_12.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_13.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_13.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_14.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_14.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_15.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_15.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_17.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_17.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_18.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_18.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_19.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_19.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_2.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_20.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_20.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_21.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_21.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_22.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_22.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_24.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_24.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_26.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_26.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_27.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_27.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_3.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_30.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_30.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_31.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_31.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_4.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_4.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_5.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_5.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_6.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_6.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_7.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_7.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + sBLink" title="Blue'" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/entity_ref_8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + "<"<">"<>""]]>resentation"<">"" ]]>>" xml:lang="en-GB"> + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/head_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/head_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/head_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/head_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/img_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc021337.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc021337.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc022160.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc022160.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc025788.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/inc025788.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + + + + + Characters that need to be escaped: < &. Characters that can be escaped ' ('), > (>) and " ("). + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/layout_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/layout_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/layout_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/layout_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/newline_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/newline_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/par_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/ref_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/region_att_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/root-layout_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_6.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/seq_struc_6.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/smil_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/smil_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/smil_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/smil_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/switch_struc_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/text_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/textstream_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/utf8.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/utf8.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_3.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_3.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_4.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_4.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_5.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/video_att_5.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/whitespace_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/whitespace_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/whitespace_2.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/whitespace_2.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/xml_version_1.txt Binary file xml/legacyminidomparser/XMLParser/test/SMIL_Test_Files/smil_input/valid/xml_version_1.txt has changed diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.CPP Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,249 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "t_GmxmlFailure.h" +#include "t_XMLParserLOG.H" + +LOCAL_D CActiveScheduler* scheduler; +LOCAL_D CImLog* log; +_LIT(KTestTitle, "T_GmxmlFailure"); +_LIT(KExistingFilePath, "c:\\GmxmlTest.txt"); +_LIT(KNonExistingFilePath, "c:\\msg\\NotExist.txt"); +LOCAL_D CGmxmlFailure* myTester; +// Global variables +RTest gTest(_L("t_GmxmlFailure Test Harness")); + +CGmxmlFailure :: CGmxmlFailure() : CActive(EPriorityStandard) + { + } + +/** + * Second stage constructor: + * Creates the XML parser and calls the ParseFile() with + * a non-exixtent file + */ + +void CGmxmlFailure :: ConstructL() + { + iSession.Connect(); + iCMDXMLParser = CMDXMLParser::NewL(this); + log->AppendComment(_L8("Performing tests on opening non-existing file")); + LoadXmlFile(KNonExistingFilePath); + log->AppendComment(_L8("Completed checking of opening non-existing file")); + + CActiveScheduler::Add(this); + + iState = ENonExistFileState; + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + SetActive(); + } + +void CGmxmlFailure::LoadXmlFile(const TDesC &aFilePath) + { + TInt err=iCMDXMLParser->ParseFile(iSession, aFilePath); + if(err!=KErrNone) + { + log->AppendError(_L8("Parse File returned an error "),err); + } + } + +void CGmxmlFailure::LockXmlFile() + { + RFile file; + //Open the file before calling ParseFile function. + file.Open(iSession, KExistingFilePath,EFileShareExclusive); + //Call the ParseFile() on the locked file + TInt err=iCMDXMLParser->ParseFile(iSession, KExistingFilePath); + if(err!=KErrNone) + { + log->AppendError(_L8("Parse File returned an error "),err); + } + file.Close(); + } + +CGmxmlFailure :: ~CGmxmlFailure() +/** + * Destructor + */ + { + iSession.Close(); + delete iCMDXMLParser; + } + +CGmxmlFailure* CGmxmlFailure :: NewLC() +/** +* Allocates a new CGmxmlFailure test object and pushes +* it on clean up stack. +* @return New CGmxmlFailure +*/ + { + CGmxmlFailure* self = new (ELeave) CGmxmlFailure(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CGmxmlFailure :: ParseFileCompleteL() +/** +* Function from MMDXMLParserObserver class +*/ + { + } + + +void CGmxmlFailure :: DoCancel() +/** +* Functions from CActive class +*/ + { + } + +void CGmxmlFailure :: RunL() + { + switch(iState) + { + case ENonExistFileState: + { + CActiveScheduler::Stop(); + iState = ELockFileState; + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + SetActive(); + } + break; + case ELockFileState: + { + CActiveScheduler::Stop(); + iState = EEndState; + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + SetActive(); + } + break; + case EEndState: + { + CActiveScheduler::Stop(); + } + break; + default: + break; + } + + } + +LOCAL_C void InitL() + { + TBuf<80> logFile(KLogFileName); + +#if defined(__WINS__) && defined(__WINSCW__) + logFile.Append(_L(".WINSCW")); +#elif(__WINS__) + logFile.Append(_L(".WINS")); +#else + logFile.Append(_L(".MARM")); +#endif + +#if defined(_DEBUG) + logFile.Append(_L(".DEB")); +#else + logFile.Append(_L(".REL")); +#endif + logFile.Append(_L(".LOG")); + + gTest.Printf(_L("\nLog File ")); + gTest.Printf(logFile); + gTest.Printf(_L("\n")); + log = CImLog::NewL(logFile, EAppend); + CleanupStack::PushL(log); + log->AppendComment(_L8("Test Results")); + log->AppendComment(_L8("T_GMXMLFAILURE memory leak test in XMLParser")); + log->AppendComment(_L8("Test 1 Starting")); + } + +/** + * setup test environment, create CGmxmlFailure object and run test. + * + * This is an memory leak test. + * Test case: + * Passes the file name and session to CMDXMLParser::ParseFile() + * as arguments and run the memory leak test. + * Running Instructions: + * 1. Build this test harness: cd \GMXML\XMLParser\GROUP + * bldmake bldfiles + * abld test build wins udeb t_GmxmlFailure + * 2. Run t_GmxmlFailure.exe: cd \epoc32\release\wins\udeb + * t_GmxmlFailure -dtextshell -- + * + * Output files produced by running test harness: + * :\msglogs\T_GMXMLFAILURE...txt + */ + +LOCAL_C void doMainL() + { + gTest.Start(KTestTitle); + InitL(); + scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install( scheduler ); + __UHEAP_MARK; + myTester = CGmxmlFailure::NewLC(); + CActiveScheduler::Start(); + log->AppendComment(_L8("Completed tests. No panic")); + log->AppendComment(_L8("Test PASSED")); + log->AppendComment(_L8("Test 1 OK")); + + log->AppendComment(_L8("Test 2 Starting")); + log->AppendComment(_L8("Performing tests on opening existing file")); + myTester->LoadXmlFile(KExistingFilePath); + log->AppendComment(_L8("Completed checking of opening existing file")); + CActiveScheduler::Start(); + log->AppendComment(_L8("Completed tests. No panic")); + log->AppendComment(_L8("Test PASSED")); + log->AppendComment(_L8("Test 2 OK")); + + log->AppendComment(_L8("Test 3 Starting")); + log->AppendComment(_L8("Performing tests on locked file")); + myTester->LockXmlFile(); + log->AppendComment(_L8("Completed checking of opening a locked file")); + CActiveScheduler::Start(); + log->AppendComment(_L8("Completed tests. No panic")); + log->AppendComment(_L8("Test PASSED")); + log->AppendComment(_L8("Test 3 OK")); + + CleanupStack::PopAndDestroy(myTester); // myTester + __UHEAP_MARKEND; + + log->AppendComment(_L8("No memory leak in XMLParser")); + log->AppendComment(_L8("T_GMXMLFAILURE Tests Complete")); + log->AppendComment(_L8("Tests Completed")); + + CleanupStack::PopAndDestroy(2); // scheduler, log + gTest.End(); + gTest.Close(); + } + +/** entry point for test executable */ +GLDEF_C TInt E32Main() + { + CTrapCleanup* theCleanup = CTrapCleanup::New(); + TRAPD(ret,doMainL()); + gTest(ret==KErrNone); + delete theCleanup; + + return(KErrNone); + } diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,76 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include + +/** @file + * This file contains the declaration of the generic CGmxmlFailure class + * which is responsible for testing the memory leak in the XMLParser. + */ + +class CGmxmlFailure : public CActive, public MMDXMLParserObserver + { +public: + /** Allocates and constructs a new CGmxmlFailure test. + @return New CGmxmlFailure + */ + static CGmxmlFailure* NewLC(); + + // Second constructor + void ConstructL(); + + /** Constructor. */ + CGmxmlFailure(); + + /** Destructor. */ + ~CGmxmlFailure(); + + /** + * Functions from MMDXMLParserObserver class + */ + void ParseFileCompleteL(); + + /** + * Function from MMDXMLComposerObserver + */ + void ComposeFileCompleteL(); + + void LoadXmlFile(const TDesC &aFilePath); + void LockXmlFile(); + +public: // from CActive + void DoCancel(); + /* + * RunL function inherited from CActive base class - carries out the actual + * parser leak test. + * @leave can Leave due to OOM + */ + void RunL(); + +private: + CMDXMLParser* iCMDXMLParser; + RFs iSession; // File session for ParseFile. + TInt iState; + enum TStates + { + EEndState = 0x00, + ENonExistFileState, + ELockFileState, + }; + }; + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_GmxmlFailure.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +target t_gmxmlfailure.exe +targettype exe + +SOURCEPATH ../test +SOURCE t_GmxmlFailure.CPP +SOURCE t_XMLParserLOG.CPP + +USERINCLUDE ../test + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + +LIBRARY efsrv.lib euser.lib xmlparser.lib +EPOCSTACKSIZE 0x8000 + +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_GmxmlParser.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_GmxmlParser.CPP Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,207 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include +#include + +#include "GmxmlTestsetup.h" + + +_LIT(KGMXMLParserTest,"T_GMXMLParser"); +class CTestGMXMLParser; + +RTest test(KGMXMLParserTest); +LOCAL_D CTestGMXMLParser* testParser; +LOCAL_D CActiveScheduler* scheduler; + +//------------------------------------------------------------------------------ + +class CStreamErrorDataSupplier : public CBase, public MMDXMLParserDataProvider + { +public: + static CStreamErrorDataSupplier * NewL(); + ~CStreamErrorDataSupplier () {} + + // From MMDXMLParserDataProvided + void GetData(TPtrC8& aPtr, TRequestStatus &aStatus); + void Disconnect() {} + }; + +//------------------------------------------------------------------------------ + +CStreamErrorDataSupplier* CStreamErrorDataSupplier::NewL() + { + CStreamErrorDataSupplier* self = new (ELeave) CStreamErrorDataSupplier(); + return self; + } + +//------------------------------------------------------------------------------ +// From MMDXMLParserDataProvided +void CStreamErrorDataSupplier::GetData(TPtrC8& /*aPtr*/, TRequestStatus &aStatus) + { + TRequestStatus *s = &aStatus; + User::RequestComplete(s, KDataStreamError); + return; + } + +//------------------------------------------------------------------------------ + +class CTestGMXMLParser : public CActive, public MMDXMLParserObserver + { +public: + static CTestGMXMLParser* NewLC(); + ~CTestGMXMLParser(); + void ConstructL(); + void RunTestL(); + +public: // from CActive + void DoCancel(); + void RunL(); + +public: // from MMDXMLParserObserver + void ParseFileCompleteL(); + +private: + CTestGMXMLParser(); + +public: + TBool iParseFileCompleted; // Whether the ParseFileCompleted was called. + TBool iParserCalled; // Whether the GMXMLParser::ParseSource was called + +private: + CMDXMLParser* iParser; + CStreamErrorDataSupplier* iDataSupplier; + CTestTimer* iTimer; + + static const TTimeIntervalMicroSeconds32 TestParserTimeout; + }; + +//------------------------------------------------------------------------------ + +const TTimeIntervalMicroSeconds32 CTestGMXMLParser::TestParserTimeout = 10000000; // 10s + +//------------------------------------------------------------------------------ + +CTestGMXMLParser* CTestGMXMLParser::NewLC() + { + CTestGMXMLParser* self = new (ELeave) CTestGMXMLParser(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +//------------------------------------------------------------------------------ + +CTestGMXMLParser::~CTestGMXMLParser() + { + delete iParser; + delete iDataSupplier; + delete iTimer; + } + +//------------------------------------------------------------------------------ + +CTestGMXMLParser::CTestGMXMLParser() : CActive(EPriorityStandard), iParseFileCompleted(EFalse), iParserCalled(EFalse) + { + } + +//------------------------------------------------------------------------------ + +void CTestGMXMLParser::ConstructL() + { + iParser = CMDXMLParser::NewL(this); + iTimer = CTestTimer::NewL(); + + CActiveScheduler::Add(this); + + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + SetActive(); + } + +//------------------------------------------------------------------------------ + +void CTestGMXMLParser::RunL() + { + RunTestL(); + } + +//------------------------------------------------------------------------------ + +void CTestGMXMLParser::DoCancel() + { + } + +//------------------------------------------------------------------------------ + +void CTestGMXMLParser::RunTestL() + { + if (!iParserCalled) + { + delete iDataSupplier; + iDataSupplier = NULL; + iDataSupplier = CStreamErrorDataSupplier::NewL(); + iParser->ParseSource(iDataSupplier); + + iStatus = KRequestPending; + SetActive(); + iParserCalled = ETrue; + // Create a timer to stop the active scheduler if ParseFileComplete not called. + iTimer->AfterReq(CTestGMXMLParser::TestParserTimeout, iStatus); + } + else + CActiveScheduler::Stop(); + } + +//------------------------------------------------------------------------------ + +void CTestGMXMLParser::ParseFileCompleteL() + { + // Success. + iParseFileCompleted = ETrue; + + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + } + +//------------------------------------------------------------------------------ + +LOCAL_C void doTestsL() + { + scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install( scheduler ); + testParser = CTestGMXMLParser::NewLC(); + + theUtils->WriteComment(_L("\nPerforming Tests\n")); + theUtils->Start(_L("Testing GMXMLParser receiving KDataStreamError from MMDXMLParserDataProvider::GetData()")); + CActiveScheduler::Start(); + theUtils->Complete(); + + // Succeed only if the GMXMLParser::ParserSource was called and it resulted + // in ParseFileCompleted being called. + if (!testParser->iParserCalled || !testParser->iParseFileCompleted) + { + theUtils->WriteComment(_L("\nParseFileCompleted was not called within the timeout (10s)!")); + User::Leave(KErrGeneral); + } + + CleanupStack::PopAndDestroy(2); //testParser, ischeduler + } + +//------------------------------------------------------------------------------ + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_GmxmlParser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_GmxmlParser.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// t_gmxmlparser.mmp +// + +TARGET t_gmxmlparser.exe +TARGETTYPE exe + +SOURCEPATH . +SOURCE GmxmlTestUtils.cpp +SOURCE t_GmxmlParser.CPP + + +USERINCLUDE . + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + + + + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY xmlparser.lib + + +EPOCSTACKSIZE 0x8000 + + + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_SmilData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_SmilData.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,228 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the definitions of elemenent names and transitions +// for the SMIL DTD. +// +// + +/** + @file +*/ + +#ifndef T_SMILDATA_H +#define T_SMILDATA_H + +// Constants for the initial and terminal states +const TInt KSMILDTDStartState = 0; +const TInt KSMILDTDEndState = -1; +const TInt KSMILDTDMinJump = 5; // Don't do binary chop below this size. Not a critical value. + +#define MAKESMILDTDSTATETYPE( from, to, str ) { from, to, _S(str), (sizeof(str)-1) } + +//Literal definitions for element names +_LIT(KSMILDTDElta, "a"); +_LIT(KSMILDTDEltanchor, "anchor"); +_LIT(KSMILDTDEltanimation, "animation"); +_LIT(KSMILDTDEltarea, "area"); +_LIT(KSMILDTDEltaudio, "audio"); +_LIT(KSMILDTDEltbody, "body"); +_LIT(KSMILDTDElthead, "head"); +_LIT(KSMILDTDEltimg, "img"); +_LIT(KSMILDTDEltlayout, "layout"); +_LIT(KSMILDTDEltpar, "par"); +_LIT(KSMILDTDEltprefetch, "prefetch"); +_LIT(KSMILDTDEltref, "ref"); +_LIT(KSMILDTDEltregion, "region"); +_LIT(KSMILDTDEltroot_layout, "root-layout"); +_LIT(KSMILDTDEltseq, "seq"); +_LIT(KSMILDTDEltsmil, "smil"); +_LIT(KSMILDTDEltswitch, "switch"); +_LIT(KSMILDTDElttext, "text"); +_LIT(KSMILDTDElttextstream, "textstream"); +_LIT(KSMILDTDEltvideo, "video"); +_LIT(KSMILDTDEltmeta, "meta"); +_LIT(KSMILDTDEltmetadata, "metadata"); +_LIT(KSMILDTDEltDoc, "documentelement"); +_LIT(KSMILDTDEltTrans, "transition"); +// Child Validation States + +// Array of allowed child element state transitions +// +// Same for par +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDTimingChildStates[15] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(0, 0, "a"), + MAKESMILDTDSTATETYPE(0, 0, "anchor"), + MAKESMILDTDSTATETYPE(0, 0, "animation"), + MAKESMILDTDSTATETYPE(0, 0, "area"), + MAKESMILDTDSTATETYPE(0, 0, "audio"), + MAKESMILDTDSTATETYPE(0, 0, "img"), + MAKESMILDTDSTATETYPE(0, 0, "par"), + MAKESMILDTDSTATETYPE(0, 0, "prefetch"), + MAKESMILDTDSTATETYPE(0, 0, "ref"), + MAKESMILDTDSTATETYPE(0, 0, "seq"), + MAKESMILDTDSTATETYPE(0, 0, "switch"), + MAKESMILDTDSTATETYPE(0, 0, "text"), + MAKESMILDTDSTATETYPE(0, 0, "textstream"), + MAKESMILDTDSTATETYPE(0, 0, "video") + }; + +LOCAL_D const TInt KSMILDTDTimingChildStateTranCount = 15; + + +LOCAL_D const TSMILDTDChildStateType SMILDTDAChildStates[8] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(0, 0, "animation"), + MAKESMILDTDSTATETYPE(0, 0, "audio"), + MAKESMILDTDSTATETYPE(0, 0, "img"), + MAKESMILDTDSTATETYPE(0, 0, "ref"), + MAKESMILDTDSTATETYPE(0, 0, "text"), + MAKESMILDTDSTATETYPE(0, 0, "textstream"), + MAKESMILDTDSTATETYPE(0, 0, "video") + }; + +LOCAL_D const TInt KSMILDTDAChildStateTranCount = 8; + + +// Array of allowed child element state transitions +// +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDBodyChildStates[15] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(0, 0, "a"), + MAKESMILDTDSTATETYPE(0, 0, "anchor"), + MAKESMILDTDSTATETYPE(0, 0, "area"), + MAKESMILDTDSTATETYPE(0, 0, "animation"), + MAKESMILDTDSTATETYPE(0, 0, "audio"), + MAKESMILDTDSTATETYPE(0, 0, "img"), + MAKESMILDTDSTATETYPE(0, 0, "par"), + MAKESMILDTDSTATETYPE(0, 0, "prefetch"), + MAKESMILDTDSTATETYPE(0, 0, "ref"), + MAKESMILDTDSTATETYPE(0, 0, "seq"), + MAKESMILDTDSTATETYPE(0, 0, "switch"), + MAKESMILDTDSTATETYPE(0, 0, "text"), + MAKESMILDTDSTATETYPE(0, 0, "textstream"), + MAKESMILDTDSTATETYPE(0, 0, "video") + }; + +LOCAL_D const TInt KSMILDTDBodyChildStateTranCount = 15; + + +// Array of allowed child element state transitions +// PLUS we allow meta's anywhere! +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDHeadChildStates[10] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(1, -1, ""), + MAKESMILDTDSTATETYPE(0, 1, "layout"), + MAKESMILDTDSTATETYPE(0, 0, "meta"), + MAKESMILDTDSTATETYPE(1, 1, "meta"), + MAKESMILDTDSTATETYPE(0, 0, "metadata"), + MAKESMILDTDSTATETYPE(1, 1, "metadata"), + MAKESMILDTDSTATETYPE(0, 0, "transition"), + MAKESMILDTDSTATETYPE(1, 1, "transition"), + MAKESMILDTDSTATETYPE(0, 1, "switch") + }; + +LOCAL_D const TInt KSMILDTDHeadChildStateTranCount = 10; + + +// Array of allowed child element state transitions +// +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDLayoutChildStates[5] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(1, -1, ""), + MAKESMILDTDSTATETYPE(0, 1, "region"), + MAKESMILDTDSTATETYPE(1, 1, "region"), + MAKESMILDTDSTATETYPE(0, 1, "root-layout") + }; + +LOCAL_D const TInt KSMILDTDLayoutChildStateTranCount = 5; + + +// Array of allowed child element state transitions +// +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDMediaChildStates[3] = + { + MAKESMILDTDSTATETYPE( 0, -1, "") , + MAKESMILDTDSTATETYPE( 0, 0, "anchor"), + MAKESMILDTDSTATETYPE( 0, 0, "area") + }; + +LOCAL_D const TInt KSMILDTDMediaChildStateTranCount = 3; + +// Array of allowed child element state transitions +// +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDSmilChildStates[6] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(1, -1, ""), + MAKESMILDTDSTATETYPE(2, -1, ""), + MAKESMILDTDSTATETYPE(0, 2, "body"), + MAKESMILDTDSTATETYPE(1, 2, "body"), + MAKESMILDTDSTATETYPE(0, 1, "head") + }; + +LOCAL_D const TInt KSMILDTDSmilChildStateTranCount = 6; + +// Array of allowed child element state transitions +// +// Entries must be sorted by tag and then by from state +LOCAL_D const TSMILDTDChildStateType SMILDTDSwitchChildStates[31] = + { + MAKESMILDTDSTATETYPE(0, -1, ""), + MAKESMILDTDSTATETYPE(1, -1, ""), + MAKESMILDTDSTATETYPE(2, -1, ""), + MAKESMILDTDSTATETYPE(3, -1, ""), + MAKESMILDTDSTATETYPE(0, 1, "a"), + MAKESMILDTDSTATETYPE(1, 1, "a"), + MAKESMILDTDSTATETYPE(0, 1, "anchor"), + MAKESMILDTDSTATETYPE(1, 1, "anchor"), + MAKESMILDTDSTATETYPE(0, 1, "animation"), + MAKESMILDTDSTATETYPE(1, 1, "animation"), + MAKESMILDTDSTATETYPE(0, 1, "area"), + MAKESMILDTDSTATETYPE(1, 1, "area"), + MAKESMILDTDSTATETYPE(0, 1, "audio"), + MAKESMILDTDSTATETYPE(1, 1, "audio"), + MAKESMILDTDSTATETYPE(0, 1, "img"), + MAKESMILDTDSTATETYPE(1, 1, "img"), + MAKESMILDTDSTATETYPE(0, 3, "layout"), + MAKESMILDTDSTATETYPE(0, 2, "par"), + MAKESMILDTDSTATETYPE(2, 2, "par"), + MAKESMILDTDSTATETYPE(0, 1, "prefetch"), + MAKESMILDTDSTATETYPE(1, 1, "prefetch"), + MAKESMILDTDSTATETYPE(0, 1, "ref"), + MAKESMILDTDSTATETYPE(1, 1, "ref"), + MAKESMILDTDSTATETYPE(0, 2, "seq"), + MAKESMILDTDSTATETYPE(2, 2, "seq"), + MAKESMILDTDSTATETYPE(0, 1, "text"), + MAKESMILDTDSTATETYPE(1, 1, "text"), + MAKESMILDTDSTATETYPE(0, 1, "textstream"), + MAKESMILDTDSTATETYPE(1, 1, "textstream"), + MAKESMILDTDSTATETYPE(0, 1, "video"), + MAKESMILDTDSTATETYPE(1, 1, "video") + }; + +LOCAL_D const TInt KSMILDTDSwitchChildStateTranCount = 31; + +#endif // T_SMILDATA_H diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_SmilDtd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_SmilDtd.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,119 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the definition of the SMILDTD class +// +// +/** + * @file + * @publishedPartner + * @released + */ +#ifndef T_SMILDTD_H +#define T_SMILDTD_H + +#include +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "t_smildtdenum.h" +#endif +/** +MXMLDtd is a mixin class. If User wants to derive from MXMLDtd class , +then one should not derive from any other class at the same time. +i.e A class can not derive from CBase at all using MXMLDtd. + +Represents the SMIL DTD. +It is used for validation of SMIL documents. +@publishedPartner +@released +*/ +class CSMILDtd: public MXMLDtd + { +public: + + /** Allocates and constructs a new SMIL DTD validator. + + @leave KErrNoMemory Out of memory + @return New SMIL DTD validator */ + IMPORT_C static CSMILDtd* NewL(); + + /** Allocates and constructs a new SMIL DTD validator, leaving the object on the + cleanup stack. + + @leave KErrNoMemory Out of memory + @return New SMIL DTD validator */ + IMPORT_C static CSMILDtd* NewLC(); + + /** Destructor. */ + IMPORT_C virtual ~CSMILDtd(); + +protected: + /* + * Function to determine whether an Element name is valid in DTD + * @return ETrue the if element name valid - else EFalse + * @param aElement the element name to be tested + * @leave can leave due to OOM + */ + virtual TBool IsValidElementL(const TDesC& aElement) const; + + /* + * Function to determine whether an attribute name and value is valid in DTD + * @return KErrNone if name&value are valid, KXMLBadAttributeName if attrib name invalid + * KXMLBadAttributeValue if attrib value invalid + * @param aElement the element to which the attributes belong + * @param aAttribute the attribute to be tested + * @leave aAttributeValue the attributeValue to be tested + * @leave can leave due to OOM + */ + + virtual TInt IsValidAttributeForElementL(const TDesC& aElement, const TDesC& aAttribute, const TDesC& aAttributeValue) const; + + /* + * Function to determine whether the parent/child relationship is valid in DTD + * @return ETrue if parent/child relationship is valid + * @param aParentElement the name of the parent element to be tested + * @param aChildElements an array of child element name to be tested + * @leave can leave due to OOM + */ + + virtual TBool AreValidChildElementsL(const TDesC& aParentElement, const CDesCArray& aChildElements) const; + + + /* + * Function to determine whether it is valid for a particular element to + * have children + * @param aElement the name of the element to be tested + * @return ETrue if it is valid for element to have children + */ + virtual TBool CanElementHaveChildren(const TDesC& aElement) const; + + + /* + * Constructor + */ + CSMILDtd(); + +private: + /* + * Second stage constructor + */ + void ConstructL(); + + TBool CheckValidChildren(const TSMILDTDChildStateType aStateTrans[],TInt aStateCount, const CDesCArray& aChildElements) const; + + }; + +#endif + + + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_Smildtd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_Smildtd.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,549 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// CSMILDTD.cpp +// @file +// This file contains the definition of the SMILDTD class +// which describes the SMIL DTD and is responsible for validation +// of SMIL documents +// +// +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "t_smildtdenum.h" +#endif +#include "t_SmilDtd.h" +#include "t_SmilData.h" +#include +#include "smilelements.h" +#include "smilattributes.h" +#include "smilgenericelements.h" +#include + +// +// Global functions // +// + + +EXPORT_C CSMILDtd* CSMILDtd::NewL() +// +// Two phase static factory function constructor +// @return Created CSMILDtd +// @leave can Leave due to OOM +// + { + CSMILDtd* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +EXPORT_C CSMILDtd* CSMILDtd::NewLC() +// +// Two phase static factory function constructor +// @return Created CSMILDtd +// @leave can Leave due to OOM +// + { + CSMILDtd* self = new (ELeave) CSMILDtd(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CSMILDtd::ConstructL() +// +// Second stage constructor +// @leave can Leave due to OOM +// + { + // nothing to do + } + + +CSMILDtd::CSMILDtd() + { + } + + +EXPORT_C CSMILDtd::~CSMILDtd() + { + } + +TBool CSMILDtd::IsValidElementL(const TDesC& aElement) const + { +// +// Checks to see if the element name passed in has been specified in the string table +// @param aElementName the element name to be checked +// @return ETrue if defined in the string table else EFalse +// @leave Leave due to OOM +// + + // Use the string table SMILElements to validate the element name + TBool validElement = EFalse; + + RStringPool pool; + CleanupClosePushL(pool); + pool.OpenL(SMILElements::Table); + + int numTableEntries = SMILElements::Table.iCount; + if(numTableEntries != 0) + { + // Using a binary search since the table is always sorted alphabetically by element. + + // Set us search indices to outer bounds of array + TInt left = 0; + TInt right = numTableEntries - 1; + TInt compareResult = 0; + TInt pos; + while (right >= left) + { + pos = (left + right) / 2; + + RStringF tableEntry = pool.StringF(pos, SMILElements::Table); + HBufC* buf = HBufC::NewLC(tableEntry.DesC().Length()); + buf->Des().Copy(tableEntry.DesC()); + + TLex string(*buf); + + TPtrC token = string.NextToken(); + compareResult = aElement.Compare(token); + if(compareResult == 0) + validElement = ETrue; + + CleanupStack::PopAndDestroy(buf); + + + if(compareResult == 0) + break; + else if (compareResult > 0) + left = pos + 1; + else + right = pos - 1; + } + + } + CleanupStack::PopAndDestroy(); // close pool + return validElement; + + } + +TInt CSMILDtd::IsValidAttributeForElementL(const TDesC& aElement, const TDesC& aAttribute, const TDesC& aAttributeValue) const + { +// +// Checks that both the Attribute Name & Attribute Value are valid using string tables stored in the document +// @param aAttributeName - name of attribute to be checked +// @param aAttributeValue - value of attribute to be checked +// @return KErrNone if attribute & value are valid, otherwise KErrXMLBadAttributeName or KErrXMLBadAttributeValue +// @leave Leave due to OOM +// + + + // To reduce the size of the element/attribute/value generic element names are used + // So for example 'img' and 'video' are both represented by the genericelement 'media' + // A table exists (SMILGenericElements) detailing these relationships + + // So first we see if there is a generic element name for this element + // If not then genericElementName will just be the element name passed in + HBufC* genericElementName = NULL; + + + RStringPool pool; + CleanupClosePushL(pool); + pool.OpenL(SMILGenericElements::Table); + + TInt numTableEntries = SMILGenericElements::Table.iCount; + if(numTableEntries != 0) + { + // Using a binary search since the table is always sorted alphabetically by element. + + // Set us search indices to outer bounds of array + TInt left = 0; + TInt right = numTableEntries - 1; + TInt pos; + while (right >= left) + { + pos = (left + right) / 2; + + RStringF elementAndGeneric = pool.StringF(pos, SMILGenericElements::Table); + + HBufC* buf = HBufC::NewLC(elementAndGeneric.DesC().Length()); + buf->Des().Copy(elementAndGeneric.DesC()); + TLex string(*buf); + + TPtrC token = string.NextToken(); + TInt compare = aElement.Compare(token); + + if(compare == 0) + { + // We've got a match so use the generic name + // This isn't pushed on the CleanupStack here as we need to be able to pop + // buf and pool whilst genericElementName is still in scope. It will be + // pushed once these aren't necessary. Because of this THERE MUST BE + // NOTHING THAT LEAVES UNTIL genericElementName IS PUT ONTO THE CLEANUPSTACK + genericElementName =(string.NextToken()).AllocL(); + } + + CleanupStack::PopAndDestroy(buf); //buf + + + if(compare == 0) + break; + else if (compare > 0) + left = pos + 1; + else + right = pos - 1; + } + } + + CleanupStack::PopAndDestroy(); // Close pool + + if(genericElementName != NULL) + { + CleanupStack::PushL(genericElementName); + } + else + { + // We didn't find a generic name so use the element name passed in + genericElementName = HBufC::NewLC(aElement.Length()); + genericElementName->Des().Copy(aElement); + } + + // Using the generic element name test to see if we have a valid attribute and value + + // assume the attribute name is invalid + TInt error = KErrXMLBadAttributeName; + + // retrieve the attributeValue string table + // this is of the form elementName attributeName attribValue1 attribValue2 ... + + CleanupClosePushL(pool); + pool.OpenL(SMILAttributes::Table); + + numTableEntries = SMILAttributes::Table.iCount; + if(numTableEntries != 0) + { + // Using a binary search since the table is always sorted alphabetically by element+attribute. + + // Set us search indices to outer bounds of array + TInt left = 0; + TInt right = numTableEntries - 1; + TInt compareResult = 0; + TInt pos; + while (right >= left) + { + pos = (left + right) / 2; + + RStringF tableEntry = pool.StringF(pos, SMILAttributes::Table); + HBufC* buf = HBufC::NewLC(tableEntry.DesC().Length()); + buf->Des().Copy(tableEntry.DesC()); + + TLex string(*buf); + + // Get the element name from the string table (the first token) + TPtrC token = string.NextToken(); + // Is this the element name we are interested in + compareResult = genericElementName->Compare(token); + if(compareResult == 0) + { + // we're looking at an entry in the string table for this element + // so test to see if it's the correct attribute too. + token.Set(string.NextToken()); + compareResult = aAttribute.Compare(token); + if(compareResult == 0) + { + // we've got the correct entry in the table (both element & attribute match) + // so now assume the error is an incorrect attribute value + error = KErrXMLBadAttributeValue; + + // get hold of the first valid attribure value + token.Set(string.NextToken()); + // if we don't have a list of attribute values then we can assume whatever we've got is valid + // so set the error to KErrNone + if (token.Length() == 0) + error = KErrNone; + else + { + // Cycle through all listed attribute values to see if we have a valid one + while (token.Length() != 0) + { + if (aAttributeValue.Compare(token) == 0) + { + // value of attribute is valid + error = KErrNone; + break; + } + else + token.Set(string.NextToken()); + + } + } + + } + + } + CleanupStack::PopAndDestroy(buf); // buf + if (compareResult == 0) // Matching item found + break; + else if (compareResult > 0) + left = pos + 1; + else + right = pos - 1; + } + + } + CleanupStack::PopAndDestroy(2); // pool, genericElementName + + return error; + } + +TBool CSMILDtd::AreValidChildElementsL(const TDesC& aParentElement, const CDesCArray& aChildElements) const +// Function to determine whether the parent/child relationship is valid in DTD +// @return ETrue if parent/child relationship is valid +// @param aParentElement the name of the parent element to be tested +// @param aChildElements an array of child element name to be tested +// @leave leave due to OOM +// + { + TBool retVal = EFalse; + + + + if(aParentElement == KSMILDTDElta) + { + retVal = CheckValidChildren(SMILDTDAChildStates,KSMILDTDAChildStateTranCount, aChildElements); + } + + else if( aParentElement == KSMILDTDEltDoc) + { + retVal = ETrue; + } + + + else if(aParentElement == KSMILDTDEltanimation || aParentElement == KSMILDTDEltaudio || aParentElement == KSMILDTDEltimg || aParentElement == KSMILDTDEltref + || aParentElement == KSMILDTDElttext || aParentElement == KSMILDTDElttextstream || aParentElement == KSMILDTDEltvideo) + { + retVal = CheckValidChildren(SMILDTDMediaChildStates, KSMILDTDMediaChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDEltbody) + { + retVal = CheckValidChildren(SMILDTDBodyChildStates, KSMILDTDBodyChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDElthead) + { + retVal = CheckValidChildren(SMILDTDHeadChildStates, KSMILDTDHeadChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDEltlayout) + { + retVal = CheckValidChildren(SMILDTDLayoutChildStates, KSMILDTDLayoutChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDEltpar || aParentElement == KSMILDTDEltseq) + { + retVal = CheckValidChildren(SMILDTDTimingChildStates, KSMILDTDTimingChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDEltsmil) + { + retVal = CheckValidChildren(SMILDTDSmilChildStates, KSMILDTDSmilChildStateTranCount, aChildElements); + } + + else if(aParentElement == KSMILDTDEltswitch) + { + retVal = CheckValidChildren(SMILDTDSwitchChildStates, KSMILDTDSwitchChildStateTranCount, aChildElements); + } + + return retVal; + } + + +TBool CSMILDtd::CheckValidChildren(const TSMILDTDChildStateType aStateTrans[],TInt aStateCount, const CDesCArray& aChildElements) const +// +// Checks child element ownership based on a Finite State Machine +// @param aFirstChild - pointer to first child element +// @param aStateTrans - Array of state transition elements. +// The elements must be ordered by tag name first and then starting state +// as this routine uses the ordering to drive an efficient search. +// @param aStateCount - the number of state transitions in the array +// @return true if the list of children matches the defined state machine +// + { + // This routine works by considering the allowed set of child elements as a Finite State + // Machine. When tracing through the list of children, each child encountered causes + // a state transition. The actual states are 'between' elements. The states are + // simply referred to by numbers, 0 is the starting state, the legal final state is + // state -1, other states are positive integers (the actual values have no significance, + // only the transitions and the start and end are of importance. + // When the list of children ends, a special 'empty tag' element is considered to be + // found. If this empty tag element causes a transition to the final state then the list + // has been successfully traversed. + // If, at any point, a child element is encountered which does not lead to a valid + // transition from the current state then the list is invalid. By considering the + // empty tag element to be on the end of the list we handle the requirements for valid + // completion. + // This routine is general - it just needs to be fed a set of state transitions for a specific + // element type. + + TBool returnValue = true; // We are successful until proved otherwise + if( aStateCount < 1 ) + { + returnValue = false; // Just check for a duff count + } + TInt fromState=KSMILDTDStartState; // Current state - the one we are looking for a transition from + TInt toState=KSMILDTDEndState; // State to which this tag leads us - initialised to avoid warning + TInt midPoint= aStateCount / 2; // Middle of the state array, used for binary search + TInt initJump = midPoint / 2; // Size of initial jump for binary search + TInt tranArrInd; // Index into the state transition array + + // Prime the search with the initial state and the tag for the first element + // We skip nodes which are not elements (e.g. text, comments or processing instructions) + + + for (TInt i = 0; i 0) + { + tranArrInd += jump; + } + jump = jump / 2; + if((compVal == 0) || (jump < KSMILDTDMinJump)) + { + keepChopping = false; + } + }// endwhile + // We have now finished binary chopping, either because we matched the tag or because + // We got to a small jump size. Now do a linear scan, up or down, to fimd a match. + + TBool up = true; // Direction of scan + tranTag.Set( aStateTrans[tranArrInd].TagName, aStateTrans[tranArrInd].TagLength); + compVal = aChildElements[i].Compare(tranTag); + if((compVal < 0) || + ((compVal == 0) && (fromState < aStateTrans[tranArrInd].FromState))) + { + up = false; + } + if( up ) + { + while((tranArrInd < aStateCount) && + ((compVal > 0) || + ((compVal == 0) && (fromState > aStateTrans[tranArrInd].FromState)))) + { + tranArrInd ++; + tranTag.Set( aStateTrans[tranArrInd].TagName, aStateTrans[tranArrInd].TagLength); + if(tranArrInd < aStateCount) + { + compVal = aChildElements[i].Compare(tranTag); + } + }// endwhile stepping up + } + else + { + while((tranArrInd >= 0) && + ((compVal < 0) || + ((compVal == 0) && (fromState < aStateTrans[tranArrInd].FromState)))) + { + tranArrInd --; + tranTag.Set( aStateTrans[tranArrInd].TagName, aStateTrans[tranArrInd].TagLength); + if(tranArrInd >= 0) + { + compVal = aChildElements[i].Compare(tranTag); + } + }// endwhile stepping down + } + // If we have a match, fine, else this is an illegal transition + if((tranArrInd >= 0) && (tranArrInd < aStateCount) && + (compVal == 0) && (fromState == aStateTrans[tranArrInd].FromState)) + { + toState = aStateTrans[tranArrInd].ToState; + } + else + { + returnValue = false; + break; + } + }//end else not reached end of list of children + + fromState = toState; + }// endfor + + if(returnValue) + { + tranArrInd = 0; + while((tranArrInd < aStateCount) && + (aStateTrans[tranArrInd].FromState != fromState) && + (aStateTrans[tranArrInd].TagLength == 0)) + { + tranArrInd++; + } + if((tranArrInd < aStateCount) && + (aStateTrans[tranArrInd].FromState == fromState) && + (aStateTrans[tranArrInd].TagLength == 0)) + { + toState = aStateTrans[tranArrInd].ToState ; // Better be the final state! + } + else + { + returnValue = false ; // No legal transition + } + } + + + return returnValue; + } + + + + +TBool CSMILDtd::CanElementHaveChildren(const TDesC& aElement) const +// +// Function to determine whether it is valid for a particular element to +// have children +// @param aElement the name of the element to be tested +// @return ETrue if it is valid for element to have children +// + { + TBool retVal = ETrue; + if(aElement == KSMILDTDEltanchor || aElement == KSMILDTDEltmeta || aElement == KSMILDTDEltroot_layout + || aElement == KSMILDTDEltregion || aElement == KSMILDTDEltarea || aElement == KSMILDTDEltmetadata + || aElement == KSMILDTDEltprefetch || aElement == KSMILDTDEltTrans) + retVal = EFalse; + + return retVal; + + } diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_XMLParserLOG.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_XMLParserLOG.CPP Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,190 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifdef _DEBUG +#undef _MSG_NO_LOGGING +#endif + +#include "t_XMLParserLOG.H" + + +CImLog::CImLog() + { + __DECLARE_NAME(_S("CImLog")); + } + +// +// NewL - user describes full file path and file name for the log file +// +CImLog *CImLog::NewL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode) + { + CImLog* self = new (ELeave) CImLog(); + CleanupStack::PushL(self); + self->ConstructL(aFullFilePath,aImLogOpenMode); + CleanupStack::Pop(); + return self; + } + +// +// 2nd phase of construction +// +#ifndef _MSG_NO_LOGGING +void CImLog::ConstructL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode) +#else +void CImLog::ConstructL(const TDesC& /*aFullFilePath*/, TImLogOpenMode /*aImLogOpenMode*/) +#endif + { +#ifndef _MSG_NO_LOGGING + + User::LeaveIfError(iFs.Connect()); + TFileName logFile; + logFile.Append(aFullFilePath); + + if (aImLogOpenMode==EAppend) + { + TInt err=iFile.Open(iFs,logFile,EFileWrite|EFileShareAny); + if (err==KErrNotFound) + { + iFile.Create(iFs,logFile,EFileWrite|EFileShareAny); + } + else if (err != KErrNone) + { + User::Leave(err); + } + TInt position=1; + User::LeaveIfError(iFile.Seek(ESeekEnd,position)); + } + else + { + // If the log directory has not been created, no log will be created. OK + User::LeaveIfError(iFile.Replace(iFs,logFile,EFileWrite|EFileShareAny)); + } + +#endif // _MSG_NO_LOGGING + } + +CImLog::~CImLog() + { +#ifndef _MSG_NO_LOGGING + + iFile.Close(); + iFs.Close(); + +#endif // _MSG_NO_LOGGING + } + +// +// Log an error message +// +#ifndef _MSG_NO_LOGGING +void CImLog::AppendError(const TDesC8& aErrorMessage, TInt aErrorCode) +#else +void CImLog::AppendError(const TDesC8& /*aErrorMessage*/, TInt /*aErrorCode*/) +#endif + { +#ifndef _MSG_NO_LOGGING + WriteToLog(KLogErrorString, &aErrorMessage, aErrorCode); +#endif + } + +// +// Log a comment +// +#ifndef _MSG_NO_LOGGING +void CImLog::AppendComment(const TDesC8& aMessage) +#else +void CImLog::AppendComment(const TDesC8& /*aMessage*/) +#endif + { +#ifndef _MSG_NO_LOGGING + WriteToLog(KLogCommentString, &aMessage); +#endif + } + +// +// Construct a string with date, a message type indicator (out, in, error) sort out formatting +// +#ifndef _MSG_NO_LOGGING +void CImLog::BuildLogString(const TDesC8& aFormat,const TDesC8& aOutPut, TBool aWriteCrLf) +#else +void CImLog::BuildLogString(const TDesC8& /*aFormat*/,const TDesC8& /*aOutPut*/, TBool /*aWriteCrLf*/) +#endif + { +#ifndef _MSG_NO_LOGGING + + TPtrC8 logString(aOutPut); + + for(;;) + { + TInt crLfPos=logString.Find(KLogCR); + if(crLfPos==KErrNotFound) + { + break; + } + else + { + TPtrC8 line; + if (aWriteCrLf && (crLfPos == logString.Size() - 2)) + { + line.Set(logString); + } + else + { + line.Set(logString.Left(crLfPos)); + } + WriteToLog(TRefByValue(aFormat),&line); + logString.Set(logString.Mid(crLfPos+2)); + } + } + + if(logString.Length()) + { + WriteToLog(TRefByValue(aFormat),&logString); + } + +#endif // _MSG_NO_LOGGING + } + +// +// Write information to the log file +// +#ifndef _MSG_NO_LOGGING +void CImLog::WriteToLog(TRefByValue aFmt,...) +#else +void CImLog::WriteToLog(TRefByValue /*aFmt*/,...) +#endif + { +#ifndef _MSG_NO_LOGGING + + TBuf8<1024> buf; + TTime date; + date.HomeTime(); + TBuf<18> dateString; + TRAPD(error, date.FormatL(dateString,(KLogDateFormatString))); + if(error) + { + dateString.Copy(_L("Invalid Date")); + } + buf.Copy(dateString); + + VA_LIST list; + VA_START(list,aFmt); + + buf.AppendFormatList(aFmt,list); + buf.Append(KLogCR); + iFile.Write(buf); + +#endif // _MSG_NO_LOGGING + } diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_XMLParserLOG.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_XMLParserLOG.H Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#if !defined(__E32BASE_H__) +#include +#endif + +#if !defined(__F32FILE_H__) +#include +#endif + +_LIT(KLogFileName, "C:\\MsgLogs\\T_GMXMLFAILURE"); +_LIT8(KLogErrorString, "** %S %d"); +_LIT8(KLogCommentString, " %S"); +_LIT8(KLogCR, "\r\n"); +_LIT(KLogDateFormatString, "%D%M%*Y%1%/1%2%/2%3 %H%:1%T%:2%S"); + + +// Setting to select whether a new log file will be created, +// or existing one will be appended to... + +/** +@internalTechnology +@released +*/ +enum TImLogOpenMode + { + EReplace, + EAppend + }; + +class CImLog : public CBase +/** +@internalTechnology +@released +*/ + { +public: + static CImLog* NewL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); + ~CImLog(); + + void AppendComment(const TDesC8& aMessage); + void AppendError(const TDesC8& aErrorMessage, TInt aErrorCode); +private: + CImLog(); + void ConstructL(const TDesC& aFullFilePath, TImLogOpenMode aImLogOpenMode); + + void BuildLogString(const TDesC8& aFormat,const TDesC8& aOutPut, TBool aWriteCrLf = EFalse); + void WriteToLog(TRefByValue aFmt,...); +private: + RFile iFile; + RFs iFs; + }; + diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_smildtdenum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_smildtdenum.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// smildtdenum.h +// +// +/** + * @file + * @internalComponent + * @released + */ +#ifndef T_SMILDTDENUM_H +#define T_SMILDTDENUM_H + +#include + +// Structures and definitions for child element checking. +// The child element checks are managed by a state machine and this type defines +// allowed transitions. +struct TSMILDTDChildStateType +/** +@internalComponent +@released +*/ + { + TInt FromState; // Starting state - 0 = initial state + TInt ToState; // Next state - -1 = terminating state + const TText *TagName; // Name of tag causing the transition, empty string = finished + TInt TagLength; // Length of tag string (helps to make the descriptor) + }; + +#endif // T_SMILDTDENUM_H diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_smiltranslatortest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_smiltranslatortest.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1219 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the Console Test Harness for testing the SMILTranslator .dll +// It carries this out by searching for all files of a certain type (as specified by +// KWildName) that reside in a given set of directories (as specified by KInputPathList) +// It then passes each file through a Parser object, picks up the resultant Document +// object and passes this straight back to the composer object. Output is a new XML +// file of the same name but different directory (same as initial directory but with +// KTestFindStr replaced by KTestReplaceStr & KTestReplaceStr2) - these directories are +// created automatically. The application then reports any errors for each file before +// moving onto the next one. These error reports are copied to the console screen (but +// usually too fast to read); to the output window in developer studio; and to a flat +// file (named and located as specified in KErrorFileName) +// There are 3 types of test that may be run. The Basic test merely +// translates all input files to output files. The Performance test does the same thing +// multiple times (as specified by KPerformanceTestIterations), although the log file +// output will only relate to the last run. Finally the Memory test utilises the Heap +// Allocation Failure tool to incrementally run and progressively fail at each and every +// attempt to allocate memory, it's finally run should complete successfully to prove +// that no memory leaks have occurred in spite of X hundreds of previously failed runs. +// Note that this finally test should be done with a much reduced number of files +// residing in the input directories. +// The application can test ASCII or Unicode input and output (4 combinations possible). +// To vary the input you must manually add ASCII or Unicode files to the input +// directories. +// The tests can be run automatically or interactively: +// For interactive tests, run with '-i as follows: +// SMILTRANSLATORTEST.EXE -i +// To run with out user interaction, please see the following examples: +// SMILTRANSLATORTEST.EXE -h # show command line help +// SMILTRANSLATORTEST.EXE # runs with default options +// SMILTRANSLATORTEST.EXE -file_type ascii -data_mode file -test_type basic # same as above +// SMILTRANSLATORTEST.EXE -use_file_handles # msgapi2 only +// SMILTRANSLATORTEST.EXE -use_full_paths # msgapi2 only +// SMILTRANSLATORTEST.EXE -test_type performance -performance_iteratons 3 # performance test with 3 iterations +// +// + +/** + @file +*/ + +//#define DEBUG_SMILTRANSLATORTEST_ + +#include +#include +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "t_smildtdenum.h" +#endif +#include "t_SmilDtd.h" +#include + +// Constants +_LIT(KErrorFileName,"c:\\legacyminidomparsertest\\SMIL_Test_Files\\ErrorLog.txt"); +_LIT(KParseError," Parse File error = "); +_LIT(KComposeError," Compose File error = "); +_LIT(KOutputNewLine,"\r\n"); +_LIT(KStartFile,"Starting test of file "); +_LIT(KTxtAsciiOrUnicode,"Unicode (F1), Ascii (F2) or Utf-8 (F3) output?"); +_LIT(KTxtBufferOrFile,"\nTest file API (F1), test buffer API (F2)"); +_LIT(KTxtChooseTest,"\nPress:\nF1 (or any other key) for Basic test\nF2 for Performance test\nF3 for Memory Allocation test"); +_LIT(KSmilTranslatorTest,"Smil Translator"); +_LIT(KInputPathList, "c:\\legacyminidomparsertest\\SMIL_Test_Files\\SMIL_Input\\Valid\\;c:\\legacyminidomparsertest\\SMIL_Test_Files\\MMS_Input\\Valid\\;c:\\legacyminidomparsertest\\SMIL_Test_Files\\SMIL_Input\\Invalid\\;c:\\legacyminidomparsertest\\SMIL_Test_Files\\MMS_Input\\Invalid\\;"); +_LIT(KTestFindStr, "_Input\\"); +_LIT(KTestReplaceStr, "_Output\\"); +_LIT(KWildName, "*.txt"); // read all file that match *.txt +_LIT(KOptionI, "-i"); // unary: interactive mode +_LIT(KOptionH, "-h"); +// note: traditional style args "--file-type" don't work with the CCommandLineArguments class +_LIT(KOptionFileType, "-file_type"); // binary: ascii, utf8, unicode +_LIT(KOptionDataMode, "-data_mode"); // binary: buffer, file +_LIT(KOptionTestType, "-test_type"); // binary: basic, performance, memory +_LIT(KOptionPerformanceIterations, "-performance_iterations"); // binary: +_LIT(KOptionUseFileHandles, "-use_file_handles"); // unary: use file handles as input +_LIT(KOptionUseFullPaths, "-use_full_paths"); // unary: use full paths as input +_LIT(KTxtChooseFileInput, "Choose input file type: Using file path (F1), Using file handle (F2)?"); + +// Globals +LOCAL_D CTrapCleanup* theCleanup; +LOCAL_D CActiveScheduler* scheduler; +LOCAL_D RTest test(KSmilTranslatorTest); +LOCAL_D RFs fileSystem; +class CTestConfig; +LOCAL_D CTestConfig* testConfig; + +// +// TestConfig +class CTestConfig : public CBase + { +public: + typedef enum {EBasic, EPerformance, EMemory} TTestType; + typedef enum {EFileData, EBufferData} TXMLDataMode; + static CTestConfig* NewLC(); + ~CTestConfig() {} + + TInt ProcessCommandLineL(); + void InteractiveMode(); + + // accessors + TBool NeedsHelp() const {return iNeedsHelp; } + TBool IsInteractive() const {return iIsInteractive; } + TXMLFileType FileType() const {return iFileType; } + TXMLDataMode DataMode() const {return iDataMode; } + TTestType TestType() const {return iTestType; } + TInt PerformanceTestIterations() const {return iPerformanceTestIterations; } + + // display + void DisplayHelp(); + void UseageErr(); + void Dump(); + + TBool UseFileHandles() const {return iUseFileHandles; } + + +private: + void ConstructL(); + TBool UnaryArgPresent(CCommandLineArguments* aArgs,TInt aArgCount, const TDesC& aOption); + TInt ExtractBinaryArg(CCommandLineArguments* aArgs,TInt aArgCount, const TDesC& aOption,TBuf<32>& aBuf); + + TBool FileTypeFromStr(const TBuf<32>& aFileType); + TBool DataModeFromStr(const TBuf<32>& aDataMode); + TBool TestTypeFromStr(const TBuf<32>& aTestType); +private: + TBool iNeedsHelp; + TBool iIsInteractive; + TXMLFileType iFileType; + TTestType iTestType; + TXMLDataMode iDataMode; + TInt iPerformanceTestIterations; + TBool iUseFileHandles; + }; + +void CTestConfig::ConstructL() + { + iNeedsHelp=EFalse; + iIsInteractive=EFalse; + iFileType=EAscii; + iTestType=EBasic; + iDataMode=EFileData; + iPerformanceTestIterations=100; + iUseFileHandles = EFalse; + } + +CTestConfig* CTestConfig::NewLC() + { + CTestConfig* self=new(ELeave)CTestConfig(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +TBool CTestConfig::FileTypeFromStr(const TBuf<32>& aFileType) + { + TBool found=ETrue; + if(aFileType.Compare(_L("ascii"))==0) + { + iFileType=EAscii; + } + else if(aFileType.Compare(_L("utf8"))==0) + { + iFileType=EUtf8; + } + else if (aFileType.Compare(_L("unicode"))==0) + { + iFileType=EUnicode; + } + else + { + found=EFalse; + } + return found; + } + +TBool CTestConfig::DataModeFromStr(const TBuf<32>& aDataMode) + { + TBool found=ETrue; + if(aDataMode.Compare(_L("buffer"))==0) + { + iDataMode=EBufferData; + } + else if(aDataMode.Compare(_L("file"))==0) + { + iDataMode=EFileData; + } + else + { + found=EFalse; + } + return found; + } + +TBool CTestConfig::TestTypeFromStr(const TBuf<32>& aTestType) + { + TBool found=ETrue; + if (aTestType.Compare(_L("basic"))==0) + { + iTestType=EBasic; + } + else if (aTestType.Compare(_L("performance"))==0) + { + iTestType=EPerformance; + } + else if (aTestType.Compare(_L("memory"))==0) + { + iTestType=EMemory; + } + else + { + found=EFalse; + } + return found; + } + +void CTestConfig::DisplayHelp() + { + test.Printf(KOptionH); + test.Printf(_L("\thelp\r\n")); + test.Printf(KOptionI); + test.Printf(_L("\tinteractive mode\r\n")); + test.Printf(KOptionFileType); + test.Printf(_L("\tascii|utf8|unicode\r\n")); + test.Printf(KOptionDataMode); + test.Printf(_L("\tbuffer-data|file-data\r\n")); + test.Printf(KOptionTestType); + test.Printf(_L("\tbasic|performance|memory\r\n")); + test.Printf(KOptionPerformanceIterations); + test.Printf(_L(" N\tthe number of iterations to perform\r\n")); + test.Printf(KOptionUseFileHandles); + test.Printf(_L("\tuse file handles for the test\r\n")); + test.Printf(KOptionUseFullPaths); + test.Printf(_L("\tuse file paths for the test\r\n")); + } + +void CTestConfig::UseageErr() + { + test.Printf(_L("\r\nUseage Err:\r\n")); + DisplayHelp(); + } + +void CTestConfig::Dump() + { + RDebug::Print(_L("\r\n")); + RDebug::Print(_L("SMILTRANSLATORTEST Config Settings:\r\n")); + RDebug::Print(_L("===================================\r\n")); + RDebug::Print(_L("iNeedsHelp = %d\r\n"),iNeedsHelp); + RDebug::Print(_L("iIsInteractive = %d\r\n"),iIsInteractive); + RDebug::Print(_L("iFiletype = %d\r\n"),iFileType); + RDebug::Print(_L("iTestType = %d\r\n"),iTestType); + RDebug::Print(_L("iDataMode = %d\r\n"),iDataMode); + RDebug::Print(_L("iPerformanceTestIterations = %d\r\n"),iPerformanceTestIterations); + RDebug::Print(_L("iUseFileHanldes = %d\r\n"),iUseFileHandles); + } + +TBool CTestConfig::UnaryArgPresent(CCommandLineArguments *aArgs, TInt aArgCount, const TDesC& aOption) + { + TInt i = 1; + while ((iArg(i).Compare(aOption)) + { + ++i; + } + return i& aBuf) + { + TInt err=KErrNotFound; + TInt i=0; + + while ((iArg(i).Compare(aOption)) + { + ++i; + } + if (iArg(i); + } + else + { + err=KErrArgument; + } + } + return err; + } + +void CTestConfig::InteractiveMode() + { + TKeyCode choice; + + test.Printf(KTxtAsciiOrUnicode); + choice=test.Getch(); + + if(choice==EKeyHelp) + { + iFileType=EAscii; + } + else if(choice==EKeyDial) + { + iFileType=EUtf8; + } + else + { + iFileType=EUnicode; + } + test.Printf(KTxtBufferOrFile); + choice=test.Getch(); + if(choice==EKeyHelp) + { + iDataMode=EBufferData; + } + else + { + iDataMode=EFileData; + } + + // Get user's input on whether to use file paths or file handles for the input files + test.Printf(KOutputNewLine()); + test.Printf(KTxtChooseFileInput()); + choice=test.Getch(); + iUseFileHandles=EFalse; + if(choice==EKeyHelp) // F2 + { + iUseFileHandles = ETrue; + } + + test.Printf(KTxtChooseTest); + choice=test.Getch(); + if(choice==EKeyHelp) // F2 + { + iTestType=EPerformance; + } + else if (choice==EKeyDial) // F3 + { + iTestType=EMemory; + } + else // any key + { + iTestType=EBasic; + } + } + +TInt CTestConfig::ProcessCommandLineL() + { + // Handle command line arguments + CCommandLineArguments* args=CCommandLineArguments::NewLC(); + + TInt argCount=args->Count(); + + // Search for: "-h"/help parameter + if (UnaryArgPresent(args,argCount,KOptionH)) + { + iNeedsHelp = ETrue; + CleanupStack::Pop(args); + delete args; + return KErrNone; + } + + // Search for: "-i"/interactive parameter + if(UnaryArgPresent(args,argCount,KOptionI)) + { + if (argCount==2) + { + iIsInteractive=ETrue; + } + else + { + UseageErr(); + } + } + // Search for: "-usefilehandles" parameter + if(UnaryArgPresent(args,argCount,KOptionUseFileHandles)) + { + iUseFileHandles=ETrue; + } + // Search for: "-usefullpaths" parameter + if(UnaryArgPresent(args,argCount,KOptionUseFullPaths)) + { + iUseFileHandles=EFalse; + } + + // Search for: --file-type, --data-mode, --test-type + TBuf<32> buf; + TInt err; + if (((err=ExtractBinaryArg(args,argCount,KOptionFileType,buf))==KErrNone)&&(!FileTypeFromStr(buf))|| + err==KErrArgument) + { + UseageErr(); + CleanupStack::PopAndDestroy(args); + return KErrArgument; + } + if (((err=ExtractBinaryArg(args,argCount,KOptionDataMode,buf))==KErrNone)&&(!DataModeFromStr(buf))|| + err==KErrArgument) + { + UseageErr(); + CleanupStack::PopAndDestroy(args); + return KErrArgument; + } + if (((err=ExtractBinaryArg(args,argCount,KOptionTestType,buf))==KErrNone)&&(!TestTypeFromStr(buf))|| + err==KErrArgument) + { + UseageErr(); + CleanupStack::PopAndDestroy(args); + return KErrArgument; + } + if (((err=ExtractBinaryArg(args,argCount,KOptionPerformanceIterations,buf))==KErrNone)) + { + TLex16 lexer(buf.Ptr()); + TInt iterations; + lexer.Val(iterations); + iPerformanceTestIterations = iterations; + } + else if (err==KErrArgument) + { + UseageErr(); + CleanupStack::PopAndDestroy(args); + return KErrArgument; + } + CleanupStack::PopAndDestroy(args); + return KErrNone; + } + +// + +class CTestDataSupplier : public CBase, public MMDXMLParserDataProvider + { +public: + static CTestDataSupplier* NewL(RFs &aRFs, const TDesC& aFileName); + ~CTestDataSupplier(); + + // From MMDXMLParserDataProvided + void GetData(TPtrC8 &aPtr, TRequestStatus &aStatus); + void Disconnect(); + +private: + void ConstructL(RFs &aRFs, const TDesC& aFileName); + +private: + HBufC8* iCurrentChunk; + RFile iFile; + TInt iChunkSize; // Start at 1, then increment for subsequent chunk + }; + + +CTestDataSupplier* CTestDataSupplier::NewL(RFs &aRFs, const TDesC& aFileName) + { + CTestDataSupplier* self = new (ELeave) CTestDataSupplier(); + CleanupStack::PushL(self); + self->ConstructL(aRFs, aFileName); + CleanupStack::Pop(self); + return self; + } + +CTestDataSupplier::~CTestDataSupplier() + { + iFile.Close(); + delete iCurrentChunk; + } + +// From MMDXMLParserDataProvided +// TODO: Should GetData be a leaving function? Allows more flexibility to implementations of this funtion? +void CTestDataSupplier::GetData(TPtrC8 &aPtr, TRequestStatus &aStatus) + { + // Read the data into the descriptor + delete iCurrentChunk; + iCurrentChunk = NULL; + iCurrentChunk = HBufC8::NewL(iChunkSize); + TPtr8 chunk = iCurrentChunk->Des(); + iFile.Read(chunk, iChunkSize); // Ignore the error code, assume end of file if we haven't read any data. + + TDataProviderResults result; + + if (iCurrentChunk->Length() != 0) + { + aPtr.Set(*iCurrentChunk); + result = KMoreData; + } + else + { + // Assume that if we haven't got any data then we're at the end of the stream. + result = KDataStreamEnd; + } + +// iChunkSize++; + TRequestStatus *s = &aStatus; + User::RequestComplete(s, (TInt)result); + return; + } + +void CTestDataSupplier::Disconnect() + { + // Don't need to do anything here. + } + +void CTestDataSupplier::ConstructL(RFs &aRFs, const TDesC& aFileName) + { + iChunkSize = 1; + + // Open the file that will supply the data + User::LeaveIfError(iFile.Open(aRFs, aFileName, EFileRead)); + } + + +// +// CSmilTranslatorTestUtils declaration +// + +class CSmilTranslatorTestUtils : public CActive, public MMDXMLParserObserver, public MMDXMLComposerObserver + { +public: + static CSmilTranslatorTestUtils* NewLC(); + ~CSmilTranslatorTestUtils(); + void ConstructL(); + void RunTestL(); + TInt FilesProcessed() const {return iFilesProcessed; } + +public: // from CActive + void DoCancel(); + void RunL(); + +public: // from MMDXMLParserObserver + void ParseFileCompleteL(); + +public: // from MMDXMLComposerObserver + void ComposeFileCompleteL(); + +private: + CSmilTranslatorTestUtils(); + void SetOutputFileName(); + void AppendErrorStr(TInt aError, TDes& aOutputMsg); + void AppendSeverityStr(TInt aSeverity, TDes& aOutputMsg); + +private: + enum TComposerState + { + EComposing, + ESizing + }; + + RFs iSession; + CMDXMLDocument* iXMLDoc; + + + CMDXMLParser* iParser; + CMDXMLComposer* iComposer; + TBuf<255> iInputFileName; + TBuf<255> iOutputFileName; + TComposerState iComposerState; + TInt iSize; + RFile iErrorFile; + CTestDataSupplier* iDataSupplier; + + // return list of found files used by TFileFinder class + CDir* iFileList; + + // buffer for composing the error messages for output to the screen and error file + TBuf<255> iOutputMsg; + + TFindFile *iFileFinder; + + TInt iState; + TInt iErr; + TInt iIndex; + + enum TSmilTestStates + { + KInit = 0x00, + KParseFile, + KCheckResults, + KEnd + }; + + TTime iStartTime; + TTime iStartComposeTime; + TInt64 iComposeTime; + TInt iFilesProcessed; + + TBool iUseFileHandle; + }; + +//=================================================================================== + +// +// CSmilTranslatorTestUtils definition +// + +CSmilTranslatorTestUtils* CSmilTranslatorTestUtils::NewLC() + { + CSmilTranslatorTestUtils* self = new (ELeave) CSmilTranslatorTestUtils(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +//=================================================================================== + +CSmilTranslatorTestUtils::~CSmilTranslatorTestUtils() + { + delete iFileList; + delete iXMLDoc; + delete iParser; + delete iComposer; + iSession.Close(); + } + +//=================================================================================== + +CSmilTranslatorTestUtils::CSmilTranslatorTestUtils() : CActive(EPriorityStandard), iFileFinder() + { + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::ConstructL() + { + + iSession.Connect(); + iComposer = CMDXMLComposer::NewL(this); +#define VALIDATE +#ifndef VALIDATE + iParser = CMDXMLParser::NewL(this); +#else + CSMILDtd* smil = CSMILDtd::NewLC(); + iParser = CMDXMLParser::NewL(this, smil); + CleanupStack::Pop(smil); +#endif + + iUseFileHandle = testConfig->UseFileHandles(); + + iState = KInit; + iErr = KErrNone; + iStartTime.UniversalTime(); + iFilesProcessed = 0; + + CActiveScheduler::Add(this); + + TRequestStatus *s = &iStatus; + User::RequestComplete(s, KErrNone); + SetActive(); + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::RunL() + { + RunTestL(); + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::DoCancel() + { + } + +//=================================================================================== + +#define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size())) + +void CSmilTranslatorTestUtils::RunTestL() + { + TRequestStatus *s = &iStatus; + + // used to generate a leave if an out of memory error was encountered, specifically + // during the memory test loop in E32Main(). This is necessary because leaves in + // the .dll Active Object RunL() functions do not return to this application, so + // have to be Trapped in the Active objects and translated into an error code. + TBool memoryError = EFalse; + + switch(iState) + { + case KInit: + { + // Utility class for file manipulation + iFileFinder = new TFindFile(iSession); + + TPtrC errorFileName(KErrorFileName); + + // create err dir if doesn't exist - this api ignores the file name (ignores everything after final '/') + fileSystem.MkDirAll(KErrorFileName); + + // overwrite any existing file of this name + iErr = iErrorFile.Replace(iSession, errorFileName, EFileWrite | EFileStreamText); + + if(iErr == KErrNone) + { + TBuf<1> bom; + bom.Append(CEditableText::EByteOrderMark); + iErrorFile.Write(DES_AS_8_BIT(bom)); + // will search multiple directories, but halt after completing current directory + // if at least one match is made. Remembers which directories have been searched + // in order to continue search using .FindWild() function later + iErr = iFileFinder->FindWildByPath(KWildName, &KInputPathList, iFileList); + iIndex = 0; + } + + if(iErr == KErrNone) + { + iState = KParseFile; + } + else + { + iState = KEnd; + } + User::RequestComplete(s, KErrNone); + SetActive(); + } + break; + + case KParseFile: + { + ++iFilesProcessed; + iErr = KErrNone; + + TParse fullEntry; + fullEntry.Set((*iFileList)[iIndex++].iName,& iFileFinder->File(),NULL); + iInputFileName = fullEntry.FullName(); // extract individual path + name from list + SetOutputFileName(); // output name is based on input one + + iOutputMsg = KStartFile; + iOutputMsg.Append(iInputFileName); // display full path + test.Start(iOutputMsg); // print to console + + // test console automatically places output on a new line, for output + // to error file we need to add white space ready for next line + iOutputMsg.Append(KOutputNewLine); + iErrorFile.Write(DES_AS_8_BIT(iOutputMsg)); // print to error file + + // schedule Parser active object for call to it's RunL function + if (testConfig->DataMode() == CTestConfig::EBufferData) + { + // We're testing the buffering API... + // Create a data supplier object and pass it in to the parser + delete iDataSupplier; + iDataSupplier = NULL; + iDataSupplier = CTestDataSupplier::NewL(iSession, iInputFileName); + iParser->ParseSource(iDataSupplier); + } + else + { + if( iUseFileHandle ) + { + RFile file; + User::LeaveIfError(file.Open(iSession, iInputFileName, EFileRead | EFileShareReadersOnly)); + // No function declaration of ParseFile() that take RFile Object parameter + // iParser->ParseFile(file); + iParser->ParseFile(iSession, iInputFileName); + } + else + { + // We're testing the file mode so parse the file. + iParser->ParseFile(iSession, iInputFileName); + } + } + + iState = KCheckResults; + iStatus = KRequestPending; + SetActive(); + } + break; + + case KCheckResults: + { + // when execution begins again one parse followed by a compose would have + // completed for the current file, handle any error messages generated here + iErr = iParser->Error(); + TInt severity = iParser->ErrorSeverity(); + if(iErr != KErrNone) + { + iOutputMsg = KParseError; + AppendErrorStr(iErr, iOutputMsg); + AppendSeverityStr(severity, iOutputMsg); + iOutputMsg.Append(KOutputNewLine); + + // IF there are no more errors for this file bung in an + // extra line to make output more prominent + if(iComposer->Error() == KErrNone) + { + iOutputMsg.Append(KOutputNewLine); + } + test.Printf(iOutputMsg); // print to console + iErrorFile.Write(DES_AS_8_BIT(iOutputMsg)); // print to error file + + if(iErr == KErrNoMemory) + { + memoryError = ETrue; + } + } + + iErr = iComposer->Error(); + severity = iComposer->ErrorSeverity(); + if(iErr != KErrNone) + { + iOutputMsg = KComposeError; + AppendErrorStr(iErr, iOutputMsg); + AppendSeverityStr(severity, iOutputMsg); + iOutputMsg.Append(KOutputNewLine); + iOutputMsg.Append(KOutputNewLine); + test.Printf(iOutputMsg); + iErrorFile.Write(DES_AS_8_BIT(iOutputMsg)); + + if(iErr == KErrNoMemory) + { + memoryError = ETrue; + } + } + + test.End(); + + // if the OOM condition occured during Parsing or Composing + if(memoryError) + { + User::Leave(KErrNoMemory); + } + + iState = KParseFile; + + if(iIndex >= iFileList->Count()) + { + // fileList must be deleted after each loop prior to being passed + // back to fileFinder (unnecessary after KErrNotFound) + delete iFileList; + iFileList = 0; // Just in case it doesn't get set in the FindWild + + // continue wildcard search for next directory in list + iErr = iFileFinder->FindWild(iFileList); + iIndex = 0; + if(iErr != KErrNone) + iState = KEnd; + } + + SetActive(); + User::RequestComplete(s, KErrNone); + } + break; + + default: + case KEnd: + { + TTime endTime; + TTimeIntervalSeconds interval; + endTime.UniversalTime(); + endTime.SecondsFrom(iStartTime, interval); + + TBuf<100> time; + _LIT(KComposeTime, "Total time for composing: %d microseconds\n"); + time.Format(KComposeTime, iComposeTime); + iErrorFile.Write(DES_AS_8_BIT(time)); + + _LIT(KTimeTaken, "Total time for tests: %d seconds"); + time.Format(KTimeTaken, interval.Int()); + iErrorFile.Write(DES_AS_8_BIT(time)); + + + delete iFileFinder; + delete iDataSupplier; + CActiveScheduler::Stop(); + } + break; + } + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::AppendErrorStr(TInt aError, TDes& aOutputMsg) + { + switch(aError) + { + case KErrXMLBadAttributeValue: + aOutputMsg.Append(_L("Bad Attribute Value")); break; + + case KErrXMLBadAttributeName: + aOutputMsg.Append(_L("Bad Attribute Name")); break; + + case KErrXMLInvalidChild: + aOutputMsg.Append(_L("Invalid Child")); break; + + case KErrXMLBadNesting: + aOutputMsg.Append(_L("Bad Nesting")); break; + + case KErrXMLIncomplete: + aOutputMsg.Append(_L("Incomplete")); break; + + case KErrXMLBadElementName: + aOutputMsg.Append(_L("Bad Element Name")); break; + + case KErrXMLDuplicateDocTypeTags: + aOutputMsg.Append(_L("Duplicate DocType Tags")); break; + + case KErrXMLDuplicateVersionTags: + aOutputMsg.Append(_L("Duplicate Version Tags")); break; + + case KErrXMLDuplicateRootElements: + aOutputMsg.Append(_L("Duplicate Root Elements")); break; + + case KErrXMLMissingDocTypeTag: + aOutputMsg.Append(_L("Missing DocType Tag")); break; + + case KErrXMLMissingVersionTag: + aOutputMsg.Append(_L("Missing Version Tag")); break; + + case KErrXMLDuplicateAttributeName: + aOutputMsg.Append(_L("Duplicate Attribute Name")); break; + + case KErrXMLMultipleRootElements: + aOutputMsg.Append(_L("Mulitiple Root Elements")); break; + + case KErrXMLCorruptFile: + aOutputMsg.Append(_L("Corrupt File")); break; + + case KErrXMLIllegalCharacter: + aOutputMsg.Append(_L("Illegal Character")); break; + + case KErrXMLBadEntity: + aOutputMsg.Append(_L("Malformed Entity")); break; + + case KErrXMLInvalidElement: + aOutputMsg.Append(_L("Invalid Element")); break; + + case KErrXMLInvalidAttribute: + aOutputMsg.Append(_L("Invalid Attribute")); break; + + case KErrPathNotFound: + aOutputMsg.Append(_L("File Path Not Found")); break; + + case KErrNoMemory: + aOutputMsg.Append(_L("Memory Allocation Failure")); break; + + case KErrNotSupported: + aOutputMsg.Append(_L("Not Supported")); break; + + default: + aOutputMsg.Append(_L("Unknown Error")); break; + } + } + +//=================================================================================== +void CSmilTranslatorTestUtils::AppendSeverityStr(TInt aSeverity, TDes& aOutputMsg) + { + aOutputMsg.Append(_L(", Severity ")); + switch(aSeverity) + { + case EXMLFatal: + aOutputMsg.Append(_L("Fatal")); + break; + case EXMLIndeterminate: + aOutputMsg.Append(_L("Indeterminate")); + break; + case EXMLWorkable: + aOutputMsg.Append(_L("Workable")); + break; + case EXMLNone: + aOutputMsg.Append(_L("None")); + break; + default: + aOutputMsg.Append(_L("Unknown")); + break; + } + } +//=================================================================================== + +void CSmilTranslatorTestUtils::ParseFileCompleteL() +// call back function called from Parser::RunL() + { + // iXMLDoc ends up owned by this class, must delete off the old one on each pass. + delete iXMLDoc; + iXMLDoc = NULL; + + // get parsed file, don't worry about errors, composer should be robust enough to handle bad files + iXMLDoc = iParser->DetachXMLDoc(); + + iComposerState = EComposing; + TRequestStatus *s = &iStatus; + + iStartComposeTime.UniversalTime(); + + // create output dir if doesn't exist - this api ignores the file name (ignores everything after final '/') + fileSystem.MkDirAll(iOutputFileName); + + // schedule composer active object for call to it's RunL function + + if( iUseFileHandle ) + { + RFile file; + TInt fileError = file.Replace(iSession, iOutputFileName, EFileWrite | EFileStream); + + if( fileError==KErrNone ) + { + // No function declaration of ComposeFile() that take RFile Object parameter +// iErr = iComposer->ComposeFile(file, iXMLDoc, filetype); + iErr = iComposer->ComposeFile(iSession, iOutputFileName, iXMLDoc, testConfig->FileType()); + } + else + { + // if a file error has occured, we need to set the internal error state + // and can only do this by trying to compose again with the filepath so + // it fails internally + iErr = iComposer->ComposeFile(iSession, iOutputFileName, iXMLDoc, testConfig->FileType()); + } + } + else + { + iErr = iComposer->ComposeFile(iSession, iOutputFileName, iXMLDoc, testConfig->FileType()); + } + + // we are waiting on this event... + User::RequestComplete(s, KErrNone); + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::ComposeFileCompleteL() +// call back function called from Composer::RunL() + { + TTime timeNow; + timeNow.UniversalTime(); + TTimeIntervalMicroSeconds timeForCompose = timeNow.MicroSecondsFrom(iStartComposeTime); + iComposeTime += timeForCompose.Int64(); + + if (iComposerState == ESizing) + { + // Check the size of the file that has been written against the size calulated by the + // call to CMDXMLComposer::CalculateFileSize + + RFile outputXMLFile; + outputXMLFile.Open(iSession, iOutputFileName, EFileRead); + + TInt actualSize; + User::LeaveIfError(outputXMLFile.Size(actualSize)); + + if (iSize != actualSize) + { + // The calculated file size doesn't match the real file size, this test has failed + TBuf<255> outputMsg; + + outputMsg.Append(KOutputNewLine); + outputMsg.Append(_L("Test Failed - The calculated file size doesn't match the actual size.")); + outputMsg.Append(KOutputNewLine); + + test.Printf(outputMsg); // print to console + iErrorFile.Write(DES_AS_8_BIT(outputMsg)); // print to error file + } + + outputXMLFile.Close(); + + // If we are sizing then stop the active scheduler. Once the scheduler is stopped + // and this function exits, program control resumes where the scheduler was started + // in RunTestL. +// CActiveScheduler::Stop(); + } + + else if (iComposerState == EComposing) + { + // The XML file has been composed. Now we need to run the sizing function to check + // that we can calculate the size correctly. + + // Set the state to sizing and run the sizing operation... + iComposerState = ESizing; + + // Calculate the file size and wait for the callback to this function again. + iComposer->CalculateFileSize(iSize, iXMLDoc, testConfig->FileType()); + } + } + +//=================================================================================== + +void CSmilTranslatorTestUtils::SetOutputFileName() + { + TInt offset; + + iOutputFileName = iInputFileName; + if((offset = iOutputFileName.Find(KTestFindStr)) != KErrNotFound) + { + iOutputFileName.Replace(offset, TPtrC(KTestFindStr).Length(), KTestReplaceStr); + } + } + +//=================================================================================== + +// +// TestHarness implementation +// + + + +LOCAL_C TInt startTestL() + { + TInt err = KErrNone; + + // we may need to make some output dirs if they don't already exist + fileSystem.Connect(); + + scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install( scheduler ); + + CSmilTranslatorTestUtils* ttu=CSmilTranslatorTestUtils::NewLC(); + + // suspend execution until active object scheduler is finished + CActiveScheduler::Start(); + + if (ttu->FilesProcessed()==0) + err=KErrNotFound; + + fileSystem.Close(); + CleanupStack::PopAndDestroy(2, scheduler); //scheduler, as well as the object + //placed on the stack by CSmilTranslatorTestUtils::NewLC(); + return err; + } + +LOCAL_C TInt doMainL() + { + testConfig = CTestConfig::NewLC(); + + // set command line options + TInt err=testConfig->ProcessCommandLineL(); + if(err!=KErrNone) + return err; + + // users specified -h: display help to console and abort + if (testConfig->NeedsHelp()) + { + testConfig->DisplayHelp(); + test.Getch(); + return KErrNone; + } + + // user specified -i: let them override settings inside the console + if (testConfig->IsInteractive()) + testConfig->InteractiveMode(); + +#ifdef DEBUG_SMILTRANSLATORTEST_ + testConfig->Dump(); +#endif + + TInt returnCode = KErrNone; + + // performance Performance Test + if (testConfig->TestType() == CTestConfig::EPerformance) + { + TInt loopFor = 0; + do + { + loopFor++; + returnCode=startTestL(); // Qualified: false leavescan error + } + while(loopFor!=testConfig->PerformanceTestIterations() && returnCode == KErrNone); + } + else if (testConfig->TestType()==CTestConfig::EMemory) + { + TInt after = 0; + do + { + after++; + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EDeterministic, after); + returnCode=startTestL(); + } + while(returnCode != KErrNone); + } + // Assume user wants a basic test + else + { + returnCode=startTestL(); + } + + CleanupStack::Pop(testConfig); + return returnCode; + } +void CopyFileL() + { + RFs fs; + fs.Connect(); + CleanupClosePushL(fs); + + CFileMan* fileMan = CFileMan::NewL(fs); + CleanupStack::PushL(fileMan); + + // Do the file copy + User::LeaveIfError(fileMan->Copy(_L("z:\\gmxmltest.txt"),_L("c:\\gmxmltest.txt"),CFileMan::EOverWrite)); + User::LeaveIfError(fileMan->Copy(_L("z:\\legacyminidomparsertest"),_L("c:\\legacyminidomparsertest"),CFileMan::EOverWrite|CFileMan::ERecurse)); + + CleanupStack::PopAndDestroy(2); + } + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + theCleanup=CTrapCleanup::New(); + test.Start(_L("Smil Translator")); + TRAPD(err,CopyFileL()); + test(err == KErrNone); + TInt returnCode=KErrNone; + TRAP(returnCode,returnCode=doMainL()); + test(returnCode==KErrNone); + delete testConfig; + delete theCleanup; + test.End(); + test.Close(); + __UHEAP_MARKEND; + User::Heap().Check(); + return(KErrNone); + } + +// End Of File diff -r 000000000000 -r e35f40988205 xml/legacyminidomparser/XMLParser/test/t_smiltranslatortest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/legacyminidomparser/XMLParser/test/t_smiltranslatortest.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// t_smiltranslatortest.mmp +// + +TARGET t_smiltranslatortest.exe +TARGETTYPE exe + +SOURCEPATH . +SOURCE t_smiltranslatortest.cpp +SOURCE t_Smildtd.cpp + + +USERINCLUDE . + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY xmlparser.lib +LIBRARY bafl.lib + +SOURCEPATH ../STRINGS +START STRINGTABLE SMILElements.st + EXPORTPATH /epoc32/include +END +START STRINGTABLE SMILGenericElements.st + EXPORTPATH /epoc32/include +END +START STRINGTABLE SMILAttributes.st + EXPORTPATH /epoc32/include +END + +EPOCSTACKSIZE 0x8000 + + + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/libxml2libs/bwins/xmlengine.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/bwins/xmlengine.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,941 @@ +EXPORTS + UTF8Toisolat1 @ 1 NONAME + __xmlErrEncoding @ 2 NONAME ABSENT + __xmlRaiseError @ 3 NONAME ABSENT + __xmlSimpleError @ 4 NONAME ABSENT + free_debug @ 5 NONAME ABSENT + htmlDocContentDumpFormatOutput @ 6 NONAME + htmlDocContentDumpOutput @ 7 NONAME + htmlIsBooleanAttr @ 8 NONAME + htmlNewDoc @ 9 NONAME + htmlNewDocNoDtD @ 10 NONAME + htmlNodeDumpFormatOutput @ 11 NONAME + htmlSetMetaEncoding @ 12 NONAME + htmlTagLookup @ 13 NONAME + initGenericErrorDefaultFunc @ 14 NONAME + inputPop @ 15 NONAME + inputPush @ 16 NONAME + isolat1ToUTF8 @ 17 NONAME + malloc_impl @ 18 NONAME + namePop @ 19 NONAME + namePush @ 20 NONAME + nodePop @ 21 NONAME + nodePush @ 22 NONAME + realloc_impl @ 23 NONAME + symbian_snprintf @ 24 NONAME ABSENT + symbian_vsnprintf @ 25 NONAME ABSENT + trio_fpclassify_and_signbit @ 26 NONAME + trio_isinf @ 27 NONAME + trio_isnan @ 28 NONAME + trio_nan @ 29 NONAME + trio_ninf @ 30 NONAME + trio_nzero @ 31 NONAME + trio_pinf @ 32 NONAME + trio_signbit @ 33 NONAME + valuePop @ 34 NONAME + valuePush @ 35 NONAME + xeCheckErrno @ 36 NONAME ABSENT + xeCleanupDOMStringConverter @ 37 NONAME ABSENT + xeGetGlobalConsts @ 38 NONAME ABSENT + xeGetTLS @ 39 NONAME + xeSetTLS @ 40 NONAME ABSENT + xeStackLimitAddress @ 41 NONAME ABSENT + xeXPathCleanup @ 42 NONAME ABSENT + xmlAddAttributeDecl @ 43 NONAME + xmlAddChild @ 44 NONAME + xmlAddChildList @ 45 NONAME + xmlAddDocEntity @ 46 NONAME + xmlAddDtdEntity @ 47 NONAME + xmlAddElementDecl @ 48 NONAME + xmlAddID @ 49 NONAME + xmlAddIDs @ 50 NONAME + xmlAddNextSibling @ 51 NONAME + xmlAddNotationDecl @ 52 NONAME + xmlAddPrevSibling @ 53 NONAME + xmlAddRef @ 54 NONAME + xmlAddSibling @ 55 NONAME + xmlAllocOutputBuffer @ 56 NONAME + xmlAllocParserInputBuffer @ 57 NONAME + xmlAppendDataList @ 58 NONAME + xmlAttrSerializeTxtContent @ 59 NONAME + xmlBufferAdd @ 60 NONAME + xmlBufferAddHead @ 61 NONAME + xmlBufferCCat @ 62 NONAME + xmlBufferCat @ 63 NONAME + xmlBufferCreate @ 64 NONAME + xmlBufferCreateSize @ 65 NONAME + xmlBufferCreateStatic @ 66 NONAME + xmlBufferFree @ 67 NONAME + xmlBufferGrow @ 68 NONAME + xmlBufferLength @ 69 NONAME + xmlBufferResize @ 70 NONAME + xmlBufferShrink @ 71 NONAME + xmlBufferWriteCHAR @ 72 NONAME + xmlBufferWriteChar @ 73 NONAME + xmlBufferWriteQuotedString @ 74 NONAME + xmlBuildQName @ 75 NONAME + xmlBuildURI @ 76 NONAME + xmlC14NDocDumpMemory @ 77 NONAME + xmlC14NDocSave @ 78 NONAME + xmlC14NDocSaveTo @ 79 NONAME + xmlC14NExecute @ 80 NONAME + xmlCanonicPath @ 81 NONAME + xmlCharEncCloseFunc @ 82 NONAME + xmlCharEncFirstLine @ 83 NONAME + xmlCharEncInFunc @ 84 NONAME + xmlCharEncOutFunc @ 85 NONAME + xmlCharInRange @ 86 NONAME + xmlCharStrdup @ 87 NONAME + xmlCharStrndup @ 88 NONAME + xmlCheckFilename @ 89 NONAME + xmlCheckHTTPInput @ 90 NONAME + xmlCheckLanguageID @ 91 NONAME + xmlCheckVersion @ 92 NONAME + xmlCleanupCharEncodingHandlers @ 93 NONAME + xmlCleanupEncodingAliases @ 94 NONAME + xmlCleanupGlobalData @ 95 NONAME + xmlCleanupInputCallbacks @ 96 NONAME + xmlCleanupMemory @ 97 NONAME + xmlCleanupOutputCallbacks @ 98 NONAME + xmlCleanupParser @ 99 NONAME + xmlCleanupThreads @ 100 NONAME + xmlClearParserCtxt @ 101 NONAME + xmlCopyAttributeTable @ 102 NONAME + xmlCopyChar @ 103 NONAME + xmlCopyCharMultiByte @ 104 NONAME + xmlCopyDoc @ 105 NONAME + xmlCopyDtd @ 106 NONAME + xmlCopyElementContent @ 107 NONAME + xmlCopyElementTable @ 108 NONAME + xmlCopyEntitiesTable @ 109 NONAME + xmlCopyEnumeration @ 110 NONAME + xmlCopyError @ 111 NONAME + xmlCopyNamespace @ 112 NONAME + xmlCopyNamespaceList @ 113 NONAME + xmlCopyNode @ 114 NONAME + xmlCopyNodeList @ 115 NONAME + xmlCopyNotationTable @ 116 NONAME + xmlCopyProp @ 117 NONAME + xmlCopyPropList @ 118 NONAME + xmlCreateAndInitializeGlobalState @ 119 NONAME + xmlCreateDocParserCtxt @ 120 NONAME + xmlCreateEntityParserCtxt @ 121 NONAME + xmlCreateEnumeration @ 122 NONAME + xmlCreateFileParserCtxt @ 123 NONAME + xmlCreateIntSubset @ 124 NONAME + xmlCreateMemoryParserCtxt @ 125 NONAME + xmlCreatePushParserCtxt @ 126 NONAME + xmlCreateURI @ 127 NONAME + xmlCreateURLParserCtxt @ 128 NONAME + xmlCtxtGetLastError @ 129 NONAME + xmlCtxtReset @ 130 NONAME + xmlCtxtResetLastError @ 131 NONAME + xmlCtxtUseOptions @ 132 NONAME + xmlCurrentChar @ 133 NONAME + xmlDefaultExternalEntityLoader @ 134 NONAME ABSENT + xmlDefaultSAXHandlerInit @ 135 NONAME + xmlDeregisterNodeDefault @ 136 NONAME + xmlDetectCharEncoding @ 137 NONAME + xmlDictCreate @ 138 NONAME + xmlDictCreateSub @ 139 NONAME + xmlDictFree @ 140 NONAME + xmlDictLookup @ 141 NONAME + xmlDictOwns @ 142 NONAME + xmlDictQLookup @ 143 NONAME + xmlDictReference @ 144 NONAME + xmlDocContentDumpOutput @ 145 NONAME ABSENT + xmlDocCopyNode @ 146 NONAME + xmlDocDumpFormatMemory @ 147 NONAME + xmlDocDumpFormatMemoryEnc @ 148 NONAME + xmlDocDumpMemory @ 149 NONAME + xmlDocDumpMemoryEnc @ 150 NONAME + xmlDocGetRootElement @ 151 NONAME + xmlDocSetRootElement @ 152 NONAME + xmlDumpAttributeDecl @ 153 NONAME + xmlDumpAttributeTable @ 154 NONAME + xmlDumpElementDecl @ 155 NONAME + xmlDumpElementTable @ 156 NONAME + xmlDumpEntitiesTable @ 157 NONAME + xmlDumpEntityDecl @ 158 NONAME + xmlDumpNotationDecl @ 159 NONAME + xmlDumpNotationTable @ 160 NONAME + xmlEncodeEntitiesReentrant @ 161 NONAME + xmlEncodeSpecialChars @ 162 NONAME + xmlErrMemory @ 163 NONAME ABSENT + xmlFileClose @ 164 NONAME + xmlFileMatch @ 165 NONAME + xmlFileOpen @ 166 NONAME + xmlFileOpen_real @ 167 NONAME ABSENT + xmlFileRead @ 168 NONAME + xmlFileWrite @ 169 NONAME ABSENT + xmlFindCharEncodingHandler @ 170 NONAME + xmlFreeAttributeTable @ 171 NONAME + xmlFreeDoc @ 172 NONAME + xmlFreeDtd @ 173 NONAME + xmlFreeElementContent @ 174 NONAME + xmlFreeElementTable @ 175 NONAME + xmlFreeEntitiesTable @ 176 NONAME + xmlFreeEnumeration @ 177 NONAME + xmlFreeIDTable @ 178 NONAME + xmlFreeInputStream @ 179 NONAME + xmlFreeMutex @ 180 NONAME + xmlFreeNode @ 181 NONAME + xmlFreeNodeList @ 182 NONAME + xmlFreeNotationTable @ 183 NONAME + xmlFreeNs @ 184 NONAME + xmlFreeNsList @ 185 NONAME + xmlFreeParserCtxt @ 186 NONAME + xmlFreeParserInputBuffer @ 187 NONAME + xmlFreeProp @ 188 NONAME + xmlFreePropList @ 189 NONAME + xmlFreeRefTable @ 190 NONAME + xmlFreeTextReader @ 191 NONAME + xmlFreeTextWriter @ 192 NONAME + xmlFreeURI @ 193 NONAME + xmlGetCharEncodingHandler @ 194 NONAME + xmlGetCharEncodingName @ 195 NONAME + xmlGetDocEntity @ 196 NONAME + xmlGetDtdAttrDesc @ 197 NONAME + xmlGetDtdElementDesc @ 198 NONAME + xmlGetDtdNotationDesc @ 199 NONAME + xmlGetDtdQAttrDesc @ 200 NONAME + xmlGetDtdQElementDesc @ 201 NONAME + xmlGetEncodingAlias @ 202 NONAME + xmlGetGlobalState @ 203 NONAME + xmlGetID @ 204 NONAME + xmlGetIntSubset @ 205 NONAME + xmlGetLastChild @ 206 NONAME + xmlGetLastError @ 207 NONAME + xmlGetNoNsProp @ 208 NONAME + xmlGetNsList @ 209 NONAME + xmlGetNsProp @ 210 NONAME + xmlGetParameterEntity @ 211 NONAME + xmlGetPredefinedEntity @ 212 NONAME + xmlGetProp @ 213 NONAME + xmlGetThreadId @ 214 NONAME + xmlGetUTF8Char @ 215 NONAME + xmlHasNsProp @ 216 NONAME + xmlHasProp @ 217 NONAME + xmlHashAddEntry @ 218 NONAME + xmlHashAddEntry2 @ 219 NONAME + xmlHashAddEntry3 @ 220 NONAME + xmlHashCopy @ 221 NONAME + xmlHashCreate @ 222 NONAME + xmlHashFree @ 223 NONAME + xmlHashLookup @ 224 NONAME + xmlHashLookup2 @ 225 NONAME + xmlHashLookup3 @ 226 NONAME + xmlHashQLookup2 @ 227 NONAME + xmlHashQLookup3 @ 228 NONAME + xmlHashRemoveEntry @ 229 NONAME + xmlHashRemoveEntry2 @ 230 NONAME + xmlHashRemoveEntry3 @ 231 NONAME + xmlHashScan @ 232 NONAME + xmlHashScan3 @ 233 NONAME + xmlHashScanFull @ 234 NONAME + xmlHashScanFull3 @ 235 NONAME + xmlHashUpdateEntry @ 236 NONAME + xmlHashUpdateEntry2 @ 237 NONAME + xmlHashUpdateEntry3 @ 238 NONAME + xmlInitCharEncodingHandlers @ 239 NONAME + xmlInitMemory @ 240 NONAME + xmlInitParser @ 241 NONAME + xmlInitParserCtxt @ 242 NONAME + xmlInitThreads @ 243 NONAME + xmlInitializeGlobalState @ 244 NONAME + xmlIsBaseCharGroup @ 245 NONAME + xmlIsBaseChar_srng @ 246 NONAME + xmlIsBlankNode @ 247 NONAME + xmlIsCombiningGroup @ 248 NONAME + xmlIsCombining_srng @ 249 NONAME + xmlIsDigitGroup @ 250 NONAME + xmlIsDigit_srng @ 251 NONAME + xmlIsExtenderGroup @ 252 NONAME + xmlIsExtender_srng @ 253 NONAME + xmlIsID @ 254 NONAME + xmlIsLetter @ 255 NONAME + xmlIsMainThread @ 256 NONAME + xmlIsMixedElement @ 257 NONAME + xmlIsPubidChar_tab @ 258 NONAME + xmlIsRef @ 259 NONAME + xmlIsXHTML @ 260 NONAME + xmlLinkGetData @ 261 NONAME + xmlListAppend @ 262 NONAME + xmlListClear @ 263 NONAME + xmlListCopy @ 264 NONAME + xmlListCreate @ 265 NONAME + xmlListDelete @ 266 NONAME + xmlListDup @ 267 NONAME + xmlListEmpty @ 268 NONAME + xmlListFront @ 269 NONAME + xmlListInsert @ 270 NONAME + xmlListMerge @ 271 NONAME + xmlListPopFront @ 272 NONAME + xmlListPushFront @ 273 NONAME + xmlListRemoveFirst @ 274 NONAME + xmlListSearch @ 275 NONAME + xmlListSize @ 276 NONAME + xmlListWalk @ 277 NONAME + xmlLoadExternalEntity @ 278 NONAME + xmlLockLibrary @ 279 NONAME + xmlMallocAtomicLoc @ 280 NONAME + xmlMallocLoc @ 281 NONAME + xmlMemFree @ 282 NONAME + xmlMemMalloc @ 283 NONAME + xmlMemRealloc @ 284 NONAME + xmlMemStrdupLoc @ 285 NONAME + xmlMemUsed @ 286 NONAME + xmlMemoryDump @ 287 NONAME + xmlMemoryStrdup @ 288 NONAME + xmlMutexLock @ 289 NONAME + xmlMutexUnlock @ 290 NONAME + xmlNewCDataBlock @ 291 NONAME + xmlNewCharEncodingHandler @ 292 NONAME + xmlNewCharRef @ 293 NONAME + xmlNewChild @ 294 NONAME + xmlNewComment @ 295 NONAME + xmlNewDoc @ 296 NONAME + xmlNewDocComment @ 297 NONAME + xmlNewDocFragment @ 298 NONAME + xmlNewDocNode @ 299 NONAME + xmlNewDocNodeEatName @ 300 NONAME + xmlNewDocPI @ 301 NONAME ABSENT + xmlNewDocProp @ 302 NONAME + xmlNewDocRawNode @ 303 NONAME + xmlNewDocText @ 304 NONAME + xmlNewDocTextLen @ 305 NONAME + xmlNewDtd @ 306 NONAME + xmlNewElementContent @ 307 NONAME + xmlNewEntityInputStream @ 308 NONAME + xmlNewIOInputStream @ 309 NONAME + xmlNewInputFromFile @ 310 NONAME + xmlNewInputStream @ 311 NONAME + xmlNewMutex @ 312 NONAME + xmlNewNode @ 313 NONAME + xmlNewNodeEatName @ 314 NONAME + xmlNewNs @ 315 NONAME + xmlNewNsProp @ 316 NONAME + xmlNewNsPropEatName @ 317 NONAME + xmlNewPI @ 318 NONAME + xmlNewParserCtxt @ 319 NONAME + xmlNewProp @ 320 NONAME + xmlNewRMutex @ 321 NONAME + xmlNewReference @ 322 NONAME + xmlNewStringInputStream @ 323 NONAME + xmlNewText @ 324 NONAME + xmlNewTextChild @ 325 NONAME + xmlNewTextLen @ 326 NONAME + xmlNewTextReader @ 327 NONAME + xmlNewTextReaderFilename @ 328 NONAME + xmlNewTextWriter @ 329 NONAME + xmlNewTextWriterFilename @ 330 NONAME + xmlNewTextWriterMemory @ 331 NONAME + xmlNewTextWriterPushParser @ 332 NONAME + xmlNextChar @ 333 NONAME + xmlNoNetExternalEntityLoader @ 334 NONAME + xmlNodeAddContent @ 335 NONAME + xmlNodeAddContentLen @ 336 NONAME + xmlNodeBufGetContent @ 337 NONAME + xmlNodeDump @ 338 NONAME + xmlNodeDumpOutput @ 339 NONAME + xmlNodeDumpOutputInternal @ 340 NONAME + xmlNodeGetBase @ 341 NONAME + xmlNodeGetContent @ 342 NONAME + xmlNodeGetLang @ 343 NONAME + xmlNodeGetSpacePreserve @ 344 NONAME + xmlNodeIsText @ 345 NONAME + xmlNodeListGetRawString @ 346 NONAME + xmlNodeListGetString @ 347 NONAME + xmlNodeSetBase @ 348 NONAME + xmlNodeSetContent @ 349 NONAME + xmlNodeSetContentLen @ 350 NONAME + xmlNodeSetLang @ 351 NONAME + xmlNodeSetName @ 352 NONAME + xmlNodeSetSpacePreserve @ 353 NONAME + xmlNormalizeURIPath @ 354 NONAME + xmlOOMFlag @ 355 NONAME + xmlOutputBufferClose @ 356 NONAME + xmlOutputBufferCreateFd @ 357 NONAME + xmlOutputBufferCreateFile @ 358 NONAME + xmlOutputBufferCreateFilename @ 359 NONAME + xmlOutputBufferCreateIO @ 360 NONAME + xmlOutputBufferFlush @ 361 NONAME + xmlOutputBufferWrite @ 362 NONAME + xmlOutputBufferWriteEscape @ 363 NONAME + xmlOutputBufferWriteString @ 364 NONAME + xmlParseAttValue @ 365 NONAME + xmlParseAttributeListDecl @ 366 NONAME + xmlParseAttributeType @ 367 NONAME + xmlParseCDSect @ 368 NONAME + xmlParseCharData @ 369 NONAME + xmlParseCharEncoding @ 370 NONAME + xmlParseCharRef @ 371 NONAME + xmlParseChunk @ 372 NONAME + xmlParseComment @ 373 NONAME + xmlParseContent @ 374 NONAME + xmlParseCtxtExternalEntity @ 375 NONAME + xmlParseDefaultDecl @ 376 NONAME + xmlParseDoc @ 377 NONAME + xmlParseDocTypeDecl @ 378 NONAME + xmlParseDocument @ 379 NONAME + xmlParseElement @ 380 NONAME + xmlParseElementChildrenContentDecl @ 381 NONAME + xmlParseElementContentDecl @ 382 NONAME + xmlParseElementDecl @ 383 NONAME + xmlParseElementMixedContentDecl @ 384 NONAME + xmlParseEncName @ 385 NONAME + xmlParseEncodingDecl @ 386 NONAME + xmlParseEntityDecl @ 387 NONAME + xmlParseEntityRef @ 388 NONAME + xmlParseEntityValue @ 389 NONAME + xmlParseEnumeratedType @ 390 NONAME + xmlParseEnumerationType @ 391 NONAME + xmlParseExtParsedEnt @ 392 NONAME + xmlParseExternalID @ 393 NONAME + xmlParseExternalSubset @ 394 NONAME + xmlParseFile @ 395 NONAME + xmlParseInNodeContext @ 396 NONAME + xmlParseMarkupDecl @ 397 NONAME + xmlParseMemory @ 398 NONAME + xmlParseMisc @ 399 NONAME + xmlParseName @ 400 NONAME + xmlParseNmtoken @ 401 NONAME + xmlParseNotationDecl @ 402 NONAME + xmlParseNotationType @ 403 NONAME + xmlParsePEReference @ 404 NONAME + xmlParsePI @ 405 NONAME + xmlParsePITarget @ 406 NONAME + xmlParsePubidLiteral @ 407 NONAME + xmlParseReference @ 408 NONAME + xmlParseSDDecl @ 409 NONAME + xmlParseSystemLiteral @ 410 NONAME + xmlParseTextDecl @ 411 NONAME + xmlParseURI @ 412 NONAME + xmlParseURIReference @ 413 NONAME + xmlParseVersionInfo @ 414 NONAME + xmlParseVersionNum @ 415 NONAME + xmlParseXMLDecl @ 416 NONAME + xmlParserError @ 417 NONAME + xmlParserGetDirectory @ 418 NONAME + xmlParserHandlePEReference @ 419 NONAME + xmlParserInputBufferCreateFd @ 420 NONAME + xmlParserInputBufferCreateFilename @ 421 NONAME + xmlParserInputBufferCreateIO @ 422 NONAME + xmlParserInputBufferCreateMem @ 423 NONAME + xmlParserInputBufferCreateStatic @ 424 NONAME + xmlParserInputBufferGrow @ 425 NONAME + xmlParserInputBufferPush @ 426 NONAME + xmlParserInputBufferRead @ 427 NONAME + xmlParserInputGrow @ 428 NONAME + xmlParserInputRead @ 429 NONAME + xmlParserInputShrink @ 430 NONAME + xmlParserPrintFileContext @ 431 NONAME + xmlParserPrintFileInfo @ 432 NONAME + xmlParserValidityError @ 433 NONAME + xmlParserValidityWarning @ 434 NONAME + xmlParserVersion @ 435 NONAME + xmlParserWarning @ 436 NONAME + xmlPedanticParserDefault @ 437 NONAME + xmlPopInput @ 438 NONAME + xmlPopInputCallbacks @ 439 NONAME + xmlPushInput @ 440 NONAME + xmlRMutexLock @ 441 NONAME + xmlRMutexUnlock @ 442 NONAME + xmlReadDoc @ 443 NONAME + xmlReadMemory @ 444 NONAME + xmlReaderForDoc @ 445 NONAME + xmlReaderForFd @ 446 NONAME + xmlReaderForFile @ 447 NONAME + xmlReaderForIO @ 448 NONAME + xmlReaderForMemory @ 449 NONAME + xmlReaderNewDoc @ 450 NONAME + xmlReaderNewFd @ 451 NONAME + xmlReaderNewFile @ 452 NONAME + xmlReaderNewIO @ 453 NONAME + xmlReaderNewMemory @ 454 NONAME + xmlReaderNewWalker @ 455 NONAME + xmlReaderWalker @ 456 NONAME + xmlReallocLoc @ 457 NONAME + xmlReconciliateNs @ 458 NONAME + xmlRecoverDoc @ 459 NONAME + xmlRecoverFile @ 460 NONAME + xmlRecoverMemory @ 461 NONAME + xmlRegisterCharEncodingHandler @ 462 NONAME + xmlRegisterDefaultInputCallbacks @ 463 NONAME + xmlRegisterDefaultOutputCallbacks @ 464 NONAME + xmlRegisterInputCallbacks @ 465 NONAME + xmlRegisterNodeDefault @ 466 NONAME + xmlRegisterOutputCallbacks @ 467 NONAME + xmlRemoveFromDataList @ 468 NONAME ABSENT + xmlRemoveID @ 469 NONAME + xmlRemoveProp @ 470 NONAME + xmlRemoveRef @ 471 NONAME + xmlReplaceNode @ 472 NONAME + xmlResetError @ 473 NONAME + xmlResetLastError @ 474 NONAME + xmlResetOOM @ 475 NONAME + xmlSAX2AttributeDecl @ 476 NONAME + xmlSAX2CDataBlock @ 477 NONAME + xmlSAX2Characters @ 478 NONAME + xmlSAX2Comment @ 479 NONAME + xmlSAX2ElementDecl @ 480 NONAME + xmlSAX2EndDocument @ 481 NONAME + xmlSAX2EndElementNs @ 482 NONAME + xmlSAX2EntityDecl @ 483 NONAME + xmlSAX2ExternalSubset @ 484 NONAME + xmlSAX2GetColumnNumber @ 485 NONAME + xmlSAX2GetEntity @ 486 NONAME + xmlSAX2GetLineNumber @ 487 NONAME + xmlSAX2GetParameterEntity @ 488 NONAME + xmlSAX2GetPublicId @ 489 NONAME + xmlSAX2GetSystemId @ 490 NONAME + xmlSAX2HasExternalSubset @ 491 NONAME + xmlSAX2HasInternalSubset @ 492 NONAME + xmlSAX2IgnorableWhitespace @ 493 NONAME + xmlSAX2InitDefaultSAXHandler @ 494 NONAME + xmlSAX2InternalSubset @ 495 NONAME + xmlSAX2IsStandalone @ 496 NONAME + xmlSAX2NotationDecl @ 497 NONAME + xmlSAX2ProcessingInstruction @ 498 NONAME + xmlSAX2Reference @ 499 NONAME + xmlSAX2ResolveEntity @ 500 NONAME + xmlSAX2SetDocumentLocator @ 501 NONAME + xmlSAX2StartDocument @ 502 NONAME + xmlSAX2StartElementNs @ 503 NONAME + xmlSAX2UnparsedEntityDecl @ 504 NONAME + xmlSAXParseDoc @ 505 NONAME + xmlSAXParseFile @ 506 NONAME + xmlSAXParseFileWithData @ 507 NONAME + xmlSAXParseMemory @ 508 NONAME + xmlSAXParseMemoryWithData @ 509 NONAME + xmlSAXUserParseFile @ 510 NONAME + xmlSAXUserParseMemory @ 511 NONAME + xmlSAXVersion @ 512 NONAME + xmlSaveClose @ 513 NONAME + xmlSaveCtxtInit @ 514 NONAME + xmlSaveDoc @ 515 NONAME + xmlSaveFile @ 516 NONAME + xmlSaveFileEnc @ 517 NONAME + xmlSaveFileTo @ 518 NONAME + xmlSaveFlush @ 519 NONAME + xmlSaveFormatFile @ 520 NONAME + xmlSaveFormatFileEnc @ 521 NONAME + xmlSaveFormatFileTo @ 522 NONAME + xmlSaveSetAttrEscape @ 523 NONAME + xmlSaveSetEscape @ 524 NONAME + xmlSaveToFd @ 525 NONAME + xmlSaveToFilename @ 526 NONAME + xmlSaveToIO @ 527 NONAME + xmlSaveTree @ 528 NONAME + xmlSaveUri @ 529 NONAME + xmlSchemaCleanupTypes @ 530 NONAME + xmlSchemaCompareValues @ 531 NONAME + xmlSchemaFreeFacet @ 532 NONAME + xmlSchemaFreeType @ 533 NONAME + xmlSchemaFreeValue @ 534 NONAME + xmlSchemaGetPredefinedType @ 535 NONAME + xmlSchemaInitTypes @ 536 NONAME + xmlSchemaValPredefTypeNode @ 537 NONAME + xmlSchemaValidateFacet @ 538 NONAME + xmlSchemaValidatePredefinedType @ 539 NONAME + xmlSearchNs @ 540 NONAME + xmlSearchNsByHref @ 541 NONAME + xmlSetBufferAllocationScheme @ 542 NONAME + xmlSetDocCompressMode @ 543 NONAME + xmlSetGenericErrorFunc @ 544 NONAME + xmlSetListDoc @ 545 NONAME + xmlSetNs @ 546 NONAME + xmlSetNsProp @ 547 NONAME + xmlSetOOM @ 548 NONAME + xmlSetProp @ 549 NONAME + xmlSetStructuredErrorFunc @ 550 NONAME + xmlSetTreeDoc @ 551 NONAME + xmlSetupParserForBuffer @ 552 NONAME + xmlSkipBlankChars @ 553 NONAME + xmlSnprintfElementContent @ 554 NONAME + xmlSplitQName @ 555 NONAME + xmlSplitQName2 @ 556 NONAME + xmlSplitQName3 @ 557 NONAME + xmlSprintfElementContent @ 558 NONAME + xmlStaticCopyNode @ 559 NONAME + xmlStaticCopyNodeList @ 560 NONAME + xmlStopParser @ 561 NONAME + xmlStrEqual @ 562 NONAME + xmlStrPrintf @ 563 NONAME + xmlStrQEqual @ 564 NONAME + xmlStrVPrintf @ 565 NONAME + xmlStrcasecmp @ 566 NONAME + xmlStrcasestr @ 567 NONAME + xmlStrcat @ 568 NONAME + xmlStrchr @ 569 NONAME + xmlStrcmp @ 570 NONAME + xmlStrdup @ 571 NONAME + xmlStringComment @ 572 NONAME + xmlStringCurrentChar @ 573 NONAME + xmlStringDecodeEntities @ 574 NONAME + xmlStringGetNodeList @ 575 NONAME + xmlStringLenDecodeEntities @ 576 NONAME + xmlStringLenGetNodeList @ 577 NONAME + xmlStringText @ 578 NONAME + xmlStringTextNoenc @ 579 NONAME + xmlStrlen @ 580 NONAME + xmlStrncasecmp @ 581 NONAME + xmlStrncat @ 582 NONAME + xmlStrncatNew @ 583 NONAME + xmlStrncmp @ 584 NONAME + xmlStrndup @ 585 NONAME + xmlStrstr @ 586 NONAME + xmlStrsub @ 587 NONAME + xmlSubstituteEntitiesDefault @ 588 NONAME + xmlSwitchEncoding @ 589 NONAME + xmlSwitchInputEncoding @ 590 NONAME + xmlSwitchToEncoding @ 591 NONAME + xmlTextConcat @ 592 NONAME + xmlTextMerge @ 593 NONAME + xmlTextReaderAttributeCount @ 594 NONAME + xmlTextReaderBaseUri @ 595 NONAME + xmlTextReaderByteConsumed @ 596 NONAME + xmlTextReaderClose @ 597 NONAME + xmlTextReaderConstBaseUri @ 598 NONAME + xmlTextReaderConstEncoding @ 599 NONAME + xmlTextReaderConstLocalName @ 600 NONAME + xmlTextReaderConstName @ 601 NONAME + xmlTextReaderConstNamespaceUri @ 602 NONAME + xmlTextReaderConstPrefix @ 603 NONAME + xmlTextReaderConstString @ 604 NONAME + xmlTextReaderConstValue @ 605 NONAME + xmlTextReaderConstXmlLang @ 606 NONAME + xmlTextReaderConstXmlVersion @ 607 NONAME + xmlTextReaderCurrentDoc @ 608 NONAME + xmlTextReaderCurrentNode @ 609 NONAME + xmlTextReaderDepth @ 610 NONAME + xmlTextReaderExpand @ 611 NONAME + xmlTextReaderGetAttribute @ 612 NONAME + xmlTextReaderGetAttributeNo @ 613 NONAME + xmlTextReaderGetAttributeNs @ 614 NONAME + xmlTextReaderGetErrorHandler @ 615 NONAME + xmlTextReaderGetParserColumnNumber @ 616 NONAME + xmlTextReaderGetParserLineNumber @ 617 NONAME + xmlTextReaderGetParserProp @ 618 NONAME + xmlTextReaderGetRemainder @ 619 NONAME + xmlTextReaderHasAttributes @ 620 NONAME + xmlTextReaderHasValue @ 621 NONAME + xmlTextReaderIsDefault @ 622 NONAME + xmlTextReaderIsEmptyElement @ 623 NONAME + xmlTextReaderIsNamespaceDecl @ 624 NONAME + xmlTextReaderIsValid @ 625 NONAME + xmlTextReaderLocalName @ 626 NONAME + xmlTextReaderLocatorBaseURI @ 627 NONAME + xmlTextReaderLookupNamespace @ 628 NONAME + xmlTextReaderMoveToAttribute @ 629 NONAME + xmlTextReaderMoveToAttributeNo @ 630 NONAME + xmlTextReaderMoveToAttributeNs @ 631 NONAME + xmlTextReaderMoveToElement @ 632 NONAME + xmlTextReaderMoveToFirstAttribute @ 633 NONAME + xmlTextReaderMoveToNextAttribute @ 634 NONAME + xmlTextReaderName @ 635 NONAME + xmlTextReaderNamespaceUri @ 636 NONAME + xmlTextReaderNext @ 637 NONAME + xmlTextReaderNextSibling @ 638 NONAME + xmlTextReaderNodeType @ 639 NONAME + xmlTextReaderNormalization @ 640 NONAME + xmlTextReaderPrefix @ 641 NONAME + xmlTextReaderPreserve @ 642 NONAME + xmlTextReaderQuoteChar @ 643 NONAME + xmlTextReaderRead @ 644 NONAME + xmlTextReaderReadAttributeValue @ 645 NONAME + xmlTextReaderReadInnerXml @ 646 NONAME + xmlTextReaderReadOuterXml @ 647 NONAME + xmlTextReaderReadState @ 648 NONAME + xmlTextReaderReadString @ 649 NONAME + xmlTextReaderSetErrorHandler @ 650 NONAME + xmlTextReaderSetParserProp @ 651 NONAME + xmlTextReaderSetStructuredErrorHandler @ 652 NONAME + xmlTextReaderStandalone @ 653 NONAME + xmlTextReaderValue @ 654 NONAME + xmlTextReaderXmlLang @ 655 NONAME + xmlTextWriterEndAttribute @ 656 NONAME + xmlTextWriterEndCDATA @ 657 NONAME + xmlTextWriterEndComment @ 658 NONAME + xmlTextWriterEndDTD @ 659 NONAME + xmlTextWriterEndDTDAttlist @ 660 NONAME + xmlTextWriterEndDTDElement @ 661 NONAME + xmlTextWriterEndDTDEntity @ 662 NONAME + xmlTextWriterEndDocument @ 663 NONAME + xmlTextWriterEndElement @ 664 NONAME + xmlTextWriterEndPI @ 665 NONAME + xmlTextWriterFlush @ 666 NONAME + xmlTextWriterFullEndElement @ 667 NONAME + xmlTextWriterSetIndent @ 668 NONAME + xmlTextWriterSetIndentString @ 669 NONAME + xmlTextWriterStartAttribute @ 670 NONAME + xmlTextWriterStartAttributeNS @ 671 NONAME + xmlTextWriterStartCDATA @ 672 NONAME + xmlTextWriterStartComment @ 673 NONAME + xmlTextWriterStartDTD @ 674 NONAME + xmlTextWriterStartDTDAttlist @ 675 NONAME + xmlTextWriterStartDTDElement @ 676 NONAME + xmlTextWriterStartDTDEntity @ 677 NONAME + xmlTextWriterStartDocument @ 678 NONAME + xmlTextWriterStartElement @ 679 NONAME + xmlTextWriterStartElementNS @ 680 NONAME + xmlTextWriterStartPI @ 681 NONAME + xmlTextWriterWriteAttribute @ 682 NONAME + xmlTextWriterWriteAttributeNS @ 683 NONAME + xmlTextWriterWriteBase64 @ 684 NONAME + xmlTextWriterWriteBinHex @ 685 NONAME + xmlTextWriterWriteCDATA @ 686 NONAME + xmlTextWriterWriteComment @ 687 NONAME + xmlTextWriterWriteDTD @ 688 NONAME + xmlTextWriterWriteDTDAttlist @ 689 NONAME + xmlTextWriterWriteDTDElement @ 690 NONAME + xmlTextWriterWriteDTDEntity @ 691 NONAME + xmlTextWriterWriteDTDExternalEntity @ 692 NONAME + xmlTextWriterWriteDTDExternalEntityContents @ 693 NONAME + xmlTextWriterWriteDTDInternalEntity @ 694 NONAME + xmlTextWriterWriteDTDNotation @ 695 NONAME + xmlTextWriterWriteElement @ 696 NONAME + xmlTextWriterWriteElementNS @ 697 NONAME + xmlTextWriterWriteFormatAttribute @ 698 NONAME + xmlTextWriterWriteFormatAttributeNS @ 699 NONAME + xmlTextWriterWriteFormatCDATA @ 700 NONAME + xmlTextWriterWriteFormatComment @ 701 NONAME + xmlTextWriterWriteFormatDTD @ 702 NONAME + xmlTextWriterWriteFormatDTDAttlist @ 703 NONAME + xmlTextWriterWriteFormatDTDElement @ 704 NONAME + xmlTextWriterWriteFormatDTDInternalEntity @ 705 NONAME + xmlTextWriterWriteFormatElement @ 706 NONAME + xmlTextWriterWriteFormatElementNS @ 707 NONAME + xmlTextWriterWriteFormatPI @ 708 NONAME + xmlTextWriterWriteFormatRaw @ 709 NONAME + xmlTextWriterWriteFormatString @ 710 NONAME + xmlTextWriterWritePI @ 711 NONAME + xmlTextWriterWriteRaw @ 712 NONAME + xmlTextWriterWriteRawLen @ 713 NONAME + xmlTextWriterWriteString @ 714 NONAME + xmlTextWriterWriteVFormatAttribute @ 715 NONAME + xmlTextWriterWriteVFormatAttributeNS @ 716 NONAME + xmlTextWriterWriteVFormatCDATA @ 717 NONAME + xmlTextWriterWriteVFormatComment @ 718 NONAME + xmlTextWriterWriteVFormatDTD @ 719 NONAME + xmlTextWriterWriteVFormatDTDAttlist @ 720 NONAME + xmlTextWriterWriteVFormatDTDElement @ 721 NONAME + xmlTextWriterWriteVFormatDTDInternalEntity @ 722 NONAME + xmlTextWriterWriteVFormatElement @ 723 NONAME + xmlTextWriterWriteVFormatElementNS @ 724 NONAME + xmlTextWriterWriteVFormatPI @ 725 NONAME + xmlTextWriterWriteVFormatRaw @ 726 NONAME + xmlTextWriterWriteVFormatString @ 727 NONAME + xmlTreeIndentString @ 728 NONAME + xmlURIEscape @ 729 NONAME + xmlURIEscapeStr @ 730 NONAME + xmlURIUnescapeString @ 731 NONAME + xmlUTF8Charcmp @ 732 NONAME + xmlUTF8Size @ 733 NONAME + xmlUTF8Strlen @ 734 NONAME + xmlUTF8Strloc @ 735 NONAME + xmlUTF8Strndup @ 736 NONAME + xmlUTF8Strpos @ 737 NONAME + xmlUTF8Strsize @ 738 NONAME + xmlUTF8Strsub @ 739 NONAME + xmlUnlinkNode @ 740 NONAME + xmlUnlockLibrary @ 741 NONAME + xmlUnsetNsProp @ 742 NONAME + xmlUnsetProp @ 743 NONAME + xmlValidateNCName @ 744 NONAME + xmlValidateNMToken @ 745 NONAME + xmlValidateName @ 746 NONAME + xmlValidateNotationUse @ 747 NONAME + xmlValidateQName @ 748 NONAME + xmlXIncludeFreeContext @ 749 NONAME + xmlXIncludeNewContext @ 750 NONAME + xmlXIncludeProcess @ 751 NONAME + xmlXIncludeProcessFlags @ 752 NONAME + xmlXIncludeProcessNode @ 753 NONAME + xmlXIncludeProcessTree @ 754 NONAME + xmlXIncludeProcessTreeFlags @ 755 NONAME + xmlXIncludeSetFlags @ 756 NONAME + xmlXPathAddValues @ 757 NONAME + xmlXPathBooleanFunction @ 758 NONAME + xmlXPathCastBooleanToNumber @ 759 NONAME + xmlXPathCastBooleanToString @ 760 NONAME + xmlXPathCastNodeSetToBoolean @ 761 NONAME + xmlXPathCastNodeSetToNumber @ 762 NONAME + xmlXPathCastNodeSetToString @ 763 NONAME + xmlXPathCastNodeToNumber @ 764 NONAME + xmlXPathCastNodeToString @ 765 NONAME + xmlXPathCastNumberToBoolean @ 766 NONAME + xmlXPathCastNumberToString @ 767 NONAME + xmlXPathCastStringToBoolean @ 768 NONAME + xmlXPathCastStringToNumber @ 769 NONAME + xmlXPathCastToBoolean @ 770 NONAME + xmlXPathCastToNumber @ 771 NONAME + xmlXPathCastToString @ 772 NONAME + xmlXPathCeilingFunction @ 773 NONAME + xmlXPathCmpNodes @ 774 NONAME + xmlXPathCompareValues @ 775 NONAME + xmlXPathCompile @ 776 NONAME + xmlXPathCompiledEval @ 777 NONAME + xmlXPathCompiledEvalWithDependencies @ 778 NONAME + xmlXPathConcatFunction @ 779 NONAME + xmlXPathContainsFunction @ 780 NONAME + xmlXPathConvertBoolean @ 781 NONAME + xmlXPathConvertNumber @ 782 NONAME + xmlXPathConvertString @ 783 NONAME + xmlXPathCountFunction @ 784 NONAME + xmlXPathCtxtCompile @ 785 NONAME + xmlXPathDifference @ 786 NONAME + xmlXPathDistinct @ 787 NONAME + xmlXPathDistinctSorted @ 788 NONAME + xmlXPathDivValues @ 789 NONAME + xmlXPathEqualValues @ 790 NONAME + xmlXPathErr @ 791 NONAME + xmlXPathEval @ 792 NONAME + xmlXPathEvalExpr @ 793 NONAME + xmlXPathEvalExpression @ 794 NONAME + xmlXPathEvalPredicate @ 795 NONAME + xmlXPathEvaluatePredicateResult @ 796 NONAME + xmlXPathFalseFunction @ 797 NONAME + xmlXPathFloorFunction @ 798 NONAME + xmlXPathFreeCompExpr @ 799 NONAME + xmlXPathFreeContext @ 800 NONAME + xmlXPathFreeNodeSet @ 801 NONAME + xmlXPathFreeNodeSetList @ 802 NONAME + xmlXPathFreeObject @ 803 NONAME + xmlXPathFreeParserContext @ 804 NONAME + xmlXPathFunctionLookup @ 805 NONAME + xmlXPathFunctionLookupNS @ 806 NONAME + xmlXPathHasSameNodes @ 807 NONAME + xmlXPathIdFunction @ 808 NONAME + xmlXPathInit @ 809 NONAME + xmlXPathIntersection @ 810 NONAME + xmlXPathIsNodeType @ 811 NONAME + xmlXPathLangFunction @ 812 NONAME + xmlXPathLastFunction @ 813 NONAME + xmlXPathLeading @ 814 NONAME + xmlXPathLeadingSorted @ 815 NONAME + xmlXPathLocalNameFunction @ 816 NONAME + xmlXPathModValues @ 817 NONAME + xmlXPathMultValues @ 818 NONAME + xmlXPathNamespaceURIFunction @ 819 NONAME + xmlXPathNewBoolean @ 820 NONAME + xmlXPathNewCString @ 821 NONAME + xmlXPathNewContext @ 822 NONAME + xmlXPathNewFloat @ 823 NONAME + xmlXPathNewNodeSet @ 824 NONAME + xmlXPathNewNodeSetList @ 825 NONAME + xmlXPathNewParserContext @ 826 NONAME + xmlXPathNewString @ 827 NONAME + xmlXPathNewValueTree @ 828 NONAME + xmlXPathNextAncestor @ 829 NONAME + xmlXPathNextAncestorOrSelf @ 830 NONAME + xmlXPathNextAttribute @ 831 NONAME + xmlXPathNextChild @ 832 NONAME + xmlXPathNextDescendant @ 833 NONAME + xmlXPathNextDescendantOrSelf @ 834 NONAME + xmlXPathNextFollowing @ 835 NONAME + xmlXPathNextFollowingSibling @ 836 NONAME + xmlXPathNextNamespace @ 837 NONAME + xmlXPathNextParent @ 838 NONAME + xmlXPathNextPreceding @ 839 NONAME + xmlXPathNextPrecedingSibling @ 840 NONAME + xmlXPathNextSelf @ 841 NONAME + xmlXPathNodeLeading @ 842 NONAME + xmlXPathNodeLeadingSorted @ 843 NONAME + xmlXPathNodeSetAdd @ 844 NONAME + xmlXPathNodeSetAddNs @ 845 NONAME + xmlXPathNodeSetAddUnique @ 846 NONAME + xmlXPathNodeSetContains @ 847 NONAME + xmlXPathNodeSetCreate @ 848 NONAME + xmlXPathNodeSetDel @ 849 NONAME + xmlXPathNodeSetFreeNs @ 850 NONAME + xmlXPathNodeSetMerge @ 851 NONAME + xmlXPathNodeSetRemove @ 852 NONAME + xmlXPathNodeSetSort @ 853 NONAME + xmlXPathNodeTrailing @ 854 NONAME + xmlXPathNodeTrailingSorted @ 855 NONAME + xmlXPathNormalizeFunction @ 856 NONAME + xmlXPathNotEqualValues @ 857 NONAME + xmlXPathNotFunction @ 858 NONAME + xmlXPathNsLookup @ 859 NONAME + xmlXPathNumberFunction @ 860 NONAME + xmlXPathObjectCopy @ 861 NONAME + xmlXPathOrderDocElems @ 862 NONAME + xmlXPathParseNCName @ 863 NONAME + xmlXPathParseName @ 864 NONAME + xmlXPathPopBoolean @ 865 NONAME + xmlXPathPopExternal @ 866 NONAME + xmlXPathPopNodeSet @ 867 NONAME + xmlXPathPopNumber @ 868 NONAME + xmlXPathPopString @ 869 NONAME + xmlXPathPositionFunction @ 870 NONAME + xmlXPathRegisterAllFunctions @ 871 NONAME + xmlXPathRegisterFunc @ 872 NONAME + xmlXPathRegisterFuncLookup @ 873 NONAME + xmlXPathRegisterFuncNS @ 874 NONAME + xmlXPathRegisterNs @ 875 NONAME + xmlXPathRegisterVariable @ 876 NONAME + xmlXPathRegisterVariableLookup @ 877 NONAME + xmlXPathRegisterVariableNS @ 878 NONAME + xmlXPathRegisteredFuncsCleanup @ 879 NONAME + xmlXPathRegisteredNsCleanup @ 880 NONAME + xmlXPathRegisteredVariablesCleanup @ 881 NONAME + xmlXPathRoot @ 882 NONAME + xmlXPathRoundFunction @ 883 NONAME + xmlXPathStartsWithFunction @ 884 NONAME + xmlXPathStringEvalNumber @ 885 NONAME + xmlXPathStringFunction @ 886 NONAME + xmlXPathStringLengthFunction @ 887 NONAME + xmlXPathSubValues @ 888 NONAME + xmlXPathSubstringAfterFunction @ 889 NONAME + xmlXPathSubstringBeforeFunction @ 890 NONAME + xmlXPathSubstringFunction @ 891 NONAME + xmlXPathSumFunction @ 892 NONAME + xmlXPathTrailing @ 893 NONAME + xmlXPathTrailingSorted @ 894 NONAME + xmlXPathTranslateFunction @ 895 NONAME + xmlXPathTrueFunction @ 896 NONAME + xmlXPathValueFlipSign @ 897 NONAME + xmlXPathVariableLookup @ 898 NONAME + xmlXPathVariableLookupNS @ 899 NONAME + xmlXPathWrapCString @ 900 NONAME + xmlXPathWrapExternal @ 901 NONAME + xmlXPathWrapNodeSet @ 902 NONAME + xmlXPathWrapString @ 903 NONAME + xmlXPtrBuildNodeList @ 904 NONAME + xmlXPtrEval @ 905 NONAME + xmlXPtrEvalRangePredicate @ 906 NONAME + xmlXPtrFreeLocationSet @ 907 NONAME + xmlXPtrLocationSetAdd @ 908 NONAME + xmlXPtrLocationSetCreate @ 909 NONAME + xmlXPtrLocationSetDel @ 910 NONAME + xmlXPtrLocationSetMerge @ 911 NONAME + xmlXPtrLocationSetRemove @ 912 NONAME + xmlXPtrNewCollapsedRange @ 913 NONAME + xmlXPtrNewContext @ 914 NONAME + xmlXPtrNewLocationSetNodeSet @ 915 NONAME + xmlXPtrNewLocationSetNodes @ 916 NONAME + xmlXPtrNewRange @ 917 NONAME + xmlXPtrNewRangeNodeObject @ 918 NONAME + xmlXPtrNewRangeNodePoint @ 919 NONAME + xmlXPtrNewRangeNodes @ 920 NONAME + xmlXPtrNewRangePointNode @ 921 NONAME + xmlXPtrNewRangePoints @ 922 NONAME + xmlXPtrRangeToFunction @ 923 NONAME + xmlXPtrWrapLocationSet @ 924 NONAME + xmlReplaceInDataList @ 925 NONAME ABSENT + initxmlDefaultSAXHandler @ 926 NONAME + xmlNewTextWriterDoc @ 927 NONAME + xmlNewTextWriterTree @ 928 NONAME + xmlParseAttribute @ 929 NONAME + xmlParseBalancedChunkMemory @ 930 NONAME + xmlParseBalancedChunkMemoryRecover @ 931 NONAME + xmlParseEndTag @ 932 NONAME + xmlParseEntity @ 933 NONAME + xmlParseExternalEntity @ 934 NONAME + xmlParseStartTag @ 935 NONAME + xmlSAX2EndElement @ 936 NONAME + xmlSAX2StartElement @ 937 NONAME + xmlSAXDefaultVersion @ 938 NONAME + xmlSAXParseEntity @ 939 NONAME + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/bwins/xmlengineutils.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/bwins/xmlengineutils.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +EXPORTS + ?AllocAndFreeL@TXmlEngString@@QAEPAVHBufC16@@XZ @ 1 NONAME ; class HBufC16 * TXmlEngString::AllocAndFreeL(void) + ?AllocAndFreeLC@TXmlEngString@@QAEPAVHBufC16@@XZ @ 2 NONAME ; class HBufC16 * TXmlEngString::AllocAndFreeLC(void) + ?AllocL@TXmlEngConstString@@QBEPAVHBufC16@@XZ @ 3 NONAME ; class HBufC16 * TXmlEngConstString::AllocL(void) const + ?AllocLC@TXmlEngConstString@@QBEPAVHBufC16@@XZ @ 4 NONAME ; class HBufC16 * TXmlEngConstString::AllocLC(void) const + ?AppendL@TXmlEngString@@QAEXV1@0@Z @ 5 NONAME ; void TXmlEngString::AppendL(class TXmlEngString, class TXmlEngString) + ?AppendL@TXmlEngString@@QAEXV1@@Z @ 6 NONAME ; void TXmlEngString::AppendL(class TXmlEngString) + ?Compare@TXmlEngConstString@@QBEHV1@@Z @ 7 NONAME ; int TXmlEngConstString::Compare(class TXmlEngConstString) const + ?CopyL@TXmlEngConstString@@QBEPADXZ @ 8 NONAME ; char * TXmlEngConstString::CopyL(void) const + ?Free@TXmlEngString@@QAEXXZ @ 9 NONAME ; void TXmlEngString::Free(void) + ?Length@TXmlEngConstString@@QBEIXZ @ 10 NONAME ; unsigned int TXmlEngConstString::Length(void) const + ?Set@TXmlEngString@@QAEXAAV1@@Z @ 11 NONAME ; void TXmlEngString::Set(class TXmlEngString &) + ?SetL@TXmlEngString@@QAEXABVTDesC16@@@Z @ 12 NONAME ; void TXmlEngString::SetL(class TDesC16 const &) + ?SetL@TXmlEngString@@QAEXABVTDesC8@@@Z @ 13 NONAME ; void TXmlEngString::SetL(class TDesC8 const &) + ?Size@TXmlEngConstString@@QBEIXZ @ 14 NONAME ; unsigned int TXmlEngConstString::Size(void) const + ?XmlEngEscapeForXmlValueL@@YAPADPBD@Z @ 15 NONAME ; char * XmlEngEscapeForXmlValueL(char const *) + ?XmlEngLeaveL@@YAXH@Z @ 16 NONAME ; void XmlEngLeaveL(int) + ?XmlEngLeaveOOML@@YAXXZ @ 17 NONAME ; void XmlEngLeaveOOML(void) + ?XmlEngOOMTestL@@YAXXZ @ 18 NONAME ; void XmlEngOOMTestL(void) + ?XmlEngXmlCharFromDes8L@@YAPADABVTDesC8@@@Z @ 19 NONAME ; char * XmlEngXmlCharFromDes8L(class TDesC8 const &) + ?XmlEngXmlCharFromDesL@@YAPADABVTDesC16@@@Z @ 20 NONAME ; char * XmlEngXmlCharFromDesL(class TDesC16 const &) + ?XmlEngineAttachL@@YAXXZ @ 21 NONAME ; void XmlEngineAttachL(void) + ?XmlEngineCleanup@@YAXPAX@Z @ 22 NONAME ; void XmlEngineCleanup(void *) + ?XmlEnginePopAndClose@@YAXXZ @ 23 NONAME ; void XmlEnginePopAndClose(void) + ?XmlEnginePushL@@YAXXZ @ 24 NONAME ; void XmlEnginePushL(void) + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/eabi/xmlengine.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/eabi/xmlengine.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,941 @@ +EXPORTS + UTF8Toisolat1 @ 1 NONAME + __xmlErrEncoding @ 2 NONAME ABSENT + __xmlRaiseError @ 3 NONAME ABSENT + __xmlSimpleError @ 4 NONAME ABSENT + free_debug @ 5 NONAME ABSENT + htmlDocContentDumpFormatOutput @ 6 NONAME + htmlDocContentDumpOutput @ 7 NONAME + htmlIsBooleanAttr @ 8 NONAME + htmlNewDoc @ 9 NONAME + htmlNewDocNoDtD @ 10 NONAME + htmlNodeDumpFormatOutput @ 11 NONAME + htmlSetMetaEncoding @ 12 NONAME + htmlTagLookup @ 13 NONAME + initGenericErrorDefaultFunc @ 14 NONAME + inputPop @ 15 NONAME + inputPush @ 16 NONAME + isolat1ToUTF8 @ 17 NONAME + malloc_impl @ 18 NONAME + namePop @ 19 NONAME + namePush @ 20 NONAME + nodePop @ 21 NONAME + nodePush @ 22 NONAME + realloc_impl @ 23 NONAME + symbian_snprintf @ 24 NONAME ABSENT + symbian_vsnprintf @ 25 NONAME ABSENT + trio_fpclassify_and_signbit @ 26 NONAME + trio_isinf @ 27 NONAME + trio_isnan @ 28 NONAME + trio_nan @ 29 NONAME + trio_ninf @ 30 NONAME + trio_nzero @ 31 NONAME + trio_pinf @ 32 NONAME + trio_signbit @ 33 NONAME + valuePop @ 34 NONAME + valuePush @ 35 NONAME + xeCheckErrno @ 36 NONAME ABSENT + xeCleanupDOMStringConverter @ 37 NONAME ABSENT + xeGetGlobalConsts @ 38 NONAME ABSENT + xeGetTLS @ 39 NONAME + xeSetTLS @ 40 NONAME ABSENT + xeStackLimitAddress @ 41 NONAME ABSENT + xeXPathCleanup @ 42 NONAME ABSENT + xmlAddAttributeDecl @ 43 NONAME + xmlAddChild @ 44 NONAME + xmlAddChildList @ 45 NONAME + xmlAddDocEntity @ 46 NONAME + xmlAddDtdEntity @ 47 NONAME + xmlAddElementDecl @ 48 NONAME + xmlAddID @ 49 NONAME + xmlAddIDs @ 50 NONAME + xmlAddNextSibling @ 51 NONAME + xmlAddNotationDecl @ 52 NONAME + xmlAddPrevSibling @ 53 NONAME + xmlAddRef @ 54 NONAME + xmlAddSibling @ 55 NONAME + xmlAllocOutputBuffer @ 56 NONAME + xmlAllocParserInputBuffer @ 57 NONAME + xmlAppendDataList @ 58 NONAME + xmlAttrSerializeTxtContent @ 59 NONAME + xmlBufferAdd @ 60 NONAME + xmlBufferAddHead @ 61 NONAME + xmlBufferCCat @ 62 NONAME + xmlBufferCat @ 63 NONAME + xmlBufferCreate @ 64 NONAME + xmlBufferCreateSize @ 65 NONAME + xmlBufferCreateStatic @ 66 NONAME + xmlBufferFree @ 67 NONAME + xmlBufferGrow @ 68 NONAME + xmlBufferLength @ 69 NONAME + xmlBufferResize @ 70 NONAME + xmlBufferShrink @ 71 NONAME + xmlBufferWriteCHAR @ 72 NONAME + xmlBufferWriteChar @ 73 NONAME + xmlBufferWriteQuotedString @ 74 NONAME + xmlBuildQName @ 75 NONAME + xmlBuildURI @ 76 NONAME + xmlC14NDocDumpMemory @ 77 NONAME + xmlC14NDocSave @ 78 NONAME + xmlC14NDocSaveTo @ 79 NONAME + xmlC14NExecute @ 80 NONAME + xmlCanonicPath @ 81 NONAME + xmlCharEncCloseFunc @ 82 NONAME + xmlCharEncFirstLine @ 83 NONAME + xmlCharEncInFunc @ 84 NONAME + xmlCharEncOutFunc @ 85 NONAME + xmlCharInRange @ 86 NONAME + xmlCharStrdup @ 87 NONAME + xmlCharStrndup @ 88 NONAME + xmlCheckFilename @ 89 NONAME + xmlCheckHTTPInput @ 90 NONAME + xmlCheckLanguageID @ 91 NONAME + xmlCheckVersion @ 92 NONAME + xmlCleanupCharEncodingHandlers @ 93 NONAME + xmlCleanupEncodingAliases @ 94 NONAME + xmlCleanupGlobalData @ 95 NONAME + xmlCleanupInputCallbacks @ 96 NONAME + xmlCleanupMemory @ 97 NONAME + xmlCleanupOutputCallbacks @ 98 NONAME + xmlCleanupParser @ 99 NONAME + xmlCleanupThreads @ 100 NONAME + xmlClearParserCtxt @ 101 NONAME + xmlCopyAttributeTable @ 102 NONAME + xmlCopyChar @ 103 NONAME + xmlCopyCharMultiByte @ 104 NONAME + xmlCopyDoc @ 105 NONAME + xmlCopyDtd @ 106 NONAME + xmlCopyElementContent @ 107 NONAME + xmlCopyElementTable @ 108 NONAME + xmlCopyEntitiesTable @ 109 NONAME + xmlCopyEnumeration @ 110 NONAME + xmlCopyError @ 111 NONAME + xmlCopyNamespace @ 112 NONAME + xmlCopyNamespaceList @ 113 NONAME + xmlCopyNode @ 114 NONAME + xmlCopyNodeList @ 115 NONAME + xmlCopyNotationTable @ 116 NONAME + xmlCopyProp @ 117 NONAME + xmlCopyPropList @ 118 NONAME + xmlCreateAndInitializeGlobalState @ 119 NONAME + xmlCreateDocParserCtxt @ 120 NONAME + xmlCreateEntityParserCtxt @ 121 NONAME + xmlCreateEnumeration @ 122 NONAME + xmlCreateFileParserCtxt @ 123 NONAME + xmlCreateIntSubset @ 124 NONAME + xmlCreateMemoryParserCtxt @ 125 NONAME + xmlCreatePushParserCtxt @ 126 NONAME + xmlCreateURI @ 127 NONAME + xmlCreateURLParserCtxt @ 128 NONAME + xmlCtxtGetLastError @ 129 NONAME + xmlCtxtReset @ 130 NONAME + xmlCtxtResetLastError @ 131 NONAME + xmlCtxtUseOptions @ 132 NONAME + xmlCurrentChar @ 133 NONAME + xmlDefaultExternalEntityLoader @ 134 NONAME ABSENT + xmlDefaultSAXHandlerInit @ 135 NONAME + xmlDeregisterNodeDefault @ 136 NONAME + xmlDetectCharEncoding @ 137 NONAME + xmlDictCreate @ 138 NONAME + xmlDictCreateSub @ 139 NONAME + xmlDictFree @ 140 NONAME + xmlDictLookup @ 141 NONAME + xmlDictOwns @ 142 NONAME + xmlDictQLookup @ 143 NONAME + xmlDictReference @ 144 NONAME + xmlDocContentDumpOutput @ 145 NONAME ABSENT + xmlDocCopyNode @ 146 NONAME + xmlDocDumpFormatMemory @ 147 NONAME + xmlDocDumpFormatMemoryEnc @ 148 NONAME + xmlDocDumpMemory @ 149 NONAME + xmlDocDumpMemoryEnc @ 150 NONAME + xmlDocGetRootElement @ 151 NONAME + xmlDocSetRootElement @ 152 NONAME + xmlDumpAttributeDecl @ 153 NONAME + xmlDumpAttributeTable @ 154 NONAME + xmlDumpElementDecl @ 155 NONAME + xmlDumpElementTable @ 156 NONAME + xmlDumpEntitiesTable @ 157 NONAME + xmlDumpEntityDecl @ 158 NONAME + xmlDumpNotationDecl @ 159 NONAME + xmlDumpNotationTable @ 160 NONAME + xmlEncodeEntitiesReentrant @ 161 NONAME + xmlEncodeSpecialChars @ 162 NONAME + xmlErrMemory @ 163 NONAME ABSENT + xmlFileClose @ 164 NONAME + xmlFileMatch @ 165 NONAME + xmlFileOpen @ 166 NONAME + xmlFileOpen_real @ 167 NONAME ABSENT + xmlFileRead @ 168 NONAME + xmlFileWrite @ 169 NONAME ABSENT + xmlFindCharEncodingHandler @ 170 NONAME + xmlFreeAttributeTable @ 171 NONAME + xmlFreeDoc @ 172 NONAME + xmlFreeDtd @ 173 NONAME + xmlFreeElementContent @ 174 NONAME + xmlFreeElementTable @ 175 NONAME + xmlFreeEntitiesTable @ 176 NONAME + xmlFreeEnumeration @ 177 NONAME + xmlFreeIDTable @ 178 NONAME + xmlFreeInputStream @ 179 NONAME + xmlFreeMutex @ 180 NONAME + xmlFreeNode @ 181 NONAME + xmlFreeNodeList @ 182 NONAME + xmlFreeNotationTable @ 183 NONAME + xmlFreeNs @ 184 NONAME + xmlFreeNsList @ 185 NONAME + xmlFreeParserCtxt @ 186 NONAME + xmlFreeParserInputBuffer @ 187 NONAME + xmlFreeProp @ 188 NONAME + xmlFreePropList @ 189 NONAME + xmlFreeRefTable @ 190 NONAME + xmlFreeTextReader @ 191 NONAME + xmlFreeTextWriter @ 192 NONAME + xmlFreeURI @ 193 NONAME + xmlGetCharEncodingHandler @ 194 NONAME + xmlGetCharEncodingName @ 195 NONAME + xmlGetDocEntity @ 196 NONAME + xmlGetDtdAttrDesc @ 197 NONAME + xmlGetDtdElementDesc @ 198 NONAME + xmlGetDtdNotationDesc @ 199 NONAME + xmlGetDtdQAttrDesc @ 200 NONAME + xmlGetDtdQElementDesc @ 201 NONAME + xmlGetEncodingAlias @ 202 NONAME + xmlGetGlobalState @ 203 NONAME + xmlGetID @ 204 NONAME + xmlGetIntSubset @ 205 NONAME + xmlGetLastChild @ 206 NONAME + xmlGetLastError @ 207 NONAME + xmlGetNoNsProp @ 208 NONAME + xmlGetNsList @ 209 NONAME + xmlGetNsProp @ 210 NONAME + xmlGetParameterEntity @ 211 NONAME + xmlGetPredefinedEntity @ 212 NONAME + xmlGetProp @ 213 NONAME + xmlGetThreadId @ 214 NONAME + xmlGetUTF8Char @ 215 NONAME + xmlHasNsProp @ 216 NONAME + xmlHasProp @ 217 NONAME + xmlHashAddEntry @ 218 NONAME + xmlHashAddEntry2 @ 219 NONAME + xmlHashAddEntry3 @ 220 NONAME + xmlHashCopy @ 221 NONAME + xmlHashCreate @ 222 NONAME + xmlHashFree @ 223 NONAME + xmlHashLookup @ 224 NONAME + xmlHashLookup2 @ 225 NONAME + xmlHashLookup3 @ 226 NONAME + xmlHashQLookup2 @ 227 NONAME + xmlHashQLookup3 @ 228 NONAME + xmlHashRemoveEntry @ 229 NONAME + xmlHashRemoveEntry2 @ 230 NONAME + xmlHashRemoveEntry3 @ 231 NONAME + xmlHashScan @ 232 NONAME + xmlHashScan3 @ 233 NONAME + xmlHashScanFull @ 234 NONAME + xmlHashScanFull3 @ 235 NONAME + xmlHashUpdateEntry @ 236 NONAME + xmlHashUpdateEntry2 @ 237 NONAME + xmlHashUpdateEntry3 @ 238 NONAME + xmlInitCharEncodingHandlers @ 239 NONAME + xmlInitMemory @ 240 NONAME + xmlInitParser @ 241 NONAME + xmlInitParserCtxt @ 242 NONAME + xmlInitThreads @ 243 NONAME + xmlInitializeGlobalState @ 244 NONAME + xmlIsBaseCharGroup @ 245 NONAME DATA 16 + xmlIsBaseChar_srng @ 246 NONAME DATA 788 + xmlIsBlankNode @ 247 NONAME + xmlIsCombiningGroup @ 248 NONAME DATA 16 + xmlIsCombining_srng @ 249 NONAME DATA 380 + xmlIsDigitGroup @ 250 NONAME DATA 16 + xmlIsDigit_srng @ 251 NONAME DATA 56 + xmlIsExtenderGroup @ 252 NONAME DATA 16 + xmlIsExtender_srng @ 253 NONAME DATA 40 + xmlIsID @ 254 NONAME + xmlIsLetter @ 255 NONAME + xmlIsMainThread @ 256 NONAME + xmlIsMixedElement @ 257 NONAME + xmlIsPubidChar_tab @ 258 NONAME DATA 256 + xmlIsRef @ 259 NONAME + xmlIsXHTML @ 260 NONAME + xmlLinkGetData @ 261 NONAME + xmlListAppend @ 262 NONAME + xmlListClear @ 263 NONAME + xmlListCopy @ 264 NONAME + xmlListCreate @ 265 NONAME + xmlListDelete @ 266 NONAME + xmlListDup @ 267 NONAME + xmlListEmpty @ 268 NONAME + xmlListFront @ 269 NONAME + xmlListInsert @ 270 NONAME + xmlListMerge @ 271 NONAME + xmlListPopFront @ 272 NONAME + xmlListPushFront @ 273 NONAME + xmlListRemoveFirst @ 274 NONAME + xmlListSearch @ 275 NONAME + xmlListSize @ 276 NONAME + xmlListWalk @ 277 NONAME + xmlLoadExternalEntity @ 278 NONAME + xmlLockLibrary @ 279 NONAME + xmlMallocAtomicLoc @ 280 NONAME + xmlMallocLoc @ 281 NONAME + xmlMemFree @ 282 NONAME + xmlMemMalloc @ 283 NONAME + xmlMemRealloc @ 284 NONAME + xmlMemStrdupLoc @ 285 NONAME + xmlMemUsed @ 286 NONAME + xmlMemoryDump @ 287 NONAME + xmlMemoryStrdup @ 288 NONAME + xmlMutexLock @ 289 NONAME + xmlMutexUnlock @ 290 NONAME + xmlNewCDataBlock @ 291 NONAME + xmlNewCharEncodingHandler @ 292 NONAME + xmlNewCharRef @ 293 NONAME + xmlNewChild @ 294 NONAME + xmlNewComment @ 295 NONAME + xmlNewDoc @ 296 NONAME + xmlNewDocComment @ 297 NONAME + xmlNewDocFragment @ 298 NONAME + xmlNewDocNode @ 299 NONAME + xmlNewDocNodeEatName @ 300 NONAME + xmlNewDocPI @ 301 NONAME ABSENT + xmlNewDocProp @ 302 NONAME + xmlNewDocRawNode @ 303 NONAME + xmlNewDocText @ 304 NONAME + xmlNewDocTextLen @ 305 NONAME + xmlNewDtd @ 306 NONAME + xmlNewElementContent @ 307 NONAME + xmlNewEntityInputStream @ 308 NONAME + xmlNewIOInputStream @ 309 NONAME + xmlNewInputFromFile @ 310 NONAME + xmlNewInputStream @ 311 NONAME + xmlNewMutex @ 312 NONAME + xmlNewNode @ 313 NONAME + xmlNewNodeEatName @ 314 NONAME + xmlNewNs @ 315 NONAME + xmlNewNsProp @ 316 NONAME + xmlNewNsPropEatName @ 317 NONAME + xmlNewPI @ 318 NONAME + xmlNewParserCtxt @ 319 NONAME + xmlNewProp @ 320 NONAME + xmlNewRMutex @ 321 NONAME + xmlNewReference @ 322 NONAME + xmlNewStringInputStream @ 323 NONAME + xmlNewText @ 324 NONAME + xmlNewTextChild @ 325 NONAME + xmlNewTextLen @ 326 NONAME + xmlNewTextReader @ 327 NONAME + xmlNewTextReaderFilename @ 328 NONAME + xmlNewTextWriter @ 329 NONAME + xmlNewTextWriterFilename @ 330 NONAME + xmlNewTextWriterMemory @ 331 NONAME + xmlNewTextWriterPushParser @ 332 NONAME + xmlNextChar @ 333 NONAME + xmlNoNetExternalEntityLoader @ 334 NONAME + xmlNodeAddContent @ 335 NONAME + xmlNodeAddContentLen @ 336 NONAME + xmlNodeBufGetContent @ 337 NONAME + xmlNodeDump @ 338 NONAME + xmlNodeDumpOutput @ 339 NONAME + xmlNodeDumpOutputInternal @ 340 NONAME + xmlNodeGetBase @ 341 NONAME + xmlNodeGetContent @ 342 NONAME + xmlNodeGetLang @ 343 NONAME + xmlNodeGetSpacePreserve @ 344 NONAME + xmlNodeIsText @ 345 NONAME + xmlNodeListGetRawString @ 346 NONAME + xmlNodeListGetString @ 347 NONAME + xmlNodeSetBase @ 348 NONAME + xmlNodeSetContent @ 349 NONAME + xmlNodeSetContentLen @ 350 NONAME + xmlNodeSetLang @ 351 NONAME + xmlNodeSetName @ 352 NONAME + xmlNodeSetSpacePreserve @ 353 NONAME + xmlNormalizeURIPath @ 354 NONAME + xmlOOMFlag @ 355 NONAME + xmlOutputBufferClose @ 356 NONAME + xmlOutputBufferCreateFd @ 357 NONAME + xmlOutputBufferCreateFile @ 358 NONAME + xmlOutputBufferCreateFilename @ 359 NONAME + xmlOutputBufferCreateIO @ 360 NONAME + xmlOutputBufferFlush @ 361 NONAME + xmlOutputBufferWrite @ 362 NONAME + xmlOutputBufferWriteEscape @ 363 NONAME + xmlOutputBufferWriteString @ 364 NONAME + xmlParseAttValue @ 365 NONAME + xmlParseAttributeListDecl @ 366 NONAME + xmlParseAttributeType @ 367 NONAME + xmlParseCDSect @ 368 NONAME + xmlParseCharData @ 369 NONAME + xmlParseCharEncoding @ 370 NONAME + xmlParseCharRef @ 371 NONAME + xmlParseChunk @ 372 NONAME + xmlParseComment @ 373 NONAME + xmlParseContent @ 374 NONAME + xmlParseCtxtExternalEntity @ 375 NONAME + xmlParseDefaultDecl @ 376 NONAME + xmlParseDoc @ 377 NONAME + xmlParseDocTypeDecl @ 378 NONAME + xmlParseDocument @ 379 NONAME + xmlParseElement @ 380 NONAME + xmlParseElementChildrenContentDecl @ 381 NONAME + xmlParseElementContentDecl @ 382 NONAME + xmlParseElementDecl @ 383 NONAME + xmlParseElementMixedContentDecl @ 384 NONAME + xmlParseEncName @ 385 NONAME + xmlParseEncodingDecl @ 386 NONAME + xmlParseEntityDecl @ 387 NONAME + xmlParseEntityRef @ 388 NONAME + xmlParseEntityValue @ 389 NONAME + xmlParseEnumeratedType @ 390 NONAME + xmlParseEnumerationType @ 391 NONAME + xmlParseExtParsedEnt @ 392 NONAME + xmlParseExternalID @ 393 NONAME + xmlParseExternalSubset @ 394 NONAME + xmlParseFile @ 395 NONAME + xmlParseInNodeContext @ 396 NONAME + xmlParseMarkupDecl @ 397 NONAME + xmlParseMemory @ 398 NONAME + xmlParseMisc @ 399 NONAME + xmlParseName @ 400 NONAME + xmlParseNmtoken @ 401 NONAME + xmlParseNotationDecl @ 402 NONAME + xmlParseNotationType @ 403 NONAME + xmlParsePEReference @ 404 NONAME + xmlParsePI @ 405 NONAME + xmlParsePITarget @ 406 NONAME + xmlParsePubidLiteral @ 407 NONAME + xmlParseReference @ 408 NONAME + xmlParseSDDecl @ 409 NONAME + xmlParseSystemLiteral @ 410 NONAME + xmlParseTextDecl @ 411 NONAME + xmlParseURI @ 412 NONAME + xmlParseURIReference @ 413 NONAME + xmlParseVersionInfo @ 414 NONAME + xmlParseVersionNum @ 415 NONAME + xmlParseXMLDecl @ 416 NONAME + xmlParserError @ 417 NONAME + xmlParserGetDirectory @ 418 NONAME + xmlParserHandlePEReference @ 419 NONAME + xmlParserInputBufferCreateFd @ 420 NONAME + xmlParserInputBufferCreateFilename @ 421 NONAME + xmlParserInputBufferCreateIO @ 422 NONAME + xmlParserInputBufferCreateMem @ 423 NONAME + xmlParserInputBufferCreateStatic @ 424 NONAME + xmlParserInputBufferGrow @ 425 NONAME + xmlParserInputBufferPush @ 426 NONAME + xmlParserInputBufferRead @ 427 NONAME + xmlParserInputGrow @ 428 NONAME + xmlParserInputRead @ 429 NONAME + xmlParserInputShrink @ 430 NONAME + xmlParserPrintFileContext @ 431 NONAME + xmlParserPrintFileInfo @ 432 NONAME + xmlParserValidityError @ 433 NONAME + xmlParserValidityWarning @ 434 NONAME + xmlParserVersion @ 435 NONAME DATA 4 + xmlParserWarning @ 436 NONAME + xmlPedanticParserDefault @ 437 NONAME + xmlPopInput @ 438 NONAME + xmlPopInputCallbacks @ 439 NONAME + xmlPushInput @ 440 NONAME + xmlRMutexLock @ 441 NONAME + xmlRMutexUnlock @ 442 NONAME + xmlReadDoc @ 443 NONAME + xmlReadMemory @ 444 NONAME + xmlReaderForDoc @ 445 NONAME + xmlReaderForFd @ 446 NONAME + xmlReaderForFile @ 447 NONAME + xmlReaderForIO @ 448 NONAME + xmlReaderForMemory @ 449 NONAME + xmlReaderNewDoc @ 450 NONAME + xmlReaderNewFd @ 451 NONAME + xmlReaderNewFile @ 452 NONAME + xmlReaderNewIO @ 453 NONAME + xmlReaderNewMemory @ 454 NONAME + xmlReaderNewWalker @ 455 NONAME + xmlReaderWalker @ 456 NONAME + xmlReallocLoc @ 457 NONAME + xmlReconciliateNs @ 458 NONAME + xmlRecoverDoc @ 459 NONAME + xmlRecoverFile @ 460 NONAME + xmlRecoverMemory @ 461 NONAME + xmlRegisterCharEncodingHandler @ 462 NONAME + xmlRegisterDefaultInputCallbacks @ 463 NONAME + xmlRegisterDefaultOutputCallbacks @ 464 NONAME + xmlRegisterInputCallbacks @ 465 NONAME + xmlRegisterNodeDefault @ 466 NONAME + xmlRegisterOutputCallbacks @ 467 NONAME + xmlRemoveFromDataList @ 468 NONAME ABSENT + xmlRemoveID @ 469 NONAME + xmlRemoveProp @ 470 NONAME + xmlRemoveRef @ 471 NONAME + xmlReplaceInDataList @ 472 NONAME ABSENT + xmlReplaceNode @ 473 NONAME + xmlResetError @ 474 NONAME + xmlResetLastError @ 475 NONAME + xmlResetOOM @ 476 NONAME + xmlSAX2AttributeDecl @ 477 NONAME + xmlSAX2CDataBlock @ 478 NONAME + xmlSAX2Characters @ 479 NONAME + xmlSAX2Comment @ 480 NONAME + xmlSAX2ElementDecl @ 481 NONAME + xmlSAX2EndDocument @ 482 NONAME + xmlSAX2EndElementNs @ 483 NONAME + xmlSAX2EntityDecl @ 484 NONAME + xmlSAX2ExternalSubset @ 485 NONAME + xmlSAX2GetColumnNumber @ 486 NONAME + xmlSAX2GetEntity @ 487 NONAME + xmlSAX2GetLineNumber @ 488 NONAME + xmlSAX2GetParameterEntity @ 489 NONAME + xmlSAX2GetPublicId @ 490 NONAME + xmlSAX2GetSystemId @ 491 NONAME + xmlSAX2HasExternalSubset @ 492 NONAME + xmlSAX2HasInternalSubset @ 493 NONAME + xmlSAX2IgnorableWhitespace @ 494 NONAME + xmlSAX2InitDefaultSAXHandler @ 495 NONAME + xmlSAX2InternalSubset @ 496 NONAME + xmlSAX2IsStandalone @ 497 NONAME + xmlSAX2NotationDecl @ 498 NONAME + xmlSAX2ProcessingInstruction @ 499 NONAME + xmlSAX2Reference @ 500 NONAME + xmlSAX2ResolveEntity @ 501 NONAME + xmlSAX2SetDocumentLocator @ 502 NONAME + xmlSAX2StartDocument @ 503 NONAME + xmlSAX2StartElementNs @ 504 NONAME + xmlSAX2UnparsedEntityDecl @ 505 NONAME + xmlSAXParseDoc @ 506 NONAME + xmlSAXParseFile @ 507 NONAME + xmlSAXParseFileWithData @ 508 NONAME + xmlSAXParseMemory @ 509 NONAME + xmlSAXParseMemoryWithData @ 510 NONAME + xmlSAXUserParseFile @ 511 NONAME + xmlSAXUserParseMemory @ 512 NONAME + xmlSAXVersion @ 513 NONAME + xmlSaveClose @ 514 NONAME + xmlSaveCtxtInit @ 515 NONAME + xmlSaveDoc @ 516 NONAME + xmlSaveFile @ 517 NONAME + xmlSaveFileEnc @ 518 NONAME + xmlSaveFileTo @ 519 NONAME + xmlSaveFlush @ 520 NONAME + xmlSaveFormatFile @ 521 NONAME + xmlSaveFormatFileEnc @ 522 NONAME + xmlSaveFormatFileTo @ 523 NONAME + xmlSaveSetAttrEscape @ 524 NONAME + xmlSaveSetEscape @ 525 NONAME + xmlSaveToFd @ 526 NONAME + xmlSaveToFilename @ 527 NONAME + xmlSaveToIO @ 528 NONAME + xmlSaveTree @ 529 NONAME + xmlSaveUri @ 530 NONAME + xmlSchemaCleanupTypes @ 531 NONAME + xmlSchemaCompareValues @ 532 NONAME + xmlSchemaFreeFacet @ 533 NONAME + xmlSchemaFreeType @ 534 NONAME + xmlSchemaFreeValue @ 535 NONAME + xmlSchemaGetPredefinedType @ 536 NONAME + xmlSchemaInitTypes @ 537 NONAME + xmlSchemaValPredefTypeNode @ 538 NONAME + xmlSchemaValidateFacet @ 539 NONAME + xmlSchemaValidatePredefinedType @ 540 NONAME + xmlSearchNs @ 541 NONAME + xmlSearchNsByHref @ 542 NONAME + xmlSetBufferAllocationScheme @ 543 NONAME + xmlSetDocCompressMode @ 544 NONAME + xmlSetGenericErrorFunc @ 545 NONAME + xmlSetListDoc @ 546 NONAME + xmlSetNs @ 547 NONAME + xmlSetNsProp @ 548 NONAME + xmlSetOOM @ 549 NONAME + xmlSetProp @ 550 NONAME + xmlSetStructuredErrorFunc @ 551 NONAME + xmlSetTreeDoc @ 552 NONAME + xmlSetupParserForBuffer @ 553 NONAME + xmlSkipBlankChars @ 554 NONAME + xmlSnprintfElementContent @ 555 NONAME + xmlSplitQName @ 556 NONAME + xmlSplitQName2 @ 557 NONAME + xmlSplitQName3 @ 558 NONAME + xmlSprintfElementContent @ 559 NONAME + xmlStaticCopyNode @ 560 NONAME + xmlStaticCopyNodeList @ 561 NONAME + xmlStopParser @ 562 NONAME + xmlStrEqual @ 563 NONAME + xmlStrPrintf @ 564 NONAME + xmlStrQEqual @ 565 NONAME + xmlStrVPrintf @ 566 NONAME + xmlStrcasecmp @ 567 NONAME + xmlStrcasestr @ 568 NONAME + xmlStrcat @ 569 NONAME + xmlStrchr @ 570 NONAME + xmlStrcmp @ 571 NONAME + xmlStrdup @ 572 NONAME + xmlStringComment @ 573 NONAME DATA 8 + xmlStringCurrentChar @ 574 NONAME + xmlStringDecodeEntities @ 575 NONAME + xmlStringGetNodeList @ 576 NONAME + xmlStringLenDecodeEntities @ 577 NONAME + xmlStringLenGetNodeList @ 578 NONAME + xmlStringText @ 579 NONAME DATA 5 + xmlStringTextNoenc @ 580 NONAME DATA 10 + xmlStrlen @ 581 NONAME + xmlStrncasecmp @ 582 NONAME + xmlStrncat @ 583 NONAME + xmlStrncatNew @ 584 NONAME + xmlStrncmp @ 585 NONAME + xmlStrndup @ 586 NONAME + xmlStrstr @ 587 NONAME + xmlStrsub @ 588 NONAME + xmlSubstituteEntitiesDefault @ 589 NONAME + xmlSwitchEncoding @ 590 NONAME + xmlSwitchInputEncoding @ 591 NONAME + xmlSwitchToEncoding @ 592 NONAME + xmlTextConcat @ 593 NONAME + xmlTextMerge @ 594 NONAME + xmlTextReaderAttributeCount @ 595 NONAME + xmlTextReaderBaseUri @ 596 NONAME + xmlTextReaderByteConsumed @ 597 NONAME + xmlTextReaderClose @ 598 NONAME + xmlTextReaderConstBaseUri @ 599 NONAME + xmlTextReaderConstEncoding @ 600 NONAME + xmlTextReaderConstLocalName @ 601 NONAME + xmlTextReaderConstName @ 602 NONAME + xmlTextReaderConstNamespaceUri @ 603 NONAME + xmlTextReaderConstPrefix @ 604 NONAME + xmlTextReaderConstString @ 605 NONAME + xmlTextReaderConstValue @ 606 NONAME + xmlTextReaderConstXmlLang @ 607 NONAME + xmlTextReaderConstXmlVersion @ 608 NONAME + xmlTextReaderCurrentDoc @ 609 NONAME + xmlTextReaderCurrentNode @ 610 NONAME + xmlTextReaderDepth @ 611 NONAME + xmlTextReaderExpand @ 612 NONAME + xmlTextReaderGetAttribute @ 613 NONAME + xmlTextReaderGetAttributeNo @ 614 NONAME + xmlTextReaderGetAttributeNs @ 615 NONAME + xmlTextReaderGetErrorHandler @ 616 NONAME + xmlTextReaderGetParserColumnNumber @ 617 NONAME + xmlTextReaderGetParserLineNumber @ 618 NONAME + xmlTextReaderGetParserProp @ 619 NONAME + xmlTextReaderGetRemainder @ 620 NONAME + xmlTextReaderHasAttributes @ 621 NONAME + xmlTextReaderHasValue @ 622 NONAME + xmlTextReaderIsDefault @ 623 NONAME + xmlTextReaderIsEmptyElement @ 624 NONAME + xmlTextReaderIsNamespaceDecl @ 625 NONAME + xmlTextReaderIsValid @ 626 NONAME + xmlTextReaderLocalName @ 627 NONAME + xmlTextReaderLocatorBaseURI @ 628 NONAME + xmlTextReaderLookupNamespace @ 629 NONAME + xmlTextReaderMoveToAttribute @ 630 NONAME + xmlTextReaderMoveToAttributeNo @ 631 NONAME + xmlTextReaderMoveToAttributeNs @ 632 NONAME + xmlTextReaderMoveToElement @ 633 NONAME + xmlTextReaderMoveToFirstAttribute @ 634 NONAME + xmlTextReaderMoveToNextAttribute @ 635 NONAME + xmlTextReaderName @ 636 NONAME + xmlTextReaderNamespaceUri @ 637 NONAME + xmlTextReaderNext @ 638 NONAME + xmlTextReaderNextSibling @ 639 NONAME + xmlTextReaderNodeType @ 640 NONAME + xmlTextReaderNormalization @ 641 NONAME + xmlTextReaderPrefix @ 642 NONAME + xmlTextReaderPreserve @ 643 NONAME + xmlTextReaderQuoteChar @ 644 NONAME + xmlTextReaderRead @ 645 NONAME + xmlTextReaderReadAttributeValue @ 646 NONAME + xmlTextReaderReadInnerXml @ 647 NONAME + xmlTextReaderReadOuterXml @ 648 NONAME + xmlTextReaderReadState @ 649 NONAME + xmlTextReaderReadString @ 650 NONAME + xmlTextReaderSetErrorHandler @ 651 NONAME + xmlTextReaderSetParserProp @ 652 NONAME + xmlTextReaderSetStructuredErrorHandler @ 653 NONAME + xmlTextReaderStandalone @ 654 NONAME + xmlTextReaderValue @ 655 NONAME + xmlTextReaderXmlLang @ 656 NONAME + xmlTextWriterEndAttribute @ 657 NONAME + xmlTextWriterEndCDATA @ 658 NONAME + xmlTextWriterEndComment @ 659 NONAME + xmlTextWriterEndDTD @ 660 NONAME + xmlTextWriterEndDTDAttlist @ 661 NONAME + xmlTextWriterEndDTDElement @ 662 NONAME + xmlTextWriterEndDTDEntity @ 663 NONAME + xmlTextWriterEndDocument @ 664 NONAME + xmlTextWriterEndElement @ 665 NONAME + xmlTextWriterEndPI @ 666 NONAME + xmlTextWriterFlush @ 667 NONAME + xmlTextWriterFullEndElement @ 668 NONAME + xmlTextWriterSetIndent @ 669 NONAME + xmlTextWriterSetIndentString @ 670 NONAME + xmlTextWriterStartAttribute @ 671 NONAME + xmlTextWriterStartAttributeNS @ 672 NONAME + xmlTextWriterStartCDATA @ 673 NONAME + xmlTextWriterStartComment @ 674 NONAME + xmlTextWriterStartDTD @ 675 NONAME + xmlTextWriterStartDTDAttlist @ 676 NONAME + xmlTextWriterStartDTDElement @ 677 NONAME + xmlTextWriterStartDTDEntity @ 678 NONAME + xmlTextWriterStartDocument @ 679 NONAME + xmlTextWriterStartElement @ 680 NONAME + xmlTextWriterStartElementNS @ 681 NONAME + xmlTextWriterStartPI @ 682 NONAME + xmlTextWriterWriteAttribute @ 683 NONAME + xmlTextWriterWriteAttributeNS @ 684 NONAME + xmlTextWriterWriteBase64 @ 685 NONAME + xmlTextWriterWriteBinHex @ 686 NONAME + xmlTextWriterWriteCDATA @ 687 NONAME + xmlTextWriterWriteComment @ 688 NONAME + xmlTextWriterWriteDTD @ 689 NONAME + xmlTextWriterWriteDTDAttlist @ 690 NONAME + xmlTextWriterWriteDTDElement @ 691 NONAME + xmlTextWriterWriteDTDEntity @ 692 NONAME + xmlTextWriterWriteDTDExternalEntity @ 693 NONAME + xmlTextWriterWriteDTDExternalEntityContents @ 694 NONAME + xmlTextWriterWriteDTDInternalEntity @ 695 NONAME + xmlTextWriterWriteDTDNotation @ 696 NONAME + xmlTextWriterWriteElement @ 697 NONAME + xmlTextWriterWriteElementNS @ 698 NONAME + xmlTextWriterWriteFormatAttribute @ 699 NONAME + xmlTextWriterWriteFormatAttributeNS @ 700 NONAME + xmlTextWriterWriteFormatCDATA @ 701 NONAME + xmlTextWriterWriteFormatComment @ 702 NONAME + xmlTextWriterWriteFormatDTD @ 703 NONAME + xmlTextWriterWriteFormatDTDAttlist @ 704 NONAME + xmlTextWriterWriteFormatDTDElement @ 705 NONAME + xmlTextWriterWriteFormatDTDInternalEntity @ 706 NONAME + xmlTextWriterWriteFormatElement @ 707 NONAME + xmlTextWriterWriteFormatElementNS @ 708 NONAME + xmlTextWriterWriteFormatPI @ 709 NONAME + xmlTextWriterWriteFormatRaw @ 710 NONAME + xmlTextWriterWriteFormatString @ 711 NONAME + xmlTextWriterWritePI @ 712 NONAME + xmlTextWriterWriteRaw @ 713 NONAME + xmlTextWriterWriteRawLen @ 714 NONAME + xmlTextWriterWriteString @ 715 NONAME + xmlTextWriterWriteVFormatAttribute @ 716 NONAME + xmlTextWriterWriteVFormatAttributeNS @ 717 NONAME + xmlTextWriterWriteVFormatCDATA @ 718 NONAME + xmlTextWriterWriteVFormatComment @ 719 NONAME + xmlTextWriterWriteVFormatDTD @ 720 NONAME + xmlTextWriterWriteVFormatDTDAttlist @ 721 NONAME + xmlTextWriterWriteVFormatDTDElement @ 722 NONAME + xmlTextWriterWriteVFormatDTDInternalEntity @ 723 NONAME + xmlTextWriterWriteVFormatElement @ 724 NONAME + xmlTextWriterWriteVFormatElementNS @ 725 NONAME + xmlTextWriterWriteVFormatPI @ 726 NONAME + xmlTextWriterWriteVFormatRaw @ 727 NONAME + xmlTextWriterWriteVFormatString @ 728 NONAME + xmlTreeIndentString @ 729 NONAME DATA 4 + xmlURIEscape @ 730 NONAME + xmlURIEscapeStr @ 731 NONAME + xmlURIUnescapeString @ 732 NONAME + xmlUTF8Charcmp @ 733 NONAME + xmlUTF8Size @ 734 NONAME + xmlUTF8Strlen @ 735 NONAME + xmlUTF8Strloc @ 736 NONAME + xmlUTF8Strndup @ 737 NONAME + xmlUTF8Strpos @ 738 NONAME + xmlUTF8Strsize @ 739 NONAME + xmlUTF8Strsub @ 740 NONAME + xmlUnlinkNode @ 741 NONAME + xmlUnlockLibrary @ 742 NONAME + xmlUnsetNsProp @ 743 NONAME + xmlUnsetProp @ 744 NONAME + xmlValidateNCName @ 745 NONAME + xmlValidateNMToken @ 746 NONAME + xmlValidateName @ 747 NONAME + xmlValidateNotationUse @ 748 NONAME + xmlValidateQName @ 749 NONAME + xmlXIncludeFreeContext @ 750 NONAME + xmlXIncludeNewContext @ 751 NONAME + xmlXIncludeProcess @ 752 NONAME + xmlXIncludeProcessFlags @ 753 NONAME + xmlXIncludeProcessNode @ 754 NONAME + xmlXIncludeProcessTree @ 755 NONAME + xmlXIncludeProcessTreeFlags @ 756 NONAME + xmlXIncludeSetFlags @ 757 NONAME + xmlXPathAddValues @ 758 NONAME + xmlXPathBooleanFunction @ 759 NONAME + xmlXPathCastBooleanToNumber @ 760 NONAME + xmlXPathCastBooleanToString @ 761 NONAME + xmlXPathCastNodeSetToBoolean @ 762 NONAME + xmlXPathCastNodeSetToNumber @ 763 NONAME + xmlXPathCastNodeSetToString @ 764 NONAME + xmlXPathCastNodeToNumber @ 765 NONAME + xmlXPathCastNodeToString @ 766 NONAME + xmlXPathCastNumberToBoolean @ 767 NONAME + xmlXPathCastNumberToString @ 768 NONAME + xmlXPathCastStringToBoolean @ 769 NONAME + xmlXPathCastStringToNumber @ 770 NONAME + xmlXPathCastToBoolean @ 771 NONAME + xmlXPathCastToNumber @ 772 NONAME + xmlXPathCastToString @ 773 NONAME + xmlXPathCeilingFunction @ 774 NONAME + xmlXPathCmpNodes @ 775 NONAME + xmlXPathCompareValues @ 776 NONAME + xmlXPathCompile @ 777 NONAME + xmlXPathCompiledEval @ 778 NONAME + xmlXPathCompiledEvalWithDependencies @ 779 NONAME + xmlXPathConcatFunction @ 780 NONAME + xmlXPathContainsFunction @ 781 NONAME + xmlXPathConvertBoolean @ 782 NONAME + xmlXPathConvertNumber @ 783 NONAME + xmlXPathConvertString @ 784 NONAME + xmlXPathCountFunction @ 785 NONAME + xmlXPathCtxtCompile @ 786 NONAME + xmlXPathDifference @ 787 NONAME + xmlXPathDistinct @ 788 NONAME + xmlXPathDistinctSorted @ 789 NONAME + xmlXPathDivValues @ 790 NONAME + xmlXPathEqualValues @ 791 NONAME + xmlXPathErr @ 792 NONAME + xmlXPathEval @ 793 NONAME + xmlXPathEvalExpr @ 794 NONAME + xmlXPathEvalExpression @ 795 NONAME + xmlXPathEvalPredicate @ 796 NONAME + xmlXPathEvaluatePredicateResult @ 797 NONAME + xmlXPathFalseFunction @ 798 NONAME + xmlXPathFloorFunction @ 799 NONAME + xmlXPathFreeCompExpr @ 800 NONAME + xmlXPathFreeContext @ 801 NONAME + xmlXPathFreeNodeSet @ 802 NONAME + xmlXPathFreeNodeSetList @ 803 NONAME + xmlXPathFreeObject @ 804 NONAME + xmlXPathFreeParserContext @ 805 NONAME + xmlXPathFunctionLookup @ 806 NONAME + xmlXPathFunctionLookupNS @ 807 NONAME + xmlXPathHasSameNodes @ 808 NONAME + xmlXPathIdFunction @ 809 NONAME + xmlXPathInit @ 810 NONAME + xmlXPathIntersection @ 811 NONAME + xmlXPathIsNodeType @ 812 NONAME + xmlXPathLangFunction @ 813 NONAME + xmlXPathLastFunction @ 814 NONAME + xmlXPathLeading @ 815 NONAME + xmlXPathLeadingSorted @ 816 NONAME + xmlXPathLocalNameFunction @ 817 NONAME + xmlXPathModValues @ 818 NONAME + xmlXPathMultValues @ 819 NONAME + xmlXPathNamespaceURIFunction @ 820 NONAME + xmlXPathNewBoolean @ 821 NONAME + xmlXPathNewCString @ 822 NONAME + xmlXPathNewContext @ 823 NONAME + xmlXPathNewFloat @ 824 NONAME + xmlXPathNewNodeSet @ 825 NONAME + xmlXPathNewNodeSetList @ 826 NONAME + xmlXPathNewParserContext @ 827 NONAME + xmlXPathNewString @ 828 NONAME + xmlXPathNewValueTree @ 829 NONAME + xmlXPathNextAncestor @ 830 NONAME + xmlXPathNextAncestorOrSelf @ 831 NONAME + xmlXPathNextAttribute @ 832 NONAME + xmlXPathNextChild @ 833 NONAME + xmlXPathNextDescendant @ 834 NONAME + xmlXPathNextDescendantOrSelf @ 835 NONAME + xmlXPathNextFollowing @ 836 NONAME + xmlXPathNextFollowingSibling @ 837 NONAME + xmlXPathNextNamespace @ 838 NONAME + xmlXPathNextParent @ 839 NONAME + xmlXPathNextPreceding @ 840 NONAME + xmlXPathNextPrecedingSibling @ 841 NONAME + xmlXPathNextSelf @ 842 NONAME + xmlXPathNodeLeading @ 843 NONAME + xmlXPathNodeLeadingSorted @ 844 NONAME + xmlXPathNodeSetAdd @ 845 NONAME + xmlXPathNodeSetAddNs @ 846 NONAME + xmlXPathNodeSetAddUnique @ 847 NONAME + xmlXPathNodeSetContains @ 848 NONAME + xmlXPathNodeSetCreate @ 849 NONAME + xmlXPathNodeSetDel @ 850 NONAME + xmlXPathNodeSetFreeNs @ 851 NONAME + xmlXPathNodeSetMerge @ 852 NONAME + xmlXPathNodeSetRemove @ 853 NONAME + xmlXPathNodeSetSort @ 854 NONAME + xmlXPathNodeTrailing @ 855 NONAME + xmlXPathNodeTrailingSorted @ 856 NONAME + xmlXPathNormalizeFunction @ 857 NONAME + xmlXPathNotEqualValues @ 858 NONAME + xmlXPathNotFunction @ 859 NONAME + xmlXPathNsLookup @ 860 NONAME + xmlXPathNumberFunction @ 861 NONAME + xmlXPathObjectCopy @ 862 NONAME + xmlXPathOrderDocElems @ 863 NONAME + xmlXPathParseNCName @ 864 NONAME + xmlXPathParseName @ 865 NONAME + xmlXPathPopBoolean @ 866 NONAME + xmlXPathPopExternal @ 867 NONAME + xmlXPathPopNodeSet @ 868 NONAME + xmlXPathPopNumber @ 869 NONAME + xmlXPathPopString @ 870 NONAME + xmlXPathPositionFunction @ 871 NONAME + xmlXPathRegisterAllFunctions @ 872 NONAME + xmlXPathRegisterFunc @ 873 NONAME + xmlXPathRegisterFuncLookup @ 874 NONAME + xmlXPathRegisterFuncNS @ 875 NONAME + xmlXPathRegisterNs @ 876 NONAME + xmlXPathRegisterVariable @ 877 NONAME + xmlXPathRegisterVariableLookup @ 878 NONAME + xmlXPathRegisterVariableNS @ 879 NONAME + xmlXPathRegisteredFuncsCleanup @ 880 NONAME + xmlXPathRegisteredNsCleanup @ 881 NONAME + xmlXPathRegisteredVariablesCleanup @ 882 NONAME + xmlXPathRoot @ 883 NONAME + xmlXPathRoundFunction @ 884 NONAME + xmlXPathStartsWithFunction @ 885 NONAME + xmlXPathStringEvalNumber @ 886 NONAME + xmlXPathStringFunction @ 887 NONAME + xmlXPathStringLengthFunction @ 888 NONAME + xmlXPathSubValues @ 889 NONAME + xmlXPathSubstringAfterFunction @ 890 NONAME + xmlXPathSubstringBeforeFunction @ 891 NONAME + xmlXPathSubstringFunction @ 892 NONAME + xmlXPathSumFunction @ 893 NONAME + xmlXPathTrailing @ 894 NONAME + xmlXPathTrailingSorted @ 895 NONAME + xmlXPathTranslateFunction @ 896 NONAME + xmlXPathTrueFunction @ 897 NONAME + xmlXPathValueFlipSign @ 898 NONAME + xmlXPathVariableLookup @ 899 NONAME + xmlXPathVariableLookupNS @ 900 NONAME + xmlXPathWrapCString @ 901 NONAME + xmlXPathWrapExternal @ 902 NONAME + xmlXPathWrapNodeSet @ 903 NONAME + xmlXPathWrapString @ 904 NONAME + xmlXPtrBuildNodeList @ 905 NONAME + xmlXPtrEval @ 906 NONAME + xmlXPtrEvalRangePredicate @ 907 NONAME + xmlXPtrFreeLocationSet @ 908 NONAME + xmlXPtrLocationSetAdd @ 909 NONAME + xmlXPtrLocationSetCreate @ 910 NONAME + xmlXPtrLocationSetDel @ 911 NONAME + xmlXPtrLocationSetMerge @ 912 NONAME + xmlXPtrLocationSetRemove @ 913 NONAME + xmlXPtrNewCollapsedRange @ 914 NONAME + xmlXPtrNewContext @ 915 NONAME + xmlXPtrNewLocationSetNodeSet @ 916 NONAME + xmlXPtrNewLocationSetNodes @ 917 NONAME + xmlXPtrNewRange @ 918 NONAME + xmlXPtrNewRangeNodeObject @ 919 NONAME + xmlXPtrNewRangeNodePoint @ 920 NONAME + xmlXPtrNewRangeNodes @ 921 NONAME + xmlXPtrNewRangePointNode @ 922 NONAME + xmlXPtrNewRangePoints @ 923 NONAME + xmlXPtrRangeToFunction @ 924 NONAME + xmlXPtrWrapLocationSet @ 925 NONAME + initxmlDefaultSAXHandler @ 926 NONAME + xmlNewTextWriterDoc @ 927 NONAME + xmlNewTextWriterTree @ 928 NONAME + xmlParseAttribute @ 929 NONAME + xmlParseBalancedChunkMemory @ 930 NONAME + xmlParseBalancedChunkMemoryRecover @ 931 NONAME + xmlParseEndTag @ 932 NONAME + xmlParseEntity @ 933 NONAME + xmlParseExternalEntity @ 934 NONAME + xmlParseStartTag @ 935 NONAME + xmlSAX2EndElement @ 936 NONAME + xmlSAX2StartElement @ 937 NONAME + xmlSAXDefaultVersion @ 938 NONAME + xmlSAXParseEntity @ 939 NONAME + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/eabi/xmlengineutils.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/eabi/xmlengineutils.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +EXPORTS + _Z12XmlEngLeaveLi @ 1 NONAME + _Z14XmlEngOOMTestLv @ 2 NONAME + _Z14XmlEnginePushLv @ 3 NONAME + _Z15XmlEngLeaveOOMLv @ 4 NONAME + _Z16XmlEngineAttachLv @ 5 NONAME + _Z16XmlEngineCleanupPv @ 6 NONAME + _Z20XmlEnginePopAndClosev @ 7 NONAME + _Z21XmlEngXmlCharFromDesLRK7TDesC16 @ 8 NONAME + _Z22XmlEngXmlCharFromDes8LRK6TDesC8 @ 9 NONAME + _Z24XmlEngEscapeForXmlValueLPKc @ 10 NONAME + _ZN13TXmlEngString13AllocAndFreeLEv @ 11 NONAME + _ZN13TXmlEngString14AllocAndFreeLCEv @ 12 NONAME + _ZN13TXmlEngString3SetERS_ @ 13 NONAME + _ZN13TXmlEngString4FreeEv @ 14 NONAME + _ZN13TXmlEngString4SetLERK6TDesC8 @ 15 NONAME + _ZN13TXmlEngString4SetLERK7TDesC16 @ 16 NONAME + _ZN13TXmlEngString7AppendLES_ @ 17 NONAME + _ZN13TXmlEngString7AppendLES_S_ @ 18 NONAME + _ZNK18TXmlEngConstString4SizeEv @ 19 NONAME + _ZNK18TXmlEngConstString5CopyLEv @ 20 NONAME + _ZNK18TXmlEngConstString6AllocLEv @ 21 NONAME + _ZNK18TXmlEngConstString6LengthEv @ 22 NONAME + _ZNK18TXmlEngConstString7AllocLCEv @ 23 NONAME + _ZNK18TXmlEngConstString7CompareES_ @ 24 NONAME + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,80 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file provides the information required for building Libxml2. +// + +PRJ_EXPORTS +../inc/libxml2/libxml2_valid.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_valid.h) +../inc/libxml2/libxml2_parser.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_parser.h) +../inc/libxml2/libxml2_sax.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_sax.h) +../inc/libxml2/libxml2_tree.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_tree.h) +../inc/libxml2/libxml2_entities.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_entities.h) +../inc/libxml2/libxml2_sax2.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_sax2.h) +../inc/libxml2/libxml2_parserinternals.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_parserinternals.h) +../inc/libxml2/xmlengxeconfig.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/xmlengxeconfig.h) +../inc/libxml2/xmlengtriodef.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/libxml2/xmlengtriodef.h) +../inc/libxml2/xmlengconfig.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/xmlengconfig.h) +../inc/libxml2/libxml2_xmlstring.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlstring.h) +../inc/libxml2/libxml2_list.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_list.h) +../inc/libxml2/libxml2_xmlio.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlio.h) +../inc/libxml2/libxml2_xmlversion.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlversion.h) +../inc/libxml2/libxml2_encoding.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_encoding.h) +../inc/libxml2/libxml2_xmlmemory.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlmemory.h) +../inc/libxml2/libxml2_globals.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_globals.h) +../inc/libxml2/libxml2_xmlexports.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlexports.h) +../inc/libxml2/xmlengtrionan.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/libxml2/xmlengtrionan.h) +../inc/libxml2/libxml2_xmlerror.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlerror.h) +../inc/libxml2/libxml2_chvalid.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_chvalid.h) +../inc/libxml2/libxml2_modules.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_modules.h) +../inc/libxml2/libxml2_dict.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_dict.h) +../inc/libxml2/libxml2_threads.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_threads.h) +../inc/libxml2/libxml2_hash.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_hash.h) +../inc/libxml2/libxml2_xlink.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xlink.h) +../inc/libxml2/libxml2_xmlschemastypes.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlschemastypes.h) +../inc/libxml2/libxml2_schemasinternals.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_schemasinternals.h) +../inc/libxml2/libxml2_xmlschemasglobals.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlschemasglobals.h) +../inc/libxml2/libxml2_xmlschemas.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlschemas.h) +../inc/libxml2/libxml2_xpathinternals.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xpathinternals.h) +../inc/libxml2/libxml2_xpath.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xpath.h) +../inc/libxml2/libxml2_c14n.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_c14n.h) +../inc/libxml2/libxml2_xpointer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xpointer.h) +../inc/libxml2/libxml2_uri.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_uri.h) +../inc/libxml2/libxml2_xmlsave.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlsave.h) +../inc/libxml2/libxml2_htmlparser.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_htmlparser.h) +../inc/libxml2/libxml2_htmltree.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_htmltree.h) +../inc/libxml2/libxml2_xinclude.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xinclude.h) +../inc/libxml2/libxml2_xmlreader.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlreader.h) +../inc/libxml2/libxml2_xmlwriter.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/libxml2/libxml2_xmlwriter.h) + +xmlengineutils.iby /epoc32/rom/include/xmlengineutils.iby +xmlengine.iby /epoc32/rom/include/xmlengine.iby +../inc/xmlengineutils/xmlengxestd.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/utils/xmlengxestd.h) +../inc/xmlengineutils/xmlengxestrings.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/utils/xmlengxestrings.h) +../inc/xmlengineutils/xmlengmem.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/utils/xmlengmem.h) +../inc/xmlengineutils/xmlengutils.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/utils/xmlengutils.h) +../inc/xmlengineutils/xmlengxestrings.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/utils/xmlengxestrings.inl) + +#ifndef GCCXML +PRJ_MMPFILES +xmlengine.mmp +xmlengineutils.mmp +#endif //GCCXML + +#include "../test/common/group/bld.inf" +#include "../test/tef/def130695/group/bld.inf" +#include "../test/tef/xml2/group/bld.inf" + + + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/syslibs_libxml2.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/syslibs_libxml2.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,53 @@ + + + + Contains the libxml2 OSS library and the XML Engine utilities library. + + + + The listed files are now being exported to proper locations. + + + + Fix the illegal dependency of XML test code iby on BAFL component test iby + + + + The ExPORT_C and IMPORT_C macro has been added + + + + Fix the profanity found in Base Services code + + + The macro OPTION GCCXML -fpermissive was added to the libxml2.mmp file for migrating the GCCXML build from abld to raptor. + + + + The API's XmlBufferResize( ) and XMlSax2Characters( ) have been updated to catch the NULL pointers passed herein. A new libxml2 test case : def130695 has been added to verify the same. + + + + The buffer size increased by sufficient amount before doubling of the macro GROW_BUFFER. + + + + + The Symbian OS XML services subsystem shall be extended with a new DOM API, the open source libxml2 library and a new libxml2-based SAX plug-in for the existing XML Parser Framework. + + + + + + + Splitting Mixed Header files for Base Services API + + + + + + + Relocating Header files for XML API + + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/syslibs_libxml2.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/syslibs_libxml2.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,12 @@ +component syslibs_libxml2 + +source \sf\os\xmlsrv\xml\libxml2libs + +exports \sf\os\xmlsrv\xml\libxml2libs\group +binary \sf\os\xmlsrv\xml\libxml2libs\group all + +notes_source \component_defs\release.src + +ipr E +ipr T \sf\os\xmlsrv\xml\libxml2libs\test + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/xmlengine.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/xmlengine.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef XMLENGINE_IBY +#define XMLENGINE_IBY + +file=ABI_DIR\BUILD_DIR\xmlengine.dll sys\bin\xmlengine.dll + + +#endif // XMLENGINE_IBY diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/xmlengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/xmlengine.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +TARGET xmlengine.dll +TARGETTYPE dll +UID 0x1000008D 0x10285EF9 + +//Macros for performance improvement +macro XE_ENABLE_GS_CACHING + + +SOURCEPATH ../src/libxml2 +SOURCE xmlenglibxml2dll.cpp + +SOURCEPATH ../src/libxml2 +SOURCE libxml2_c14n.c +SOURCE libxml2_chvalid.c +SOURCE libxml2_dict.c +SOURCE libxml2_encoding.c +SOURCE libxml2_entities.c +SOURCE libxml2_error.c +SOURCE libxml2_globals.c +SOURCE libxml2_hash.c +SOURCE libxml2_htmlparser.c +SOURCE libxml2_htmltree.c +SOURCE libxml2_xinclude.c +SOURCE libxml2_list.c +SOURCE libxml2_parser.c +SOURCE libxml2_parserinternals.c +SOURCE libxml2_sax2.c +SOURCE libxml2_sax.c +SOURCE libxml2_threads.c +SOURCE libxml2_tree.c +SOURCE libxml2_uri.c +SOURCE libxml2_valid.c +SOURCE libxml2_xmlio.c +SOURCE libxml2_xmlmemory.c +SOURCE libxml2_xmlreader.c +SOURCE libxml2_xmlsave.c +SOURCE libxml2_xmlwriter.c +SOURCE libxml2_xmlschemas.c +SOURCE libxml2_xmlschemastypes.c +SOURCE libxml2_xmlstring.c +SOURCE libxml2_xpath.c +SOURCE libxml2_xpointer.c + +USERINCLUDE ../inc/libxml2_nonexport +USERINCLUDE ../src/libxml2 +USERINCLUDE ../inc/libxml2 + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 + +LIBRARY libc.lib +LIBRARY libm.lib +LIBRARY euser.lib + +nostrictdef + +CAPABILITY ALL -TCB +VENDORID 0x70000001 + +// RVCT compiler warning options +// Warning: #177-D: variable "X" was declared but never referenced +// Warning: #550-D: parameter "X" was set but never used +// 186-D: pointless comparison of unsigned integer with zero +// 1293-D: assignment in condition +OPTION ARMCC --diag_suppress 177,550,186,1293 + +// CW compiler warning options +// warning: variable / argument 'X' is not used in function +OPTION CW -w nounused + +// GCC compiler warning options +// "-w" option suppresses all warnings! Libxml2 does many operations on void +// pointers and thus many spurious warnings are raised. There is no GCC option +// to further refine which warnings are supressed. +OPTION GCC -w + +// Libxml2 assigns void pointers to other pointer types without a cast +// The -fpermissive flag will remove this error in gccxml. However, +// the OPTION statement is not supported for gccxml, so the following +// creative solution achieves the same thing. +#if defined(GCCXML) +MACRO "NOTAMACRO -fpermissive" +OPTION GCCXML -fpermissive +#endif + + +SMPSAFE + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/xmlengineutils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/xmlengineutils.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// BY file for Utils of XML Parser +// + +#ifndef XMLENGINEUTILS_IBY +#define XMLENGINEUTILS_IBY + +#include + +file=ABI_DIR\BUILD_DIR\xmlengineutils.dll sys\bin\xmlengineutils.dll + + +#endif // XMLENGINEUTILS_IBY diff -r 000000000000 -r e35f40988205 xml/libxml2libs/group/xmlengineutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/group/xmlengineutils.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Project specification file for Utils of XML Parser +// +// + +TARGET xmlengineutils.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9780 + +SOURCEPATH ../src/xmlengineutils +SOURCE xmlengxmlengine.cpp +SOURCE xmlengutils.cpp +SOURCE xmlengxmlstring.cpp +SOURCE xmlengmem.cpp + + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_LIBC_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 + +USERINCLUDE ../inc/libxml2_nonexport + + +LIBRARY libc.lib +LIBRARY euser.lib +LIBRARY charconv.lib +LIBRARY xmlengine.lib + +nostrictdef + +CAPABILITY ALL -TCB +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Daniel Veillard shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + +Copyright (C) 2000 Gary Pennington and Daniel Veillard. +Copyright (C) 2003 Daniel Veillard. +Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2000 Bjorn Reese and Daniel Veillard. +Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2000 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2001 Bjorn Reese + +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. diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_c14n.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_c14n.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,110 @@ +/* + * Summary: Provide Canonical XML and Exclusive XML Canonicalization + * Description: the c14n modules provides a + * + * "Canonical XML" implementation + * http://www.w3.org/TR/xml-c14n + * + * and an + * + * "Exclusive XML Canonicalization" implementation + * http://www.w3.org/TR/xml-exc-c14n + + * Copy: See Copyright for the status of this software. + * + * Author: Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ +#ifndef XML_C14N_H +#define XML_C14N_H + +#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_C14N_ENABLED) + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include + +/* + * XML Canonicazation + * http://www.w3.org/TR/xml-c14n + * + * Exclusive XML Canonicazation + * http://www.w3.org/TR/xml-exc-c14n + * + * Canonical form of an XML document could be created if and only if + * a) default attributes (if any) are added to all nodes + * b) all character and parsed entity references are resolved + * In order to achive this in libxml2 the document MUST be loaded with + * following global setings: + * + * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * xmlSubstituteEntitiesDefault(1); + * + * or corresponding parser context setting: + * xmlParserCtxtPtr ctxt; + * + * ... + * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * ctxt->replaceEntities = 1; + * ... + */ + + +XMLPUBFUN int XMLCALL + xmlC14NDocSaveTo (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +XMLPUBFUN int XMLCALL + xmlC14NDocDumpMemory (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlChar **doc_txt_ptr); + +XMLPUBFUN int XMLCALL + xmlC14NDocSave (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + const char* filename, + int compression); + + +/** + * This is the core C14N function + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, + xmlNodePtr node, + xmlNodePtr parent); + +XMLPUBFUN int XMLCALL + xmlC14NExecute (xmlDocPtr doc, + xmlC14NIsVisibleCallback is_visible_callback, + void* user_data, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_C14N_ENABLED) */ +#endif /* XML_C14N_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_chvalid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_chvalid.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,251 @@ +/* + * Summary: Unicode character range checking + * Description: this module exports interfaces for the character + * range validation APIs + * + * This file is automatically generated from the cvs source + * definition files using the genChRanges.py Python script + * + * Generation date: Tue Nov 18 08:14:21 2003 + * Sources: chvalid.def + * Author: William Brack + * + * See Copyright for the status of this software. + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_CHVALID_H +#define XML_CHVALID_H + +#pragma warning(disable: 4127 4132 4510 4512 4610) + +#include "libxml2_xmlstring.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define our typedefs and structures + * + */ + +// XMLENGINE: xmlChSRangePtr declared as const now +typedef struct _xmlChSRange xmlChSRange; +typedef const xmlChSRange* xmlChSRangePtr; +struct _xmlChSRange { + const unsigned short low; + const unsigned short high; +}; + +typedef struct _xmlChLRange xmlChLRange; +typedef const xmlChLRange* xmlChLRangePtr; +struct _xmlChLRange { + const unsigned int low; + const unsigned int high; +}; + +typedef struct _xmlChRangeGroup xmlChRangeGroup; +typedef const xmlChRangeGroup *xmlChRangeGroupPtr; +struct _xmlChRangeGroup { + const int nbShortRange; + const int nbLongRange; + const xmlChSRangePtr shortRange; /* points to an array of ranges */ + const xmlChLRangePtr longRange; +}; + +/** + * Range checking routine + */ +XMLPUBFUN int XMLCALL + xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); + + +/** + * xmlIsBaseChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ + ((0x61 <= (c)) && ((c) <= 0x7a)) || \ + ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ + ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ + (0xf8 <= (c))) +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const xmlChSRange xmlIsBaseChar_srng[197]; +#endif +/** + * xmlIsBaseCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ + xmlIsBaseChar_ch((c)) : \ + xmlCharInRange((c), &xmlIsBaseCharGroup)) +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; +#endif +/** + * xmlIsBlank_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + * + * OOM: never + */ +#define xmlIsBlank_ch(c) (((c) == 0x20) || \ + ((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd)) + +/** + * xmlIsBlankQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBlankQ(c) (((c) < 0x100) ? \ + xmlIsBlank_ch((c)) : 0) + + +/** + * xmlIsChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd) || \ + (0x20 <= (c))) + +/** + * xmlIsCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCharQ(c) (((c) < 0x100) ? \ + xmlIsChar_ch((c)) :\ + (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ + ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ + ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) + +//XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; + +/** + * xmlIsCombiningQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ + 0 : \ + xmlCharInRange((c), &xmlIsCombiningGroup)) +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const xmlChSRange xmlIsCombining_srng[]; +XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; +#endif +/** + * xmlIsDigit_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) + +/** + * xmlIsDigitQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigitQ(c) (((c) < 0x100) ? \ + xmlIsDigit_ch((c)) : \ + xmlCharInRange((c), &xmlIsDigitGroup)) +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; +XMLPUBVAR const xmlChSRange xmlIsDigit_srng[]; +#endif +/** + * xmlIsExtender_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtender_ch(c) (((c) == 0xb7)) + +/** + * xmlIsExtenderQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ + xmlIsExtender_ch((c)) : \ + xmlCharInRange((c), &xmlIsExtenderGroup)) +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const xmlChSRange xmlIsExtender_srng[]; +XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; +#endif +/** + * xmlIsIdeographicQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsIdeographicQ(c) (((c) < 0x100) ? 0 : \ + (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ + ((c) == 0x3007) || \ + ((0x3021 <= (c)) && ((c) <= 0x3029)))) + +/** + * xmlIsPubidChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) + +/* + * The initial tables ({func_name}_tab) are used to validate whether a + * single-byte character is within the specified group. Each table + * contains 256 bytes, with each byte representing one of the 256 + * possible characters. If the table byte is set, the character is + * allowed. + * + */ +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; +#endif +/** + * xmlIsPubidCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidCharQ(c) (((c) < 0x100) ? xmlIsPubidChar_ch((c)) : 0) + +#ifndef XMLENGINE_EXCLUDE_UNUSED +// these are deprecated and replaced by macroses (for performance reasons) +XMLPUBFUN int XMLCALL xmlIsBaseChar (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsBlank (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsChar (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsCombining (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsDigit (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsExtender (unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsIdeographic(unsigned int ch); +XMLPUBFUN int XMLCALL xmlIsPubidChar (unsigned int ch); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + + +#ifdef __cplusplus +} +#endif +#endif /* XML_CHVALID_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_dict.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_dict.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,107 @@ +/* + * Summary: string dictionnary + * Description: dictionary of reusable strings, just used to avoid allocation + * and freeing operations. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_DICT_H +#define XML_DICT_H + +#include "libxml2_xmlstring.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlDictStrings xmlDictStrings; +typedef xmlDictStrings* xmlDictStringsPtr; + +struct _xmlDictStrings { + xmlDictStringsPtr next; + xmlChar* free; + xmlChar* end; + int size; + int nbStrings; + xmlChar array[1]; +}; + +/* + * An entry in the dictionnary + */ +typedef struct _xmlDictEntry xmlDictEntry; +typedef xmlDictEntry* xmlDictEntryPtr; +struct _xmlDictEntry { + xmlDictEntryPtr next; + const xmlChar* name; + int len; + int valid; +}; +/* + * The dictionnary. + */ +typedef struct _xmlDict xmlDict; +typedef xmlDict* xmlDictPtr; + +/* + * The entire dictionnary + */ +struct _xmlDict { + int ref_counter; + + xmlDictEntryPtr dict; + int size; + int nbElems; + xmlDictStringsPtr strings; + + xmlDictPtr subdict; +}; + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlDictPtr XMLCALL + xmlDictCreate (void); + +XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreateSub(xmlDictPtr sub); + +XMLPUBFUN int XMLCALL + xmlDictReference(xmlDictPtr dict); +XMLPUBFUN void XMLCALL + xmlDictFree (xmlDictPtr dict); + +/* + * Lookup of entry in the dictionnary. + */ +XMLPUBFUN const xmlChar* XMLCALL + xmlDictLookup (xmlDictPtr dict, + const xmlChar *name, + int len); + +XMLPUBFUN const xmlChar * XMLCALL + xmlDictQLookup (xmlDictPtr dict, + const xmlChar *prefix, + const xmlChar *name); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL + xmlDictSize (xmlDictPtr dict); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN int XMLCALL + xmlDictOwns (xmlDictPtr dict, + const xmlChar *str); +#ifdef __cplusplus +} +#endif +#endif /* XML_DICT_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_encoding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_encoding.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,228 @@ +/* + * Summary: interface for the encoding conversion functions + * Description: interface for the encoding conversion functions needed for + * XML basic encoding and iconv() support. + * + * Related specs are + * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies + * [ISO-10646] UTF-8 and UTF-16 in Annexes + * [ISO-8859-1] ISO Latin-1 characters codes. + * [UNICODE] The Unicode Consortium, "The Unicode Standard -- + * Worldwide Character Encoding -- Version 1.0", Addison- + * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is + * described in Unicode Technical Report #4. + * [US-ASCII] Coded Character Set--7-bit American Standard Code for + * Information Interchange, ANSI X3.4-1986. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_CHAR_ENCODING_H +#define XML_CHAR_ENCODING_H + +//#include "libxml/Libxml2_xmlversion.h" // enable this when dependency on tree.h is removed +#include "libxml2_tree.h" + +#ifdef LIBXML_ICONV_ENABLED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlCharEncoding: + * + * Predefined values for some standard encodings. + * Libxml does not do beforehand translation on UTF8 and ISOLatinX. + * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. + * + * Anything else would have to be translated to UTF8 before being + * given to the parser itself. The BOM for UTF16 and the encoding + * declaration are looked at and a converter is looked for at that + * point. If not found the parser stops here as asked by the XML REC. A + * converter can be registered by the user using xmlRegisterCharEncodingHandler + * but the current form doesn't allow stateful transcoding (a serious + * problem agreed !). If iconv has been found it will be used + * automatically and allow stateful transcoding, the simplest is then + * to be sure to enable iconv and to provide iconv libs for the encoding + * support needed. + * + * Note that the generic "UTF-16" is not a predefined value. Instead, only + * the specific UTF-16LE and UTF-16BE are present. + */ +typedef enum { + XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ + XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ + XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ + XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ + XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ + XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ + XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ + XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ + XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ + XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ + XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ + XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ + XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ + XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ + XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ + XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ + XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ + XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ + XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ + XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ + XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ + XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ +} xmlCharEncoding; + +/** + * xmlCharEncodingInputFunc: + * @param out a pointer to an array of bytes to store the UTF-8 result + * @param outlen the length of out + * @param in a pointer to an array of chars in the original encoding + * @param inlen the length of in + * + * Take a block of chars in the original encoding and try to convert + * it to an UTF-8 block of chars out. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of outlen after return is the number of octets consumed. + */ +typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/** + * xmlCharEncodingOutputFunc: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to another + * encoding. + * Note: a first call designed to produce heading info is called with + * in = NULL. If stateful this should also initialize the encoder state. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of outlen after return is the number of octets produced. + */ +typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/* + * Block defining the handlers for non UTF-8 encodings. + * If iconv is supported, there are two extra fields. + */ + +typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; +typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; +struct _xmlCharEncodingHandler { + char *name; + xmlCharEncodingInputFunc input; + xmlCharEncodingOutputFunc output; +#ifdef LIBXML_ICONV_ENABLED + iconv_t iconv_in; + iconv_t iconv_out; +#endif /* LIBXML_ICONV_ENABLED */ +}; + +//#ifdef __cplusplus +//} +//#endif +//#ifdef __cplusplus +//extern "C" { +//#endif + +/* + * Interfaces for encoding handlers. + */ +XMLPUBFUN void XMLCALL + xmlInitCharEncodingHandlers (void); +XMLPUBFUN void XMLCALL + xmlCleanupCharEncodingHandlers (void); +XMLPUBFUN void XMLCALL + xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlGetCharEncodingHandler (xmlCharEncoding enc); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlFindCharEncodingHandler (const char *name); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); + +/* + * Interfaces for encoding names and aliases. + */ +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL xmlAddEncodingAlias(const char *name, const char *alias); +XMLPUBFUN int XMLCALL xmlDelEncodingAlias(const char *alias); +#endif + +XMLPUBFUN const char * XMLCALL xmlGetEncodingAlias (const char *alias); +XMLPUBFUN void XMLCALL xmlCleanupEncodingAliases (void); +XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding (const char *name); +XMLPUBFUN const char * XMLCALL xmlGetCharEncodingName (xmlCharEncoding enc); + +/* + * Interfaces directly used by the parsers. + */ +XMLPUBFUN xmlCharEncoding XMLCALL + xmlDetectCharEncoding (const unsigned char *in, + int len); + +XMLPUBFUN int XMLCALL + xmlCharEncOutFunc (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); + +XMLPUBFUN int XMLCALL + xmlCharEncInFunc (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); +XMLPUBFUN int XMLCALL + xmlCharEncFirstLine (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); +XMLPUBFUN int XMLCALL + xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); + +/* + * Export a few useful functions + */ +XMLPUBFUN int XMLCALL + UTF8Toisolat1 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +XMLPUBFUN int XMLCALL + isolat1ToUTF8 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +#ifdef __cplusplus +} +#endif + +#endif /* XML_CHAR_ENCODING_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_entities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_entities.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,143 @@ +/* + * Summary: interface for the XML entities handling + * Description: this module provides some of the entity API needed + * for the parser and applications. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_ENTITIES_H +#define XML_ENTITIES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The different valid entity types. + */ +typedef enum { + XML_INTERNAL_GENERAL_ENTITY = 1, + XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, + XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, + XML_INTERNAL_PARAMETER_ENTITY = 4, + XML_EXTERNAL_PARAMETER_ENTITY = 5, + XML_INTERNAL_PREDEFINED_ENTITY = 6 +} xmlEntityType; + +/* + * An unit of storage for an entity, contains the string, the value + * and the linkind data needed for the linking in the hash table. + */ + +struct _xmlEntity { + void *_private; /* application data */ + xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ + const xmlChar *name; /* Entity name */ + struct _xmlNode *children; /* First child link */ + struct _xmlNode *last; /* Last child link */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + /* end of common part */ + xmlChar *orig; /* content without ref substitution */ + xmlChar *content; /* content or ndata if unparsed */ + int length; /* the content length */ + xmlEntityType etype; /* The entity type */ + const xmlChar *ExternalID; /* External identifier for PUBLIC */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ + + struct _xmlEntity *nexte; /* unused */ + const xmlChar *URI; /* the full URI as computed */ + int owner; /* does the entity own the childrens */ +}; + +/* + * All entities are stored in an hash table. + * There is 2 separate hash tables for global and parameter entities. + */ + +typedef struct _xmlHashTable xmlEntitiesTable; +typedef xmlEntitiesTable *xmlEntitiesTablePtr; + +/* + * External functions: + */ + +XMLPUBFUN void XMLCALL + xmlInitializePredefinedEntities (void); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlAddDocEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlAddDtdEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetPredefinedEntity (const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetDocEntity (xmlDocPtr doc, const xmlChar *name); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetDtdEntity (xmlDocPtr doc, const xmlChar *name); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetParameterEntity (xmlDocPtr doc, const xmlChar *name); + + +// (it is in _excluded-forever code group) +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN const xmlChar * XMLCALL + xmlEncodeEntities (xmlDocPtr doc, + const xmlChar *input); +#endif /* LIBXML_LEGACY_ENABLED */ + +XMLPUBFUN xmlChar * XMLCALL + xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input); +XMLPUBFUN xmlChar * XMLCALL + xmlEncodeSpecialChars (xmlDocPtr doc, const xmlChar *input); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCreateEntitiesTable (void); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN xmlEntitiesTablePtr XMLCALL + xmlCopyEntitiesTable (xmlEntitiesTablePtr table); +XMLPUBFUN void XMLCALL + xmlFreeEntitiesTable (xmlEntitiesTablePtr table); +XMLPUBFUN void XMLCALL + xmlCleanupPredefinedEntities(void); + +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpEntitiesTable (xmlBufferPtr buf, xmlEntitiesTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpEntityDecl (xmlBufferPtr buf, xmlEntityPtr ent); +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef __cplusplus +} +#endif + +# endif /* XML_ENTITIES_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_errencoding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_errencoding.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,75 @@ +/* + * Summary: internals routines exported by the parser. + * Description: this module exports a number of internal parsing routines + * they are not really all intended for applications but + * can prove useful doing low level processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef LIBXML2_ERRENCODING_H_ + +#define LIBXML2_ERRENCODING_H_ + + + +#include + +#include + + + + + +#ifdef IN_LIBXML + +/* internal error reporting + + * @internalComponent + + * @prototype + + */ + +void XMLCALL + + __xmlErrEncoding (xmlParserCtxtPtr ctxt, + + xmlParserErrors error, + + const char *msg, + + const xmlChar * str1, + + const xmlChar * str2); + + + +/* + + * internal only + + * @internalComponent + + * @prototype + + */ + +void XMLCALL + + xmlErrMemory (xmlParserCtxtPtr ctxt, + + const char *extra); + + + +#endif + + + + + +#endif /*LIBXML2_ERRENCODING_H_*/ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_globals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,557 @@ +/* + * Summary: interface for all global variables of the library + * Description: all the global variables and thread handling for + * those variables is handled by this module. + * + * The bottom of this file is automatically generated by build_glob.py + * based on the description file global.data + * + * Copy: See Copyright for the status of this software. + * + * Author: Gary Pennington , Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_GLOBALS_H +#define XML_GLOBALS_H + +#ifdef XE_ENABLE_GS_CACHING +/* This feature is enabled/disabled by defining/removing XE_ENABLE_GS_CACHING macro in libxml2 mmp file. + When enabled, it allows to use cached GS (global state) pointer from xmlDoc and xmlParserCtxt objects + in libxml2. This improves the overall performance (depending on usecase, dom parsing is improved sigificantly) + since it avoids most of Dll::Tls() calls for accessing each member in GS data structure. + + NOTE: When GS pointer caching is enabled, always ensure that GS proxy variable is initialized + before first access to any GS member. We should ensure more safety in debug builds, like non initialized or NULL + GS proxy variable. +*/ +#define XE_GS_PROXY_VAR __xe_gs +#define DEFINE_GS_PROXY xmlGlobalStatePtr XE_GS_PROXY_VAR; +#define SET_GS_PROXY(addr) XE_GS_PROXY_VAR = addr; +#define DEFINE_GS_PROXY_AS(addr) xmlGlobalStatePtr XE_GS_PROXY_VAR = addr; +#define ASSIGN_GS_DIRECT XE_GS_PROXY_VAR = (xmlGlobalStatePtr)xmlGetGlobalState() +#define ASSIGN_GS(var) XE_GS_PROXY_VAR = (xmlGlobalStatePtr)(var->cachedGs) +#define LOAD_GS_DIRECT DEFINE_GS_PROXY_AS((xmlGlobalStatePtr)xmlGetGlobalState()) +#define LOAD_GS(src) DEFINE_GS_PROXY_AS((xmlGlobalStatePtr)(src->cachedGs)) + +#define LOAD_GS_SAFE_CTXT(ctxt) \ + DEFINE_GS_PROXY \ + if(ctxt) \ + {ASSIGN_GS(ctxt);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_DOC(doc) \ + DEFINE_GS_PROXY \ + if(doc && (doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_NODE(node) \ + DEFINE_GS_PROXY \ + if(node && (node->doc) && (node->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(node->doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_DTD(dtd) \ + DEFINE_GS_PROXY \ + if(dtd && (dtd->doc) && (dtd->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(dtd->doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_ATTR(attr) \ + DEFINE_GS_PROXY \ + if(attr && (attr->doc) && (attr->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(attr->doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_ENT(ent) \ + DEFINE_GS_PROXY \ + if(ent && (ent->doc) && (ent->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(ent->doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_XPATH_PARSER_CTXT(ctxtp) \ + DEFINE_GS_PROXY \ + if(ctxtp && (ctxtp->context) && (ctxtp->context->doc) && (ctxtp->context->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(ctxtp->context->doc);} else {ASSIGN_GS_DIRECT;} + +#define LOAD_GS_SAFE_XPATH_CTXT(ctx) \ + DEFINE_GS_PROXY \ + if(ctx && (ctx->doc) && (ctx->doc->type == XML_DOCUMENT_NODE)) \ + {ASSIGN_GS(ctx->doc);} else {ASSIGN_GS_DIRECT;} + +#else // Feature is disabled +#define XE_GS_PROXY_VAR xmlGetGlobalState() +#define DEFINE_GS_PROXY +#define SET_GS_PROXY(addr) +#define LOAD_GS_DIRECT +#define LOAD_GS(src) +#define ASSIGN_GS_DIRECT +#define ASSIGN_GS(var) +#define LOAD_GS_SAFE_CTXT(ctxt) +#define LOAD_GS_SAFE_DOC(doc) +#define LOAD_GS_SAFE_NODE(node) +#define LOAD_GS_SAFE_DTD(dtd) +#define LOAD_GS_SAFE_ATTR(attr) +#define LOAD_GS_SAFE_ENT(ent) +#define LOAD_GS_SAFE_XPATH_PARSER_CTXT(ctxtp) +#define LOAD_GS_SAFE_XPATH_CTXT(ctx) +#endif //XE_ENABLE_GS_CACHING + +typedef struct _xmlGlobalState xmlGlobalState; +typedef xmlGlobalState *xmlGlobalStatePtr; + +#include +#include +#include +#include + +#ifdef XMLENGINE_XSLT +#if defined(XSLT_WIN32_PERFORMANCE_COUNTER) || defined(HAVE_GETTIMEOFDAY) +#defined XSLT_PROFILING_ENABLED +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned int xmlLinAddress; + +XMLPUBFUN int XMLCALL xmlOOMFlag(); + +XMLPUBFUN void* XMLCALL malloc_impl(size_t size); + +XMLPUBFUN void* XMLCALL realloc_impl(void *ptr, size_t size); + +#ifdef LIBXML_XPATH_ENABLED +# include "xmlengtriodef.h" +# include "xmlengtrionan.h" +# include "libxml2_xpathinternals.h" +#endif + +#ifdef LIBXML_CATALOG_ENABLED +#include "libxml/libxml2_catalog.h" +#endif + + +#ifdef XMLENGINE_XMLSCHEMA_DATATYPES +#include +#endif + + +typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias; +typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr; +struct _xmlCharEncodingAlias { + const char *name; + const char *alias; +}; + +typedef struct _xmlInputCallback { + xmlInputMatchCallback matchcallback; + xmlInputOpenCallback opencallback; + xmlInputReadCallback readcallback; + xmlInputCloseCallback closecallback; +} xmlInputCallback; +#define MAX_INPUT_CALLBACK 15 + +#ifdef LIBXML_OUTPUT_ENABLED +typedef struct _xmlOutputCallback { + xmlOutputMatchCallback matchcallback; + xmlOutputOpenCallback opencallback; + xmlOutputWriteCallback writecallback; + xmlOutputCloseCallback closecallback; +} xmlOutputCallback; +#define MAX_OUTPUT_CALLBACK 15 +#endif /* LIBXML_OUTPUT_ENABLED */ + +#define xmlThrDefMutex NULL +#define xmlInitGlobals() +#define xmlCleanupGlobals() + + +/* + * Externally global symbols which need to be protected for backwards + * compatibility support. + */ + +#undef docbDefaultSAXHandler +#undef htmlDefaultSAXHandler +#undef xmlBufferAllocScheme +#undef xmlDefaultBufferSize +#undef xmlDefaultSAXHandler +#undef xmlDefaultSAXLocator +#undef xmlDoValidityCheckingDefaultValue +#undef xmlFree +#undef xmlGenericError +#undef xmlStructuredError +#undef xmlGenericErrorContext +#undef xmlGetWarningsDefaultValue +#undef xmlIndentTreeOutput +#undef xmlTreeIndentString +#undef xmlKeepBlanksDefaultValue +#undef xmlLineNumbersDefaultValue +#undef xmlLoadExtDtdDefaultValue +#undef xmlMalloc +#undef xmlMallocAtomic +#undef xmlMemStrdup +#undef xmlParserDebugEntities +#undef xmlPedanticParserDefaultValue +#undef xmlRealloc +#undef xmlSaveNoEmptyTags +#undef xmlSubstituteEntitiesDefaultValue +#undef xmlRegisterNodeDefaultValue +#undef xmlDeregisterNodeDefaultValue +#undef xmlLastError +#undef xmlOOM +#undef xeUserCount + +#undef htmlStartCloseIndex +#undef htmlStartCloseIndexinitialized + +/* XMLENGINE_XSLT +#undef g_calibration +#undef default_token +#undef xsltExtensionsHash +#undef xsltFunctionsHash +#undef xsltElementsHash +#undef xsltTopLevelsHash +#undef xsltDebuggerCurrentCallbacks +*/ +#undef xsltGlobalsCleanupFunc + +typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); +typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); + + +struct _xmlGlobalState +{ + // NOTE: structure fields were reordered comparatively to the original libxml2 source + // Most used fields should be in the first 256 bytes of the structure (64 fields) + // because on ARM an extra operation is needed for addressing the fields with + // larger offset. + // Doing this has made size of the DLL 4 KB smaller ! (and faster!) + + int xmlOOM; + int xeUserCount; + xmlError xmlLastError; + + DOMStringConverterData xeStringArgs; + + /* Memory */ +/* Not used in Symbian: xmlMalloc is malloc_impl(), xmlFree is standard free() now + xmlFreeFunc xmlFreeFn; + xmlMallocFunc xmlMallocFn; + xmlStrdupFunc xmlMemStrdupFn; + xmlReallocFunc xmlReallocFn; + xmlMallocFunc xmlMallocAtomicFn; +*/ + + xmlGenericErrorFunc xmlGenericError; + xmlStructuredErrorFunc xmlStructuredError; + void *xmlGenericErrorContext; + + /* Deafault settings and configuration values */ + xmlBufferAllocationScheme xmlBufferAllocScheme; + int xmlDefaultBufferSize; + int xmlSubstituteEntitiesDefaultValue; + int xmlDoValidityCheckingDefaultValue; + int xmlGetWarningsDefaultValue; + int xmlKeepBlanksDefaultValue; + int xmlLoadExtDtdDefaultValue; + int xmlParserDebugEntities; + int xmlPedanticParserDefaultValue; +#ifdef LIBXML_ENABLE_NODE_LINEINFO + int xmlLineNumbersDefaultValue; +#endif // LIBXML_ENABLE_NODE_LINEINFO + int xmlSaveNoEmptyTags; + int xmlIndentTreeOutput; + //const + char *xmlTreeIndentString; + xmlExternalEntityLoader xmlCurrentExternalEntityLoader; + + xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; + xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; + + /* parser */ + unsigned int xmlParserMaxDepth; + + int __xmlRegisterCallbacks; + int xmlCompressMode; + int xmlCheckDTD; + + /* xpath */ + double xmlXPathNAN; + double xmlXPathPINF; + double xmlXPathNINF; + double xmlXPathNZERO; + int xmlXPathInitialized; +#ifndef LIBXML_THREAD_ENABLED + int xmlXPathDisableOptimizer; +#endif + int xmlXPathDefineExtensionFunctionsGlobally; + xmlHashTablePtr xmlXPathDefaultFunctionsHash; + xmlHashTablePtr xmlXPathIntermediaryExtensionFunctionsHash; + + /* encoding */ + xmlCharEncodingHandlerPtr xmlUTF16LEHandler; + xmlCharEncodingHandlerPtr xmlUTF16BEHandler; + xmlCharEncodingAliasPtr xmlCharEncodingAliases; + int xmlCharEncodingAliasesNb; + int xmlCharEncodingAliasesMax; + int xmlLittleEndian; + + xmlCharEncodingHandlerPtr *handlers; + int nbCharEncodingHandler; + xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler; + + /* error */ + int had_info; /* internal */ + + /* parserInternals */ + int xmlInputStreamId; /* internal: renamed from "id" to prevent namespace collisions */ + + /* parser */ + const char *xmlW3CPIs [2]; + int xmlParserInitialized; + unsigned int xeStackLimit; + + /* SAX2 */ + int xmlSAX2DefaultVersionValue; + + /* xmlio */ + xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK]; + int xmlInputCallbackNr; + int xmlInputCallbackInitialized; +#ifdef LIBXML_OUTPUT_ENABLED + xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK]; + int xmlOutputCallbackNr; + int xmlOutputCallbackInitialized; +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef LIBXML_HTML_ENABLED + /*HTML parser*/ + const char** htmlStartCloseIndex[100]; + int htmlStartCloseIndexinitialized; +#endif + + + /* SAX: old SAX1, and others */ + xmlSAXLocator xmlDefaultSAXLocator; + xmlSAXHandlerV1 xmlDefaultSAXHandler; + xmlSAXHandlerV1 docbDefaultSAXHandler; + xmlSAXHandlerV1 htmlDefaultSAXHandler; + +#ifdef LIBXML_XPTR_ENABLED + xlinkHandlerPtr xlinkDefaultHandler; + xlinkNodeDetectFunc xlinkDefaultDetect; +#endif /* LIBXML_XPTR_ENABLED */ + +#ifdef XMLENGINE_XMLSCHEMA_DATATYPES + xmlSchemaTypesGlobalDataPtr xmlSchemaTypesGlobals; + int xmlSchemaTypesInitialized; +#endif + +#ifdef XMLENGINE_XSLT +#ifdef XSLT_PROFILING_ENABLED + long g_calibration; // DONE: renamed from 'calibration' +#endif + void* xsltGlobalsCleanupFunc; + xmlHashTablePtr xsltTopLevelsHash; +#ifdef XSLT_EXTENSION + xmlHashTablePtr xsltExtensionsHash; + xmlHashTablePtr xsltFunctionsHash; + xmlHashTablePtr xsltElementsHash; + //xsltFormatToken default_token; +#endif + +#ifdef XSLT_DEBUG_CALLBACK + xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks; +#endif +#endif /*end of XMLENGINE_XSLT*/ + +#ifdef LIBXML_CATALOG_ENABLED + int xmlDebugCatalogs; + xmlCatalogAllow xmlCatalogDefaultAllow; + xmlCatalogPrefer xmlCatalogDefaultPrefer; + xmlHashTablePtr xmlCatalogXMLFiles; + xmlCatalogPtr xmlDefaultCatalog; +// xmlRMutexPtr xmlCatalogMutex; + int xmlCatalogInitialized; +#endif + + /* xmlmemory */ + int xmlMemInitialized; + unsigned long debugMemSize; + unsigned long debugMaxMemSize; +// xmlMutexPtr xmlMemMutex; + unsigned int g_block; + unsigned int xmlMemStopAtBlock; + void *xmlMemTraceBlockAt; + +#ifdef XMLENGINE_MEM_DEBUG + int allocCount; + int reallocCount; + int deallocCount; + int allocTotal; + int deallocTotal; + void* memSizeFunc; + int allocMemSize; + int allocMemSizeMax; +#endif + + int reserved; +}; // end of struct _xmlGlobalState + +#ifdef XMLENGINE_MEM_DEBUG +typedef void (*MemSizeFunc)(void*, void*, void*); +#endif + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif +#ifndef UNDEF_IMPORT_C_IN_DATA +XMLPUBVAR const char* const xmlTreeIndentString; +XMLPUBVAR const char* const xmlParserVersion; +#endif + +XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); +XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault (xmlRegisterNodeFunc func); +XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); + +// NOTE: We can actually use fixed values for memory allocation routines! + +// Boost the performance! This has saved 2 KB of the code and made it faster +#define xmlFree free +#define xmlMalloc malloc_impl +#define xmlMallocAtomic malloc_impl +#define xmlRealloc realloc_impl +#define xmlMemStrdup(p) ((char*)xmlStrdup((const xmlChar*)(p))) + +#define xmlLastError (XE_GS_PROXY_VAR->xmlLastError) +#define xmlBufferAllocScheme (XE_GS_PROXY_VAR->xmlBufferAllocScheme) +#define xmlDefaultBufferSize (XE_GS_PROXY_VAR->xmlDefaultBufferSize) + +#ifdef LIBXML_SAX1_ENABLED +#define xmlDefaultSAXHandler (XE_GS_PROXY_VAR->xmlDefaultSAXHandler) +#endif /* LIBXML_SAX1_ENABLED */ + +#define xmlDefaultSAXLocator (XE_GS_PROXY_VAR->xmlDefaultSAXLocator) + +#define xmlDoValidityCheckingDefaultValue (XE_GS_PROXY_VAR->xmlDoValidityCheckingDefaultValue) +#define xmlGenericError (xmlGetGlobalState()->xmlGenericError) +#define xmlStructuredError (XE_GS_PROXY_VAR->xmlStructuredError) +#define xmlGenericErrorContext (xmlGetGlobalState()->xmlGenericErrorContext) +#define xmlGetWarningsDefaultValue (XE_GS_PROXY_VAR->xmlGetWarningsDefaultValue) +#define xmlIndentTreeOutput (XE_GS_PROXY_VAR->xmlIndentTreeOutput) +#define xmlKeepBlanksDefaultValue (XE_GS_PROXY_VAR->xmlKeepBlanksDefaultValue) +#define xmlLineNumbersDefaultValue (XE_GS_PROXY_VAR->xmlLineNumbersDefaultValue) +#define xmlLoadExtDtdDefaultValue (XE_GS_PROXY_VAR->xmlLoadExtDtdDefaultValue) +#define xmlParserDebugEntities (XE_GS_PROXY_VAR->xmlParserDebugEntities) +#define xmlPedanticParserDefaultValue (XE_GS_PROXY_VAR->xmlPedanticParserDefaultValue) +#define xmlSaveNoEmptyTags (XE_GS_PROXY_VAR->xmlSaveNoEmptyTags) +#define xmlSubstituteEntitiesDefaultValue (XE_GS_PROXY_VAR->xmlSubstituteEntitiesDefaultValue) +#define xmlRegisterNodeDefaultValue (XE_GS_PROXY_VAR->xmlRegisterNodeDefaultValue) +#define xmlDeregisterNodeDefaultValue (XE_GS_PROXY_VAR->xmlDeregisterNodeDefaultValue) + +/* Static Globals */ +#define xmlLibraryLock NULL + +#define had_info (XE_GS_PROXY_VAR->had_info) +#define xmlInputStreamId (XE_GS_PROXY_VAR->xmlInputStreamId) + +#define xmlUTF16LEHandler (XE_GS_PROXY_VAR->xmlUTF16LEHandler) +#define xmlUTF16BEHandler (XE_GS_PROXY_VAR->xmlUTF16BEHandler) +#define xmlCharEncodingAliases (XE_GS_PROXY_VAR->xmlCharEncodingAliases) +#define xmlCharEncodingAliasesNb (XE_GS_PROXY_VAR->xmlCharEncodingAliasesNb) +#define xmlCharEncodingAliasesMax (XE_GS_PROXY_VAR->xmlCharEncodingAliasesMax) +#define xmlLittleEndian (XE_GS_PROXY_VAR->xmlLittleEndian) +#define handlers (XE_GS_PROXY_VAR->handlers) +#define nbCharEncodingHandler (XE_GS_PROXY_VAR->nbCharEncodingHandler) +#define xmlDefaultCharEncodingHandler (XE_GS_PROXY_VAR->xmlDefaultCharEncodingHandler) + +#define xmlParserMaxDepth (XE_GS_PROXY_VAR->xmlParserMaxDepth) +#define xmlW3CPIs (XE_GS_PROXY_VAR->xmlW3CPIs) +#define xmlParserInitialized (XE_GS_PROXY_VAR->xmlParserInitialized) +#define xeStackLimit (XE_GS_PROXY_VAR->xeStackLimit) + +#define xmlSAX2DefaultVersionValue (XE_GS_PROXY_VAR->xmlSAX2DefaultVersionValue) + +#define xmlInputCallbackTable (XE_GS_PROXY_VAR->xmlInputCallbackTable) +#define xmlInputCallbackNr (XE_GS_PROXY_VAR->xmlInputCallbackNr) +#define xmlInputCallbackInitialized (XE_GS_PROXY_VAR->xmlInputCallbackInitialized) +#define xmlOutputCallbackTable (XE_GS_PROXY_VAR->xmlOutputCallbackTable) +#define xmlOutputCallbackNr (XE_GS_PROXY_VAR->xmlOutputCallbackNr) +#define xmlOutputCallbackInitialized (XE_GS_PROXY_VAR->xmlOutputCallbackInitialized) +#define xmlCurrentExternalEntityLoader (XE_GS_PROXY_VAR->xmlCurrentExternalEntityLoader) + +#define xmlMemInitialized (XE_GS_PROXY_VAR->xmlMemInitialized) +#define debugMemSize (XE_GS_PROXY_VAR->debugMemSize) +#define debugMaxMemSize (XE_GS_PROXY_VAR->debugMaxMemSize) +#define xmlMemMutex NULL +#define g_block (XE_GS_PROXY_VAR->g_block) +#define xmlMemStopAtBlock (XE_GS_PROXY_VAR->xmlMemStopAtBlock) +#define xmlMemTraceBlockAt (XE_GS_PROXY_VAR->xmlMemTraceBlockAt) + +#define __xmlRegisterCallbacks (XE_GS_PROXY_VAR->__xmlRegisterCallbacks) + +#ifdef LIBXML_TREE_ENABLED +# define xmlCompressMode (XE_GS_PROXY_VAR->xmlCompressMode) +# define xmlCheckDTD (XE_GS_PROXY_VAR->xmlCheckDTD) +#endif + +#ifdef LIBXML_CATALOG_ENABLED +# define xmlDebugCatalogs (XE_GS_PROXY_VAR->xmlDebugCatalogs) +# define xmlCatalogDefaultAllow (XE_GS_PROXY_VAR->xmlCatalogDefaultAllow) +# define xmlCatalogDefaultPrefer (XE_GS_PROXY_VAR->xmlCatalogDefaultPrefer) +# define xmlCatalogXMLFiles (XE_GS_PROXY_VAR->xmlCatalogXMLFiles) +# define xmlDefaultCatalog (XE_GS_PROXY_VAR->xmlDefaultCatalog) +# define xmlCatalogMutex NULL +# define xmlCatalogInitialized (XE_GS_PROXY_VAR->xmlCatalogInitialized) +#endif + +#ifdef LIBXML_HTML_ENABLED +# define htmlStartCloseIndex (XE_GS_PROXY_VAR->htmlStartCloseIndex) +# define htmlStartCloseIndexinitialized (XE_GS_PROXY_VAR->htmlStartCloseIndexinitialized) +# define htmlDefaultSAXHandler (XE_GS_PROXY_VAR->htmlDefaultSAXHandler) +#endif + +#ifdef LIBXML_XPATH_ENABLED +# define xmlXPathNAN (XE_GS_PROXY_VAR->xmlXPathNAN) +# define xmlXPathPINF (XE_GS_PROXY_VAR->xmlXPathPINF) +# define xmlXPathNINF (XE_GS_PROXY_VAR->xmlXPathNINF) +# define xmlXPathNZERO (XE_GS_PROXY_VAR->xmlXPathNZERO) +# define xmlXPathInitialized (XE_GS_PROXY_VAR->xmlXPathInitialized) +# define xmlXPathDefineExtensionFunctionsGlobally (XE_GS_PROXY_VAR->xmlXPathDefineExtensionFunctionsGlobally) +# define xmlXPathDefaultFunctionsHash (XE_GS_PROXY_VAR->xmlXPathDefaultFunctionsHash) +# define xmlXPathIntermediaryExtensionFunctionsHash (XE_GS_PROXY_VAR->xmlXPathIntermediaryExtensionFunctionsHash) +# ifndef LIBXML_THREAD_ENABLED +# define xmlXPathDisableOptimizer (XE_GS_PROXY_VAR->xmlXPathDisableOptimizer) +# endif +#endif + +#ifdef LIBXML_XPTR_ENABLED +# define xlinkDefaultHandler (XE_GS_PROXY_VAR->xlinkDefaultHandler) +# define xlinkDefaultDetect (XE_GS_PROXY_VAR->xlinkDefaultDetect) +#endif + +#define xsltGlobalsCleanupFunc (XE_GS_PROXY_VAR->xsltGlobalsCleanupFunc) + +#define xmlOOM (XE_GS_PROXY_VAR->xmlOOM) +#define xeUserCount (XE_GS_PROXY_VAR->xeUserCount) + +#ifdef XMLENGINE_XMLSCHEMA_DATATYPES +# define xmlSchemaTypesGlobals (XE_GS_PROXY_VAR->xmlSchemaTypesGlobals) +# define xmlSchemaTypesInitialized (XE_GS_PROXY_VAR->xmlSchemaTypesInitialized) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* XML_GLOBALS_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_hash.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_hash.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,220 @@ +/* + * Summary: chained hash tables + * description: this module implement the hash table support used in + * various place in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Bjorn Reese + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_HASH_H +#define XML_HASH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The hash table. + */ +typedef struct _xmlHashTable xmlHashTable; +typedef xmlHashTable* xmlHashTablePtr; + +#ifdef __cplusplus +} +#endif +#ifdef __cplusplus +extern "C" { +#endif + +/* + * function types: + */ +/** + * xmlHashDeallocator: + * @param payload the data in the hash + * @param name the name associated + * + * Callback to free data from a hash. + */ +typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); +/** + * xmlHashCopier: + * @param payload the data in the hash + * @param name the name associated + * + * Callback to copy data from a hash. + * + * Returns a copy of the data or NULL in case of error. + */ +typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); +/** + * xmlHashScanner: + * @param payload the data in the hash + * @param data extra scannner data + * @param name the name associated + * + * Callback when scanning data in a hash with the simple scanner. + */ +typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); +/** + * xmlHashScannerFull: + * @param payload the data in the hash + * @param data extra scannner data + * @param name the name associated + * @param name2 the second name associated + * @param name3 the third name associated + * + * Callback when scanning data in a hash with the full scanner. + */ +typedef void (*xmlHashScannerFull)(void *payload, void *data, + const xmlChar *name, const xmlChar *name2, + const xmlChar *name3); + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlHashTablePtr XMLCALL + xmlHashCreate (int size); +XMLPUBFUN void XMLCALL + xmlHashFree (xmlHashTablePtr table, + xmlHashDeallocator f); + + +/* + * Add a new entry to the hash table. + */ +XMLPUBFUN int XMLCALL + xmlHashAddEntry (xmlHashTablePtr table, + const xmlChar *name, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry(xmlHashTablePtr table, + const xmlChar *name, + void *userdata, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashAddEntry2(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry2(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + void *userdata, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashAddEntry3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata, + xmlHashDeallocator f); + +/* + * Remove an entry from the hash table. + */ +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashDeallocator f); + +/* + * Retrieve the userdata. + */ +XMLPUBFUN void * XMLCALL + xmlHashLookup (xmlHashTablePtr table, + const xmlChar *name); +XMLPUBFUN void * XMLCALL + xmlHashLookup2 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2); +XMLPUBFUN void * XMLCALL + xmlHashLookup3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN void * XMLCALL + xmlHashQLookup (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN void * XMLCALL + xmlHashQLookup2 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix, + const xmlChar *name2, + const xmlChar *prefix2); +XMLPUBFUN void * XMLCALL + xmlHashQLookup3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix, + const xmlChar *name2, + const xmlChar *prefix2, + const xmlChar *name3, + const xmlChar *prefix3); + +/* + * Helpers. + */ +XMLPUBFUN xmlHashTablePtr XMLCALL + xmlHashCopy (xmlHashTablePtr table, + xmlHashCopier f); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL + xmlHashSize (xmlHashTablePtr table); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN void XMLCALL + xmlHashScan (xmlHashTablePtr table, + xmlHashScanner f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScan3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScanner f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScanFull (xmlHashTablePtr table, + xmlHashScannerFull f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScanFull3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScannerFull f, + void *data); +#ifdef __cplusplus +} +#endif +#endif /* XML_HASH_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_htmlparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_htmlparser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,309 @@ +/* + * Summary: interface for an HTML 4.0 non-verifying parser + * Description: this module implements an HTML 4.0 non-verifying parser + * with API compatible with the XML parser ones. It should + * be able to parse "real world" HTML, even if severely + * broken from a specification point of view. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef HTML_PARSER_H +#define HTML_PARSER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Most of the back-end structures from XML and HTML are shared. + */ +typedef xmlParserCtxt htmlParserCtxt; +typedef xmlParserCtxtPtr htmlParserCtxtPtr; +typedef xmlParserNodeInfo htmlParserNodeInfo; +typedef xmlSAXHandler htmlSAXHandler; +typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; +typedef xmlParserInput htmlParserInput; +typedef xmlParserInputPtr htmlParserInputPtr; +typedef xmlDocPtr htmlDocPtr; +typedef xmlNodePtr htmlNodePtr; + +/* + * Internal description of an HTML element, representing HTML 4.01 + * and XHTML 1.0 (which share the same structure). + */ +typedef struct _htmlElemDesc htmlElemDesc; +typedef htmlElemDesc *htmlElemDescPtr; +struct _htmlElemDesc { + const char *name; /* The tag name */ + char startTag; /* Whether the start tag can be implied */ + char endTag; /* Whether the end tag can be implied */ + char saveEndTag; /* Whether the end tag should be saved */ + char empty; /* Is this an empty element ? */ + char depr; /* Is this a deprecated element ? */ + char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ + char isinline; /* is this a block 0 or inline 1 element */ + const char *desc; /* the description */ + +/* NRK Jan.2003 + * New fields encapsulating HTML structure + * + * Bugs: + * This is a very limited representation. It fails to tell us when + * an element *requires* subelements (we only have whether they're + * allowed or not), and it doesn't tell us where CDATA and PCDATA + * are allowed. Some element relationships are not fully represented: + * these are flagged with the word MODIFIER + */ + const char** subelts; /* allowed sub-elements of this element */ + const char* defaultsubelt; /* subelement for suggested auto-repair + if necessary or NULL */ + const char** attrs_opt; /* Optional Attributes */ + const char** attrs_depr; /* Additional deprecated attributes */ + const char** attrs_req; /* Required attributes */ +}; + +/* + * Internal description of an HTML entity. + */ +typedef struct _htmlEntityDesc htmlEntityDesc; +typedef htmlEntityDesc *htmlEntityDescPtr; +struct _htmlEntityDesc { + unsigned int value; /* the UNICODE value for the character */ + const char *name; /* The entity name */ + const char *desc; /* the description */ +}; + +#if defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) +/* + * There is only few public functions. + */ +XMLPUBFUN const htmlElemDesc * XMLCALL + htmlTagLookup (const xmlChar *tag); + +#endif /* LIBXML_HTML_ENABLED || XMLENGINE_XSLT ) */ + +#ifdef LIBXML_HTML_ENABLED + +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlEntityLookup(const xmlChar *name); +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlEntityValueLookup(unsigned int value); + +XMLPUBFUN int XMLCALL + htmlIsAutoClosed(htmlDocPtr doc, + htmlNodePtr elem); +XMLPUBFUN int XMLCALL + htmlAutoCloseTag(htmlDocPtr doc, + const xmlChar *name, + htmlNodePtr elem); +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlParseEntityRef(htmlParserCtxtPtr ctxt, + const xmlChar **str); +XMLPUBFUN int XMLCALL + htmlParseCharRef(htmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + htmlParseElement(htmlParserCtxtPtr ctxt); + +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlCreateMemoryParserCtxt(const char *buffer, + int size); + +XMLPUBFUN int XMLCALL + htmlParseDocument(htmlParserCtxtPtr ctxt); +XMLPUBFUN htmlDocPtr XMLCALL + htmlSAXParseDoc (xmlChar *cur, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr XMLCALL + htmlParseDoc (xmlChar *cur, + const char *encoding); +XMLPUBFUN htmlDocPtr XMLCALL + htmlSAXParseFile(const char *filename, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr XMLCALL + htmlParseFile (const char *filename, + const char *encoding); +XMLPUBFUN int XMLCALL + UTF8ToHtml (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +XMLPUBFUN int XMLCALL + htmlEncodeEntities(unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen, int quoteChar); +XMLPUBFUN int XMLCALL + htmlIsScriptAttribute(const xmlChar *name); +XMLPUBFUN int XMLCALL + htmlHandleOmittedElem(int val); + +#ifdef LIBXML_PUSH_ENABLED +/** + * Interfaces for the Push mode. + */ +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + htmlParseChunk (htmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +XMLPUBFUN void XMLCALL + htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ + HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + HTML_PARSE_NONET = 1<<11 /* Forbid network access */ +} htmlParserOption; + +XMLPUBFUN void XMLCALL + htmlCtxtReset (htmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadFile (const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +/* NRK/Jan2003: further knowledge of HTML structure + */ +typedef enum { + HTML_NA = 0 , /* something we don't check at all */ + HTML_INVALID = 0x1 , + HTML_DEPRECATED = 0x2 , + HTML_VALID = 0x4 , + HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ +} htmlStatus ; + +/* Using htmlElemDesc rather than name here, to emphasise the fact + that otherwise there's a lookup overhead +*/ +XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; +XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; +XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; +XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; +/** + * htmlDefaultSubelement: + * @param elt HTML element + * + * Returns the default subelement for this element + */ +#define htmlDefaultSubelement(elt) elt->defaultsubelt +/** + * htmlElementAllowedHereDesc: + * @param parent HTML parent element + * @param elt HTML element + * + * Checks whether an HTML element description may be a + * direct child of the specified element. + * + * Returns 1 if allowed; 0 otherwise. + */ +#define htmlElementAllowedHereDesc(parent,elt) \ + htmlElementAllowedHere((parent), (elt)->name) +/** + * htmlRequiredAttrs: + * @param elt HTML element + * + * Returns the attributes required for the specified element. + */ +#define htmlRequiredAttrs(elt) (elt)->attrs_req + + +#endif /* LIBXML_HTML_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* HTML_PARSER_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_htmltree.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_htmltree.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,154 @@ +/* + * Summary: specific APIs to process HTML tree, especially serialization + * Description: this module implements a few function needed to process + * tree in an HTML specific way. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef HTML_TREE_H +#define HTML_TREE_H + +#include +#include "libxml2_tree.h" +#include "libxml2_htmlparser.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * HTML_TEXT_NODE: + * + * Macro. A text node in a HTML document is really implemented + * the same way as a text node in an XML document. + */ +#define HTML_TEXT_NODE XML_TEXT_NODE +/** + * HTML_ENTITY_REF_NODE: + * + * Macro. An entity reference in a HTML document is really implemented + * the same way as an entity reference in an XML document. + */ +#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE +/** + * HTML_COMMENT_NODE: + * + * Macro. A comment in a HTML document is really implemented + * the same way as a comment in an XML document. + */ +#define HTML_COMMENT_NODE XML_COMMENT_NODE +/** + * HTML_PRESERVE_NODE: + * + * Macro. A preserved node in a HTML document is really implemented + * the same way as a CDATA section in an XML document. + */ +#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +/** + * HTML_PI_NODE: + * + * Macro. A processing instruction in a HTML document is really implemented + * the same way as a processing instruction in an XML document. + */ +#define HTML_PI_NODE XML_PI_NODE + +#if defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) + +XMLPUBFUN htmlDocPtr XMLCALL + htmlNewDoc (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN htmlDocPtr XMLCALL + htmlNewDocNoDtD (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN int XMLCALL + htmlSetMetaEncoding (htmlDocPtr doc, + const xmlChar *encoding); + +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + htmlDocContentDumpOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN void XMLCALL + htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN void XMLCALL + htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); + +#endif /* LIBXML_OUTPUT_ENABLED */ + +XMLPUBFUN int XMLCALL + htmlIsBooleanAttr (const xmlChar *name); + +#endif /* HTML or XSLT */ + +#ifdef LIBXML_HTML_ENABLED + +XMLPUBFUN const xmlChar * XMLCALL + htmlGetMetaEncoding (htmlDocPtr doc); + +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + htmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN int XMLCALL + htmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + htmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + htmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN void XMLCALL + htmlNodeDumpFile (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN int XMLCALL + htmlNodeDumpFileFormat (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +XMLPUBFUN int XMLCALL + htmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int XMLCALL + htmlSaveFileFormat (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN void XMLCALL + htmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ +#endif /* LIBXML_HTML_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* HTML_TREE_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_list.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,117 @@ +/* + * Summary: lists interfaces + * Description: this module implement the list support used in + * various place in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Gary Pennington + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_LIST_H +#define XML_LIST_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlLink xmlLink; +typedef xmlLink *xmlLinkPtr; + +typedef struct _xmlList xmlList; +typedef xmlList *xmlListPtr; + +/** + * xmlListDeallocator: + * @param lk the data to deallocate + * + * Callback function used to free data from a list. + */ +typedef void (*xmlListDeallocator) (xmlLinkPtr lk); +/** + * xmlListDataCompare: + * @param data0 the first data + * @param data1 the second data + * + * Callback function used to compare 2 data. + * + * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. + */ +typedef int (*xmlListDataCompare) (const void *data0, const void *data1); +/** + * xmlListWalker: + * @param data the data found in the list + * @param user extra user provided data to the walker + * + * Callback function used when walking a list with xmlListWalk(). + * + * Returns 0 to stop walking the list, 1 otherwise. + */ +typedef int (*xmlListWalker) (const void *data, const void *user); + +/* Creation/Deletion */ +XMLPUBFUN xmlListPtr XMLCALL + xmlListCreate (xmlListDeallocator deallocator, xmlListDataCompare compare); +XMLPUBFUN void XMLCALL + xmlListDelete (xmlListPtr l); + +/* Basic Operators */ +XMLPUBFUN int XMLCALL + xmlListInsert (xmlListPtr l, void *data) ; +XMLPUBFUN int XMLCALL + xmlListAppend (xmlListPtr l, void *data) ; +XMLPUBFUN int XMLCALL + xmlListRemoveFirst (xmlListPtr l, void *data); +XMLPUBFUN void XMLCALL + xmlListClear (xmlListPtr l); +XMLPUBFUN int XMLCALL + xmlListEmpty (xmlListPtr l); +XMLPUBFUN xmlLinkPtr XMLCALL + xmlListFront (xmlListPtr l); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlLinkPtr XMLCALL xmlListEnd (xmlListPtr l); +XMLPUBFUN void XMLCALL xmlListReverse (xmlListPtr l); +XMLPUBFUN void XMLCALL xmlListPopBack (xmlListPtr l); +XMLPUBFUN void XMLCALL xmlListSort (xmlListPtr l); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN void* XMLCALL xmlListSearch (xmlListPtr l, void *data); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN void* XMLCALL xmlListReverseSearch(xmlListPtr l, void *data); +XMLPUBFUN int XMLCALL xmlListRemoveLast (xmlListPtr l, void *data); +XMLPUBFUN int XMLCALL xmlListRemoveAll (xmlListPtr l, void *data); +XMLPUBFUN int XMLCALL xmlListPushBack (xmlListPtr l, void *data); +XMLPUBFUN void XMLCALL xmlListReverseWalk (xmlListPtr l, + xmlListWalker walker, + const void *user); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN xmlListPtr XMLCALL xmlListDup (const xmlListPtr old); +XMLPUBFUN int XMLCALL xmlListSize (xmlListPtr l); +XMLPUBFUN void XMLCALL xmlListPopFront (xmlListPtr l); +XMLPUBFUN int XMLCALL xmlListPushFront(xmlListPtr l, void *data); +XMLPUBFUN void XMLCALL xmlListWalk (xmlListPtr l, xmlListWalker walker, const void *user); +XMLPUBFUN void XMLCALL xmlListMerge (xmlListPtr l1, xmlListPtr l2); +XMLPUBFUN int XMLCALL xmlListCopy (xmlListPtr cur, const xmlListPtr old); +/* Link operators */ +XMLPUBFUN void* XMLCALL xmlLinkGetData (xmlLinkPtr lk); + +/* xmlListUnique() */ +/* xmlListSwap */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_LIST_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_modules.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_modules.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,212 @@ +/* + * Summary: Defines which libxml2 modules are compiled in for XML Engine + * Description: Defines which libxml2 modules are compiled in for XML Engine + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @publishedAll + @released +*/ +#ifndef LIBXML2_MODULES_H +#define LIBXML2_MODULES_H + +// All new configuration directives are in: +#include + +#ifdef XMLENGINE_EXCLUDE_EMBED_MSG +extern const char * const __embedded_errtxt_replacement; +#define EMBED_ERRTXT(str) NULL +//#define EMBED_ERRTXT(str) __embedded_errtxt_replacement +#else +#define EMBED_ERRTXT(str) str +#endif + +#ifdef IN_LIBXML +# define OOM_FLAG (xmlOOM) +#else +// DO NOT USE "xmlOOM" outside of Libxml2 code!!! +// (xmlOOM is an internal macro for accessing value via TLS) +# define OOM_FLAG (xmlOOMFlag()) +#endif + +# define SET_OOM_FLAG xmlSetOOM() +# define RESET_OOM_FLAG xmlResetOOM() + +/* +* _xmlDoc struct has field 'cachedGs' +* where result of xmlGetGlobalState() is stored +* +* (cachedGs field is not in the part that is common with _xmlNode and _xmlAttr) +*/ +#define LIBXML_ENABLE_GS_CACHING_IN_DOC +#define LIBXML_ENABLE_GS_CACHING_IN_CTXT + +/* +* struct members +* _xmlNode.line, _xmlRef.lineno, _xmlID.lineno +* and all related functions/code +* are excluded from the current configuration if this is commented out: +*/ +//#define LIBXML_ENABLE_NODE_LINEINFO + +/** + * LIBXML_CATALOG_ENABLED: + * + * Whether the Catalog support is configured in + */ +//#define LIBXML_CATALOG_ENABLED + +/** + * LIBXML_THREAD_ENABLED: + * + * Whether the thread support is configured in + */ +//#define LIBXML_THREAD_ENABLED + +/** + * LIBXML_TREE_ENABLED: + * + * Whether the DOM like tree manipulation API support is configured in + */ +#define LIBXML_TREE_ENABLED + +/** + * LIBXML_OUTPUT_ENABLED: + * + * Whether the serialization/saving support is configured in + */ +#define LIBXML_OUTPUT_ENABLED + +/** + * LIBXML_PUSH_ENABLED: + * + * Whether the push parsing interfaces are configured in + */ +#define LIBXML_PUSH_ENABLED + +/** + * LIBXML_READER_ENABLED: + * + * Whether the xmlReader parsing interface is configured in + */ +#define LIBXML_READER_ENABLED + +/** + * LIBXML_PATTERN_ENABLED: + * + * Whether the xmlPattern node selection interface is configured in + */ +//#define LIBXML_PATTERN_ENABLED + +/** + * LIBXML_WRITER_ENABLED: + * + * Whether the xmlWriter saving interface is configured in + */ +#define LIBXML_WRITER_ENABLED + +/** + * LIBXML_SAX1_ENABLED: + * + * Whether the older SAX1 interface is configured in + */ +#define LIBXML_SAX1_ENABLED + +/** + * LIBXML_VALID_ENABLED: + * + * Whether the DTD validation support is configured in + */ +//#define LIBXML_VALID_ENABLED + +/** + * LIBXML_HTML_ENABLED: + * + * Whether the HTML support is configured in + */ +//#define LIBXML_HTML_ENABLED + +/** + * LIBXML_LEGACY_ENABLED: + * + * Whether the deprecated APIs are compiled in for compatibility + */ +//#define LIBXML_LEGACY_ENABLED + +/** + * LIBXML_C14N_ENABLED: + * + * Whether the Canonicalization support is configured in + */ +#define LIBXML_C14N_ENABLED + +/** + * LIBXML_XPATH_ENABLED: + * + * Whether XPath is configured in + */ +#define LIBXML_XPATH_ENABLED + +/** + * LIBXML_XPTR_ENABLED: + * + * Whether XPointer is configured in + */ +#define LIBXML_XPTR_ENABLED + +/** + * LIBXML_XINCLUDE_ENABLED: + * + * Whether XInclude is configured in + */ +#define LIBXML_XINCLUDE_ENABLED + +/** + * LIBXML_DEBUG_ENABLED: + * + * Whether Debugging module is configured in + */ +//#define LIBXML_DEBUG_ENABLED + +/** + * DEBUG_MEMORY_LOCATION: + * + * Whether the memory debugging is configured in + */ +//#define DEBUG_MEMORY_LOCATION + +/** + * LIBXML_UNICODE_ENABLED: + * + * Whether the Unicode related interfaces are compiled in + */ +//#define LIBXML_UNICODE_ENABLED + +/** + * LIBXML_REGEXP_ENABLED: + * + * Whether the regular expressions interfaces are compiled in + */ +//#define LIBXML_REGEXP_ENABLED + +/** + * LIBXML_AUTOMATA_ENABLED: + * + * Whether the automata interfaces are compiled in + */ +//#define LIBXML_AUTOMATA_ENABLED + +/** + * LIBXML_SCHEMAS_ENABLED: + * + * Whether the Schemas validation interfaces are compiled in + */ +//#define LIBXML_SCHEMAS_ENABLED + +#endif /* LIBXML2_MODULES_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_parser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_parser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1231 @@ +/* + * Summary: the core parser module + * Description: Interfaces, constants and types related to the XML parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_PARSER_H +#define XML_PARSER_H + +#include +#include +#include +#include +#include + +//typedef struct _xmlParserInput xmlParserInput; +//typedef xmlParserInput *xmlParserInputPtr; + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_DEFAULT_VERSION: + * + * The default version of XML used: 1.0 + */ +#define XML_DEFAULT_VERSION "1.0" + +/** + * xmlParserInput: + * + * An xmlParserInput is an input flow for the XML processor. + * Each entity parsed is associated an xmlParserInput (except the + * few predefined ones). This is the case both for internal entities + * - in which case the flow is already completely in memory - or + * external entities - in which case we use the buf structure for + * progressive reading and I18N conversions to the internal UTF-8 format. + */ + +/** + * xmlParserInputDeallocate: + * @param str the string to deallocate + * + * Callback for freeing some parser input allocations. + */ +typedef void (* xmlParserInputDeallocate)(xmlChar *str); + +struct _xmlParserInput { + /* Input buffer */ + xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ + + const char *filename; /* The file analyzed, if any */ + const char *directory; /* the directory/base of the file */ + const xmlChar *base; /* Base of the array to parse */ + const xmlChar *cur; /* Current char being parsed */ + const xmlChar *end; /* end of the array to parse */ + int length; /* length if known */ + int line; /* Current line */ + int col; /* Current column */ + /* + * NOTE: consumed is only tested for equality in the parser code, + * so even if there is an overflow this should not give troubles + * for parsing very large instances. + */ + unsigned long consumed; /* How many xmlChars already consumed */ + xmlParserInputDeallocate free; /* function to deallocate the base */ + const xmlChar *encoding; /* the encoding string for entity */ + const xmlChar *version; /* the version string for entity */ + int standalone; /* Was that entity marked standalone */ + int id; /* an unique identifier for the entity */ +}; + +/** + * xmlParserNodeInfo: + * + * The parser can be asked to collect Node informations, i.e. at what + * place in the file they were detected. + * NOTE: This is off by default and not very well tested. + */ +typedef struct _xmlParserNodeInfo xmlParserNodeInfo; +typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; + +struct _xmlParserNodeInfo { + const struct _xmlNode* node; + /* Position & line # that text that created the node begins & ends on */ + unsigned long begin_pos; + unsigned long begin_line; + unsigned long end_pos; + unsigned long end_line; +}; + +typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; +typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; +struct _xmlParserNodeInfoSeq { + unsigned long maximum; + unsigned long length; + xmlParserNodeInfo* buffer; +}; + +/** + * xmlParserInputState: + * + * The parser is now working also as a state based parser. + * The recursive one use the state info for entities processing. + */ +typedef enum { + XML_PARSER_EOF = -1, /* nothing is to be parsed */ + XML_PARSER_START = 0, /* nothing has been parsed */ + XML_PARSER_MISC, /* Misc* before int subset */ + XML_PARSER_PI, /* Within a processing instruction */ + XML_PARSER_DTD, /* within some DTD content */ + XML_PARSER_PROLOG, /* Misc* after internal subset */ + XML_PARSER_COMMENT, /* within a comment */ + XML_PARSER_START_TAG, /* within a start tag */ + XML_PARSER_CONTENT, /* within the content */ + XML_PARSER_CDATA_SECTION, /* within a CDATA section */ + XML_PARSER_END_TAG, /* within a closing tag */ + XML_PARSER_ENTITY_DECL, /* within an entity declaration */ + XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ + XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ + XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_IGNORE, /* within an IGNORED section */ + XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ +} xmlParserInputState; + +/** + * XML_DETECT_IDS: + * + * Bit in the loadsubset context field to tell to do ID/REFs lookups. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_DETECT_IDS 2 + +/** + * XML_COMPLETE_ATTRS: + * + * Bit in the loadsubset context field to tell to do complete the + * elements attributes lists with the ones defaulted from the DTDs. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_COMPLETE_ATTRS 4 + +/** + * XML_SKIP_IDS: + * + * Bit in the loadsubset context field to tell to not do ID/REFs registration. + * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. + */ +#define XML_SKIP_IDS 8 + +/** + * xmlParserCtxt: + * + * The parser context. + * NOTE This doesn't completely define the parser state, the (current ?) + * design of the parser uses recursive function calls since this allow + * and easy mapping from the production rules of the specification + * to the actual code. The drawback is that the actual function call + * also reflect the parser state. However most of the parsing routines + * takes as the only argument the parser context pointer, so migrating + * to a state based parser for progressive parsing shouldn't be too hard. + */ +struct _xmlParserCtxt { + struct _xmlSAXHandler *sax; /* The SAX handler */ + void* userData; /* For SAX interface only, used by DOM build */ + xmlDocPtr myDoc; /* the document being built */ + int wellFormed; /* is the document well formed */ + int replaceEntities; /* shall we replace entities ? */ + const xmlChar* encoding; /* the declared encoding, if any */ + int standalone; /* standalone document */ + int html; /* an HTML(1)/Docbook(2) document */ + + /* Input stream stack */ + xmlParserInputPtr input; /* Current input stream */ + int inputNr; /* Number of current input streams */ + int inputMax; /* Max number of input streams */ + xmlParserInputPtr* inputTab; /* stack of inputs */ + +#ifdef LIBXML_ENABLE_GS_CACHING_IN_CTXT + // Note: location is chosen trying to get GS pointer into proximity to + // the data often referred to (to avoid cache misses) + //XMLENGINE: NEW CODE + void* cachedGs; /* cached GS pointer */ +#endif + /* Node analysis stack only used for DOM building */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr* nodeTab; /* array of nodes */ + + int errNo; /* error code */ + + int hasExternalSubset; /* reference and external subset */ + int hasPErefs; /* the internal subset has PE refs */ + int external; /* are we parsing an external entity */ + + int valid; /* is the document valid */ + int validate; /* shall we try to validate ? */ + + xmlParserInputState instate; /* current type of input */ + int token; /* next char look-ahead */ + + char* directory; /* the data directory */ + + /* Node name stack */ + const xmlChar* name; /* Current parsed Node */ + int nameNr; /* Depth of the parsing stack */ + int nameMax; /* Max depth of the parsing stack */ + const xmlChar** nameTab; /* array of nodes */ + + long nbChars; /* number of xmlChar processed */ + long checkIndex; /* used by progressive parsing lookup */ + int keepBlanks; /* ugly but ... */ + int disableSAX; /* SAX callbacks are disabled */ + int inSubset; /* Parsing is in int 1/ext 2 subset */ + int stackLowThreshold; /* minimum amount of thread's stack left */ + + /* xml:space values */ + int* space; /* Should the parser preserve spaces */ + int spaceNr; /* Depth of the parsing stack */ + int spaceMax; /* Max depth of the parsing stack */ + int* spaceTab; /* array of space infos */ + + int depth; /* to prevent entity substitution loops */ + int charset; /* encoding of the in-memory content + actually an xmlCharEncoding */ + int nodelen; /* Those two fields are there to */ + int nodemem; /* Speed up large node parsing */ + int pedantic; /* signal pedantic warnings */ + void* _private; /* For user data, libxml won't touch it */ + + int loadsubset; /* should the external subset be loaded */ + + void* catalogs; /* document's own catalog */ + int progressive; /* is this a progressive parsing */ + xmlDictPtr dict; /* dictionnary for the parser */ + const xmlChar** atts; /* array for the attributes callbacks */ + int maxatts; /* the size of the array */ + + /* + * pre-interned strings + */ + const xmlChar* str_xml; + const xmlChar* str_xmlns; + const xmlChar* str_xml_ns; + + /* + * Everything below is used only by the new SAX mode + */ + int sax2; /* operating in the new SAX mode */ + int nsNr; /* the number of inherited namespaces */ + int nsMax; /* the size of the arrays */ + const xmlChar** nsTab; /* the array of prefix/namespace name */ + int* attallocs; /* which attribute were allocated */ + void** pushTab; /* array of data for push */ + xmlHashTablePtr attsDefault; /* defaulted attributes if any */ + xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ + int nsWellFormed; /* is the document XML Nanespace okay */ + int options; /* Extra options */ + + /* + * Those fields are needed only for streaming parsing so far + */ + int dictNames; /* Use dictionary names for the tree */ + int freeElemsNr; /* number of freed element nodes */ + xmlNodePtr freeElems; /* List of freed element nodes */ + int freeAttrsNr; /* number of freed attributes nodes */ + xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ + + /* + * the complete error informations for the last error. + */ + xmlError lastError; + +// XMLENGINE: BEGIN NEW CODE - lastNsNr attribute in parser context + int lastNsNr; /* temporarily contains number of new namespaces in element*/ +// XMLENGINE: END NEW CODE + +//== Fields less used in libxml2, so put in the end of the structure (offset is > 255) +// +// Note: these fields were move from their original place in the structure +// + const xmlChar* version; /* the XML version string */ + const xmlChar* intSubName; /* name of subset */ + xmlChar* extSubURI; /* URI of external subset */ + xmlChar* extSubSystem; /* SYSTEM ID of external subset */ + int recovery; /* run in recovery mode */ + int docdict; /* use strings from dict to build tree */ + xmlParserInputPtr entity; /* used to check entities boundaries */ + + xmlValidCtxt vctxt; /* The validity context */ + +//== Fields below are likely to stay disabled forever in XML ENGINE + +#ifdef LIBXML_ENABLE_NODE_LINEINFO + int linenumbers; /* set line number in element content */ +#endif + +#ifdef XMLENGINE_ENABLE_PARSER_RECORD_INFO + int record_info; /* Whether node info should be kept */ + xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ +#endif + + +}; // struct _xmlParserCtxt + + + +/** + * xmlSAXLocator: + * + * A SAX Locator. + */ +struct _xmlSAXLocator { + const xmlChar* (*getPublicId)(void* ctx); + const xmlChar* (*getSystemId)(void* ctx); + int (*getLineNumber)(void* ctx); + int (*getColumnNumber)(void* ctx); +}; + +/** + * xmlSAXHandler: + * + * A SAX handler is bunch of callbacks called by the parser when processing + * of the input generate data or structure informations. + */ + +/** + * resolveEntitySAXFunc: + * @param ctx the user data (XML parser context) + * @param publicId The public ID of the entity + * @param systemId The system ID of the entity + * + * Callback: + * The entity loader, to control the loading of external entities, + * the application can either: + * - override this resolveEntity() callback in the SAX block + * - or better use the xmlSetExternalEntityLoader() function to + * set up it's own entity resolution routine + * + * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. + */ +typedef xmlParserInputPtr (*resolveEntitySAXFunc) ( + void* ctx, + const xmlChar* publicId, + const xmlChar* systemId); +/** + * internalSubsetSAXFunc: + * @param ctx the user data (XML parser context) + * @param name the root element name + * @param ExternalID the external ID + * @param SystemID the SYSTEM ID (e.g. filename or URL) + * + * Callback on internal subset declaration. + */ +typedef void (*internalSubsetSAXFunc) ( + void* ctx, + const xmlChar* name, + const xmlChar* ExternalID, + const xmlChar* SystemID); +/** + * externalSubsetSAXFunc: + * @param ctx the user data (XML parser context) + * @param name the root element name + * @param ExternalID the external ID + * @param SystemID the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +typedef void (*externalSubsetSAXFunc) ( + void* ctx, + const xmlChar* name, + const xmlChar* ExternalID, + const xmlChar* SystemID); +/** + * getEntitySAXFunc: + * @param ctx the user data (XML parser context) + * @param name The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getEntitySAXFunc) ( + void* ctx, + const xmlChar* name); +/** + * getParameterEntitySAXFunc: + * @param ctx the user data (XML parser context) + * @param name The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getParameterEntitySAXFunc) ( + void* ctx, + const xmlChar* name); +/** + * entityDeclSAXFunc: + * @param ctx the user data (XML parser context) + * @param name the entity name + * @param type the entity type + * @param publicId The public ID of the entity + * @param systemId The system ID of the entity + * @param content the entity value (without processing). + * + * An entity definition has been parsed. + */ +typedef void (*entityDeclSAXFunc) ( + void* ctx, + const xmlChar* name, + int type, + const xmlChar* publicId, + const xmlChar* systemId, + xmlChar* content); +/** + * notationDeclSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The name of the notation + * @param publicId The public ID of the entity + * @param systemId The system ID of the entity + * + * What to do when a notation declaration has been parsed. + */ +typedef void (*notationDeclSAXFunc)( + void* ctx, + const xmlChar* name, + const xmlChar* publicId, + const xmlChar* systemId); +/** + * attributeDeclSAXFunc: + * @param ctx the user data (XML parser context) + * @param elem the name of the element + * @param fullname the attribute name + * @param type the attribute type + * @param def the type of default value + * @param defaultValue the attribute default value + * @param tree the tree of enumerated value set + * + * An attribute definition has been parsed. + */ +typedef void (*attributeDeclSAXFunc)( + void* ctx, + const xmlChar* elem, + const xmlChar* fullname, + int type, + int def, + const xmlChar* defaultValue, + xmlEnumerationPtr tree); +/** + * elementDeclSAXFunc: + * @param ctx the user data (XML parser context) + * @param name the element name + * @param type the element type + * @param content the element value tree + * + * An element definition has been parsed. + */ +typedef void (*elementDeclSAXFunc)( + void* ctx, + const xmlChar* name, + int type, + xmlElementContentPtr content); +/** + * unparsedEntityDeclSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The name of the entity + * @param publicId The public ID of the entity + * @param systemId The system ID of the entity + * @param notationName the name of the notation + * + * What to do when an unparsed entity declaration is parsed. + */ +typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); +/** + * setDocumentLocatorSAXFunc: + * @param ctx the user data (XML parser context) + * @param loc A SAX Locator + * + * Receive the document locator at startup, actually xmlDefaultSAXLocator. + * Everything is available on the context, so this is useless in our case. + */ +typedef void (*setDocumentLocatorSAXFunc) (void *ctx, + xmlSAXLocatorPtr loc); +/** + * startDocumentSAXFunc: + * @param ctx the user data (XML parser context) + * + * Called when the document start being processed. + */ +typedef void (*startDocumentSAXFunc) (void *ctx); +/** + * endDocumentSAXFunc: + * @param ctx the user data (XML parser context) + * + * Called when the document end has been detected. + */ +typedef void (*endDocumentSAXFunc) (void *ctx); +/** + * startElementSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The element name, including namespace prefix + * @param atts An array of name/value attributes pairs, NULL terminated + * + * Called when an opening tag has been processed. + */ +typedef void (*startElementSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar **atts); +/** + * endElementSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The element name + * + * Called when the end of an element has been detected. + */ +typedef void (*endElementSAXFunc) (void *ctx, + const xmlChar *name); +/** + * attributeSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The attribute name, including namespace prefix + * @param value The attribute value + * + * Handle an attribute that has been read by the parser. + * The default handling is to convert the attribute into an + * DOM subtree and past it in a new xmlAttr element added to + * the element. + */ +typedef void (*attributeSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *value); +/** + * referenceSAXFunc: + * @param ctx the user data (XML parser context) + * @param name The entity name + * + * Called when an entity reference is detected. + */ +typedef void (*referenceSAXFunc) (void *ctx, + const xmlChar *name); +/** + * charactersSAXFunc: + * @param ctx the user data (XML parser context) + * @param ch a xmlChar string + * @param len the number of xmlChar + * + * Receiving some chars from the parser. + */ +typedef void (*charactersSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * ignorableWhitespaceSAXFunc: + * @param ctx the user data (XML parser context) + * @param ch a xmlChar string + * @param len the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * processingInstructionSAXFunc: + * @param ctx the user data (XML parser context) + * @param target the target name + * @param data the PI data's + * + * A processing instruction has been parsed. + */ +typedef void (*processingInstructionSAXFunc) (void *ctx, + const xmlChar *target, + const xmlChar *data); +/** + * commentSAXFunc: + * @param ctx the user data (XML parser context) + * @param value the comment content + * + * A comment has been parsed. + */ +typedef void (*commentSAXFunc) (void *ctx, + const xmlChar *value); +/** + * cdataBlockSAXFunc: + * @param ctx the user data (XML parser context) + * @param value The pcdata content + * @param len the block length + * + * Called when a pcdata block has been parsed. + */ +typedef void (*cdataBlockSAXFunc) ( + void *ctx, + const xmlChar *value, + int len); +/** + * warningSAXFunc: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format a warning messages, callback. + */ +typedef void (*warningSAXFunc) (void *ctx, + const char *msg, ...); +/** + * errorSAXFunc: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format an error messages, callback. + */ +typedef void (*errorSAXFunc) (void *ctx, + const char *msg, ...); +/** + * fatalErrorSAXFunc: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format fatal error messages, callback. + * Note: so far fatalError() SAX callbacks are not used, error() + * get all the callbacks for errors. + */ +typedef void (*fatalErrorSAXFunc) (void *ctx, + const char *msg, ...); +/** + * isStandaloneSAXFunc: + * @param ctx the user data (XML parser context) + * + * Is this document tagged standalone? + * + * Returns 1 if true + */ +typedef int (*isStandaloneSAXFunc) (void *ctx); +/** + * hasInternalSubsetSAXFunc: + * @param ctx the user data (XML parser context) + * + * Does this document has an internal subset. + * + * Returns 1 if true + */ +typedef int (*hasInternalSubsetSAXFunc) (void *ctx); + +/** + * hasExternalSubsetSAXFunc: + * @param ctx the user data (XML parser context) + * + * Does this document has an external subset? + * + * Returns 1 if true + */ +typedef int (*hasExternalSubsetSAXFunc) (void *ctx); + +/************************************************************************ + * * + * The SAX version 2 API extensions * + * * + ************************************************************************/ +/** + * XML_SAX2_MAGIC: + * + * Special constant found in SAX2 blocks initialized fields + */ +#define XML_SAX2_MAGIC 0xDEEDBEAF + +/** + * startElementNsSAX2Func: + * @param ctx the user data (XML parser context) + * @param localname the local name of the element + * @param prefix the element namespace prefix if available + * @param URI the element namespace name if available + * @param nb_namespaces number of namespace definitions on that node + * @param namespaces pointer to the array of prefix/URI pairs namespace definitions + * @param nb_attributes the number of attributes on that node + * @param nb_defaulted the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @param attributes pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ + +typedef void (*startElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); + +/** + * endElementNsSAX2Func: + * @param ctx the user data (XML parser context) + * @param localname the local name of the element + * @param prefix the element namespace prefix if available + * @param URI the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ + +typedef void (*endElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); + +// XE: BEGIN new code +/** + * startPrefixMappingSAX2Func: + * @param ctx the user data (XML parser context) + * @param prefix the element namespace prefix if available, NULL if default namespace + * @param URI the element namespace name if available + * + * SAX2 callback when namespace prefix mapping is done. + */ + +typedef void (*startPrefixMappingSAX2Func) (void *ctx, + const xmlChar *prefix, + const xmlChar *URI); + + +/** + * endPrefixMappingSAX2Func: + * @param ctx the user data (XML parser context) + * @param prefix the element namespace prefix if available, NULL otherwise + * + * SAX2 callback when namespace prefix mapping is getting out of scope. + */ + +typedef void (*endPrefixMappingSAX2Func) (void *ctx, + const xmlChar *prefix); + +// XE: END new code + +struct _xmlSAXHandler { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused - error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + unsigned int initialized; + /* The following fields are extensions available only on version 2 */ + void *_private; + startElementNsSAX2Func startElementNs; + endElementNsSAX2Func endElementNs; + xmlStructuredErrorFunc serror; + startPrefixMappingSAX2Func startPrefixMapping; + endPrefixMappingSAX2Func endPrefixMapping; +}; + +/* + * SAX Version 1 + */ +typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; +typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; +struct _xmlSAXHandlerV1 { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + unsigned int initialized; +}; + + +/** + * xmlExternalEntityLoader: + * @param URL The System ID of the resource requested + * @param ID The Public ID of the resource requested + * @param context the XML parser context + * + * External entity loaders types. + * + * Returns the entity input parser. + */ +typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, + const char *ID, + xmlParserCtxtPtr context); + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Init/Cleanup + */ +XMLPUBFUN void XMLCALL + xmlInitParser (void); +XMLPUBFUN void XMLCALL + xmlCleanupParser (void); + +/* + * Input functions + */ +XMLPUBFUN int XMLCALL + xmlParserInputRead (xmlParserInputPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputGrow (xmlParserInputPtr in, + int len); + +/* + * Basic parsing Interfaces + */ +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseDoc (xmlChar *cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseMemory (const char *buffer, + int size); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseFile (const char *filename); +XMLPUBFUN int XMLCALL + xmlSubstituteEntitiesDefault(int val); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL xmlKeepBlanksDefault (int val); +XMLPUBFUN int XMLCALL xmlLineNumbersDefault (int val); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN void XMLCALL + xmlStopParser (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlPedanticParserDefault(int val); + +/* + * Recovery mode + */ +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverDoc (xmlChar *cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverMemory (const char *buffer, int size); +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverFile (const char *filename); + +/* + * Less common routines and SAX interfaces + */ +XMLPUBFUN int XMLCALL + xmlParseDocument (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseDoc (xmlSAXHandlerPtr sax, + xmlChar *cur, + int length, + int recovery, + int* /* out if !NULL */ errorCode); +XMLPUBFUN int XMLCALL + xmlSAXUserParseFile (xmlSAXHandlerPtr sax, + void *user_data, + const char *filename); +XMLPUBFUN int XMLCALL + xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, + void *user_data, + const char *buffer, + int size); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseMemory (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery, + void *data); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseFile (xmlSAXHandlerPtr sax, + const char *filename, + int recovery); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, + const char *filename, + int recovery, + void *data); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseEntity (xmlSAXHandlerPtr sax, + const char *filename); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseEntity (const char *filename); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlParseDTD (const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlSAXParseDTD (xmlSAXHandlerPtr sax, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlIOParseDTD (xmlSAXHandlerPtr sax, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + xmlParseBalancedChunkMemory(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst); +// XMLENGINE: added from v2.6.21 +XMLPUBFUN xmlParserErrors XMLCALL + xmlParseInNodeContext (xmlNodePtr node, + const char *data, + int datalen, + int options, + xmlNodePtr *lst); +//-- +XMLPUBFUN int XMLCALL + xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst, + int recover); +XMLPUBFUN int XMLCALL + xmlParseExternalEntity (xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); +XMLPUBFUN int XMLCALL + xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); + +/* + * Parser contexts handling. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlNewParserCtxt (void); +XMLPUBFUN int XMLCALL + xmlInitParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlClearParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, + const xmlChar* buffer, + const char *filename); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateDocParserCtxt (const xmlChar *cur, int length); + +/* + * Reading/setting optional parsing features. + */ + +XMLPUBFUN int XMLCALL + xmlGetFeaturesList (int *len, + const char **result); +XMLPUBFUN int XMLCALL + xmlGetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *result); +XMLPUBFUN int XMLCALL + xmlSetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *value); + +#ifdef LIBXML_PUSH_ENABLED +/* + * Interfaces for the Push mode. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename); +XMLPUBFUN int XMLCALL + xmlParseChunk (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +/* + * Special I/O mode. + */ +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, + void *user_data, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + + +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewIOInputStream (xmlParserCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); + +#ifdef XMLENGINE_ENABLE_PARSER_RECORD_INFO +/* + * Node infos. + */ +XMLPUBFUN const xmlParserNodeInfo* XMLCALL + xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, + const xmlNodePtr node); +XMLPUBFUN void XMLCALL + xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN void XMLCALL + xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN unsigned long XMLCALL + xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, + const xmlNodePtr node); +XMLPUBFUN void XMLCALL + xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, + const xmlParserNodeInfoPtr info); +#endif /* XMLENGINE_ENABLE_PARSER_RECORD_INFO */ + +/* + * External entities handling actually implemented in xmlIO. + */ + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader(xmlExternalEntityLoader f); +XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlLoadExternalEntity (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +/* + * Index lookup, actually implemented in the encoding module + */ + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN long XMLCALL xmlByteConsumed (xmlParserCtxtPtr ctxt); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + XML_PARSE_RECOVER = 1<<0, /* recover on errors */ + XML_PARSE_NOENT = 1<<1, /* substitute entities */ + XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ + XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ + XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ + XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ + XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ + XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ + XML_PARSE_NONET = 1<<11,/* Forbid network access */ + XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ + XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ + XML_PARSE_NOCDATA = 1<<14 /* merge CDATA as text nodes */ +} xmlParserOption; + +XMLPUBFUN void XMLCALL + xmlCtxtReset (xmlParserCtxtPtr ctxt); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL + xmlCtxtResetPush (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + const char *filename, + const char *encoding); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN int XMLCALL + xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadFile (const char *URL, + const char *encoding, + int options); +#endif + +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +#ifndef XMLENGINE_EXCLUDE_UNUSED + +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +#ifdef __cplusplus +} +#endif +#endif /* XML_PARSER_H */ + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_parserinternals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_parserinternals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,622 @@ +/* + * Summary: internals routines exported by the parser. + * Description: this module exports a number of internal parsing routines + * they are not really all intended for applications but + * can prove useful doing low level processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_PARSER_INTERNALS_H +#define XML_PARSER_INTERNALS_H + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document" + + + + /** + * XML_MAX_NAMELEN: + * + * Identifiers can be longer, but this will be more costly + * at runtime. + */ +#define XML_MAX_NAMELEN 100 + +/** + * INPUT_CHUNK: + * + * The parser tries to always have that amount of input ready. + * One of the point is providing context when reporting errors. + */ +#define INPUT_CHUNK 250 + +/** + * MIN_STACK_THRESHOLD: + * + * The safty buffer that defines number of bytes from stack overflow. + */ +#define MIN_STACK_THRESHOLD 600 + +/** + * MAX_STACK_THRESHOLD: + * + * The safty buffer that defines number of bytes from stack overflow. + * This value is used for SAX parsing - buffer is bigger to account + * for stack that might be allocated during user callbacks + */ +#define MAX_STACK_THRESHOLD 1000 + +/************************************************************************ + * * + * UNICODE version of the macros. * + * * + ************************************************************************/ +/** + * IS_BYTE_CHAR: + * @param c an byte value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20...] + * any byte character in the accepted range + */ +#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) + +/** + * IS_CHAR: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] + * | [#x10000-#x10FFFF] + * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. + */ +#define IS_CHAR(c) xmlIsCharQ(c) + +/** + * IS_CHAR_CH: + * @param c an xmlChar (usually an unsigned char) + * + * Behaves like IS_CHAR on single-byte value + */ +#define IS_CHAR_CH(c) xmlIsChar_ch(c) + +/** + * IS_BLANK: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [3] S ::= (#x20 | #x9 | #xD | #xA)+ + */ +#define IS_BLANK(c) xmlIsBlankQ(c) + +/** + * IS_BLANK_CH: + * @param c an xmlChar value (normally unsigned char) + * + * Behaviour same as IS_BLANK + * + * OOM: never + */ +#define IS_BLANK_CH(c) xmlIsBlank_ch(c) + +/** + * IS_BASECHAR: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [85] BaseChar ::= ... long list see REC ... + */ +#define IS_BASECHAR(c) xmlIsBaseCharQ(c) + +/** + * IS_DIGIT: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [88] Digit ::= ... long list see REC ... + */ +#define IS_DIGIT(c) xmlIsDigitQ(c) + +/** + * IS_DIGIT_CH: + * @param c an xmlChar value (usually an unsigned char) + * + * Behaves like IS_DIGIT but with a single byte argument + */ +#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) + +/** + * IS_COMBINING: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [87] CombiningChar ::= ... long list see REC ... + */ +#define IS_COMBINING(c) xmlIsCombiningQ(c) + +/** + * IS_COMBINING_CH: + * @param c an xmlChar (usually an unsigned char) + * + * Always false (all combining chars > 0xff) + */ +#define IS_COMBINING_CH(c) 0 + +/** + * IS_EXTENDER: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | + * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | + * [#x309D-#x309E] | [#x30FC-#x30FE] + */ +#define IS_EXTENDER(c) xmlIsExtenderQ(c) + +/** + * IS_EXTENDER_CH: + * @param c an xmlChar value (usually an unsigned char) + * + * Behaves like IS_EXTENDER but with a single-byte argument + */ +#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) + +/** + * IS_IDEOGRAPHIC: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] + */ +#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) + +/** + * IS_LETTER: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [84] Letter ::= BaseChar | Ideographic + */ +#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) + +/** + * IS_LETTER_CH: + * @param c an xmlChar value (normally unsigned char) + * + * Macro behaves like IS_LETTER, but only check base chars + * + */ +#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) +/** + * IS_PUBIDCHAR: + * @param c an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + */ +#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) + +/** + * IS_PUBIDCHAR_CH: + * @param c an xmlChar value (normally unsigned char) + * + * Same as IS_PUBIDCHAR but for single-byte value + */ +#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) + +/** + * SKIP_EOL: + * @param p and UTF8 string pointer + * + * Skips the end of line chars. + */ +#define SKIP_EOL(p) \ + if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ + if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } + +/** + * MOVETO_ENDTAG: + * @param p and UTF8 string pointer + * + * Skips to the next '>' char. + */ +#define MOVETO_ENDTAG(p) \ + while ((*p) && (*(p) != '>')) (p)++ + +/** + * MOVETO_STARTTAG: + * @param p and UTF8 string pointer + * + * Skips to the next '<' char. + */ +#define MOVETO_STARTTAG(p) \ + while ((*p) && (*(p) != '<')) (p)++ + +/** + * Global constants used for predefined strings. + */ +#ifndef UNDEF_IMPORT_C_IN_DATA_ParserInternal +XMLPUBVAR const xmlChar xmlStringText[]; +XMLPUBVAR const xmlChar xmlStringTextNoenc[]; +XMLPUBVAR const xmlChar xmlStringComment[]; +#endif +/* + * Function to finish the work of the macros where needed. + */ +XMLPUBFUN int XMLCALL xmlIsLetter (int c); + +/** + * Parser context. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateFileParserCtxt (const char *filename); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateURLParserCtxt (const char *filename, + int options); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateMemoryParserCtxt(const char *buffer, + int size); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateEntityParserCtxt(const xmlChar *URL, + const xmlChar *ID, + const xmlChar *base); +XMLPUBFUN int XMLCALL + xmlSwitchEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncodingHandlerPtr handler); +XMLPUBFUN int XMLCALL + xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input, + xmlCharEncodingHandlerPtr handler); + +/** + * Entities + */ +XMLPUBFUN void XMLCALL + xmlHandleEntity (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); + +/** + * Input Streams. + */ +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewStringInputStream (xmlParserCtxtPtr ctxt, + const xmlChar *buffer); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); +XMLPUBFUN void XMLCALL + xmlPushInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input); +XMLPUBFUN xmlChar XMLCALL + xmlPopInput (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlFreeInputStream (xmlParserInputPtr input); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewInputFromFile (xmlParserCtxtPtr ctxt, + const char *filename); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewInputStream (xmlParserCtxtPtr ctxt); + +/** + * Namespaces. + */ +XMLPUBFUN xmlChar * XMLCALL + xmlSplitQName (xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlChar **prefix); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, + xmlChar **prefix); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseQuotedString (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseNamespace (xmlParserCtxtPtr ctxt); + +/** + * Generic production rules. + */ +XMLPUBFUN xmlChar * XMLCALL + xmlScanName (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseName (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseNmtoken (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseEntityValue (xmlParserCtxtPtr ctxt, + xmlChar **orig); +XMLPUBFUN xmlChar * XMLCALL + xmlParseAttValue (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseCharData (xmlParserCtxtPtr ctxt, + int cdata); +XMLPUBFUN xmlChar * XMLCALL + xmlParseExternalID (xmlParserCtxtPtr ctxt, + xmlChar **publicID, + int strict); +XMLPUBFUN void XMLCALL + xmlParseComment (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParsePITarget (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParsePI (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseNotationDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseEntityDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, + xmlChar **value); +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlParseNotationType (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlParseEnumerationType (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XMLPUBFUN int XMLCALL + xmlParseAttributeType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XMLPUBFUN void XMLCALL + xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlParseElementMixedContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlParseElementChildrenContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XMLPUBFUN int XMLCALL + xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlElementContentPtr *result); +XMLPUBFUN int XMLCALL + xmlParseElementDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseCharRef (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlParseEntityRef (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseReference (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParsePEReference (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseAttribute (xmlParserCtxtPtr ctxt, + xmlChar **value); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseStartTag (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseEndTag (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseCDSect (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseContent (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseElement (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseVersionNum (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseVersionInfo (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseEncName (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseSDDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseXMLDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseTextDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseMisc (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseExternalSubset (xmlParserCtxtPtr ctxt, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * XML_SUBSTITUTE_NONE: + * + * If no entities need to be substituted. + */ +#define XML_SUBSTITUTE_NONE 0 +/** + * XML_SUBSTITUTE_REF: + * + * Whether general entities need to be substituted. + */ +#define XML_SUBSTITUTE_REF 1 +/** + * XML_SUBSTITUTE_PEREF: + * + * Whether parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_PEREF 2 +/** + * XML_SUBSTITUTE_BOTH: + * + * Both general and parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_BOTH 3 + +XMLPUBFUN xmlChar * XMLCALL + xmlDecodeEntities (xmlParserCtxtPtr ctxt, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XMLPUBFUN xmlChar * XMLCALL + xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XMLPUBFUN xmlChar * XMLCALL + xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); + +/* + * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. + */ +XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, + xmlNodePtr value); +XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, + xmlParserInputPtr value); +XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, + const xmlChar *value); + +/* + * other commodities shared between parser.c and parserInternals. + */ +XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + int *len); +XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); + +/* + * Really core function shared with HTML parser. + */ +XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, + int *len); +XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, + int val); +XMLPUBFUN int XMLCALL xmlCopyChar (int len, + xmlChar *out, + int val); +XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); + +#ifdef LIBXML_HTML_ENABLED +/* + * Actually comes from the HTML parser but launched from the init stuff. + */ +XMLPUBFUN void XMLCALL htmlInitAutoClose (void); +//XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, +// const char *encoding); + +#endif + +/* + * Specific function to keep track of entities references + * and used by the XSLT debugger. + */ +/** + * xmlEntityReferenceFunc: + * @param ent the entity + * @param firstNode the fist node in the chunk + * @param lastNode the last nod in the chunk + * + * Callback function used when one needs to be able to track back the + * provenance of a chunk of nodes inherited from an entity replacement. + */ +typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, + xmlNodePtr firstNode, + xmlNodePtr lastNode); + +XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); + + +/* + * Macros for identifying data nodes. Data nodes are kept as text nodes + * but some of the fields are reused to save memory. + * ns <-> CID + * content <-> binary content, or RChunk, or RFile reference + * properties <-> size of binary data + * nsDef <-> offset of binary data in RChunk + * psvi <-> container type + * + * Added in S60 3.2 release. + */ +#define IS_DATA_NODE(node) \ + node->type == XML_TEXT_NODE && node->ns + +#define IS_BINARY_NODE(node) \ + node->type == XML_TEXT_NODE && (int)node->psvi == 30 + +#define IS_RCHUNK_NODE(node) \ + node->type == XML_TEXT_NODE && (int)node->psvi == 31 + +#define IS_RFILE_NODE(node) \ + node->type == XML_TEXT_NODE && (int)node->psvi == 32 + +#define IS_EXTERNAL_NODE(node) \ + node->type == XML_TEXT_NODE && ((int)node->psvi == 31 || (int)node->psvi == 32) + +/** given text node, check if it represents data node **/ +#define TEXT_IS_DATA(node) \ + node->ns + +/** given text node, check if it represents binary node **/ +#define TEXT_IS_BINARY(node) \ + (int)node->psvi == 30 + +/** given text node, check if it represents external node **/ +#define TEXT_IS_EXTERNAL(node) \ + ((int)node->psvi == 31 || (int)node->psvi == 32) + +/** fetches data node cid **/ +#define DATA_NODE_CID(node) \ + (xmlChar *)node->ns + +#ifdef __cplusplus +} +#endif +#endif /* XML_PARSER_INTERNALS_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_sax.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_sax.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,172 @@ +/* + * Summary: Old SAX version 1 handler, deprecated + * Description: DEPRECATED set of SAX version 1 interfaces used to + * build the DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_SAX_H +#define XML_SAX_H + +#include + +#ifdef LIBXML_XPTR_ENABLED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN const xmlChar * XMLCALL + getPublicId (void *ctx); +XMLPUBFUN const xmlChar * XMLCALL + getSystemId (void *ctx); +XMLPUBFUN void XMLCALL + setDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XMLPUBFUN int XMLCALL + getLineNumber (void *ctx); +XMLPUBFUN int XMLCALL + getColumnNumber (void *ctx); + +XMLPUBFUN int XMLCALL + isStandalone (void *ctx); +XMLPUBFUN int XMLCALL + hasInternalSubset (void *ctx); +XMLPUBFUN int XMLCALL + hasExternalSubset (void *ctx); + +XMLPUBFUN void XMLCALL + internalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN void XMLCALL + externalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlEntityPtr XMLCALL + getEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + getParameterEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlParserInputPtr XMLCALL + resolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XMLPUBFUN void XMLCALL + entityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XMLPUBFUN void XMLCALL + attributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN void XMLCALL + elementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + notationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XMLPUBFUN void XMLCALL + unparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XMLPUBFUN void XMLCALL + startDocument (void *ctx); +XMLPUBFUN void XMLCALL + endDocument (void *ctx); +XMLPUBFUN void XMLCALL + attribute (void *ctx, + const xmlChar *fullname, + const xmlChar *value); +XMLPUBFUN void XMLCALL + startElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XMLPUBFUN void XMLCALL + endElement (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + reference (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + characters (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + ignorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + processingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XMLPUBFUN void XMLCALL + globalNamespace (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + setNamespace (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlNsPtr XMLCALL + getNamespace (void *ctx); +XMLPUBFUN int XMLCALL + checkNamespace (void *ctx, + xmlChar *nameSpace); +XMLPUBFUN void XMLCALL + namespaceDecl (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + comment (void *ctx, + const xmlChar *value); +XMLPUBFUN void XMLCALL + cdataBlock (void *ctx, + const xmlChar *value, + int len); + +XMLPUBFUN void XMLCALL + initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN void XMLCALL + inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); +#endif +#ifdef LIBXML_DOCB_ENABLED +XMLPUBFUN void XMLCALL + initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); +#endif +#ifdef __cplusplus +} +#endif +#endif /* XML_SAX_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_sax2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_sax2.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,178 @@ +/* + * Summary: SAX2 parser interface used to build the DOM tree + * Description: those are the default SAX2 interfaces used by + * the library when building DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_SAX2_H +#define XML_SAX2_H + +#include + +#ifdef LIBXML_XPTR_ENABLED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN const xmlChar * XMLCALL + xmlSAX2GetPublicId (void *ctx); +XMLPUBFUN const xmlChar * XMLCALL + xmlSAX2GetSystemId (void *ctx); +XMLPUBFUN void XMLCALL + xmlSAX2SetDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XMLPUBFUN int XMLCALL + xmlSAX2GetLineNumber (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2GetColumnNumber (void *ctx); + +XMLPUBFUN int XMLCALL + xmlSAX2IsStandalone (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2HasInternalSubset (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2HasExternalSubset (void *ctx); + +XMLPUBFUN void XMLCALL + xmlSAX2InternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN void XMLCALL + xmlSAX2ExternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlSAX2GetEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlSAX2GetParameterEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlSAX2ResolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XMLPUBFUN void XMLCALL + xmlSAX2EntityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XMLPUBFUN void XMLCALL + xmlSAX2AttributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN void XMLCALL + xmlSAX2ElementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + xmlSAX2NotationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XMLPUBFUN void XMLCALL + xmlSAX2UnparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XMLPUBFUN void XMLCALL + xmlSAX2StartDocument (void *ctx); +XMLPUBFUN void XMLCALL + xmlSAX2EndDocument (void *ctx); +XMLPUBFUN void XMLCALL + xmlSAX2StartElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XMLPUBFUN void XMLCALL + xmlSAX2EndElement (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlSAX2StartElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); +XMLPUBFUN void XMLCALL + xmlSAX2EndElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); +XMLPUBFUN void XMLCALL + xmlSAX2Reference (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlSAX2Characters (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + xmlSAX2IgnorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + xmlSAX2ProcessingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XMLPUBFUN void XMLCALL + xmlSAX2Comment (void *ctx, + const xmlChar *value); +XMLPUBFUN void XMLCALL + xmlSAX2CDataBlock (void *ctx, + const xmlChar *value, + int len); + +XMLPUBFUN int XMLCALL + xmlSAXDefaultVersion (int version); + +XMLPUBFUN int XMLCALL + xmlSAXVersion (xmlSAXHandler *hdlr, + int version); +XMLPUBFUN void XMLCALL + xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN void XMLCALL + xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); +#endif +#ifdef LIBXML_DOCB_ENABLED +XMLPUBFUN void XMLCALL + xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); +#endif +XMLPUBFUN void XMLCALL + xmlDefaultSAXHandlerInit (void); +XMLPUBFUN void XMLCALL + htmlDefaultSAXHandlerInit (void); +XMLPUBFUN void XMLCALL + docbDefaultSAXHandlerInit (void); +#ifdef __cplusplus +} +#endif +#endif /* XML_SAX2_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_schemasinternals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_schemasinternals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,558 @@ +/* + * Summary: internal interfaces for XML Schemas + * Description: internal interfaces for the XML Schemas handling + * and schema validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + + +#ifndef XML_SCHEMA_INTERNALS_H +#define XML_SCHEMA_INTERNALS_H + +#include + +#if defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES) + +#ifdef LIBXML_REGEXP_ENABLED +#include "libxml2_xmlregexp.h" +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define XML_SCHEMAS_NAMESPACE_NAME \ + (const xmlChar*) "http://www.w3.org/2001/XMLSchema" + + +/* + * XML Schemas defines multiple type of types. + */ +typedef enum { + XML_SCHEMA_TYPE_BASIC = 1, + XML_SCHEMA_TYPE_ANY, + XML_SCHEMA_TYPE_FACET, + XML_SCHEMA_TYPE_SIMPLE, + XML_SCHEMA_TYPE_COMPLEX, + XML_SCHEMA_TYPE_SEQUENCE, + XML_SCHEMA_TYPE_CHOICE, + XML_SCHEMA_TYPE_ALL, + XML_SCHEMA_TYPE_SIMPLE_CONTENT, + XML_SCHEMA_TYPE_COMPLEX_CONTENT, + XML_SCHEMA_TYPE_UR, + XML_SCHEMA_TYPE_RESTRICTION, + XML_SCHEMA_TYPE_EXTENSION, + XML_SCHEMA_TYPE_ELEMENT, + XML_SCHEMA_TYPE_ATTRIBUTE, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, + XML_SCHEMA_TYPE_GROUP, + XML_SCHEMA_TYPE_NOTATION, + XML_SCHEMA_TYPE_LIST, + XML_SCHEMA_TYPE_UNION, + XML_SCHEMA_TYPE_ANY_ATTRIBUTE, + XML_SCHEMA_FACET_MININCLUSIVE = 1000, + XML_SCHEMA_FACET_MINEXCLUSIVE, + XML_SCHEMA_FACET_MAXINCLUSIVE, + XML_SCHEMA_FACET_MAXEXCLUSIVE, + XML_SCHEMA_FACET_TOTALDIGITS, + XML_SCHEMA_FACET_FRACTIONDIGITS, + XML_SCHEMA_FACET_PATTERN, + XML_SCHEMA_FACET_ENUMERATION, + XML_SCHEMA_FACET_WHITESPACE, + XML_SCHEMA_FACET_LENGTH, + XML_SCHEMA_FACET_MAXLENGTH, + XML_SCHEMA_FACET_MINLENGTH +} xmlSchemaTypeType; + +typedef enum { + XML_SCHEMA_CONTENT_UNKNOWN = 0, + XML_SCHEMA_CONTENT_EMPTY = 1, + XML_SCHEMA_CONTENT_ELEMENTS, + XML_SCHEMA_CONTENT_MIXED, + XML_SCHEMA_CONTENT_SIMPLE, + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, + XML_SCHEMA_CONTENT_BASIC, + XML_SCHEMA_CONTENT_ANY +} xmlSchemaContentType; + +typedef enum { + XML_SCHEMAS_UNKNOWN = 0, + XML_SCHEMAS_STRING, + XML_SCHEMAS_NORMSTRING, + XML_SCHEMAS_DECIMAL, + XML_SCHEMAS_TIME, + XML_SCHEMAS_GDAY, + XML_SCHEMAS_GMONTH, + XML_SCHEMAS_GMONTHDAY, + XML_SCHEMAS_GYEAR, + XML_SCHEMAS_GYEARMONTH, + XML_SCHEMAS_DATE, + XML_SCHEMAS_DATETIME, + XML_SCHEMAS_DURATION, + XML_SCHEMAS_FLOAT, + XML_SCHEMAS_DOUBLE, + XML_SCHEMAS_BOOLEAN, + XML_SCHEMAS_TOKEN, + XML_SCHEMAS_LANGUAGE, + XML_SCHEMAS_NMTOKEN, + XML_SCHEMAS_NMTOKENS, + XML_SCHEMAS_NAME, + XML_SCHEMAS_QNAME, + XML_SCHEMAS_NCNAME, + XML_SCHEMAS_ID, + XML_SCHEMAS_IDREF, + XML_SCHEMAS_IDREFS, + XML_SCHEMAS_ENTITY, + XML_SCHEMAS_ENTITIES, + XML_SCHEMAS_NOTATION, + XML_SCHEMAS_ANYURI, + XML_SCHEMAS_INTEGER, + XML_SCHEMAS_NPINTEGER, + XML_SCHEMAS_NINTEGER, + XML_SCHEMAS_NNINTEGER, + XML_SCHEMAS_PINTEGER, + XML_SCHEMAS_INT, + XML_SCHEMAS_UINT, + XML_SCHEMAS_LONG, + XML_SCHEMAS_ULONG, + XML_SCHEMAS_SHORT, + XML_SCHEMAS_USHORT, + XML_SCHEMAS_BYTE, + XML_SCHEMAS_UBYTE, + XML_SCHEMAS_HEXBINARY, + XML_SCHEMAS_BASE64BINARY +} xmlSchemaValType; + + +/* Date value */ +struct _xmlSchemaValDate { + long year; + unsigned int mon :4; /* 1 <= mon <= 12 */ + unsigned int day :5; /* 1 <= day <= 31 */ + unsigned int hour:5; /* 0 <= hour <= 23 */ + unsigned int min :6; /* 0 <= min <= 59 */ + double sec; + unsigned int tz_flag :1; /* is tzo explicitely set? */ + int tzo :11; /* -1440 <= tzo <= 1440 */ +}; + +/* Duration value */ +typedef struct _xmlSchemaValDuration xmlSchemaValDuration; +typedef xmlSchemaValDuration *xmlSchemaValDurationPtr; +struct _xmlSchemaValDuration { + long mon; /* mon stores years also */ + long day; + double sec; /* sec stores min and hour also */ +}; + +typedef struct _xmlSchemaValDecimal xmlSchemaValDecimal; +typedef xmlSchemaValDecimal *xmlSchemaValDecimalPtr; +struct _xmlSchemaValDecimal { + /* would use long long but not portable */ + unsigned long lo; + unsigned long mi; + unsigned long hi; + unsigned int extra; + unsigned int sign:1; + unsigned int frac:7; + unsigned int total:8; +}; + +typedef struct _xmlSchemaValQName xmlSchemaValQName; +typedef xmlSchemaValQName *xmlSchemaValQNamePtr; +struct _xmlSchemaValQName { + xmlChar *name; + xmlChar *uri; +}; + +typedef struct _xmlSchemaValHex xmlSchemaValHex; +typedef xmlSchemaValHex *xmlSchemaValHexPtr; +struct _xmlSchemaValHex { + xmlChar *str; + unsigned int total; +}; + +typedef struct _xmlSchemaValBase64 xmlSchemaValBase64; +typedef xmlSchemaValBase64 *xmlSchemaValBase64Ptr; +struct _xmlSchemaValBase64 { + xmlChar *str; + unsigned int total; +}; + +typedef struct _xmlSchemaValDate xmlSchemaValDate; +typedef xmlSchemaValDate *xmlSchemaValDatePtr; + +struct _xmlSchemaVal { + xmlSchemaValType type; + union { + xmlSchemaValDecimal decimal; + xmlSchemaValDate date; + xmlSchemaValDuration dur; + xmlSchemaValQName qname; + xmlSchemaValHex hex; + xmlSchemaValBase64 base64; + float f; + double d; + int b; + xmlChar* str; + } value; +}; + +typedef struct _xmlSchemaVal xmlSchemaVal; +typedef xmlSchemaVal *xmlSchemaValPtr; + +typedef struct _xmlSchemaType xmlSchemaType; +typedef xmlSchemaType *xmlSchemaTypePtr; + +typedef struct _xmlSchemaFacet xmlSchemaFacet; +typedef xmlSchemaFacet *xmlSchemaFacetPtr; + +/** + * Annotation + */ +typedef struct _xmlSchemaAnnot xmlSchemaAnnot; +typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; +struct _xmlSchemaAnnot { + struct _xmlSchemaAnnot *next; + xmlNodePtr content; /* the annotation */ +}; + +/** + * XML_SCHEMAS_ANYATTR_SKIP: + * + * Skip unknown attribute from validation + */ +#define XML_SCHEMAS_ANYATTR_SKIP 1 +/** + * XML_SCHEMAS_ANYATTR_LAX: + * + * Ignore validation non definition on attributes + */ +#define XML_SCHEMAS_ANYATTR_LAX 2 +/** + * XML_SCHEMAS_ANYATTR_STRICT: + * + * Apply strict validation rules on attributes + */ +#define XML_SCHEMAS_ANYATTR_STRICT 3 + +/** + * XML_SCHEMAS_ATTR_USE_PROHIBITED: + * + * The attribute is prohibited. + */ +#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 + +/** + * XML_SCHEMAS_ATTR_USE_REQUIRED: + * + * The attribute is required. + */ +#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 + +/** + * XML_SCHEMAS_ATTR_USE_OPTIONAL: + * + * The attribute is optional. + */ +#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 + +/** + * XML_SCHEMAS_ATTR_NSDEFAULT: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 + +/** + * xmlSchemaAttribute: + * An attribute definition. + */ + +typedef struct _xmlSchemaAttribute xmlSchemaAttribute; +typedef xmlSchemaAttribute *xmlSchemaAttributePtr; +struct _xmlSchemaAttribute { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; + const xmlChar *refNs; + const xmlChar *typeName; + const xmlChar *typeNs; + xmlSchemaAnnotPtr annot; + + xmlSchemaTypePtr base; + int occurs; + const xmlChar *defValue; + xmlSchemaTypePtr subtypes; + xmlNodePtr node; + const xmlChar *targetNamespace; + int flags; +}; + +/** + * An attribute group definition. + * + * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures + * must be kept similar + */ +typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; +typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; +struct _xmlSchemaAttributeGroup { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; + const xmlChar *refNs; + xmlSchemaAnnotPtr annot; + + xmlSchemaAttributePtr attributes; + xmlNodePtr node; +}; + + +/** + * XML_SCHEMAS_TYPE_MIXED: + * + * the element content type is mixed + */ +#define XML_SCHEMAS_TYPE_MIXED 1 << 0 + +/** + * _xmlSchemaType: + * + * Schemas type definition. + */ +struct _xmlSchemaType { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next;/* the next type if in a sequence ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; + const xmlChar *refNs; + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; + int maxOccurs; + + int flags; + xmlSchemaContentType contentType; + const xmlChar *base; + const xmlChar *baseNs; + xmlSchemaTypePtr baseType; + xmlSchemaFacetPtr facets; + struct _xmlSchemaType *redef;/* possible redefinitions for the type */ + int recurse; +}; + +/* + * xmlSchemaElement: + * An element definition. + * + * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of + * structures must be kept similar + */ +/** + * XML_SCHEMAS_ELEM_NILLABLE: + * + * the element is nillable + */ +#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 +/** + * XML_SCHEMAS_ELEM_GLOBAL: + * + * the element is global + */ +#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ELEM_DEFAULT: + * + * the element has a default value + */ +#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 +/** + * XML_SCHEMAS_ELEM_FIXED: + * + * the element has a fixed value + */ +#define XML_SCHEMAS_ELEM_FIXED 1 << 3 +/** + * XML_SCHEMAS_ELEM_ABSTRACT: + * + * the element is abstract + */ +#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 +/** + * XML_SCHEMAS_ELEM_TOPLEVEL: + * + * the element is top level + */ +#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 +/** + * XML_SCHEMAS_ELEM_REF: + * + * the element is a reference to a type + */ +#define XML_SCHEMAS_ELEM_REF 1 << 6 +/** + * XML_SCHEMAS_ELEM_NSDEFAULT: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 + +typedef struct _xmlSchemaElement xmlSchemaElement; +typedef xmlSchemaElement *xmlSchemaElementPtr; +struct _xmlSchemaElement { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next;/* the next type if in a sequence ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; + const xmlChar *refNs; + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; + int maxOccurs; + + int flags; + const xmlChar *targetNamespace; + const xmlChar *namedType; + const xmlChar *namedTypeNs; + const xmlChar *substGroup; + const xmlChar *substGroupNs; + const xmlChar *scope; + const xmlChar *value; + struct _xmlSchemaElement *refDecl; +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr contModel; +#endif + xmlSchemaContentType contentType; +}; + +/* + * XML_SCHEMAS_FACET_UNKNOWN: + * + * unknown facet handling + */ +#define XML_SCHEMAS_FACET_UNKNOWN 0 +/* + * XML_SCHEMAS_FACET_PRESERVE: + * + * preserve the type of the facet + */ +#define XML_SCHEMAS_FACET_PRESERVE 1 +/* + * XML_SCHEMAS_FACET_REPLACE: + * + * replace the type of the facet + */ +#define XML_SCHEMAS_FACET_REPLACE 2 +/* + * XML_SCHEMAS_FACET_COLLAPSE: + * + * collapse the types of the facet + */ +#define XML_SCHEMAS_FACET_COLLAPSE 3 + +/** + * A facet definition. + */ +struct _xmlSchemaFacet { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ + const xmlChar *value; + const xmlChar *id; + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int fixed; + int whitespace; + xmlSchemaValPtr val; +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr regexp; +#endif +}; + +/** + * A notation definition. + */ +typedef struct _xmlSchemaNotation xmlSchemaNotation; +typedef xmlSchemaNotation *xmlSchemaNotationPtr; +struct _xmlSchemaNotation { + xmlSchemaTypeType type; /* The kind of type */ + const xmlChar *name; + xmlSchemaAnnotPtr annot; + const xmlChar *identifier; +}; + +/** + * XML_SCHEMAS_QUALIF_ELEM: + * + * the shemas requires qualified elements + */ +#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 +/** + * XML_SCHEMAS_QUALIF_ATTR: + * + * the shemas requires qualified attributes + */ +#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 +/** + * _xmlSchema: + * + * A Schemas definition + */ +struct _xmlSchema { + const xmlChar *name; /* schema name */ + const xmlChar *targetNamespace; /* the target namespace */ + const xmlChar *version; + const xmlChar *id; + xmlDocPtr doc; + xmlSchemaAnnotPtr annot; + int flags; + + xmlHashTablePtr typeDecl; + xmlHashTablePtr attrDecl; + xmlHashTablePtr attrgrpDecl; + xmlHashTablePtr elemDecl; + xmlHashTablePtr notaDecl; + + xmlHashTablePtr schemasImports; + + void *_private; /* unused by the library for users or bindings */ + xmlHashTablePtr groupDecl; + xmlDictPtr dict; + void *includes; /* the includes, this is opaque for now */ + int preserve; /* whether to free the document */ +}; + +XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); + +#ifdef __cplusplus +} +#endif + +#endif /* #if defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES) */ +#endif /* XML_SCHEMA_INTERNALS_H */ + + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_threads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_threads.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,84 @@ +/* + * Summary: interfaces for thread handling + * Description: set of generic threading related routines + * should work with pthreads, Windows native or TLS threads + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_THREADS_H +#define XML_THREADS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlMutex are a simple mutual exception locks. + */ +typedef struct _xmlMutex xmlMutex; +typedef xmlMutex *xmlMutexPtr; + +/* + * xmlRMutex are reentrant mutual exception locks. + */ +typedef struct _xmlRMutex xmlRMutex; +typedef xmlRMutex *xmlRMutexPtr; + +XMLPUBFUN xmlMutexPtr XMLCALL + xmlNewMutex (void); +XMLPUBFUN void XMLCALL + xmlMutexLock (xmlMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlMutexUnlock (xmlMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlFreeMutex (xmlMutexPtr tok); + +XMLPUBFUN xmlRMutexPtr XMLCALL + xmlNewRMutex (void); +XMLPUBFUN void XMLCALL + xmlRMutexLock (xmlRMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlRMutexUnlock (xmlRMutexPtr tok); + + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN void XMLCALL + xmlFreeRMutex (xmlRMutexPtr tok); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/* + * Library wide APIs. + */ +XMLPUBFUN void XMLCALL + xmlInitThreads (void); +XMLPUBFUN void XMLCALL + xmlLockLibrary (void); +XMLPUBFUN void XMLCALL + xmlUnlockLibrary(void); +XMLPUBFUN int XMLCALL + xmlGetThreadId (void); +XMLPUBFUN int XMLCALL + xmlIsMainThread (void); +XMLPUBFUN void XMLCALL + xmlCleanupThreads(void); +XMLPUBFUN xmlGlobalStatePtr XMLCALL + xmlGetGlobalState(void); + +#ifdef __cplusplus +} +#endif + + +#endif /* XML_THREADS_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_tree.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_tree.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1106 @@ +/* + * Summary: interfaces for tree manipulation + * Description: this module describes the structures found in an tree resulting + * from an XML or HTML parsing, as well as the API provided for + * various processing on that tree + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_TREE_H +#define XML_TREE_H + +#include + +#include +#include + +#ifdef LIBXML_REGEXP_ENABLED +#include "libxml2_xmlregexp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Some of the basic types pointer to structures: + */ +/* xmlIO.h */ +typedef struct _xmlParserInputBuffer xmlParserInputBuffer; +typedef xmlParserInputBuffer *xmlParserInputBufferPtr; + +typedef struct _xmlOutputBuffer xmlOutputBuffer; +typedef xmlOutputBuffer *xmlOutputBufferPtr; + +/* parser.h */ + + +typedef struct _xmlParserCtxt xmlParserCtxt; +typedef xmlParserCtxt *xmlParserCtxtPtr; + +typedef struct _xmlSAXLocator xmlSAXLocator; +typedef xmlSAXLocator *xmlSAXLocatorPtr; + +typedef struct _xmlSAXHandler xmlSAXHandler; +typedef xmlSAXHandler *xmlSAXHandlerPtr; + +/* entities.h */ +typedef struct _xmlEntity xmlEntity; +typedef xmlEntity *xmlEntityPtr; + +/** + * BASE_BUFFER_SIZE: + * + * default buffer size 4000. + */ +#define BASE_BUFFER_SIZE 4096 + + +// BUT! remember that it is checked in #ifdef's +/** + * XML_XML_NAMESPACE: + * + * This is the namespace for the special xml: prefix predefined in the + * XML Namespace specification. + */ +#define XML_XML_NAMESPACE \ + (const xmlChar *) "http://www.w3.org/XML/1998/namespace" + +/** + * XML_XML_ID: + * + * This is the name for the special xml:id attribute + */ +#define XML_XML_ID (const xmlChar *) "xml:id" + +/* + * The different element types carried by an XML tree. + * + * NOTE: This is synchronized with DOM Level1 values + * See http://www.w3.org/TR/REC-DOM-Level-1/ + * + * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should + * be deprecated to use an XML_DTD_NODE. + */ +typedef enum { + XML_ELEMENT_NODE= 1, + XML_ATTRIBUTE_NODE= 2, + XML_TEXT_NODE= 3, + XML_CDATA_SECTION_NODE= 4, + XML_ENTITY_REF_NODE= 5, + XML_ENTITY_NODE= 6, + XML_PI_NODE= 7, + XML_COMMENT_NODE= 8, + XML_DOCUMENT_NODE= 9, + XML_DOCUMENT_TYPE_NODE= 10, + XML_DOCUMENT_FRAG_NODE= 11, + XML_NOTATION_NODE= 12, + XML_HTML_DOCUMENT_NODE= 13, + XML_DTD_NODE= 14, + XML_ELEMENT_DECL= 15, + XML_ATTRIBUTE_DECL= 16, + XML_ENTITY_DECL= 17, + XML_NAMESPACE_DECL= 18, + XML_XINCLUDE_START= 19, + XML_XINCLUDE_END= 20 +//#ifdef LIBXML_DOCB_ENABLED +// ,XML_DOCB_DOCUMENT_NODE= 21 //DocBook support is excluded from XML Engine +//#endif +} xmlElementType; + + +/** + * xmlNotation: + * + * A DTD Notation definition. + */ + +typedef struct _xmlNotation xmlNotation; +typedef xmlNotation *xmlNotationPtr; +struct _xmlNotation { + const xmlChar *name; /* Notation name */ + const xmlChar *PublicID; /* Public identifier, if any */ + const xmlChar *SystemID; /* System identifier, if any */ +}; + +/** + * xmlAttributeType: + * + * A DTD Attribute type definition. + */ + +typedef enum { + XML_ATTRIBUTE_CDATA = 1, + XML_ATTRIBUTE_ID, + XML_ATTRIBUTE_IDREF , + XML_ATTRIBUTE_IDREFS, + XML_ATTRIBUTE_ENTITY, + XML_ATTRIBUTE_ENTITIES, + XML_ATTRIBUTE_NMTOKEN, + XML_ATTRIBUTE_NMTOKENS, + XML_ATTRIBUTE_ENUMERATION, + XML_ATTRIBUTE_NOTATION +} xmlAttributeType; + +/** + * xmlAttributeDefault: + * + * A DTD Attribute default definition. + */ + +typedef enum { + XML_ATTRIBUTE_NONE = 1, + XML_ATTRIBUTE_REQUIRED, + XML_ATTRIBUTE_IMPLIED, + XML_ATTRIBUTE_FIXED +} xmlAttributeDefault; + +/** + * xmlEnumeration: + * + * List structure used when there is an enumeration in DTDs. + */ + +typedef struct _xmlEnumeration xmlEnumeration; +typedef xmlEnumeration *xmlEnumerationPtr; +struct _xmlEnumeration { + struct _xmlEnumeration *next; /* next one */ + const xmlChar *name; /* Enumeration name */ +}; + +/** + * xmlAttribute: + * + * An Attribute declaration in a DTD. + */ + +typedef struct _xmlAttribute xmlAttribute; +typedef xmlAttribute *xmlAttributePtr; +struct _xmlAttribute { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ + const xmlChar *name; /* Attribute name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + struct _xmlAttribute *nexth; /* next in hash table */ + xmlAttributeType atype; /* The attribute type */ + xmlAttributeDefault def; /* the default */ + const xmlChar *defaultValue; /* or the default value */ + xmlEnumerationPtr tree; /* or the enumeration tree if any */ + const xmlChar *prefix; /* the namespace prefix if any */ + const xmlChar *elem; /* Element holding the attribute */ +}; + +/** + * xmlElementContentType: + * + * Possible definitions of element content types. + */ +typedef enum { + XML_ELEMENT_CONTENT_PCDATA = 1, + XML_ELEMENT_CONTENT_ELEMENT, + XML_ELEMENT_CONTENT_SEQ, + XML_ELEMENT_CONTENT_OR +} xmlElementContentType; + +/** + * xmlElementContentOccur: + * + * Possible definitions of element content occurrences. + */ +typedef enum { + XML_ELEMENT_CONTENT_ONCE = 1, + XML_ELEMENT_CONTENT_OPT, + XML_ELEMENT_CONTENT_MULT, + XML_ELEMENT_CONTENT_PLUS +} xmlElementContentOccur; + +/** + * xmlElementContent: + * + * An XML Element content as stored after parsing an element definition + * in a DTD. + */ + +typedef struct _xmlElementContent xmlElementContent; +typedef xmlElementContent *xmlElementContentPtr; +struct _xmlElementContent { + xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ + xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ + const xmlChar *name; /* Element name */ + struct _xmlElementContent *c1; /* first child */ + struct _xmlElementContent *c2; /* second child */ + struct _xmlElementContent *parent; /* parent */ + const xmlChar *prefix; /* Namespace prefix */ +}; + +/** + * xmlElementTypeVal: + * + * The different possibilities for an element content type. + */ + +typedef enum { + XML_ELEMENT_TYPE_UNDEFINED = 0, + XML_ELEMENT_TYPE_EMPTY = 1, + XML_ELEMENT_TYPE_ANY, + XML_ELEMENT_TYPE_MIXED, + XML_ELEMENT_TYPE_ELEMENT +} xmlElementTypeVal; + + +//#ifdef __cplusplus +//} +//#endif +//#ifdef __cplusplus +//extern "C" { +//#endif + +/** + * xmlElement: + * + * An XML Element declaration from a DTD. + */ + +typedef struct _xmlElement xmlElement; +typedef xmlElement *xmlElementPtr; +struct _xmlElement { + void *_private; /* application data */ + xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ + const xmlChar *name; /* Element name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + xmlElementTypeVal etype; /* The type */ + xmlElementContentPtr content; /* the allowed element content */ + xmlAttributePtr attributes; /* List of the declared attributes */ + const xmlChar *prefix; /* the namespace prefix if any */ +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr contModel; /* the validating regexp */ +#else + void* contModel; +#endif +}; + + +/** + * XML_LOCAL_NAMESPACE: + * + * A namespace declaration node. + */ +#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL +typedef xmlElementType xmlNsType; + +/** + * xmlNs: + * + * An XML namespace. + * Note that prefix == NULL is valid, it defines the default namespace + * within the subtree (until overridden). + * + * xmlNsType is unified with xmlElementType. + */ + +typedef struct _xmlNs xmlNs; +typedef xmlNs *xmlNsPtr; +struct _xmlNs { + struct _xmlNs *next; /* next Ns link for this node */ + xmlNsType type; /* global or local */ + const xmlChar *href; /* URL for the namespace */ + const xmlChar *prefix; /* prefix for the namespace */ + void *_private; /* application data */ +}; + +/** + * xmlDtd: + * + * An XML DTD, as defined by parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + /* End of common part */ + void *notations; /* Hash table for notations if any */ + void *elements; /* Hash table for elements if any */ + void *attributes; /* Hash table for attributes if any */ + void *entities; /* Hash table for entities if any */ + const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ + void *pentities; /* Hash table for param entities if any */ +}; + +/** + * xmlAttr: + * + * An attribute on an XML node. + */ +typedef struct _xmlAttr xmlAttr; +typedef xmlAttr *xmlAttrPtr; +struct _xmlAttr { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ + const xmlChar *name; /* the name of the property */ + struct _xmlNode *children; /* the value of the property */ + struct _xmlNode *last; /* NULL */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlAttr *next; /* next sibling link */ + struct _xmlAttr *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + /* End of common part */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlAttributeType atype; /* the attribute type if validating */ + void *psvi; /* for type/PSVI informations */ +}; + +/** + * xmlID: + * + * An XML ID instance. + */ + +typedef struct _xmlID xmlID; +typedef xmlID* xmlIDPtr; +struct _xmlID { + xmlIDPtr next; /* next ID */ + const xmlChar* value; /* The ID name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar* name; /* The attribute if attr is not available */ + struct _xmlDoc* doc; /* The document holding the ID */ +#ifdef LIBXML_ENABLE_NODE_LINEINFO + int lineno; /* The line number if attr is not available */ +#endif +}; + +/** + * xmlRef: + * + * An XML IDREF instance. + */ + +typedef struct _xmlRef xmlRef; +typedef xmlRef* xmlRefPtr; +struct _xmlRef { + xmlRefPtr next; /* next Ref */ + const xmlChar* value; /* The Ref name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar* name; /* The attribute if attr is not available */ +#ifdef LIBXML_ENABLE_NODE_LINEINFO + int lineno; /* The line number if attr is not available */ +#endif +}; + +/** + * xmlBufferAllocationScheme: + * + * A buffer allocation scheme can be defined to either match exactly the + * need or double it's allocated size each time it is found too small. + */ + +typedef enum { + XML_BUFFER_ALLOC_DOUBLEIT, + XML_BUFFER_ALLOC_EXACT, + XML_BUFFER_ALLOC_IMMUTABLE +} xmlBufferAllocationScheme; + +/** + * xmlBuffer: + * + * A buffer structure. + */ +typedef struct _xmlBuffer xmlBuffer; +typedef xmlBuffer* xmlBufferPtr; +struct _xmlBuffer { + xmlChar* content; /* The buffer content UTF8 */ + unsigned int use; /* The buffer size used */ + unsigned int size; /* The buffer size */ + xmlBufferAllocationScheme alloc; /* The realloc method */ +}; + +/** + * xmlNode: + * + * A node in an XML tree. + * + * Note: + * Text nodes are also used to store binary data in the tree. + * 'content' field is used to store a pointer to binary data + * 'properties' field is used to store int length of the data + * + */ +typedef struct _xmlNode xmlNode; +typedef xmlNode* xmlNodePtr; +struct _xmlNode { + void* _private; /* application data */ + xmlElementType type; /* type number, must be second ! */ + const xmlChar* name; /* the name of the node, or the entity */ + xmlNodePtr children; /* parent->childs link */ + xmlNodePtr last; /* last child link */ + xmlNodePtr parent; /* child->parent link */ + xmlNodePtr next; /* next sibling link */ + xmlNodePtr prev; /* previous sibling link */ + struct _xmlDoc* doc; /* the containing document */ + /* End of common part */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlChar *content; /* the content */ + struct _xmlAttr *properties;/* properties list */ + xmlNs *nsDef; /* namespace definitions on this node */ + void *psvi; /* for type/PSVI informations */ + unsigned short extra; /* extra data for XPath/XSLT */ +#ifdef LIBXML_ENABLE_NODE_LINEINFO + unsigned short line; /* line number */ +#endif +}; + +/** + * XML_GET_CONTENT: + * + * Macro to extract the content pointer of a node. + */ +#define XML_GET_CONTENT(n) \ + ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) + + + +#ifdef LIBXML_ENABLE_NODE_LINEINFO +/** + * XML_GET_LINE: + * + * Macro to extract the line number of an element node. + */ +#define XML_GET_LINE(n) (xmlGetLineNo(n)) +#endif /* LIBXML_ENABLE_NODE_LINEINFO */ + +/** + * xmlDoc: + * + * An XML document. + */ +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc* xmlDocPtr; +struct _xmlDoc { + void *_private; /* application data */ + xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ + char *name; /* name/filename/URI of the document */ + struct _xmlNode *children; /* the document tree */ + struct _xmlNode *last; /* last child link */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* autoreference to itself */ + /* End of common part */ + + /* dummy fields to avoid incorrect use of xmlDoc as xmlNode + currently, always NULL; reserved. + + Added to prevent potential problems of same kind in the future. + */ + void* _reserved1; /* ~ xmlNode.ns */ + void* _reserved2; /* ~ xmlNode.content */ + void* _reserved3; /* ~ xmlNode.properties */ + void* _reserved4; /* ~ xmlNode.nsDef */ + /* End of 2nd (extra) common part (same as xmlNode) */ + +#ifdef LIBXML_ENABLE_GS_CACHING_IN_DOC + void* cachedGs; /* cached value returned by xmlGetGlobalState() */ +#endif + int compression;/* level of zlib compression */ + int standalone; /* standalone document (no external refs) */ + struct _xmlDtd *intSubset; /* the document internal subset */ + struct _xmlDtd *extSubset; /* the document external subset */ + struct _xmlNs *oldNs; /* Global namespace, the old way */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* external initial encoding, if any */ + void *ids; /* Hash table for ID attributes if any */ + void *refs; /* Hash table for IDREFs attributes if any */ + const xmlChar *URL; /* The URI for that document */ + int charset; /* encoding of the in-memory content + actually an xmlCharEncoding */ + struct _xmlDict *dict; /* dict used to allocate names or NULL */ + void *psvi; /* for type/PSVI informations */ +//XMLENGINE: NEW CODE + /* + A container for nodes that were created as nodes of this document but + are not linked into the document yet + NOTE: this field is used by DOM C++ API only (not in libxml2 functions) + */ + void* ownedNodes; + /* + * Container for nodes that store external data references + */ + xmlNodePtr* dataNodeList; /* array of data nodes */ + int dataNodeMax; /* maximum number of data nodes in the array */ +// +}; + +/* + * Variables. + */ + +/* + * Some helper functions + */ +XMLPUBFUN int XMLCALL xmlValidateNCName (const xmlChar* value, int space); +XMLPUBFUN int XMLCALL xmlValidateQName (const xmlChar* value, int space); +XMLPUBFUN int XMLCALL xmlValidateName (const xmlChar* value, int space); +XMLPUBFUN int XMLCALL xmlValidateNMToken(const xmlChar* value, int space); + +XMLPUBFUN xmlChar* XMLCALL + xmlBuildQName (const xmlChar *ncname, const xmlChar *prefix, + xmlChar *memory, int len); +XMLPUBFUN xmlChar* XMLCALL + xmlSplitQName2 (const xmlChar *name, xmlChar **prefix); +XMLPUBFUN const xmlChar* XMLCALL + xmlSplitQName3 (const xmlChar *name, int *len); + +/* + * Handling Buffers. + */ + +XMLPUBFUN void XMLCALL + xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlBufferAllocationScheme XMLCALL + xmlGetBufferAllocationScheme(void); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreate (void); +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreateSize (size_t size); +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreateStatic (void *mem, size_t size); +XMLPUBFUN int XMLCALL + xmlBufferResize (xmlBufferPtr buf, unsigned int size); +XMLPUBFUN void XMLCALL + xmlBufferFree (xmlBufferPtr buf); + +#ifndef XMLENGINE_EXCLUDE_FILE_FUNC +XMLPUBFUN int XMLCALL + xmlBufferDump (FILE *file, xmlBufferPtr buf); +#endif + +XMLPUBFUN void XMLCALL + xmlBufferAdd (xmlBufferPtr buf, const xmlChar *str, int len); +XMLPUBFUN void XMLCALL + xmlBufferAddHead (xmlBufferPtr buf, const xmlChar *str, int len); +XMLPUBFUN void XMLCALL + xmlBufferCat (xmlBufferPtr buf, const xmlChar *str); +XMLPUBFUN void XMLCALL + xmlBufferCCat (xmlBufferPtr buf, const char *str); +XMLPUBFUN int XMLCALL + xmlBufferShrink (xmlBufferPtr buf, unsigned int len); +XMLPUBFUN int XMLCALL + xmlBufferGrow (xmlBufferPtr buf, unsigned int len); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN void XMLCALL xmlBufferEmpty (xmlBufferPtr buf); +XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme); +#endif + +XMLPUBFUN int XMLCALL xmlBufferLength (const xmlBufferPtr buf); + +// XMLENGINE: BEGIN NEW CODE +/** + * xmlBufferContent: + * @param buf the buffer + * + * Function to extract the content of a buffer + * + * Returns the internal content + */ +#define xmlBufferContent(buf) ((buf)? (buf)->content : NULL) +// XMLENGINE: END NEW CODE + +// DONE: OPTIMIZE: replaced by MACRO +// XMLPUBFUN const xmlChar* XMLCALL +// xmlBufferContent (const xmlBufferPtr buf); + +/* + * Creating/freeing new structures. + */ + +XMLPUBFUN xmlDtdPtr XMLCALL + xmlCreateIntSubset (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlNewDtd (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlGetIntSubset (xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlFreeDtd (xmlDtdPtr cur); +XMLPUBFUN xmlNsPtr XMLCALL + xmlNewGlobalNs (xmlDocPtr doc, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN xmlNsPtr XMLCALL + xmlNewNs (xmlNodePtr node, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + xmlFreeNs (xmlNsPtr cur); +XMLPUBFUN void XMLCALL + xmlFreeNsList (xmlNsPtr cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlNewDoc (const xmlChar *version); +XMLPUBFUN void XMLCALL + xmlFreeDoc (xmlDocPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewDocProp (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewNsPropEatName (xmlNodePtr node, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *value); +XMLPUBFUN void XMLCALL + xmlFreePropList (xmlAttrPtr cur); +XMLPUBFUN void XMLCALL + xmlFreeProp (xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlCopyProp (xmlNodePtr target, + xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlCopyPropList (xmlNodePtr target, + xmlAttrPtr cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlDtdPtr XMLCALL + xmlCopyDtd (xmlDtdPtr dtd); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCopyDoc (xmlDocPtr doc, + int recursive); +#endif /* LIBXML_TREE_ENABLED */ + +/* + * Creating new nodes. + */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocNodeEatName (xmlDocPtr doc, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocRawNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewNode (xmlNsPtr ns, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewNodeEatName (xmlNsPtr ns, + xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewTextChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocText (xmlDocPtr doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewText (const xmlChar *content); + +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewPI (const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocTextLen (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewTextLen (const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocComment (xmlDocPtr doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewComment (const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewCDataBlock (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewCharRef (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewReference (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlCopyNode (const xmlNodePtr node, + int recursive); +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocCopyNode (const xmlNodePtr node, + xmlDocPtr doc, + int recursive); + + +XMLPUBFUN xmlNodePtr XMLCALL xmlCopyNodeList (const xmlNodePtr node); + +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocFragment (xmlDocPtr doc); +#endif /* LIBXML_TREE_ENABLED */ + +/* + * Navigating. + */ +#ifdef LIBXML_ENABLE_NODE_LINEINFO +XMLPUBFUN long XMLCALL xmlGetLineNo(xmlNodePtr node); +#endif + +#ifdef LIBXML_TREE_ENABLED +# ifndef XMLENGINE_EXCLUDE_UNUSED + XMLPUBFUN xmlChar * XMLCALL xmlGetNodePath (xmlNodePtr node); +# endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ +#endif /* LIBXML_TREE_ENABLED */ + +XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement (xmlDocPtr doc); +XMLPUBFUN xmlNodePtr XMLCALL xmlGetLastChild (xmlNodePtr parent); +XMLPUBFUN int XMLCALL xmlNodeIsText (xmlNodePtr node); +XMLPUBFUN int XMLCALL xmlIsBlankNode (xmlNodePtr node); + +#ifdef LIBXML_TREE_ENABLED +/* + * Changing the structure. + */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root); +XMLPUBFUN void XMLCALL + xmlNodeSetName (xmlNodePtr cur, const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlReplaceNode (xmlNodePtr old, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem); +#endif /* LIBXML_TREE_ENABLED */ + +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddChild (xmlNodePtr parent, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddChildList (xmlNodePtr parent, xmlNodePtr cur); + +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem); +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddNextSibling (xmlNodePtr cur, xmlNodePtr elem); +XMLPUBFUN void XMLCALL + xmlUnlinkNode (xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextMerge (xmlNodePtr first, xmlNodePtr second); +XMLPUBFUN int XMLCALL + xmlTextConcat (xmlNodePtr node, const xmlChar *content, int len); + +XMLPUBFUN void XMLCALL xmlFreeNodeList (xmlNodePtr cur); +XMLPUBFUN void XMLCALL xmlFreeNode (xmlNodePtr cur); +XMLPUBFUN void XMLCALL xmlSetTreeDoc (xmlNodePtr tree, xmlDocPtr doc); +XMLPUBFUN void XMLCALL xmlSetListDoc (xmlNodePtr list, xmlDocPtr doc); +/* + * Namespaces. + */ +XMLPUBFUN xmlNsPtr XMLCALL + xmlSearchNs (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *nameSpace); +XMLPUBFUN xmlNsPtr XMLCALL + xmlSearchNsByHref (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *href); + +XMLPUBFUN void XMLCALL xmlSetNs (xmlNodePtr node, xmlNsPtr ns); +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespace (xmlNsPtr cur); +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespaceList (xmlNsPtr cur); + +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNsPtr* XMLCALL xmlGetNsList (xmlDocPtr doc, xmlNodePtr node); +#endif /* LIBXML_TREE_ENABLED */ + + +/* + * Changing the content. + */ +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlAttrPtr XMLCALL + xmlSetProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN xmlChar * XMLCALL + xmlGetNoNsProp (xmlNodePtr node, + const xmlChar *name); +XMLPUBFUN xmlChar * XMLCALL + xmlGetProp (xmlNodePtr node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasProp (xmlNodePtr node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasNsProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *nameSpace); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlAttrPtr XMLCALL + xmlSetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN xmlChar * XMLCALL + xmlGetNsProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *nameSpace); +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringGetNodeList (xmlDocPtr doc, + const xmlChar *value); +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringLenGetNodeList (xmlDocPtr doc, + const xmlChar *value, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeListGetString (xmlDocPtr doc, + xmlNodePtr list, + int inLine); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlChar * XMLCALL + xmlNodeListGetRawString (xmlDocPtr doc, + xmlNodePtr list, + int inLine); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlNodeSetContent (xmlNodePtr cur, + const xmlChar *content); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void XMLCALL + xmlNodeSetContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlNodeAddContent (xmlNodePtr cur, + const xmlChar *content); +XMLPUBFUN void XMLCALL + xmlNodeAddContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetContent (xmlNodePtr cur); +XMLPUBFUN int XMLCALL + xmlNodeBufGetContent (xmlBufferPtr buffer, + xmlNodePtr cur); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetLang (xmlNodePtr cur); +XMLPUBFUN int XMLCALL + xmlNodeGetSpacePreserve (xmlNodePtr cur); + +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetBase (xmlDocPtr doc, + xmlNodePtr cur); + +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void XMLCALL + xmlNodeSetLang (xmlNodePtr cur, + const xmlChar *lang); +XMLPUBFUN void XMLCALL + xmlNodeSetSpacePreserve (xmlNodePtr cur, + int val); +XMLPUBFUN void XMLCALL + xmlNodeSetBase (xmlNodePtr cur, + const xmlChar *uri); +/* + * Removing content. + */ +XMLPUBFUN int XMLCALL + xmlRemoveProp (xmlAttrPtr cur); +XMLPUBFUN int XMLCALL + xmlUnsetProp (xmlNodePtr node, + const xmlChar *name); +XMLPUBFUN int XMLCALL + xmlUnsetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name); +#endif /* LIBXML_TREE_ENABLED */ + +/* + * Internal, don't use. + */ +XMLPUBFUN void XMLCALL + xmlBufferWriteCHAR (xmlBufferPtr buf, + const xmlChar *string); +XMLPUBFUN void XMLCALL + xmlBufferWriteChar (xmlBufferPtr buf, + const char *string); +XMLPUBFUN void XMLCALL + xmlBufferWriteQuotedString(xmlBufferPtr buf, + const xmlChar *string); + +XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, + xmlDocPtr doc, + xmlAttrPtr attr, + const xmlChar *string); + +/* + * Namespace handling. + */ +XMLPUBFUN int XMLCALL + xmlReconciliateNs (xmlDocPtr doc, + xmlNodePtr tree); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Saving. + */ +XMLPUBFUN void XMLCALL + xmlDocDumpFormatMemory (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); +XMLPUBFUN void XMLCALL + xmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN void XMLCALL + xmlDocDumpMemoryEnc (xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding); +XMLPUBFUN void XMLCALL + xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding, + int format); + +#ifndef XMLENGINE_EXCLUDE_FILE_FUNC +XMLPUBFUN int XMLCALL + xmlDocFormatDump (FILE *f, + xmlDocPtr cur, + int format); + +XMLPUBFUN int XMLCALL + xmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN void XMLCALL + xmlElemDump (FILE *f, + xmlDocPtr doc, + xmlNodePtr cur); +#endif /* XMLENGINE_EXCLUDE_FILE_FUNC */ + +XMLPUBFUN int XMLCALL + xmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + xmlSaveFormatFile (const char *filename, + xmlDocPtr cur, + int format); +XMLPUBFUN int XMLCALL + xmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); + +XMLPUBFUN int XMLCALL + xmlSaveFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int XMLCALL + xmlSaveFormatFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN void XMLCALL + xmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format, + const char *encoding); + +XMLPUBFUN int XMLCALL + xmlSaveFormatFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN int XMLCALL + xmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * XHTML + */ +XMLPUBFUN int XMLCALL xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID); + +/* + * Compression. + */ +XMLPUBFUN void XMLCALL xmlSetDocCompressMode(xmlDocPtr doc, int mode); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL xmlGetDocCompressMode(xmlDocPtr doc); +XMLPUBFUN int XMLCALL xmlGetCompressMode(void); +XMLPUBFUN void XMLCALL xmlSetCompressMode(int mode); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +#ifdef __cplusplus +} +#endif + +#endif /* XML_TREE_H */ + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_uri.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_uri.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,91 @@ +/* + * Summary: library of generic URI related routines + * Description: library of generic URI related routines + * Implements RFC 2396 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_URI_H +#define XML_URI_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlURI: + * + * A parsed URI reference. This is a struct containing the various fields + * as described in RFC 2396 but separated for further processing. + */ +typedef struct _xmlURI xmlURI; +typedef xmlURI *xmlURIPtr; +struct _xmlURI { + char *scheme; /* the URI scheme */ + char *opaque; /* opaque part */ + char *authority; /* the authority part */ + char *server; /* the server part */ + char *user; /* the user part */ + int port; /* the port number */ + char *path; /* the path string */ + char *query; /* the query string */ + char *fragment; /* the fragment identifier */ + int cleanup; /* parsing potentially unclean URI */ +}; + +/* + * This function is in tree.h: + * xmlChar * xmlNodeGetBase (xmlDocPtr doc, + * xmlNodePtr cur); + */ +XMLPUBFUN xmlURIPtr XMLCALL + xmlCreateURI (void); +XMLPUBFUN xmlChar * XMLCALL + xmlBuildURI (const xmlChar *URI, + const xmlChar *base); +XMLPUBFUN xmlURIPtr XMLCALL + xmlParseURI (const char *str); +XMLPUBFUN int XMLCALL + xmlParseURIReference (xmlURIPtr uri, + const char *str); +XMLPUBFUN xmlChar * XMLCALL + xmlSaveUri (xmlURIPtr uri); + +#ifndef XMLENGINE_EXCLUDE_FILE_FUNC +XMLPUBFUN void XMLCALL + xmlPrintURI (FILE *stream, + xmlURIPtr uri); +#endif + +XMLPUBFUN xmlChar * XMLCALL + xmlURIEscapeStr (const xmlChar *str, + const xmlChar *list); +XMLPUBFUN char * XMLCALL + xmlURIUnescapeString (const char *str, + int len, + char *target); +XMLPUBFUN int XMLCALL + xmlNormalizeURIPath (char *path); +XMLPUBFUN xmlChar * XMLCALL + xmlURIEscape (const xmlChar *str); +XMLPUBFUN void XMLCALL + xmlFreeURI (xmlURIPtr uri); +XMLPUBFUN xmlChar* XMLCALL + xmlCanonicPath (const xmlChar *path); + +#ifdef __cplusplus +} +#endif +#endif /* XML_URI_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_valid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_valid.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,421 @@ +/* + * Summary: The DTD validation + * Description: API for the DTD handling and the validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_VALID_H +#define XML_VALID_H + +#include +#include +#include + +#ifdef LIBXML_AUTOMATA_ENABLED +#include "libxml2_xmlautomata.h" +#endif + +#ifdef LIBXML_REGEXP_ENABLED +#include "libxml2_xmlregexp.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Validation state added for non-determinist content model. + */ +typedef struct _xmlValidState xmlValidState; +typedef xmlValidState *xmlValidStatePtr; + +/** + * xmlValidityErrorFunc: + * @param ctx an xmlValidCtxtPtr validity error context + * @param msg the string to format *printf like vararg + * @param # remaining arguments to the format + * + * Callback called when a validity error is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityErrorFunc) (void *ctx, + const char *msg, + ...); + +/** + * xmlValidityWarningFunc: + * @param ctx an xmlValidCtxtPtr validity error context + * @param msg the string to format *printf like vararg + * @param # remaining arguments to the format + * + * Callback called when a validity warning is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityWarningFunc) (void *ctx, + const char *msg, + ...); + +/* + * xmlValidCtxt: + * An xmlValidCtxt is used for error reporting when validating. + */ +typedef struct _xmlValidCtxt xmlValidCtxt; +typedef xmlValidCtxt *xmlValidCtxtPtr; +struct _xmlValidCtxt { + void *userData; /* user specific data block */ + xmlValidityErrorFunc error; /* the callback in case of errors */ + xmlValidityWarningFunc warning; /* the callback in case of warning */ + + /* Node analysis stack used when validating within entities */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr* nodeTab; /* array of nodes */ + + int finishDtd; /* finished validating the Dtd ? */ + xmlDocPtr doc; /* the document */ + int valid; /* temporary validity check result */ + + /* state state used for non-determinist content validation */ + xmlValidState* vstate; /* current state */ + int vstateNr; /* Depth of the validation stack */ + int vstateMax; /* Max depth of the validation stack */ + xmlValidState* vstateTab; /* array of validation states */ + +#ifdef LIBXML_REGEXP_ENABLED + xmlAutomataPtr am; /* the automata */ + xmlAutomataStatePtr state; /* used to build the automata */ +#else + void *am; + void *state; +#endif +}; + +/* + * ALL notation declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlNotationTable; +typedef xmlNotationTable *xmlNotationTablePtr; + +/* + * ALL element declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlElementTable; +typedef xmlElementTable *xmlElementTablePtr; + +/* + * ALL attribute declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlAttributeTable; +typedef xmlAttributeTable *xmlAttributeTablePtr; + +/* + * ALL IDs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlIDTable; +typedef xmlIDTable *xmlIDTablePtr; + +/* + * ALL Refs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlRefTable; +typedef xmlRefTable *xmlRefTablePtr; + +/* Allocate/Release Validation Contexts */ +XMLPUBFUN xmlValidCtxtPtr XMLCALL + xmlNewValidCtxt(void); +XMLPUBFUN void XMLCALL + xmlFreeValidCtxt(xmlValidCtxtPtr); + +/* Notation */ +XMLPUBFUN xmlNotationPtr XMLCALL + xmlAddNotationDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *PublicID, + const xmlChar *SystemID); +XMLPUBFUN xmlNotationTablePtr XMLCALL + xmlCopyNotationTable (xmlNotationTablePtr table); +XMLPUBFUN void XMLCALL + xmlFreeNotationTable (xmlNotationTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpNotationDecl (xmlBufferPtr buf, + xmlNotationPtr nota); +XMLPUBFUN void XMLCALL + xmlDumpNotationTable (xmlBufferPtr buf, + xmlNotationTablePtr table); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Element Content */ +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlNewElementContent (const xmlChar *name, + xmlElementContentType type); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlCopyElementContent (xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + xmlFreeElementContent (xmlElementContentPtr cur); +XMLPUBFUN void XMLCALL + xmlSnprintfElementContent(char *buf, + int size, + xmlElementContentPtr content, + int glob); +/* DEPRECATED */ +XMLPUBFUN void XMLCALL + xmlSprintfElementContent(char *buf, + xmlElementContentPtr content, + int glob); +/* DEPRECATED */ + +/* Element */ +XMLPUBFUN xmlElementPtr XMLCALL + xmlAddElementDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + xmlElementTypeVal type, + xmlElementContentPtr content); +XMLPUBFUN xmlElementTablePtr XMLCALL + xmlCopyElementTable (xmlElementTablePtr table); +XMLPUBFUN void XMLCALL + xmlFreeElementTable (xmlElementTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpElementTable (xmlBufferPtr buf, + xmlElementTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpElementDecl (xmlBufferPtr buf, + xmlElementPtr elem); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Enumeration */ +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlCreateEnumeration (const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlFreeEnumeration (xmlEnumerationPtr cur); +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlCopyEnumeration (xmlEnumerationPtr cur); + +/* Attribute */ +XMLPUBFUN xmlAttributePtr XMLCALL + xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *ns, + xmlAttributeType type, + xmlAttributeDefault def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN xmlAttributeTablePtr XMLCALL + xmlCopyAttributeTable (xmlAttributeTablePtr table); +XMLPUBFUN void XMLCALL + xmlFreeAttributeTable (xmlAttributeTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpAttributeTable (xmlBufferPtr buf, + xmlAttributeTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpAttributeDecl (xmlBufferPtr buf, + xmlAttributePtr attr); +#endif /* LIBXML_OUTPUT_ENABLED */ + +XMLPUBFUN xmlIDPtr XMLCALL + xmlAddID (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XMLPUBFUN void XMLCALL + xmlFreeIDTable (xmlIDTablePtr table); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlGetID (xmlDocPtr doc, + const xmlChar *ID); +XMLPUBFUN int XMLCALL + xmlIsID (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XMLPUBFUN int XMLCALL + xmlRemoveID (xmlDocPtr doc, + xmlAttrPtr attr); + + +/* IDREFs */ +XMLPUBFUN xmlRefPtr XMLCALL + xmlAddRef (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XMLPUBFUN void XMLCALL + xmlFreeRefTable (xmlRefTablePtr table); +XMLPUBFUN int XMLCALL + xmlIsRef (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XMLPUBFUN int XMLCALL + xmlRemoveRef (xmlDocPtr doc, + xmlAttrPtr attr); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN xmlListPtr XMLCALL + xmlGetRefs (xmlDocPtr doc, const xmlChar *ID); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * The public function calls related to validity checking. + */ + +XMLPUBFUN int XMLCALL + xmlValidateRoot (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateElementDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlElementPtr elem); +XMLPUBFUN xmlChar * XMLCALL + xmlValidNormalizeAttributeValue(xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlChar * XMLCALL + xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlAttributePtr attr); +XMLPUBFUN int XMLCALL + xmlValidateAttributeValue(xmlAttributeType type, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNotationPtr nota); +XMLPUBFUN int XMLCALL + xmlValidateDtd (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlDtdPtr dtd); +XMLPUBFUN int XMLCALL + xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateDocument (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlValidateOneElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *prefix, + xmlNsPtr ns, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateNotationUse (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *notationName); +XMLPUBFUN int XMLCALL + xmlIsMixedElement (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr XMLCALL + xmlGetDtdAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr XMLCALL + xmlGetDtdQAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlNotationPtr XMLCALL + xmlGetDtdNotationDesc (xmlDtdPtr dtd, + const xmlChar *name); +XMLPUBFUN xmlElementPtr XMLCALL + xmlGetDtdQElementDesc (xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlElementPtr XMLCALL + xmlGetDtdElementDesc (xmlDtdPtr dtd, + const xmlChar *name); + +XMLPUBFUN int XMLCALL + xmlValidGetValidElements(xmlNode *prev, + xmlNode *next, + const xmlChar **names, + int max); +XMLPUBFUN int XMLCALL + xmlValidGetPotentialChildren(xmlElementContent *ctree, + const xmlChar **list, + int *len, + int max); +XMLPUBFUN int XMLCALL + xmlValidateNameValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNamesValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNmtokenValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNmtokensValue(const xmlChar *value); + +#ifdef LIBXML_REGEXP_ENABLED +/* + * Validation based on the regexp support + */ +XMLPUBFUN int XMLCALL + xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, + xmlElementPtr elem); + +XMLPUBFUN int XMLCALL + xmlValidatePushElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +XMLPUBFUN int XMLCALL + xmlValidatePushCData (xmlValidCtxtPtr ctxt, + const xmlChar *data, + int len); +XMLPUBFUN int XMLCALL + xmlValidatePopElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +#endif /* LIBXML_REGEXP_ENABLED */ +#ifdef __cplusplus +} +#endif +#endif /* XML_VALID_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xinclude.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xinclude.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,121 @@ +/* + * Summary: implementation of XInclude + * Description: API to handle XInclude processing, + * implements the + * World Wide Web Consortium Last Call WorkingDraft 10 November 2003 + * http://www.w3.org/TR/2003/WD-xinclude-20031110 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XINCLUDE_H +#define XML_XINCLUDE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XINCLUDE_NS: + * + * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude + */ +#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" +/** + * XINCLUDE_OLD_NS: + * + * Macro defining the draftXinclude namespace: http://www.w3.org/2001/XInclude + */ +#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" +/** + * XINCLUDE_NODE: + * + * Macro defining "include" + */ +#define XINCLUDE_NODE (const xmlChar *) "include" +/** + * XINCLUDE_FALLBACK: + * + * Macro defining "fallback" + */ +#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" +/** + * XINCLUDE_HREF: + * + * Macro defining "href" + */ +#define XINCLUDE_HREF (const xmlChar *) "href" +/** + * XINCLUDE_PARSE: + * + * Macro defining "parse" + */ +#define XINCLUDE_PARSE (const xmlChar *) "parse" +/** + * XINCLUDE_PARSE_XML: + * + * Macro defining "xml" + */ +#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" +/** + * XINCLUDE_PARSE_TEXT: + * + * Macro defining "text" + */ +#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" +/** + * XINCLUDE_PARSE_ENCODING: + * + * Macro defining "encoding" + */ +#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" +/** + * XINCLUDE_PARSE_XPOINTER: + * + * Macro defining "xpointer" + */ +#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" + +typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; +typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; + +/* + * standalone processing + */ +XMLPUBFUN int XMLCALL + xmlXIncludeProcess (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessFlags (xmlDocPtr doc, + int flags); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTree (xmlNodePtr tree); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTreeFlags(xmlNodePtr tree, + int flags); +/* + * contextual processing + */ +XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL + xmlXIncludeNewContext (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, + int flags); +XMLPUBFUN void XMLCALL + xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, + xmlNodePtr tree); +#ifdef __cplusplus +} +#endif +#endif /* XML_XINCLUDE_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xlink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xlink.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,189 @@ +/* + * Summary: unfinished XLink detection module + * Description: unfinished XLink detection module + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XLINK_H +#define XML_XLINK_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +/** + * Various defines for the various Link properties. + * + * NOTE: the link detection layer will try to resolve QName expansion + * of namespaces. If "foo" is the prefix for "http://foo.com/" + * then the link detection layer will expand role="foo:myrole" + * to "http://foo.com/:myrole". + * NOTE: the link detection layer will expand URI-Refences found on + * href attributes by using the base mechanism if found. + */ +typedef xmlChar *xlinkHRef; +typedef xmlChar *xlinkRole; +typedef xmlChar *xlinkTitle; + +typedef enum { + XLINK_TYPE_NONE = 0, + XLINK_TYPE_SIMPLE, + XLINK_TYPE_EXTENDED, + XLINK_TYPE_EXTENDED_SET +} xlinkType; + +typedef enum { + XLINK_SHOW_NONE = 0, + XLINK_SHOW_NEW, + XLINK_SHOW_EMBED, + XLINK_SHOW_REPLACE +} xlinkShow; + +typedef enum { + XLINK_ACTUATE_NONE = 0, + XLINK_ACTUATE_AUTO, + XLINK_ACTUATE_ONREQUEST +} xlinkActuate; + +/** + * xlinkNodeDetectFunc: + * @param ctx user data pointer + * @param node the node to check + * + * This is the prototype for the link detection routine. + * It calls the default link detection callbacks upon link detection. + */ +typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); + +/* + * The link detection module interact with the upper layers using + * a set of callback registered at parsing time. + */ + +/** + * xlinkSimpleLinkFunk: + * @param ctx user data pointer + * @param node the node carrying the link + * @param href the target of the link + * @param role the role string + * @param title the link title + * + * This is the prototype for a simple link detection callback. + */ +typedef void +(*xlinkSimpleLinkFunk) (void *ctx, + xmlNodePtr node, + const xlinkHRef href, + const xlinkRole role, + const xlinkTitle title); + +/** + * xlinkExtendedLinkFunk: + * @param ctx user data pointer + * @param node the node carrying the link + * @param nbLocators the number of locators detected on the link + * @param hrefs pointer to the array of locator hrefs + * @param roles pointer to the array of locator roles + * @param nbArcs the number of arcs detected on the link + * @param from pointer to the array of source roles found on the arcs + * @param to pointer to the array of target roles found on the arcs + * @param show array of values for the show attributes found on the arcs + * @param actuate array of values for the actuate attributes found on the arcs + * @param nbTitles the number of titles detected on the link + * @param title array of titles detected on the link + * @param langs array of xml:lang values for the titles + * + * This is the prototype for a extended link detection callback. + */ +typedef void +(*xlinkExtendedLinkFunk)(void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbArcs, + const xlinkRole *from, + const xlinkRole *to, + xlinkShow *show, + xlinkActuate *actuate, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * xlinkExtendedLinkSetFunk: + * @param ctx user data pointer + * @param node the node carrying the link + * @param nbLocators the number of locators detected on the link + * @param hrefs pointer to the array of locator hrefs + * @param roles pointer to the array of locator roles + * @param nbTitles the number of titles detected on the link + * @param title array of titles detected on the link + * @param langs array of xml:lang values for the titles + * + * This is the prototype for a extended link set detection callback. + */ +typedef void +(*xlinkExtendedLinkSetFunk) (void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * This is the structure containing a set of Links detection callbacks. + * + * There is no default xlink callbacks, if one want to get link + * recognition activated, those call backs must be provided before parsing. + */ +typedef struct _xlinkHandler xlinkHandler; +typedef xlinkHandler *xlinkHandlerPtr; +struct _xlinkHandler { + xlinkSimpleLinkFunk simple; + xlinkExtendedLinkFunk extended; + xlinkExtendedLinkSetFunk set; +}; + +/* + * The default detection routine, can be overridden, they call the default + * detection callbacks. + */ + +XMLPUBFUN xlinkNodeDetectFunc XMLCALL + xlinkGetDefaultDetect (void); +XMLPUBFUN void XMLCALL + xlinkSetDefaultDetect (xlinkNodeDetectFunc func); + +/* + * Routines to set/get the default handlers. + */ +XMLPUBFUN xlinkHandlerPtr XMLCALL + xlinkGetDefaultHandler (void); +XMLPUBFUN void XMLCALL + xlinkSetDefaultHandler (xlinkHandlerPtr handler); + +/* + * Link detection module itself. + */ +XMLPUBFUN xlinkType XMLCALL + xlinkIsLink (xmlDocPtr doc, + xmlNodePtr node); + +#ifdef __cplusplus +} +#endif +#endif /* XML_XLINK_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlerror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlerror.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,679 @@ +/* + * Summary: error handling + * Description: the API used to report errors + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_ERROR_H +#define XML_ERROR_H + +typedef struct _xmlParserInput xmlParserInput; +typedef xmlParserInput *xmlParserInputPtr; + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlErrorLevel: + * + * Indicates the level of an error + */ +typedef enum { + XML_ERR_NONE = 0, + XML_ERR_WARNING = 1, /* A simple warning */ + XML_ERR_ERROR = 2, /* A recoverable error */ + XML_ERR_FATAL = 3 /* A fatal error */ +} xmlErrorLevel; + +/** + * xmlErrorDomain: + * + * Indicates where an error may have come from + */ +typedef enum { + XML_FROM_NONE = 0, + XML_FROM_PARSER, /* The XML parser */ + XML_FROM_TREE, /* The tree module */ + XML_FROM_NAMESPACE, /* The XML Namespace module */ + XML_FROM_DTD, /* The XML DTD validation with parser context*/ + XML_FROM_HTML, /* The HTML parser */ + XML_FROM_MEMORY, /* The memory allocator */ + XML_FROM_OUTPUT, /* The serialization code */ + XML_FROM_IO, /* The Input/Output stack */ + XML_FROM_FTP, /* The FTP module */ + XML_FROM_HTTP, /* The FTP module */ + XML_FROM_XINCLUDE, /* The XInclude processing */ + XML_FROM_XPATH, /* The XPath module */ + XML_FROM_XPOINTER, /* The XPointer module */ + XML_FROM_REGEXP, /* The regular expressions module */ + XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ + XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ + XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ + XML_FROM_RELAXNGP, /* The Relax-NG parser module */ + XML_FROM_RELAXNGV, /* The Relax-NG validator module */ + XML_FROM_CATALOG, /* The Catalog module */ + XML_FROM_C14N, /* The Canonicalization module */ + XML_FROM_XSLT, /* The XSLT engine from libxslt */ + XML_FROM_VALID /* The XML DTD validation with valid context */ +} xmlErrorDomain; + +/** + * xmlError: + * + * An XML Error instance. + */ +typedef struct _xmlError xmlError; +typedef xmlError *xmlErrorPtr; + +struct _xmlError { + int domain; /* What part of the library raised this error */ + int code; /* The error code, e.g. an xmlParserError */ + char *message;/* human-readable informative error message */ + xmlErrorLevel level;/* how consequent is the error */ + char *file; /* the filename */ +#ifdef LIBXML_ENABLE_NODE_LINEINFO + int line; /* the line number if available */ +#endif + char *str1; /* extra string information */ + char *str2; /* extra string information */ + char *str3; /* extra string information */ + int int1; /* extra number information */ + int int2; /* extra number information */ + void *ctxt; /* the parser context if available */ + void *node; /* the node in the tree */ +}; + +/** + * xmlParserError: + * + * This is an error that the XML (or HTML) parser can generate + */ +typedef enum { + XML_ERR_OK = 0, + XML_ERR_INTERNAL_ERROR, /* 1 */ + XML_ERR_NO_MEMORY, /* 2 */ + XML_ERR_DOCUMENT_START, /* 3 */ + XML_ERR_DOCUMENT_EMPTY, /* 4 */ + XML_ERR_DOCUMENT_END, /* 5 */ + XML_ERR_INVALID_HEX_CHARREF, /* 6 */ + XML_ERR_INVALID_DEC_CHARREF, /* 7 */ + XML_ERR_INVALID_CHARREF, /* 8 */ + XML_ERR_INVALID_CHAR, /* 9 */ + XML_ERR_CHARREF_AT_EOF, /* 10 */ + XML_ERR_CHARREF_IN_PROLOG, /* 11 */ + XML_ERR_CHARREF_IN_EPILOG, /* 12 */ + XML_ERR_CHARREF_IN_DTD, /* 13 */ + XML_ERR_ENTITYREF_AT_EOF, /* 14 */ + XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ + XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ + XML_ERR_ENTITYREF_IN_DTD, /* 17 */ + XML_ERR_PEREF_AT_EOF, /* 18 */ + XML_ERR_PEREF_IN_PROLOG, /* 19 */ + XML_ERR_PEREF_IN_EPILOG, /* 20 */ + XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ + XML_ERR_ENTITYREF_NO_NAME, /* 22 */ + XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ + XML_ERR_PEREF_NO_NAME, /* 24 */ + XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ + XML_ERR_UNDECLARED_ENTITY, /* 26 */ + XML_WAR_UNDECLARED_ENTITY, /* 27 */ + XML_ERR_UNPARSED_ENTITY, /* 28 */ + XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ + XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ + XML_ERR_UNKNOWN_ENCODING, /* 31 */ + XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ + XML_ERR_STRING_NOT_STARTED, /* 33 */ + XML_ERR_STRING_NOT_CLOSED, /* 34 */ + XML_ERR_NS_DECL_ERROR, /* 35 */ + XML_ERR_ENTITY_NOT_STARTED, /* 36 */ + XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ + XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ + XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ + XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ + XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ + XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ + XML_ERR_LITERAL_NOT_STARTED, /* 43 */ + XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ + XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ + XML_ERR_PI_NOT_STARTED, /* 46 */ + XML_ERR_PI_NOT_FINISHED, /* 47 */ + XML_ERR_NOTATION_NOT_STARTED, /* 48 */ + XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ + XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ + XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ + XML_ERR_MIXED_NOT_STARTED, /* 52 */ + XML_ERR_MIXED_NOT_FINISHED, /* 53 */ + XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ + XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ + XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ + XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ + XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ + XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ + XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ + XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ + XML_ERR_MISPLACED_CDATA_END, /* 62 */ + XML_ERR_CDATA_NOT_FINISHED, /* 63 */ + XML_ERR_RESERVED_XML_NAME, /* 64 */ + XML_ERR_SPACE_REQUIRED, /* 65 */ + XML_ERR_SEPARATOR_REQUIRED, /* 66 */ + XML_ERR_NMTOKEN_REQUIRED, /* 67 */ + XML_ERR_NAME_REQUIRED, /* 68 */ + XML_ERR_PCDATA_REQUIRED, /* 69 */ + XML_ERR_URI_REQUIRED, /* 70 */ + XML_ERR_PUBID_REQUIRED, /* 71 */ + XML_ERR_LT_REQUIRED, /* 72 */ + XML_ERR_GT_REQUIRED, /* 73 */ + XML_ERR_LTSLASH_REQUIRED, /* 74 */ + XML_ERR_EQUAL_REQUIRED, /* 75 */ + XML_ERR_TAG_NAME_MISMATCH, /* 76 */ + XML_ERR_TAG_NOT_FINISHED, /* 77 */ + XML_ERR_STANDALONE_VALUE, /* 78 */ + XML_ERR_ENCODING_NAME, /* 79 */ + XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ + XML_ERR_INVALID_ENCODING, /* 81 */ + XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ + XML_ERR_CONDSEC_INVALID, /* 83 */ + XML_ERR_VALUE_REQUIRED, /* 84 */ + XML_ERR_NOT_WELL_BALANCED, /* 85 */ + XML_ERR_EXTRA_CONTENT, /* 86 */ + XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ + XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ + XML_ERR_ENTITY_LOOP, /* 89 */ + XML_ERR_ENTITY_BOUNDARY, /* 90 */ + XML_ERR_INVALID_URI, /* 91 */ + XML_ERR_URI_FRAGMENT, /* 92 */ + XML_WAR_CATALOG_PI, /* 93 */ + XML_ERR_NO_DTD, /* 94 */ + XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ + XML_ERR_VERSION_MISSING, /* 96 */ + XML_WAR_UNKNOWN_VERSION, /* 97 */ + XML_WAR_LANG_VALUE, /* 98 */ + XML_WAR_NS_URI, /* 99 */ + XML_WAR_NS_URI_RELATIVE, /* 100 */ + XML_ERR_MISSING_ENCODING, /* 101 */ + XML_NS_ERR_XML_NAMESPACE = 200, + XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ + XML_NS_ERR_QNAME, /* 202 */ + XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ + XML_DTD_ATTRIBUTE_DEFAULT = 500, + XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ + XML_DTD_ATTRIBUTE_VALUE, /* 502 */ + XML_DTD_CONTENT_ERROR, /* 503 */ + XML_DTD_CONTENT_MODEL, /* 504 */ + XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ + XML_DTD_DIFFERENT_PREFIX, /* 506 */ + XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ + XML_DTD_ELEM_NAMESPACE, /* 508 */ + XML_DTD_ELEM_REDEFINED, /* 509 */ + XML_DTD_EMPTY_NOTATION, /* 510 */ + XML_DTD_ENTITY_TYPE, /* 511 */ + XML_DTD_ID_FIXED, /* 512 */ + XML_DTD_ID_REDEFINED, /* 513 */ + XML_DTD_ID_SUBSET, /* 514 */ + XML_DTD_INVALID_CHILD, /* 515 */ + XML_DTD_INVALID_DEFAULT, /* 516 */ + XML_DTD_LOAD_ERROR, /* 517 */ + XML_DTD_MISSING_ATTRIBUTE, /* 518 */ + XML_DTD_MIXED_CORRUPT, /* 519 */ + XML_DTD_MULTIPLE_ID, /* 520 */ + XML_DTD_NO_DOC, /* 521 */ + XML_DTD_NO_DTD, /* 522 */ + XML_DTD_NO_ELEM_NAME, /* 523 */ + XML_DTD_NO_PREFIX, /* 524 */ + XML_DTD_NO_ROOT, /* 525 */ + XML_DTD_NOTATION_REDEFINED, /* 526 */ + XML_DTD_NOTATION_VALUE, /* 527 */ + XML_DTD_NOT_EMPTY, /* 528 */ + XML_DTD_NOT_PCDATA, /* 529 */ + XML_DTD_NOT_STANDALONE, /* 530 */ + XML_DTD_ROOT_NAME, /* 531 */ + XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ + XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ + XML_DTD_UNKNOWN_ELEM, /* 534 */ + XML_DTD_UNKNOWN_ENTITY, /* 535 */ + XML_DTD_UNKNOWN_ID, /* 536 */ + XML_DTD_UNKNOWN_NOTATION, /* 537 */ + XML_DTD_STANDALONE_DEFAULTED, /* 538 */ + XML_DTD_XMLID_VALUE, /* 539 */ + XML_DTD_XMLID_TYPE, /* 540 */ + XML_HTML_STRUCURE_ERROR = 800, + XML_HTML_UNKNOWN_TAG, /* 801 */ + XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, + XML_RNGP_ATTR_CONFLICT, /* 1001 */ + XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ + XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ + XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ + XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ + XML_RNGP_CHOICE_CONTENT, /* 1006 */ + XML_RNGP_CHOICE_EMPTY, /* 1007 */ + XML_RNGP_CREATE_FAILURE, /* 1008 */ + XML_RNGP_DATA_CONTENT, /* 1009 */ + XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ + XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ + XML_RNGP_DEFINE_EMPTY, /* 1012 */ + XML_RNGP_DEFINE_MISSING, /* 1013 */ + XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ + XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ + XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ + XML_RNGP_ELEMENT_EMPTY, /* 1017 */ + XML_RNGP_ELEMENT_CONTENT, /* 1018 */ + XML_RNGP_ELEMENT_NAME, /* 1019 */ + XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ + XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ + XML_RNGP_EMPTY, /* 1022 */ + XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ + XML_RNGP_EMPTY_CONTENT, /* 1024 */ + XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ + XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ + XML_RNGP_EXCEPT_EMPTY, /* 1027 */ + XML_RNGP_EXCEPT_MISSING, /* 1028 */ + XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ + XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ + XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ + XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ + XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ + XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ + XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ + XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ + XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ + XML_RNGP_GRAMMAR_MISSING, /* 1038 */ + XML_RNGP_GRAMMAR_NO_START, /* 1039 */ + XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ + XML_RNGP_HREF_ERROR, /* 1041 */ + XML_RNGP_INCLUDE_EMPTY, /* 1042 */ + XML_RNGP_INCLUDE_FAILURE, /* 1043 */ + XML_RNGP_INCLUDE_RECURSE, /* 1044 */ + XML_RNGP_INTERLEAVE_ADD, /* 1045 */ + XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ + XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ + XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ + XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ + XML_RNGP_INVALID_URI, /* 1050 */ + XML_RNGP_INVALID_VALUE, /* 1051 */ + XML_RNGP_MISSING_HREF, /* 1052 */ + XML_RNGP_NAME_MISSING, /* 1053 */ + XML_RNGP_NEED_COMBINE, /* 1054 */ + XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ + XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ + XML_RNGP_NSNAME_NO_NS, /* 1057 */ + XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ + XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ + XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ + XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ + XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ + XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ + XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ + XML_RNGP_PARSE_ERROR, /* 1065 */ + XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME,/* 1066 */ + XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ + XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ + XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ + XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ + XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ + XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ + XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE,/* 1073 */ + XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ + XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ + XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ + XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ + XML_RNGP_PAT_LIST_ATTR, /* 1078 */ + XML_RNGP_PAT_LIST_ELEM, /* 1079 */ + XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ + XML_RNGP_PAT_LIST_LIST, /* 1081 */ + XML_RNGP_PAT_LIST_REF, /* 1082 */ + XML_RNGP_PAT_LIST_TEXT, /* 1083 */ + XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ + XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ + XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ + XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR,/* 1087 */ + XML_RNGP_PAT_START_ATTR, /* 1088 */ + XML_RNGP_PAT_START_DATA, /* 1089 */ + XML_RNGP_PAT_START_EMPTY, /* 1090 */ + XML_RNGP_PAT_START_GROUP, /* 1091 */ + XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ + XML_RNGP_PAT_START_LIST, /* 1093 */ + XML_RNGP_PAT_START_ONEMORE, /* 1094 */ + XML_RNGP_PAT_START_TEXT, /* 1095 */ + XML_RNGP_PAT_START_VALUE, /* 1096 */ + XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ + XML_RNGP_REF_CREATE_FAILED, /* 1098 */ + XML_RNGP_REF_CYCLE, /* 1099 */ + XML_RNGP_REF_NAME_INVALID, /* 1100 */ + XML_RNGP_REF_NO_DEF, /* 1101 */ + XML_RNGP_REF_NO_NAME, /* 1102 */ + XML_RNGP_REF_NOT_EMPTY, /* 1103 */ + XML_RNGP_START_CHOICE_AND_INTERLEAVE,/* 1104 */ + XML_RNGP_START_CONTENT, /* 1105 */ + XML_RNGP_START_EMPTY, /* 1106 */ + XML_RNGP_START_MISSING, /* 1107 */ + XML_RNGP_TEXT_EXPECTED, /* 1108 */ + XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ + XML_RNGP_TYPE_MISSING, /* 1110 */ + XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ + XML_RNGP_TYPE_VALUE, /* 1112 */ + XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ + XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ + XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ + XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ + XML_RNGP_URI_FRAGMENT, /* 1117 */ + XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ + XML_RNGP_VALUE_EMPTY, /* 1119 */ + XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ + XML_RNGP_XMLNS_NAME, /* 1121 */ + XML_RNGP_XML_NS, /* 1122 */ + XML_XPATH_EXPRESSION_OK = 1200, + XML_XPATH_NUMBER_ERROR, /* 1201 */ + XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ + XML_XPATH_START_LITERAL_ERROR, /* 1203 */ + XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ + XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ + XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ + XML_XPATH_EXPR_ERROR, /* 1207 */ + XML_XPATH_UNCLOSED_ERROR, /* 1208 */ + XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ + XML_XPATH_INVALID_OPERAND, /* 1210 */ + XML_XPATH_INVALID_TYPE, /* 1211 */ + XML_XPATH_INVALID_ARITY, /* 1212 */ + XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ + XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ + XML_XPATH_MEMORY_ERROR, /* 1215 */ + XML_XPTR_SYNTAX_ERROR, /* 1216 */ + XML_XPTR_RESOURCE_ERROR, /* 1217 */ + XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ + XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ + XML_XPATH_ENCODING_ERROR, /* 1220 */ + XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ + XML_TREE_INVALID_HEX = 1300, + XML_TREE_INVALID_DEC, /* 1301 */ + XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ + XML_SAVE_NOT_UTF8 = 1400, + XML_SAVE_CHAR_INVALID, /* 1401 */ + XML_SAVE_NO_DOCTYPE, /* 1402 */ + XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ + XML_REGEXP_COMPILE_ERROR = 1450, + XML_IO_UNKNOWN = 1500, + XML_IO_EACCES, /* 1501 */ + XML_IO_EAGAIN, /* 1502 */ + XML_IO_EBADF, /* 1503 */ + XML_IO_EBADMSG, /* 1504 */ + XML_IO_EBUSY, /* 1505 */ + XML_IO_ECANCELED, /* 1506 */ + XML_IO_ECHILD, /* 1507 */ + XML_IO_EDEADLK, /* 1508 */ + XML_IO_EDOM, /* 1509 */ + XML_IO_EEXIST, /* 1510 */ + XML_IO_EFAULT, /* 1511 */ + XML_IO_EFBIG, /* 1512 */ + XML_IO_EINPROGRESS, /* 1513 */ + XML_IO_EINTR, /* 1514 */ + XML_IO_EINVAL, /* 1515 */ + XML_IO_EIO, /* 1516 */ + XML_IO_EISDIR, /* 1517 */ + XML_IO_EMFILE, /* 1518 */ + XML_IO_EMLINK, /* 1519 */ + XML_IO_EMSGSIZE, /* 1520 */ + XML_IO_ENAMETOOLONG, /* 1521 */ + XML_IO_ENFILE, /* 1522 */ + XML_IO_ENODEV, /* 1523 */ + XML_IO_ENOENT, /* 1524 */ + XML_IO_ENOEXEC, /* 1525 */ + XML_IO_ENOLCK, /* 1526 */ + XML_IO_ENOMEM, /* 1527 */ + XML_IO_ENOSPC, /* 1528 */ + XML_IO_ENOSYS, /* 1529 */ + XML_IO_ENOTDIR, /* 1530 */ + XML_IO_ENOTEMPTY, /* 1531 */ + XML_IO_ENOTSUP, /* 1532 */ + XML_IO_ENOTTY, /* 1533 */ + XML_IO_ENXIO, /* 1534 */ + XML_IO_EPERM, /* 1535 */ + XML_IO_EPIPE, /* 1536 */ + XML_IO_ERANGE, /* 1537 */ + XML_IO_EROFS, /* 1538 */ + XML_IO_ESPIPE, /* 1539 */ + XML_IO_ESRCH, /* 1540 */ + XML_IO_ETIMEDOUT, /* 1541 */ + XML_IO_EXDEV, /* 1542 */ + XML_IO_NETWORK_ATTEMPT, /* 1543 */ + XML_IO_ENCODER, /* 1544 */ + XML_IO_FLUSH, /* 1545 */ + XML_IO_WRITE, /* 1546 */ + XML_IO_NO_INPUT, /* 1547 */ + XML_IO_BUFFER_FULL, /* 1548 */ + XML_IO_LOAD_ERROR, /* 1549 */ + XML_IO_ENOTSOCK, /* 1550 */ + XML_IO_EISCONN, /* 1551 */ + XML_IO_ECONNREFUSED, /* 1552 */ + XML_IO_ENETUNREACH, /* 1553 */ + XML_IO_EADDRINUSE, /* 1554 */ + XML_IO_EALREADY, /* 1555 */ + XML_IO_EAFNOSUPPORT, /* 1556 */ + XML_XINCLUDE_RECURSION = 1600, + XML_XINCLUDE_PARSE_VALUE, /* 1601 */ + XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ + XML_XINCLUDE_NO_HREF, /* 1603 */ + XML_XINCLUDE_NO_FALLBACK, /* 1604 */ + XML_XINCLUDE_HREF_URI, /* 1605 */ + XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ + XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ + XML_XINCLUDE_INVALID_CHAR, /* 1608 */ + XML_XINCLUDE_BUILD_FAILED, /* 1609 */ + XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ + XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ + XML_XINCLUDE_XPTR_FAILED, /* 1612 */ + XML_XINCLUDE_XPTR_RESULT, /* 1613 */ + XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ + XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ + XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE,/* 1616 */ + XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ + XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ + XML_CATALOG_MISSING_ATTR = 1650, + XML_CATALOG_ENTRY_BROKEN, /* 1651 */ + XML_CATALOG_PREFER_VALUE, /* 1652 */ + XML_CATALOG_NOT_CATALOG, /* 1653 */ + XML_CATALOG_RECURSION, /* 1654 */ + XML_SCHEMAP_PREFIX_UNDEFINED = 1700, + XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ + XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ + XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ + XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF,/* 1704 */ + XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ + XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ + XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ + XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ + XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ + XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ + XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI,/* 1711 */ + XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ + XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ + XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ + XML_SCHEMAP_INVALID_ENUM, /* 1715 */ + XML_SCHEMAP_INVALID_FACET, /* 1716 */ + XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ + XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ + XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ + XML_SCHEMAP_INVALID_REF_AND_SUBTYPE,/* 1720 */ + XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ + XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ + XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ + XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ + XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ + XML_SCHEMAP_RESTRICTION_NONAME_NOREF,/* 1726 */ + XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ + XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ + XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ + XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD,/* 1730 */ + XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ + XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ + XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP,/* 1733 */ + XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ + XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ + XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD,/* 1736 */ + XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ + XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ + XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD,/* 1739 */ + XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ + XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ + XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ + XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ + XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ + XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ + XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ + XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ + XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ + XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ + XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ + XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ + XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ + XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ + XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ + XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ + XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ + XML_SCHEMAP_FAILED_LOAD, /* 1756 */ + XML_SCHEMAP_NOTHING_TO_PARSE, /* 1757 */ + XML_SCHEMAP_NOROOT, /* 1758 */ + XML_SCHEMAP_REDEFINED_GROUP, /* 1759 */ + XML_SCHEMAP_REDEFINED_TYPE, /* 1760 */ + XML_SCHEMAP_REDEFINED_ELEMENT, /* 1761 */ + XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1762 */ + XML_SCHEMAP_REDEFINED_ATTR, /* 1763 */ + XML_SCHEMAP_REDEFINED_NOTATION, /* 1764 */ + XML_SCHEMAP_FAILED_PARSE, /* 1765 */ + XML_SCHEMAP_UNKNOWN_PREFIX, /* 1766 */ + XML_SCHEMAP_DEF_AND_PREFIX, /* 1767 */ + XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1768 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1769 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1770 */ + XML_SCHEMAP_NOT_SCHEMA, /* 1771 */ + XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1772 */ + XML_SCHEMAP_INVALID_ATTR_USE, /* 1773 */ + XML_SCHEMAP_RECURSIVE, /* 1774 */ + XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1775 */ + XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1776 */ + XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION,/* 1777 */ + XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1778 */ + XML_SCHEMAP_INVALID_ATTR_NAME, /* 1779 */ + XML_SCHEMAP_REF_AND_CONTENT, /* 1780 */ + XML_SCHEMAV_NOROOT = 1800, + XML_SCHEMAV_UNDECLAREDELEM, /* 1801 */ + XML_SCHEMAV_NOTTOPLEVEL, /* 1802 */ + XML_SCHEMAV_MISSING, /* 1803 */ + XML_SCHEMAV_WRONGELEM, /* 1804 */ + XML_SCHEMAV_NOTYPE, /* 1805 */ + XML_SCHEMAV_NOROLLBACK, /* 1806 */ + XML_SCHEMAV_ISABSTRACT, /* 1807 */ + XML_SCHEMAV_NOTEMPTY, /* 1808 */ + XML_SCHEMAV_ELEMCONT, /* 1809 */ + XML_SCHEMAV_HAVEDEFAULT, /* 1810 */ + XML_SCHEMAV_NOTNILLABLE, /* 1811 */ + XML_SCHEMAV_EXTRACONTENT, /* 1812 */ + XML_SCHEMAV_INVALIDATTR, /* 1813 */ + XML_SCHEMAV_INVALIDELEM, /* 1814 */ + XML_SCHEMAV_NOTDETERMINIST, /* 1815 */ + XML_SCHEMAV_CONSTRUCT, /* 1816 */ + XML_SCHEMAV_INTERNAL, /* 1817 */ + XML_SCHEMAV_NOTSIMPLE, /* 1818 */ + XML_SCHEMAV_ATTRUNKNOWN, /* 1819 */ + XML_SCHEMAV_ATTRINVALID, /* 1820 */ + XML_SCHEMAV_VALUE, /* 1821 */ + XML_SCHEMAV_FACET, /* 1822 */ + XML_XPTR_UNKNOWN_SCHEME = 1900, + XML_XPTR_CHILDSEQ_START, /* 1901 */ + XML_XPTR_EVAL_FAILED, /* 1902 */ + XML_XPTR_EXTRA_OBJECTS, /* 1903 */ + XML_C14N_CREATE_CTXT = 1950, + XML_C14N_REQUIRES_UTF8, /* 1951 */ + XML_C14N_CREATE_STACK, /* 1952 */ + XML_C14N_INVALID_NODE, /* 1953 */ + XML_FTP_PASV_ANSWER = 2000, + XML_FTP_EPSV_ANSWER, /* 2001 */ + XML_FTP_ACCNT, /* 2002 */ + XML_HTTP_URL_SYNTAX = 2020, + XML_HTTP_USE_IP, /* 2021 */ + XML_HTTP_UNKNOWN_HOST, /* 2022 */ + XML_ERR_STACK_LOW = 2030 + +} xmlParserErrors; + +/** + * xmlGenericErrorFunc: + * @param ctx a parsing context + * @param msg the message + * @param # the extra arguments of the varags to format the message + * + * Signature of the function to use when there is an error and + * no parsing or validity context available . + */ +typedef void (*xmlGenericErrorFunc) (void* ctx, const char *msg, ...); + +/** + * xmlStructuredErrorFunc: + * @param userData user provided data for the error callback + * @param error the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); + +/* + * Use the following function to reset the two global variables + * xmlGenericError and xmlGenericErrorContext. + */ +XMLPUBFUN void XMLCALL + xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); +XMLPUBFUN void XMLCALL + initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler); +XMLPUBFUN void XMLCALL + xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); + +/* + * Default message routines used by SAX and Valid context for error + * and warning reporting. + */ +XMLPUBFUN void XMLCALL + xmlParserError (void *ctx, const char *msg, ...); +XMLPUBFUN void XMLCALL + xmlParserWarning (void *ctx, const char *msg, ...); +XMLPUBFUN void XMLCALL + xmlParserValidityError (void *ctx, const char *msg, ...); +XMLPUBFUN void XMLCALL + xmlParserValidityWarning(void *ctx, const char *msg, ...); +XMLPUBFUN void XMLCALL + xmlParserPrintFileInfo (xmlParserInputPtr input); +XMLPUBFUN void XMLCALL + xmlParserPrintFileContext(xmlParserInputPtr input); + +/* + * Extended error information routines + */ +XMLPUBFUN xmlErrorPtr XMLCALL + xmlGetLastError (void); +XMLPUBFUN void XMLCALL + xmlResetLastError (void); +XMLPUBFUN xmlErrorPtr XMLCALL + xmlCtxtGetLastError (void *ctx); +XMLPUBFUN void XMLCALL + xmlCtxtResetLastError (void *ctx); +XMLPUBFUN void XMLCALL + xmlResetError (xmlErrorPtr err); +XMLPUBFUN int XMLCALL + xmlCopyError (xmlErrorPtr from, xmlErrorPtr to); + +#ifdef __cplusplus +} +#endif +#endif /* XML_ERROR_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlerror2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlerror2.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +/* + * Summary: error handling + * Description: the API used to report errors + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#ifndef LIBXML2_XMLERROR2_H_ + +#define LIBXML2_XMLERROR2_H_ + + + +#include + + + + + +#ifdef __cplusplus + +extern "C" { + +#endif + + + + + +//#ifdef IN_LIBXML + +/* + + * Internal callback reporting routine + + * @internalComponent + + * @prototype + + */ + +void XMLCALL + + __xmlRaiseError (xmlStructuredErrorFunc schannel, + + xmlGenericErrorFunc channel, + + void *data, + + void *ctx, + + void *node, + + int domain, + + int code, + + xmlErrorLevel level, + + const char *file, + + int line, + + const char *str1, + + const char *str2, + + const char *str3, + + int int1, + + int int2, + + const char *msg, + + ...); + +/* + + * @internalComponent + + * @prototype + + */ + +void XMLCALL + + __xmlSimpleError (int domain, + + int code, + + xmlNodePtr node, + + const char *msg, + + const char *extra); + +//#endif + + + +#ifdef __cplusplus + +} + +#endif + + + +#endif /*LIBXML2_XMLERROR2_H_*/ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlexports.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlexports.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,166 @@ +/* + * Summary: macros for marking symbols as exportable/importable. + * Description: macros for marking symbols as exportable/importable. + * + * Copy: See Copyright for the status of this software. + * + * Author: Igor Zlatovic + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_EXPORTS_H +#define XML_EXPORTS_H + +/** + * XMLPUBFUN, XMLPUBVAR, XMLCALL + * + * Macros which declare an exportable function, an exportable variable and + * the calling convention used for functions. + * + * Please use an extra block for every platform/compiler combination when + * modifying this, rather than overlong #ifdef lines. This helps + * readability as well as the fact that different compilers on the same + * platform might need different definitions. + */ + +/** + * XMLPUBFUN: + * + * Macros which declare an exportable function + */ +#define XMLPUBFUN +/** + * XMLPUBVAR: + * + * Macros which declare an exportable variable + */ +#define XMLPUBVAR extern +/** + * XMLCALL: + * + * Macros which declare the called convention for exported functions + */ +#define XMLCALL +#define XMLPUBFUNEXPORT __declspec(dllexport) + +/** DOC_DISABLE */ + +/* Windows platform with MS compiler */ +#if defined(_WIN32) && defined(_MSC_VER) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with Borland compiler */ +#if defined(_WIN32) && defined(__BORLANDC__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) extern + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with GNU compiler (Mingw) */ +#if defined(_WIN32) && defined(__MINGW32__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Cygwin platform, GNU compiler */ +#if defined(_WIN32) && defined(__CYGWIN__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR + #endif + #endif + #define XMLCALL __cdecl +#endif + +/* Symbian: WINS/WINSCW/WINC/ARMI/ARMv5 */ +#if defined(__SYMBIAN32__) && (__ARMCC_VERSION > 230000) +# define XMLPUBFUN __declspec(dllimport) +# define XMLPUBVAR __declspec(dllimport) extern +#else + +# undef XMLPUBFUN +#ifdef IN_LIBXML +# define XMLPUBFUN __declspec(dllexport) +#else +# define XMLPUBFUN __declspec(dllimport) +#endif + +# undef XMLPUBVAR +# if defined(IN_LIBXML) +# define XMLPUBVAR __declspec(dllexport) extern +# else +# define XMLPUBVAR __declspec(dllimport) extern +#endif + +#endif + +/* Compatibility */ +#if !defined(LIBXML_DLL_IMPORT) +#define LIBXML_DLL_IMPORT XMLPUBVAR +#endif + +#endif /* XML_EXPORTS_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlio.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,344 @@ +/* + * Summary: interface for the I/O interfaces used by the parser + * Description: interface for the I/O interfaces used by the parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_IO_H +#define XML_IO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Those are the functions and datatypes for the parser input + * I/O structures. + */ + +/** + * xmlInputMatchCallback: + * @param filename the filename or URI + * + * Callback used in the I/O Input API to detect if the current handler + * can provide input fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Input module should be used + */ +typedef int (*xmlInputMatchCallback) (char const *filename); +/** + * xmlInputOpenCallback: + * @param filename the filename or URI + * + * Callback used in the I/O Input API to open the resource + * + * Returns an Input context or NULL in case or error + */ +typedef void * (*xmlInputOpenCallback) (char const *filename); +/** + * xmlInputReadCallback: + * @param context an Input context + * @param buffer the buffer to store data read + * @param len the length of the buffer in bytes + * + * Callback used in the I/O Input API to read the resource + * + * Returns the number of bytes read or -1 in case of error + */ +typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len); +/** + * xmlInputCloseCallback: + * @param context an Input context + * + * Callback used in the I/O Input API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlInputCloseCallback) (void * context); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Those are the functions and datatypes for the library output + * I/O structures. + */ + +/** + * xmlOutputMatchCallback: + * @param filename the filename or URI + * + * Callback used in the I/O Output API to detect if the current handler + * can provide output fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Output module should be used + */ +typedef int (*xmlOutputMatchCallback) (char const *filename); +/** + * xmlOutputOpenCallback: + * @param filename the filename or URI + * + * Callback used in the I/O Output API to open the resource + * + * Returns an Output context or NULL in case or error + */ +typedef void * (*xmlOutputOpenCallback) (char const *filename); +/** + * xmlOutputWriteCallback: + * @param context an Output context + * @param buffer the buffer of data to write + * @param len the length of the buffer in bytes + * + * Callback used in the I/O Output API to write to the resource + * + * Returns the number of bytes written or -1 in case of error + */ +typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer, + int len); +/** + * xmlOutputCloseCallback: + * @param context an Output context + * + * Callback used in the I/O Output API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlOutputCloseCallback) (void * context); +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif +struct _xmlParserInputBuffer { + void* context; + xmlInputReadCallback readcallback; + xmlInputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ + xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */ + int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ + int error; + unsigned long rawconsumed;/* amount consumed from raw */ +}; + + +#ifdef LIBXML_OUTPUT_ENABLED +struct _xmlOutputBuffer { + void* context; + xmlOutputWriteCallback writecallback; + xmlOutputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBufferPtr conv; /* if encoder != NULL buffer for output */ + int written; /* total number of byte written */ + int error; +}; +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* + * Interfaces for input + */ +XMLPUBFUN void XMLCALL + xmlCleanupInputCallbacks (void); + +XMLPUBFUN int XMLCALL + xmlPopInputCallbacks (void); + +XMLPUBFUN void XMLCALL + xmlRegisterDefaultInputCallbacks (void); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlAllocParserInputBuffer (xmlCharEncoding enc); + +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFilename (const char *URI, + xmlCharEncoding enc); + +#ifndef XMLENGINE_EXCLUDE_FILE_FUNC +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFile (FILE *file, + xmlCharEncoding enc); +#endif + +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFd (int fd, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateMem (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateStatic (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + xmlParserInputBufferRead (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputBufferGrow (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputBufferPush (xmlParserInputBufferPtr in, + int len, + const char *buf); +XMLPUBFUN void XMLCALL + xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); +XMLPUBFUN char * XMLCALL + xmlParserGetDirectory (const char *filename); + +XMLPUBFUN int XMLCALL + xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Interfaces for output + */ +XMLPUBFUN void XMLCALL + xmlCleanupOutputCallbacks (void); +XMLPUBFUN void XMLCALL + xmlRegisterDefaultOutputCallbacks(void); +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFilename (const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); +//libxslt needs it +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFile (FILE *file, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFd (int fd, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN int XMLCALL + xmlOutputBufferWrite (xmlOutputBufferPtr out, + int len, + const char *buf); +XMLPUBFUN int XMLCALL + xmlOutputBufferWriteString (xmlOutputBufferPtr out, + const char *str); +XMLPUBFUN int XMLCALL + xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, + const xmlChar *str, + xmlCharEncodingOutputFunc escaping); + +XMLPUBFUN int XMLCALL + xmlOutputBufferFlush (xmlOutputBufferPtr out); +XMLPUBFUN int XMLCALL + xmlOutputBufferClose (xmlOutputBufferPtr out); + +XMLPUBFUN int XMLCALL + xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, + xmlOutputOpenCallback openFunc, + xmlOutputWriteCallback writeFunc, + xmlOutputCloseCallback closeFunc); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* This function only exists if HTTP support built into the library */ +#ifdef LIBXML_HTTP_ENABLED +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpenW (const char * post_uri, + int compression ); +XMLPUBFUN void XMLCALL + xmlRegisterHTTPPostCallbacks (void ); +#endif + +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr ret); + +/* + * A predefined entity loader disabling network accesses + */ +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNoNetExternalEntityLoader (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +XMLPUBFUN int XMLCALL + xmlCheckFilename (const char *path); +/** + * Default 'file://' protocol callbacks + */ +XMLPUBFUN int XMLCALL + xmlFileMatch (const char *filename); + +XMLPUBFUN void * XMLCALL + xmlFileOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlFileRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlFileClose (void * context); + +/** + * Default 'http://' protocol callbacks + */ +#ifdef LIBXML_HTTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOHTTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOHTTPRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlIOHTTPClose (void * context); +#endif /* LIBXML_HTTP_ENABLED */ + +/** + * Default 'ftp://' protocol callbacks + */ +#ifdef LIBXML_FTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOFTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOFTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOFTPRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlIOFTPClose (void * context); +#endif /* LIBXML_FTP_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* XML_IO_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlmemory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlmemory.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,227 @@ +/* + * Summary: interface for the memory allocator + * Description: provides interfaces for the memory allocator, + * including debugging capabilities. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef LIBXML2_XMLMEMORY_H +#define LIBXML2_XMLMEMORY_H + +#include +#include + + +/** + * DEBUG_MEMORY: + * + * DEBUG_MEMORY replaces the allocator with a collect and debug + * shell to the libc allocator. + * DEBUG_MEMORY should only be activated when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +/* #define DEBUG_MEMORY_FREED */ +/* #define DEBUG_MEMORY_LOCATION */ + +#ifdef DEBUG +#ifndef DEBUG_MEMORY +#define DEBUG_MEMORY +#endif +#endif + +/** + * DEBUG_MEMORY_LOCATION: + * + * DEBUG_MEMORY_LOCATION should be activated only when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +#ifdef DEBUG_MEMORY_LOCATION +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The XML memory wrapper support 4 basic overloadable functions. + */ +/** + * xmlFreeFunc: + * @param mem an already allocated block of memory + * + * Signature for a free() implementation. + */ +typedef void (XMLCALL *xmlFreeFunc)(void *mem); +/** + * xmlMallocFunc: + * @param size the size requested in bytes + * + * Signature for a malloc() implementation. + * + * Returns a pointer to the newly allocated block or NULL in case of error. + */ +typedef void *(XMLCALL *xmlMallocFunc)(size_t size); + +/** + * xmlReallocFunc: + * @param mem an already allocated block of memory + * @param size the new size requested in bytes + * + * Signature for a realloc() implementation. + * + * Returns a pointer to the newly reallocated block or NULL in case of error. + */ +typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); + +/** + * xmlStrdupFunc: + * @param str a zero terminated string + * + * Signature for an strdup() implementation. + * + * Returns the copy of the string or NULL in case of error. + */ +typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); + +/*The 4 interfaces used for all memory handling within libxml. +LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree; +LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc; +LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic; +LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc; +LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup; + */ + +/* + * The way to overload the existing functions. + * The xmlGc function have an extra entry for atomic block + * allocations useful for garbage collected memory allocators + */ +XMLPUBFUN int XMLCALL + xmlMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); +XMLPUBFUN int XMLCALL + xmlMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); + +#ifndef XMLENGINE_EXCLUDE_UNUSED + +XMLPUBFUN int XMLCALL + xmlGcMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlMallocFunc mallocAtomicFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); + +XMLPUBFUN int XMLCALL + xmlGcMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlMallocFunc *mallocAtomicFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/* + * Initialization of the memory layer. + */ +XMLPUBFUN int XMLCALL + xmlInitMemory (void); + +/* + * Cleanup of the memory layer. + */ +XMLPUBFUN void XMLCALL + xmlCleanupMemory (void); +/* + * These are specific to the XML debug memory wrapper. + */ +XMLPUBFUN int XMLCALL + xmlMemUsed (void); + +#ifndef XMLENGINE_EXCLUDE_FILE_FUNC +XMLPUBFUN void XMLCALL + xmlMemDisplay (FILE *fp); +XMLPUBFUN void XMLCALL + xmlMemShow (FILE *fp, int nr); +#endif + +XMLPUBFUN void XMLCALL + xmlMemoryDump (void); +XMLPUBFUN void * XMLCALL + xmlMemMalloc (size_t size); +XMLPUBFUN void * XMLCALL + xmlMemRealloc (void *ptr,size_t size); +XMLPUBFUN void XMLCALL + xmlMemFree (void *ptr); +XMLPUBFUN char * XMLCALL + xmlMemoryStrdup (const char *str); +XMLPUBFUN void * XMLCALL + xmlMallocLoc (size_t size, const char *file, int line); +XMLPUBFUN void * XMLCALL + xmlReallocLoc (void *ptr, size_t size, const char *file, int line); +XMLPUBFUN void * XMLCALL + xmlMallocAtomicLoc (size_t size, const char *file, int line); +XMLPUBFUN char * XMLCALL + xmlMemStrdupLoc (const char *str, const char *file, int line); + + +#ifdef DEBUG_MEMORY_LOCATION +/** + * xmlMalloc: + * @param size number of bytes to allocate + * + * Wrapper for the malloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) +/** + * xmlMallocAtomic: + * @param size number of bytes to allocate + * + * Wrapper for the malloc() function used in the XML library for allocation + * of block not containing pointers to other areas. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) +/** + * xmlRealloc: + * @param ptr pointer to the existing allocated area + * @param size number of bytes to allocate + * + * Wrapper for the realloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) +/** + * xmlMemStrdup: + * @param str pointer to the existing string + * + * Wrapper for the strdup() function, xmlStrdup() is usually preferred. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) + +#endif /* DEBUG_MEMORY_LOCATION */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* LIBXML2_MEMORY_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlreader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlreader.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,507 @@ +/* + * Summary: the XMLReader implementation + * Description: API of the XML streaming API based on C# interfaces. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XMLREADER_H +#define XML_XMLREADER_H + +#include +#include + +#ifdef LIBXML_SCHEMAS_ENABLED +#include "libxml2_relaxng.h" +#include "libxml2_xmlschemas.h" +#endif + +// XMLENGINE: This set of header was moved here from .c file + +#ifdef LIBXML_SCHEMAS_ENABLED +#include "libxml2_relaxng.h" +#endif + +#ifdef LIBXML_XINCLUDE_ENABLED +#include "libxml2_xinclude.h" +#endif + +#ifdef LIBXML_PATTERN_ENABLED +#include "libxml2_pattern.h" +#endif +//---------------------------------------------------------- + +#ifdef LIBXML_READER_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlTextReaderMode: + * + * Internal state values for the reader. + */ +typedef enum { + XML_TEXTREADER_MODE_INITIAL = 0, + XML_TEXTREADER_MODE_INTERACTIVE = 1, + XML_TEXTREADER_MODE_ERROR = 2, + XML_TEXTREADER_MODE_EOF =3, + XML_TEXTREADER_MODE_CLOSED = 4, + XML_TEXTREADER_MODE_READING = 5 +} xmlTextReaderMode; + +/** + * xmlParserProperties: + * + * Some common options to use with xmlTextReaderSetParserProp, but it + * is better to use xmlParserOption and the xmlReaderNewxxx and + * xmlReaderForxxx APIs now. + */ +typedef enum { + XML_PARSER_LOADDTD = 1, + XML_PARSER_DEFAULTATTRS = 2, + XML_PARSER_VALIDATE = 3, + XML_PARSER_SUBST_ENTITIES = 4 +} xmlParserProperties; + +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, + XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, + XML_PARSER_SEVERITY_WARNING = 3, + XML_PARSER_SEVERITY_ERROR = 4 +} xmlParserSeverities; + +/** + * xmlReaderTypes: + * + * Predefined constants for the different types of nodes. + */ +typedef enum { + XML_READER_TYPE_NONE = 0, + XML_READER_TYPE_ELEMENT = 1, + XML_READER_TYPE_ATTRIBUTE = 2, + XML_READER_TYPE_TEXT = 3, + XML_READER_TYPE_CDATA = 4, + XML_READER_TYPE_ENTITY_REFERENCE = 5, + XML_READER_TYPE_ENTITY = 6, + XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, + XML_READER_TYPE_COMMENT = 8, + XML_READER_TYPE_DOCUMENT = 9, + XML_READER_TYPE_DOCUMENT_TYPE = 10, + XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, + XML_READER_TYPE_NOTATION = 12, + XML_READER_TYPE_WHITESPACE = 13, + XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, + XML_READER_TYPE_END_ELEMENT = 15, + XML_READER_TYPE_END_ENTITY = 16, + XML_READER_TYPE_XML_DECLARATION = 17 +} xmlReaderTypes; + +/* + * Error handling extensions + */ +typedef void * xmlTextReaderLocatorPtr; +typedef void (XMLCALL *xmlTextReaderErrorFunc) (void *arg, + const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator); +/** + * xmlTextReader: + * + * Structure for an xmlReader context. + */ +typedef struct _xmlTextReader xmlTextReader; + +/** + * xmlTextReaderPtr: + * + * Pointer to an xmlReader context. + */ +typedef xmlTextReader *xmlTextReaderPtr; +// XMLENGINE: This moved to header from xmlreader.c file +typedef enum { + XML_TEXTREADER_NONE = -1, + XML_TEXTREADER_START= 0, + XML_TEXTREADER_ELEMENT= 1, + XML_TEXTREADER_END= 2, + XML_TEXTREADER_EMPTY= 3, + XML_TEXTREADER_BACKTRACK= 4, + XML_TEXTREADER_DONE= 5, + XML_TEXTREADER_ERROR= 6 +} xmlTextReaderState; + +typedef enum { + XML_TEXTREADER_NOT_VALIDATE = 0, + XML_TEXTREADER_VALIDATE_DTD = 1, + XML_TEXTREADER_VALIDATE_RNG = 2, + XML_TEXTREADER_VALIDATE_XSD = 4 +} xmlTextReaderValidate; + +struct _xmlTextReader { + int mode; /* the parsing mode */ + xmlDocPtr doc; /* when walking an existing doc */ + xmlTextReaderValidate validate; /* is there any validation */ + int allocs; /* what structure were deallocated */ + xmlTextReaderState state; + xmlParserCtxtPtr ctxt; /* the parser context */ + xmlSAXHandlerPtr sax; /* the parser SAX callbacks */ + xmlParserInputBufferPtr input; /* the input */ + startElementSAXFunc startElement; /* initial SAX callbacks */ + endElementSAXFunc endElement; /* idem */ + startElementNsSAX2Func startElementNs; /* idem */ + endElementNsSAX2Func endElementNs; /* idem */ + charactersSAXFunc characters; + cdataBlockSAXFunc cdataBlock; + unsigned int base; /* base of the segment in the input */ + unsigned int cur; /* current position in the input */ + xmlNodePtr node; /* current node */ + xmlNodePtr curnode; /* current attribute node */ + int depth; /* depth of the current node */ + xmlNodePtr faketext;/* fake xmlNs chld */ + int preserve;/* preserve the resulting document */ + xmlBufferPtr buffer; /* used to return const xmlChar * */ + xmlDictPtr dict; /* the context dictionnary */ + + /* entity stack when traversing entities content */ + xmlNodePtr ent; /* Current Entity Ref Node */ + int entNr; /* Depth of the entities stack */ + int entMax; /* Max depth of the entities stack */ + xmlNodePtr* entTab; /* array of entities */ + + /* error handling */ + xmlTextReaderErrorFunc errorFunc; /* callback function */ + void* errorFuncArg; /* callback function user argument */ + +#ifdef LIBXML_SCHEMAS_ENABLED + /* Handling of RelaxNG validation */ + xmlRelaxNGPtr rngSchemas; /* The Relax NG schemas */ + xmlRelaxNGValidCtxtPtr rngValidCtxt; /* The Relax NG validation context */ + int rngValidErrors;/* The number of errors detected */ + xmlNodePtr rngFullNode; /* the node if RNG not progressive */ + /* Handling of Schemas validation */ + xmlSchemaPtr xsdSchemas; /* The Schemas schemas */ + xmlSchemaValidCtxtPtr xsdValidCtxt;/* The Schemas validation context */ + int xsdValidErrors;/* The number of errors detected */ + xmlSchemaSAXPlugPtr xsdPlug; /* the schemas plug in SAX pipeline */ +#endif +#ifdef LIBXML_XINCLUDE_ENABLED + /* Handling of XInclude processing */ + int xinclude; /* is xinclude asked for */ + const xmlChar* xinclude_name; /* the xinclude name from dict */ + xmlXIncludeCtxtPtr xincctxt; /* the xinclude context */ + int in_xinclude; /* counts for xinclude */ +#endif +#ifdef LIBXML_PATTERN_ENABLED + int patternNr; /* number of preserve patterns */ + int patternMax; /* max preserve patterns */ + xmlPatternPtr* patternTab; /* array of preserve patterns */ +#endif + int preserves; /* level of preserves */ + int parserFlags; /* the set of options set */ + /* Structured error handling */ + xmlStructuredErrorFunc sErrorFunc; /* callback function */ +}; + +/* + * Constructors & Destructor + */ +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlNewTextReader (xmlParserInputBufferPtr input, + const char *URI); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlNewTextReaderFilename(const char *URI); +XMLPUBFUN void XMLCALL + xmlFreeTextReader (xmlTextReaderPtr reader); + +/* + * Iterators + */ +XMLPUBFUN int XMLCALL + xmlTextReaderRead (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadString (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); + +/* + * Attributes of the node + */ +XMLPUBFUN int XMLCALL + xmlTextReaderAttributeCount(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderDepth (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderHasAttributes(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderHasValue(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsDefault (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNodeType (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderQuoteChar (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderReadState (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); + +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstLocalName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstPrefix (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstString (xmlTextReaderPtr reader, + const xmlChar *str); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstValue (xmlTextReaderPtr reader); + +/* + * use the Const version of the routine for + * better performance and simpler code + */ +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLocalName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderPrefix (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderValue (xmlTextReaderPtr reader); + +/* + * Methods of the XmlTextReader + */ +XMLPUBFUN int XMLCALL + xmlTextReaderClose (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, + int no); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttribute (xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlTextReaderGetRemainder (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, + const xmlChar *prefix); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, + int no); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToElement (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNormalization (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstEncoding (xmlTextReaderPtr reader); + +/* + * Extensions + */ +XMLPUBFUN int XMLCALL + xmlTextReaderSetParserProp (xmlTextReaderPtr reader, + int prop, + int value); +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserProp (xmlTextReaderPtr reader, + int prop); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderCurrentNode (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); + +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); + +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderPreserve (xmlTextReaderPtr reader); +#ifdef LIBXML_PATTERN_ENABLED +XMLPUBFUN int XMLCALL + xmlTextReaderPreservePattern(xmlTextReaderPtr reader, + const xmlChar *pattern, + const xmlChar **namespaces); +#endif /* LIBXML_PATTERN_ENABLED */ +XMLPUBFUN xmlDocPtr XMLCALL + xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderExpand (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNext (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNextSibling (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsValid (xmlTextReaderPtr reader); +#ifdef LIBXML_SCHEMAS_ENABLED +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, + const char *rng); +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, + xmlRelaxNGPtr schema); +XMLPUBFUN int XMLCALL + xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, + const char *xsd); +XMLPUBFUN int XMLCALL + xmlTextReaderSetSchema (xmlTextReaderPtr reader, + xmlSchemaPtr schema); +#endif +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderStandalone (xmlTextReaderPtr reader); + + +/* + * Index lookup + */ +XMLPUBFUN long XMLCALL + xmlTextReaderByteConsumed (xmlTextReaderPtr reader); + +/* + * New more complete APIs for simpler creation and reuse of readers + */ +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderWalker (xmlDocPtr doc); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForDoc (const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForFile (const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +XMLPUBFUN int XMLCALL + xmlReaderNewWalker (xmlTextReaderPtr reader, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlReaderNewDoc (xmlTextReaderPtr reader, + const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewFile (xmlTextReaderPtr reader, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewMemory (xmlTextReaderPtr reader, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewFd (xmlTextReaderPtr reader, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewIO (xmlTextReaderPtr reader, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +// typedefs moved in the beginning of the header + +#ifdef LIBXML_ENABLE_NODE_LINEINFO +XMLPUBFUN int XMLCALL + xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); +#endif /* LIBXML_ENABLE_NODE_LINEINFO */ + +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); +XMLPUBFUN void XMLCALL + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, + void *arg); +XMLPUBFUN void XMLCALL + xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, + void *arg); +XMLPUBFUN void XMLCALL + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, + void **arg); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_READER_ENABLED */ + +#endif /* XML_XMLREADER_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlsave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlsave.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,154 @@ +/* + * Summary: the XML document serializer + * Description: API to save document or subtree of document + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XMLSAVE_H +#define XML_XMLSAVE_H + +#include + +#ifdef LIBXML_OUTPUT_ENABLED +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_INDENT 60 + +#ifdef XMLENGINE_NODEFILTER + +/** +Pointer to implementation of interface NodeFilter (as introduced in DOM Level 2) + +@param aNode Node to test +@return + 1 = KFilterAccept - use node + 2 = KFilterReject - do not use node but proceed with child nodes + 3 = KFilterSkip - skip node and its subtree + 4 = KFilterSkipElementContents - [non-standard option] +*/ +typedef int (XMLCALL *xmlNodeFilterFunc)(xmlNodePtr aNode); +typedef int (XMLCALL *xmlNodeFilterProxyFunc)(void* fn, xmlNodePtr aNode); + +// Constansts for results that are returned by callbacks of node filter during serialization +extern const int KFilterAccept; +extern const int KFilterReject; +extern const int KFilterSkip; +extern const int KFilterSkipElementContents; + +typedef struct _xmlNodeFilterData xmlNodeFilterData; + +/** + * xmlSaveTextNodeCallback: + * @param context an Save context + * @param aNode node to be serialized + * + * Callback used in serializing text nodes + * + * Returns NULL or pointer to string that replaces binary data + */ +typedef unsigned char* (*xmlSaveTextNodeCallback) (void * context, xmlNodePtr aNode, int* written); + +struct _xmlNodeFilterData{ + void* fn; + xmlNodeFilterProxyFunc proxyFn; +}; +#endif + +typedef struct _xmlSaveCtxt xmlSaveCtxt; +typedef xmlSaveCtxt *xmlSaveCtxtPtr; +struct _xmlSaveCtxt { + void *_private; + int type; + int fd; + const xmlChar *filename; + const xmlChar *encoding; + xmlCharEncodingHandlerPtr handler; + xmlOutputBufferPtr buf; + xmlDocPtr doc; + int options; + int level; + int format; + + char indent[MAX_INDENT + 1]; /* array for indenting output */ + int indent_nr; + int indent_size; + xmlCharEncodingOutputFunc escape; /* used for element content */ + xmlCharEncodingOutputFunc escapeAttr;/* used for attribute content */ + xmlSaveTextNodeCallback textNodeCallback; + void * context; /* save context */ +#ifdef XMLENGINE_NODEFILTER + xmlNodeFilterData* nodeFilter; +#endif +}; + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToFd( + int fd, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToFilename( + const char *filename, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToBuffer( + xmlBufferPtr buffer, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToIO( + xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + const char *encoding, + int options); + +XMLPUBFUN long XMLCALL + xmlSaveDoc( + xmlSaveCtxtPtr ctxt, + xmlDocPtr doc); + +XMLPUBFUN long XMLCALL + xmlSaveTree( + xmlSaveCtxtPtr ctxt, + xmlNodePtr node); +// XMLENGINE: were made exported +void xmlNsListDumpOutput( + xmlOutputBufferPtr buf, + xmlNsPtr cur); +// +XMLPUBFUN int XMLCALL + xmlSaveFlush( + xmlSaveCtxtPtr ctxt); + +XMLPUBFUN int XMLCALL + xmlSaveClose (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); +XMLPUBFUN int XMLCALL + xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_OUTPUT_ENABLED */ + +#endif /* XML_XMLSAVE_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlschemas.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlschemas.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,130 @@ +/* + * Summary: incomplete XML Schemas structure implementation + * Description: interface to the XML Schemas handling and schema validity + * checking, it is incomplete right now. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_SCHEMA_H +#define XML_SCHEMA_H + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMAS_ERR_OK = 0, + XML_SCHEMAS_ERR_NOROOT = 1, + XML_SCHEMAS_ERR_UNDECLAREDELEM, + XML_SCHEMAS_ERR_NOTTOPLEVEL, + XML_SCHEMAS_ERR_MISSING, + XML_SCHEMAS_ERR_WRONGELEM, + XML_SCHEMAS_ERR_NOTYPE, + XML_SCHEMAS_ERR_NOROLLBACK, + XML_SCHEMAS_ERR_ISABSTRACT, + XML_SCHEMAS_ERR_NOTEMPTY, + XML_SCHEMAS_ERR_ELEMCONT, + XML_SCHEMAS_ERR_HAVEDEFAULT, + XML_SCHEMAS_ERR_NOTNILLABLE, + XML_SCHEMAS_ERR_EXTRACONTENT, + XML_SCHEMAS_ERR_INVALIDATTR, + XML_SCHEMAS_ERR_INVALIDELEM, + XML_SCHEMAS_ERR_NOTDETERMINIST, + XML_SCHEMAS_ERR_CONSTRUCT, + XML_SCHEMAS_ERR_INTERNAL, + XML_SCHEMAS_ERR_NOTSIMPLE, + XML_SCHEMAS_ERR_ATTRUNKNOWN, + XML_SCHEMAS_ERR_ATTRINVALID, + XML_SCHEMAS_ERR_VALUE, + XML_SCHEMAS_ERR_FACET, + XML_SCHEMAS_ERR_, + XML_SCHEMAS_ERR_XXX +} xmlSchemaValidError; + + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchema xmlSchema; +typedef xmlSchema *xmlSchemaPtr; + +/** + * A schemas validation context + */ +typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); +typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); + +typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; +typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; + +typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; +typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewParserCtxt (const char *URL); +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewMemParserCtxt (const char *buffer, + int size); +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewDocParserCtxt (xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN xmlSchemaPtr XMLCALL + xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSchemaFree (xmlSchemaPtr schema); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlSchemaDump (FILE *output, + xmlSchemaPtr schema); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * Interfaces for validating + */ +XMLPUBFUN void XMLCALL + xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL + xmlSchemaNewValidCtxt (xmlSchemaPtr schema); +XMLPUBFUN void XMLCALL + xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, + xmlDocPtr instance); +XMLPUBFUN int XMLCALL + xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc, + xmlSAXHandlerPtr sax, + void *user_data); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* XML_SCHEMA_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlschemasglobals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlschemasglobals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +/* + * libxml2_xmlschemasglobals.h : implementation of the XML Schema Datatypes + * definition and validity checking + * + * See Copyright for the status of this software. + * + * Daniel Veillard + */ + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLSCHEMAS_GLOBALS_H +#define XMLSCHEMAS_GLOBALS_H + +typedef struct _xmlSchemaTypesGlobalData xmlSchemaTypesGlobalData; +typedef xmlSchemaTypesGlobalData* xmlSchemaTypesGlobalDataPtr; + +#include + +// xmlSchemaTypesInitialized is defined as separate global variable + +struct _xmlSchemaTypesGlobalData{ + xmlHashTablePtr xmlSchemaTypesBank; + + /* + * Basic types + */ + xmlSchemaTypePtr xmlSchemaTypeStringDef; + xmlSchemaTypePtr xmlSchemaTypeAnyTypeDef; + xmlSchemaTypePtr xmlSchemaTypeAnySimpleTypeDef; + xmlSchemaTypePtr xmlSchemaTypeDecimalDef; + xmlSchemaTypePtr xmlSchemaTypeDatetimeDef; + xmlSchemaTypePtr xmlSchemaTypeDateDef; + xmlSchemaTypePtr xmlSchemaTypeTimeDef; + xmlSchemaTypePtr xmlSchemaTypeGYearDef; + xmlSchemaTypePtr xmlSchemaTypeGYearMonthDef; + xmlSchemaTypePtr xmlSchemaTypeGDayDef; + xmlSchemaTypePtr xmlSchemaTypeGMonthDayDef; + xmlSchemaTypePtr xmlSchemaTypeGMonthDef; + xmlSchemaTypePtr xmlSchemaTypeDurationDef; + xmlSchemaTypePtr xmlSchemaTypeFloatDef; + xmlSchemaTypePtr xmlSchemaTypeBooleanDef; + xmlSchemaTypePtr xmlSchemaTypeDoubleDef; + xmlSchemaTypePtr xmlSchemaTypeHexBinaryDef; + xmlSchemaTypePtr xmlSchemaTypeBase64BinaryDef; + xmlSchemaTypePtr xmlSchemaTypeAnyURIDef; + + /* + * Derived types + */ + xmlSchemaTypePtr xmlSchemaTypePositiveIntegerDef; + xmlSchemaTypePtr xmlSchemaTypeNonPositiveIntegerDef; + xmlSchemaTypePtr xmlSchemaTypeNegativeIntegerDef; + xmlSchemaTypePtr xmlSchemaTypeNonNegativeIntegerDef; + xmlSchemaTypePtr xmlSchemaTypeIntegerDef; + xmlSchemaTypePtr xmlSchemaTypeLongDef; + xmlSchemaTypePtr xmlSchemaTypeIntDef; + xmlSchemaTypePtr xmlSchemaTypeShortDef; + xmlSchemaTypePtr xmlSchemaTypeByteDef; + xmlSchemaTypePtr xmlSchemaTypeUnsignedLongDef; + xmlSchemaTypePtr xmlSchemaTypeUnsignedIntDef; + xmlSchemaTypePtr xmlSchemaTypeUnsignedShortDef; + xmlSchemaTypePtr xmlSchemaTypeUnsignedByteDef; + xmlSchemaTypePtr xmlSchemaTypeNormStringDef; + xmlSchemaTypePtr xmlSchemaTypeTokenDef; + xmlSchemaTypePtr xmlSchemaTypeLanguageDef; + xmlSchemaTypePtr xmlSchemaTypeNameDef; + xmlSchemaTypePtr xmlSchemaTypeQNameDef; + xmlSchemaTypePtr xmlSchemaTypeNCNameDef; + xmlSchemaTypePtr xmlSchemaTypeIdDef; + xmlSchemaTypePtr xmlSchemaTypeIdrefDef; + xmlSchemaTypePtr xmlSchemaTypeIdrefsDef; + xmlSchemaTypePtr xmlSchemaTypeEntityDef; + xmlSchemaTypePtr xmlSchemaTypeEntitiesDef; + xmlSchemaTypePtr xmlSchemaTypeNotationDef; + xmlSchemaTypePtr xmlSchemaTypeNmtokenDef; + xmlSchemaTypePtr xmlSchemaTypeNmtokensDef; +}; // struct _xmlSchemaGlobalData + +#endif /* XMLSCHEMAS_GLOBALS_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlschemastypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlschemastypes.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,78 @@ +/* + * Summary: implementation of XML Schema Datatypes + * Description: module providing the XML Schema Datatypes implementation + * both definition and validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_SCHEMA_TYPES_H +#define XML_SCHEMA_TYPES_H + +#include + +#if defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES) + +#include +#include "libxml2_xmlschemas.h" + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN void XMLCALL + xmlSchemaInitTypes (void); +XMLPUBFUN void XMLCALL + xmlSchemaCleanupTypes (void); +XMLPUBFUN xmlSchemaTypePtr XMLCALL + xmlSchemaGetPredefinedType (const xmlChar* name, + const xmlChar *ns); +XMLPUBFUN int XMLCALL + xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val); +XMLPUBFUN int XMLCALL + xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val, + xmlNodePtr node); +XMLPUBFUN int XMLCALL + xmlSchemaValidateFacet (xmlSchemaTypePtr base, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val); +XMLPUBFUN void XMLCALL + xmlSchemaFreeValue (xmlSchemaValPtr val); + + +#if defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlSchemaFacetPtr XMLCALL + xmlSchemaNewFacet (void); + +XMLPUBFUN int XMLCALL + xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, + xmlSchemaTypePtr typeDecl, + xmlSchemaParserCtxtPtr ctxt, + const xmlChar *name); +#endif + +XMLPUBFUN void XMLCALL + xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); +XMLPUBFUN int XMLCALL + xmlSchemaCompareValues (xmlSchemaValPtr x, + xmlSchemaValPtr y); + +#ifdef __cplusplus +} +#endif + +#endif /* defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES) */ +#endif /* XML_SCHEMA_TYPES_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlstring.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlstring.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,150 @@ +/* + * Summary: set of routines to process strings + * Description: type and interfaces needed for the internal string handling + * of the library, especially UTF8 processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_STRING_H +#define XML_STRING_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlChar: + * + * This is a basic byte in an UTF-8 encoded string. + * It's unsigned allowing to pinpoint case where char * are assigned + * to xmlChar * (possibly making serialization back impossible). + */ + +typedef unsigned char xmlChar; + +/** + * BAD_CAST: + * + * Macro to cast a string to an xmlChar * when one know its safe. + */ +#define BAD_CAST (xmlChar *) + +/* + * xmlChar handling + */ +XMLPUBFUN xmlChar* XMLCALL + xmlStrdup (const xmlChar *cur); +XMLPUBFUN xmlChar* XMLCALL + xmlStrndup (const xmlChar *cur, + int len); +XMLPUBFUN xmlChar* XMLCALL + xmlCharStrndup (const char *cur, + int len); +XMLPUBFUN xmlChar* XMLCALL + xmlCharStrdup (const char *cur); +XMLPUBFUN xmlChar* XMLCALL + xmlStrsub (const xmlChar *str, + int start, + int len); +XMLPUBFUN const xmlChar* XMLCALL + xmlStrchr (const xmlChar *str, + xmlChar val); +XMLPUBFUN const xmlChar* XMLCALL + xmlStrstr (const xmlChar *str, + const xmlChar *val); +XMLPUBFUN const xmlChar* XMLCALL + xmlStrcasestr (const xmlChar *str, + xmlChar *val); +XMLPUBFUN int XMLCALL + xmlStrcmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrncmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrcasecmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrncasecmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrEqual (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrQEqual (const xmlChar *pref, + const xmlChar *name, + const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlStrlen (const xmlChar *str); +XMLPUBFUN xmlChar* XMLCALL + xmlStrcat (xmlChar *cur, + const xmlChar *add); +XMLPUBFUN xmlChar* XMLCALL + xmlStrncat (xmlChar *cur, + const xmlChar *add, + int len); +XMLPUBFUN xmlChar* XMLCALL + xmlStrncatNew (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrPrintf (xmlChar *buf, + int len, + const xmlChar *msg, + ...); +XMLPUBFUN int XMLCALL + xmlStrVPrintf (xmlChar *buf, + int len, + const xmlChar *msg, + va_list ap); + +XMLPUBFUN int XMLCALL + xmlGetUTF8Char (const unsigned char *utf, int *len); + +#ifndef XMLENGINE_EXCLUDE_UNUSED +XMLPUBFUN int XMLCALL xmlCheckUTF8 (const unsigned char *utf); +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +XMLPUBFUN int XMLCALL + xmlUTF8Strsize (const xmlChar *utf, + int len); +XMLPUBFUN xmlChar* XMLCALL + xmlUTF8Strndup (const xmlChar *utf, + int len); +XMLPUBFUN xmlChar* XMLCALL + xmlUTF8Strpos (const xmlChar *utf, + int pos); +XMLPUBFUN int XMLCALL + xmlUTF8Strloc (const xmlChar *utf, + const xmlChar *utfchar); +XMLPUBFUN xmlChar* XMLCALL + xmlUTF8Strsub (const xmlChar *utf, + int start, + int len); +XMLPUBFUN int XMLCALL + xmlUTF8Strlen (const xmlChar *utf); +XMLPUBFUN int XMLCALL + xmlUTF8Size (const xmlChar *utf); +XMLPUBFUN int XMLCALL + xmlUTF8Charcmp (const xmlChar *utf1, + const xmlChar *utf2); + +#ifdef __cplusplus +} +#endif +#endif /* XML_STRING_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlversion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlversion.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,165 @@ +/* + * Summary: compile-time version informations + * Description: compile-time version informations for the XML library + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_VERSION_H +#define XML_VERSION_H + +/* + * modules.h contains definitions that are auto generated + * from libxml2 property files using Ant script + * + * All other defines in this files are not assumed to be changed anymore + */ + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * use those to be sure nothing nasty will happen if + * your library and includes mismatch + */ +#ifndef LIBXML2_COMPILING_MSCCDEF +XMLPUBFUN void XMLCALL xmlCheckVersion(int version); +#endif /* LIBXML2_COMPILING_MSCCDEF */ + +/** + * LIBXML_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBXML_DOTTED_VERSION "2.6.10" + +/** + * LIBXML_VERSION: + * + * the version number: 1.2.3 value is 1002003 + */ +#define LIBXML_VERSION 20610 + +/** + * LIBXML_VERSION_STRING: + * + * the version number string, 1.2.3 value is "1002003" + */ +#define LIBXML_VERSION_STRING "20610" + +/** + * LIBXML_TEST_VERSION: + * + * Macro to check that the libxml version in use is compatible with + * the version the software has been compiled against + */ +#define LIBXML_TEST_VERSION xmlCheckVersion(20610); + +//#ifndef VMS +//#if 0 +///** +// * WITH_TRIO: +// * +// * defined if the trio support need to be configured in +// */ +//#define WITH_TRIO +//#else +///** +// * WITHOUT_TRIO: +// * +// * defined if the trio support should not be configured in +// */ +//#define WITHOUT_TRIO +//#endif +//#else /* VMS */ +///** +// * WITH_TRIO: +// * +// * defined if the trio support need to be configured in +// */ +//#define WITH_TRIO 1 +//#endif /* VMS */ + + + +/** + * LIBXML_FTP_ENABLED: + * + * Whether the FTP support is configured in + */ +// Excluded from XML Engine +//#define LIBXML_FTP_ENABLED + + +/** + * LIBXML_HTTP_ENABLED: + * + * Whether the HTTP support is configured in + */ +// Excluded from XML Engine +//#define LIBXML_HTTP_ENABLED + + +/** + * LIBXML_DOCB_ENABLED: + * + * Whether the SGML Docbook support is configured in + */ +// Excluded from XML Engine +//#define LIBXML_DOCB_ENABLED + +/** + * LIBXML_ICONV_ENABLED: + * + * Whether iconv support is available + */ +#if 0 +#define LIBXML_ICONV_ENABLED +#endif + +/** + * LIBXML_ISO8859X_ENABLED: + * + * Whether ISO-8859-* support is made available in case iconv is not + */ +#if 0 +#define LIBXML_ISO8859X_ENABLED +#endif + + +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* XML_VERSION_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xmlwriter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xmlwriter.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,475 @@ +/* + * Summary: text writing API for XML + * Description: text writing API for XML + * + * Copy: See Copyright for the status of this software. + * + * Author: Alfred Mickautsch + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XMLWRITER_H +#define XML_XMLWRITER_H + +#include +#include +#include +#include + +#ifdef LIBXML_WRITER_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlTextWriter xmlTextWriter; +typedef xmlTextWriter *xmlTextWriterPtr; +// Moved from Libxml2_xmlwriter.cpp +struct _xmlTextWriter { + xmlOutputBufferPtr out; /* output buffer */ + xmlListPtr nodes; /* element name stack */ + xmlListPtr nsstack; /* name spaces stack */ + int level; + int indent; /* enable indent */ + int doindent; /* internal indent flag */ + xmlChar *ichar; /* indent character */ + char qchar; /* character used for quoting attribute values */ + xmlParserCtxtPtr ctxt; +}; + +/* + * Constructors & Destructor + */ + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriter(xmlOutputBufferPtr out); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterFilename(const char *uri, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, + int compression); + XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); + +/* + * Functions + */ + + +/* + * Document + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDocument(xmlTextWriterPtr writer, + const char *version, + const char *encoding, + const char *standalone); + XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr + writer); + +/* + * Comments + */ + XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr + writer); + XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr + writer, + const xmlChar * + content); + +/* + * Elements + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI); + XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr + writer); + +/* + * Elements conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * Text + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, + const char *format, va_list argptr); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, + const xmlChar * content, int len); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteRaw(xmlTextWriterPtr writer, + const xmlChar * content); + XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr + writer, + const char + *format, ...); + XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr + writer, + const char + *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, + const xmlChar * + content); + XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, + const char *data, + int start, int len); + XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, + const char *data, + int start, int len); + +/* + * Attributes + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartAttribute(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI); + XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr + writer); + +/* + * Attributes conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * PI's + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartPI(xmlTextWriterPtr writer, + const xmlChar * target); + XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); + +/* + * PI conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, va_list argptr); + XMLPUBFUN int XMLCALL + xmlTextWriterWritePI(xmlTextWriterPtr writer, + const xmlChar * target, + const xmlChar * content); + +/** + * xmlTextWriterWriteProcessingInstruction: + * + * This macro maps to xmlTextWriterWritePI + */ +#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI + +/* + * CDATA + */ + XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); + +/* + * CDATA conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, + const char *format, va_list argptr); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, + const xmlChar * content); + +/* + * DTD + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); + +/* + * DTD conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, va_list argptr); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * subset); + +/** + * xmlTextWriterWriteDocType: + * + * this macro maps to xmlTextWriterWriteDTD + */ +#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD + +/* + * DTD element definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr + writer); + +/* + * DTD element definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD attribute list definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr + writer); + +/* + * DTD attribute list definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD entity definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, + int pe, const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr + writer); + +/* + * DTD entity definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, ...); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, + va_list argptr); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * ndataid); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr + writer, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * + ndataid); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr + writer, int pe, + const xmlChar * name, + const xmlChar * + pubid, + const xmlChar * + sysid, + const xmlChar * + ndataid, + const xmlChar * + content); + +/* + * DTD notation definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + +/* + * Indentation + */ + XMLPUBFUN int XMLCALL + xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); + XMLPUBFUN int XMLCALL + xmlTextWriterSetIndentString(xmlTextWriterPtr writer, + const xmlChar * str); + +/* + * misc + */ + XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_WRITER_ENABLED */ + +#endif /* XML_XMLWRITER_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xpath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xpath.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,550 @@ +/* + * Summary: XML Path Language implementation + * Description: API for the XML Path Language implementation + * + * XML Path Language implementation + * XPath is a language for addressing parts of an XML document, + * designed to be used by both XSLT and XPointer + * http://www.w3.org/TR/xpath + * + * Implements + * W3C Recommendation 16 November 1999 + * http://www.w3.org/TR/1999/REC-xpath-19991116 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XPATH_H +#define XML_XPATH_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct _xmlXPathContext xmlXPathContext; +typedef xmlXPathContext *xmlXPathContextPtr; +typedef struct _xmlXPathParserContext xmlXPathParserContext; +typedef xmlXPathParserContext *xmlXPathParserContextPtr; + +/** + * The set of XPath error codes. + */ +typedef enum { + XPATH_EXPRESSION_OK = 0, + XPATH_NUMBER_ERROR, + XPATH_UNFINISHED_LITERAL_ERROR, + XPATH_START_LITERAL_ERROR, + XPATH_VARIABLE_REF_ERROR, + XPATH_UNDEF_VARIABLE_ERROR, + XPATH_INVALID_PREDICATE_ERROR, + XPATH_EXPR_ERROR, + XPATH_UNCLOSED_ERROR, + XPATH_UNKNOWN_FUNC_ERROR, + XPATH_INVALID_OPERAND, + XPATH_INVALID_TYPE, + XPATH_INVALID_ARITY, + XPATH_INVALID_CTXT_SIZE, + XPATH_INVALID_CTXT_POSITION, + XPATH_MEMORY_ERROR, + XPTR_SYNTAX_ERROR, + XPTR_RESOURCE_ERROR, + XPTR_SUB_RESOURCE_ERROR, + XPATH_UNDEF_PREFIX_ERROR, + XPATH_ENCODING_ERROR, + XPATH_INVALID_CHAR_ERROR, + XPATH_XE_EXTENSION_FUNC_ERROR +} xmlXPathError; + +/* + * A node-set (an unordered collection of nodes without duplicates). + */ +typedef struct _xmlNodeSet xmlNodeSet; +typedef xmlNodeSet *xmlNodeSetPtr; +struct _xmlNodeSet { + int nodeNr; /* number of nodes in the set */ + int nodeMax; /* size of the array as allocated */ + xmlNodePtr* nodeTab; /* array of nodes in no particular order */ + /* @@ with_ns to check wether namespace nodes should be looked at @@ */ +}; + +/* + * An expression is evaluated to yield an object, which + * has one of the following four basic types: + * - node-set + * - boolean + * - number + * - string + * + * @@ XPointer will add more types ! + */ + +typedef enum { + XPATH_UNDEFINED = 0, + XPATH_NODESET = 1, + XPATH_BOOLEAN = 2, + XPATH_NUMBER = 3, + XPATH_STRING = 4, + XPATH_POINT = 5, + XPATH_RANGE = 6, + XPATH_LOCATIONSET = 7, + XPATH_USERS = 8, + XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ +} xmlXPathObjectType; + +typedef struct _xmlXPathObject xmlXPathObject; +typedef xmlXPathObject *xmlXPathObjectPtr; +struct _xmlXPathObject { + xmlXPathObjectType type; + xmlNodeSetPtr nodesetval; + int boolval; + double floatval; + xmlChar* stringval; + void* user; + int index; + void* user2; + int index2; +}; + +/** + * xmlXPathConvertFunc: + * @param obj an XPath object + * @param type the number of the target type + * + * A conversion function is associated to a type and used to cast + * the new type to primitive values. + * + * Returns -1 in case of error, 0 otherwise + */ +typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); + +/* + * Extra type: a name and a conversion function. + */ + +typedef struct _xmlXPathType xmlXPathType; +typedef xmlXPathType *xmlXPathTypePtr; +struct _xmlXPathType { + const xmlChar *name; /* the type name */ + xmlXPathConvertFunc func; /* the conversion function */ +}; + +/* + * Extra variable: a name and a value. + */ + +typedef struct _xmlXPathVariable xmlXPathVariable; +typedef xmlXPathVariable *xmlXPathVariablePtr; +struct _xmlXPathVariable { + const xmlChar *name; /* the variable name */ + xmlXPathObjectPtr value; /* the value */ +}; + +/** + * xmlXPathEvalFunc: + * @param ctxt an XPath parser context + * @param nargs the number of arguments passed to the function + * + * An XPath evaluation function, the parameters are on the XPath context stack. + */ + +typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, int nargs); + +/* + * Extra function: a name and a evaluation function. + */ + +typedef struct _xmlXPathFunct xmlXPathFunct; +typedef xmlXPathFunct *xmlXPathFuncPtr; +struct _xmlXPathFunct { + const xmlChar *name; /* the function name */ + xmlXPathEvalFunc func; /* the evaluation function */ +}; + +/** + * xmlXPathAxisFunc: + * @param ctxt the XPath interpreter context + * @param cur the previous node being explored on that axis + * + * An axis traversal function. To traverse an axis, the engine calls + * the first time with cur == NULL and repeat until the function returns + * NULL indicating the end of the axis traversal. + * + * Returns the next node in that axis or NULL if at the end of the axis. + */ + +typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr cur); + +/* + * Extra axis: a name and an axis function. + */ + +typedef struct _xmlXPathAxis xmlXPathAxis; +typedef xmlXPathAxis* xmlXPathAxisPtr; +struct _xmlXPathAxis { + const xmlChar* name; /* the axis name */ + xmlXPathAxisFunc func; /* the search function */ +}; + +// XMLENGINE: NEW CODE -- XForms extensions support +/** +Callback for resolving prefix names into namespace URIs + +@return Namespace URI for aNs prefix. + +Resolving is made with aCtxt context. + +This function is used internally by for implementation of +namespace-resovling feature in XPath API of XML Engine +(MXmlEngNamespaceResolver interface is called by libxml2) +*/ +typedef const xmlChar* (*xeXPathNsResolverFunc)(void* aCtxt, const xmlChar* aNs); +//--- + +/** + * xmlXPathContext: + * + * Expression evaluation occurs with respect to a context. + * the context consists of: + * - a node (the context node) + * - a node list (the context node list) + * - a set of variable bindings + * - a function library + * - the set of namespace declarations in scope for the expression + * Following the switch to hash tables, this need to be trimmed up at + * the next binary incompatible release. + */ +struct _xmlXPathContext { + xmlDocPtr doc; /* The current document */ + xmlNodePtr node; /* The current node */ + + //int nb_variables_unused; /* unused (hash table) */ + //int max_variables_unused; /* unused (hash table) */ + xmlHashTablePtr varHash; /* Hash table of defined variables */ + + int nb_types; /* number of defined types */ + int max_types; /* max number of types */ + xmlXPathTypePtr types; /* Array of defined types */ + + //int nb_funcs_unused; /* unused (hash table) */ + //int max_funcs_unused; /* unused (hash table) */ + xmlHashTablePtr funcHash; /* Hash table of defined funcs */ + + int nb_axis; /* number of defined axis */ + int max_axis; /* max number of axis */ + xmlXPathAxisPtr axis; /* Array of defined axis */ + + /* the namespace nodes of the context node */ + xmlNsPtr *namespaces; /* Array of namespaces */ + int nsNr; /* number of namespace in scope */ + void *user; /* function to free */ + + /* extra variables */ + int contextSize; /* the context size */ + int proximityPosition; /* the proximity position */ + + /* extra stuff for XPointer */ + int xptr; /* it this an XPointer context */ + xmlNodePtr here; /* for here() */ + xmlNodePtr origin; /* for origin() */ + + /* the set of namespace declarations in scope for the expression */ + xmlHashTablePtr nsHash; /* The namespaces hash table */ + void* varLookupFunc; /* variable lookup func */ + void* varLookupData; /* variable lookup data */ + + /* Possibility to link in an extra item */ + void* extra; /* needed for XSLT */ + + /* The function name and URI when calling a function */ + const xmlChar* function; + const xmlChar* functionURI; + + /* function lookup function and data */ + void* funcLookupFunc; /* function lookup func */ + void* funcLookupData; /* function lookup data */ + + /* temporary namespace lists kept for walking the namespace axis */ + xmlNsPtr* tmpNsList; /* Array of namespaces */ + int tmpNsNr; /* number of namespace in scope */ + + /* error reporting mechanism */ + void* userData; /* user specific data block */ + xmlStructuredErrorFunc error; /* the callback in case of errors */ + xmlError lastError; /* the last error */ + xmlNodePtr debugNode; /* the source node XSLT */ + + /* dictionnary */ + xmlDictPtr dict; /* dictionnary if any */ + +// XMLENGINE: NEW CODE -- XForms extensions support + xmlHashTablePtr instanceDocs; /* hash table that stores instance XForms instance docs, + not owned by the structure, will be freed by the client*/ + xmlNodeSetPtr dependencyList;/* nodes that the expression depends on */ + xeXPathNsResolverFunc xeResolveNs; /* find namespace URI bound to prefix in the current context */ + void* xeResolveNsCtxt; /* resolver-specific context for processing */ +// END NEW CODE + +}; + +/* + * The structure of a compiled expression form has become public in XML ENGINE + */ + +typedef enum { + XPATH_OP_END=0, + XPATH_OP_AND, + XPATH_OP_OR, + XPATH_OP_EQUAL, + XPATH_OP_CMP, + XPATH_OP_PLUS, + XPATH_OP_MULT, + XPATH_OP_UNION, + XPATH_OP_ROOT, + XPATH_OP_NODE, + XPATH_OP_RESET, + XPATH_OP_COLLECT, + XPATH_OP_VALUE, + XPATH_OP_VARIABLE, + XPATH_OP_FUNCTION, + XPATH_OP_ARG, + XPATH_OP_PREDICATE, + XPATH_OP_FILTER, + XPATH_OP_SORT +#ifdef LIBXML_XPTR_ENABLED + ,XPATH_OP_RANGETO +#endif +} xmlXPathOp; + +typedef struct _xmlXPathStepOp xmlXPathStepOp; +typedef xmlXPathStepOp *xmlXPathStepOpPtr; +struct _xmlXPathStepOp { + xmlXPathOp op; /* The identifier of the operation */ + int ch1; /* First child */ + int ch2; /* Second child */ + int value; + int value2; + int value3; + void* value4; + void* value5; + void* cache; + void* cacheURI; +}; + + +/** + The initial size of 'steps' table in the precompiled XPath exression + + Double-it policy for growth is used in the code +*/ +#define XPATH_STEPS_GRANULARITY 10 + +typedef struct _xmlXPathCompExpr xmlXPathCompExpr; +typedef xmlXPathCompExpr* xmlXPathCompExprPtr; +struct _xmlXPathCompExpr { + int nbStep; /* Number of steps in this expression */ + int maxStep; /* Maximum number of steps allocated */ + xmlXPathStepOp* steps; /* ops for computation of this expression */ + int last; /* index of last step in expression */ + xmlChar* expr; /* the expression being computed */ + xmlDictPtr dict; /* the dictionnary to use if any */ +#ifdef DEBUG_EVAL_COUNTS + int nb; + xmlChar* string; +#endif +//XMLENGINE: NEW CODE + void* extendedContext; /* some data set by API users and available for XPath extension functions */ + void* xeNsResolver; /* default namespace resolver supplied when compiling expression */ +//XMLENGINE: END NEW CODE +}; +/** + * xmlXPathParserContext: + * + * An XPath parser context. It contains pure parsing informations, + * an xmlXPathContext, and the stack of objects. + */ +struct _xmlXPathParserContext { + const xmlChar *cur; /* the current char being parsed */ + const xmlChar *base; /* the full expression */ + + int error; /* error code */ + + xmlXPathContextPtr context; /* the evaluation context */ + xmlXPathObjectPtr value; /* the current value */ + int valueNr; /* number of values stacked */ + int valueMax; /* max number of values stacked */ + xmlXPathObjectPtr *valueTab; /* stack of values */ + + xmlXPathCompExprPtr comp; /* the precompiled expression */ + int xptr; /* it this an XPointer expression */ + xmlNodePtr ancestor; /* used for walking preceding axis */ +}; + +/** + * xmlXPathFunction: + * @param ctxt the XPath interprestation context + * @param nargs the number of arguments + * + * An XPath function. + * The arguments (if any) are popped out from the context stack + * and the result is pushed on the stack. + */ + +typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); + +/************************************************************************ + * * + * Public API * + * * + ************************************************************************/ + +/* +NOTE: Now defined as local inline functions in xpath.c + It seems that no one uses them from outside.. + --> used by libxslt +*/ + +#define xmlXPathIsNaN(val) trio_isnan(val) +#define xmlXPathIsInf(val) trio_isinf(val) + + +/* These macros may later turn into functions */ +/** + * xmlXPathNodeSetGetLength: + * @param ns a node-set + * + * Implements a functionality similar to the DOM NodeList.length. + * + * Returns the number of nodes in the node-set. + */ +#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) +/** + * xmlXPathNodeSetItem: + * @param ns a node-set + * @param index index of a node in the set + * + * Implements a functionality similar to the DOM NodeList.item(). + * + * Returns the xmlNodePtr at the given index in ns or NULL if + * index is out of range (0 to length-1) + */ +#define xmlXPathNodeSetItem(ns, index) \ + (( (ns) && ((index) >= 0) && ((index) < (ns)->nodeNr) ) \ + ? (ns)->nodeTab[(index)] \ + : NULL) +/** + * xmlXPathNodeSetIsEmpty: + * @param ns a node-set + * + * Checks whether ns is empty or not. + * + * Returns %TRUE if ns is an empty node-set. + */ +#define xmlXPathNodeSetIsEmpty(ns) \ + (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) + + +XMLPUBFUN void XMLCALL + xmlXPathFreeObject (xmlXPathObjectPtr obj); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetCreate (xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); +XMLPUBFUN void XMLCALL + xmlXPathFreeNodeSet (xmlNodeSetPtr obj); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathObjectCopy (xmlXPathObjectPtr val); +XMLPUBFUN int XMLCALL + xmlXPathCmpNodes (xmlNodePtr node1, xmlNodePtr node2); +/** + * Conversion functions to basic types. + */ +XMLPUBFUN int XMLCALL + xmlXPathCastNumberToBoolean (double val); +XMLPUBFUN int XMLCALL + xmlXPathCastStringToBoolean (const xmlChar * val); +XMLPUBFUN int XMLCALL + xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); +XMLPUBFUN int XMLCALL + xmlXPathCastToBoolean (xmlXPathObjectPtr val); + +XMLPUBFUN double XMLCALL + xmlXPathCastBooleanToNumber (int val); +XMLPUBFUN double XMLCALL + xmlXPathCastStringToNumber (const xmlChar * val); +XMLPUBFUN double XMLCALL + xmlXPathCastNodeToNumber (xmlNodePtr node); +XMLPUBFUN double XMLCALL + xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); +XMLPUBFUN double XMLCALL + xmlXPathCastToNumber (xmlXPathObjectPtr val); + +XMLPUBFUN xmlChar* XMLCALL + xmlXPathCastBooleanToString (int val); +XMLPUBFUN xmlChar* XMLCALL + xmlXPathCastNumberToString (double val); +XMLPUBFUN xmlChar* XMLCALL + xmlXPathCastNodeToString (xmlNodePtr node); +XMLPUBFUN xmlChar* XMLCALL + xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); +XMLPUBFUN xmlChar* XMLCALL + xmlXPathCastToString (xmlXPathObjectPtr val); + +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertBoolean (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertNumber (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertString (xmlXPathObjectPtr val); + +/** + * Context handling. + */ +XMLPUBFUN void XMLCALL + xmlXPathInit (void); +XMLPUBFUN xmlXPathContextPtr XMLCALL + xmlXPathNewContext (xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlXPathFreeContext (xmlXPathContextPtr ctxt); + +/** + * Evaluation functions. + */ +XMLPUBFUN long XMLCALL + xmlXPathOrderDocElems (xmlDocPtr doc); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathEval (const xmlChar *str, xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathEvalExpression (const xmlChar *str, xmlXPathContextPtr ctxt); +XMLPUBFUN int XMLCALL + xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, xmlXPathObjectPtr res); +/** + * Separate compilation/evaluation entry points. + */ +XMLPUBFUN xmlXPathCompExprPtr XMLCALL + xmlXPathCompile (const xmlChar *str); +XMLPUBFUN xmlXPathCompExprPtr XMLCALL + xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, const xmlChar *str); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathCompiledEval (xmlXPathCompExprPtr comp,xmlXPathContextPtr ctx); +XMLPUBFUN void XMLCALL + xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); + +#ifdef __cplusplus +} +#endif + +#endif /* XML_XPATH_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xpathinternals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xpathinternals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,642 @@ +/* + * Summary: internal interfaces for XML Path Language implementation + * Description: internal interfaces for XML Path Language implementation + * used to build new modules on top of XPath like XPointer and + * XSLT + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XPATH_INTERNALS_H +#define XML_XPATH_INTERNALS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/************************************************************************ + * * + * Helpers * + * * + ************************************************************************/ + +/* + * Many of these macros may later turn into functions. They + * shouldn't be used in #ifdef's preprocessor instructions. + */ +/** + * xmlXPathSetError: + * @param ctxt an XPath parser context + * @param err an xmlXPathError code + * + * Raises an error. + */ +#define xmlXPathSetError(ctxt, err) \ + { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ + (ctxt)->error = (err); } + +/** + * xmlXPathSetArityError: + * @param ctxt an XPath parser context + * + * Raises an XPATH_INVALID_ARITY error. + */ +#define xmlXPathSetArityError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) + +/** + * xmlXPathSetTypeError: + * @param ctxt an XPath parser context + * + * Raises an XPATH_INVALID_TYPE error. + */ +#define xmlXPathSetTypeError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) + +/** + * xmlXPathGetError: + * @param ctxt an XPath parser context + * + * Get the error code of an XPath context. + * + * Returns the context error. + */ +#define xmlXPathGetError(ctxt) ((ctxt)->error) + +/** + * xmlXPathCheckError: + * @param ctxt an XPath parser context + * + * Check if an XPath error was raised. + * + * Returns true if an error has been raised, false otherwise. + */ +#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) + +/** + * xmlXPathGetDocument: + * @param ctxt an XPath parser context + * + * Get the document of an XPath context. + * + * Returns the context document. + */ +#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) + +/** + * xmlXPathGetContextNode: + * @param ctxt an XPath parser context + * + * Get the context node of an XPath context. + * + * Returns the context node. + */ +#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) + +XMLPUBFUN int XMLCALL + xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); +XMLPUBFUN double XMLCALL + xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathPopString (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void * XMLCALL + xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); + +/** + * xmlXPathReturnBoolean: + * @param ctxt an XPath parser context + * @param val a boolean + * + * Pushes the boolean val on the context stack. + */ +#define xmlXPathReturnBoolean(ctxt, val) \ + valuePush((ctxt), xmlXPathNewBoolean(val)) + +/** + * xmlXPathReturnTrue: + * @param ctxt an XPath parser context + * + * Pushes true on the context stack. + */ +#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) + +/** + * xmlXPathReturnFalse: + * @param ctxt an XPath parser context + * + * Pushes false on the context stack. + */ +#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) + +/** + * xmlXPathReturnNumber: + * @param ctxt an XPath parser context + * @param val a double + * + * Pushes the double val on the context stack. + */ +#define xmlXPathReturnNumber(ctxt, val) \ + valuePush((ctxt), xmlXPathNewFloat(val)) + +/** + * xmlXPathReturnString: + * @param ctxt an XPath parser context + * @param str a string + * + * Pushes the string str on the context stack. + */ +#define xmlXPathReturnString(ctxt, str) \ + valuePush((ctxt), xmlXPathWrapString(str)) + +/** + * xmlXPathReturnEmptyString: + * @param ctxt an XPath parser context + * + * Pushes an empty string on the stack. + */ +#define xmlXPathReturnEmptyString(ctxt) \ + valuePush((ctxt), xmlXPathNewCString("")) + +/** + * xmlXPathReturnNodeSet: + * @param ctxt an XPath parser context + * @param ns a node-set + * + * Pushes the node-set ns on the context stack. + */ +#define xmlXPathReturnNodeSet(ctxt, ns) \ + valuePush((ctxt), xmlXPathWrapNodeSet(ns)) + +/** + * xmlXPathReturnEmptyNodeSet: + * @param ctxt an XPath parser context + * + * Pushes an empty node-set on the context stack. + */ +#define xmlXPathReturnEmptyNodeSet(ctxt) \ + valuePush((ctxt), xmlXPathNewNodeSet(NULL)) + +/** + * xmlXPathReturnExternal: + * @param ctxt an XPath parser context + * @param val user data + * + * Pushes user data on the context stack. + */ +#define xmlXPathReturnExternal(ctxt, val) \ + valuePush((ctxt), xmlXPathWrapExternal(val)) + +/** + * xmlXPathStackIsNodeSet: + * @param ctxt an XPath parser context + * + * Check if the current value on the XPath stack is a node set or + * an XSLT value tree. + * + * Returns true if the current object on the stack is a node-set. + */ +#define xmlXPathStackIsNodeSet(ctxt) \ + (((ctxt)->value != NULL) \ + && (((ctxt)->value->type == XPATH_NODESET) \ + || ((ctxt)->value->type == XPATH_XSLT_TREE))) + +/** + * xmlXPathStackIsExternal: + * @param ctxt an XPath parser context + * + * Checks if the current value on the XPath stack is an external + * object. + * + * Returns true if the current object on the stack is an external + * object. + */ +#define xmlXPathStackIsExternal(ctxt) \ + ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) + +/** + * xmlXPathEmptyNodeSet: + * @param ns a node-set + * + * Empties a node-set. + */ +#define xmlXPathEmptyNodeSet(ns) \ + { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } + +/** + * CHECK_ERROR: + * + * Macro to return from the function if an XPath error was detected. + */ +#define CHECK_ERROR \ + if (ctxt->error != XPATH_EXPRESSION_OK) return + +/** + * CHECK_ERROR0: + * + * Macro to return 0 from the function if an XPath error was detected. + */ +#define CHECK_ERROR0 \ + if (ctxt->error != XPATH_EXPRESSION_OK) return(0) + +/** + * XP_ERROR: + * @param X the error code + * + * Macro to raise an XPath error and return. + */ +#define XP_ERROR(X) \ + { xmlXPathErr(ctxt, X); return; } + +/** + * XP_ERROR0: + * @param X the error code + * + * Macro to raise an XPath error and return 0. + */ +#define XP_ERROR0(X) \ + { xmlXPathErr(ctxt, X); return(0); } + +/** + * CHECK_TYPE: + * @param typeval the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. + */ +#define CHECK_TYPE(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR(XPATH_INVALID_TYPE) + +/** + * CHECK_TYPE0: + * @param typeval the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. Return(0) in case of failure + */ +#define CHECK_TYPE0(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR0(XPATH_INVALID_TYPE) + +/** + * CHECK_ARITY: + * @param x the number of expected args + * + * Macro to check that the number of args passed to an XPath function matches. + */ +#define CHECK_ARITY(x) \ + if (nargs != (x)) \ + XP_ERROR(XPATH_INVALID_ARITY); + +/** + * CAST_TO_STRING: + * + * Macro to try to cast the value on the top of the XPath stack to a string. + */ +#define CAST_TO_STRING \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ + xmlXPathStringFunction(ctxt, 1); + +/** + * CAST_TO_NUMBER: + * + * Macro to try to cast the value on the top of the XPath stack to a number. + */ +#define CAST_TO_NUMBER \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ + xmlXPathNumberFunction(ctxt, 1); + +/** + * CAST_TO_BOOLEAN: + * + * Macro to try to cast the value on the top of the XPath stack to a boolean. + */ +#define CAST_TO_BOOLEAN \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ + xmlXPathBooleanFunction(ctxt, 1); + +/* + * Variable Lookup forwarding. + */ +/** + * xmlXPathVariableLookupFunc: + * @param ctxt an XPath context + * @param name name of the variable + * @param ns_uri the namespace name hosting this variable + * + * Prototype for callbacks used to plug variable lookup in the XPath + * engine. + * + * Returns the XPath object value or NULL if not found. + */ +typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +XMLPUBFUN void XMLCALL + xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, + xmlXPathVariableLookupFunc f, + void *data); + +/* + * Function Lookup forwarding. + */ +/** + * xmlXPathFuncLookupFunc: + * @param ctxt an XPath context + * @param name name of the function + * @param ns_uri the namespace name hosting this function + * + * Prototype for callbacks used to plug function lookup in the XPath + * engine. + * + * Returns the XPath function or NULL if not found. + */ +typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +XMLPUBFUN void XMLCALL + xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, + xmlXPathFuncLookupFunc f, + void *funcCtxt); + +/* + * Error reporting. + */ + + +// DONE: Replaced with macro +#define xmlXPatherror(ctxt,file,line,no) xmlXPathErr(ctxt, no) +//XMLPUBFUN void XMLCALL +// xmlXPatherror (xmlXPathParserContextPtr ctxt, +// const char *file, +// int line, +// int no); + +XMLPUBFUN void XMLCALL + xmlXPathErr (xmlXPathParserContextPtr ctxt, int error); + +#ifdef LIBXML_DEBUG_ENABLED +XMLPUBFUN void XMLCALL + xmlXPathDebugDumpObject (FILE *output, + xmlXPathObjectPtr cur, + int depth); +XMLPUBFUN void XMLCALL + xmlXPathDebugDumpCompExpr(FILE *output, + xmlXPathCompExprPtr comp, + int depth); +#endif +/** + * NodeSet handling. + */ +XMLPUBFUN int XMLCALL + xmlXPathNodeSetContains (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDifference (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathIntersection (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDistinctSorted (xmlNodeSetPtr nodes); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDistinct (xmlNodeSetPtr nodes); + +XMLPUBFUN int XMLCALL + xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeLeading (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathLeading (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeTrailing (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathTrailing (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + + +/** + * Extending a context. + */ + +XMLPUBFUN int XMLCALL + xmlXPathRegisterNs (xmlXPathContextPtr ctxt, + const xmlChar *prefix, + const xmlChar *ns_uri); +XMLPUBFUN const xmlChar * XMLCALL + xmlXPathNsLookup (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); + +XMLPUBFUN int XMLCALL + xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathFunction f); +XMLPUBFUN int XMLCALL + xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathFunction f); +XMLPUBFUN int XMLCALL + xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathObjectPtr value); +XMLPUBFUN int XMLCALL + xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathObjectPtr value); +XMLPUBFUN xmlXPathFunction XMLCALL + xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathFunction XMLCALL + xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathVariableLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); + +/** + * Utilities to extend XPath. + */ +XMLPUBFUN xmlXPathParserContextPtr XMLCALL + xmlXPathNewParserContext (const xmlChar *str, xmlXPathContextPtr ctxt); +XMLPUBFUN void XMLCALL + xmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt); + + +XMLPUBFUN xmlXPathObjectPtr XMLCALL + valuePop (xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL + valuePush (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewString (const xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewCString (const char *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapString (xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapCString (char * val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewFloat (double val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewBoolean (int val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewNodeSet (xmlNodePtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewValueTree(xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetAdd (xmlNodeSetPtr cur, xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetSort (xmlNodeSetPtr set); +XMLPUBFUN void XMLCALL + xmlXPathRoot (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL + xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathParseName (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); + +/* + * Existing functions. + */ +XMLPUBFUN double XMLCALL + xmlXPathStringEvalNumber (const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res); +XMLPUBFUN void XMLCALL + xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetMerge (xmlNodeSetPtr val1, xmlNodeSetPtr val2); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetDel (xmlNodeSetPtr cur, xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetRemove (xmlNodeSetPtr cur, int val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewNodeSetList (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapNodeSet (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapExternal (void *val); + +XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); +XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); + +XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); + +/* + * Some of the axis navigation routines. + */ +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur); +/* + * The official core of XPath functions. + */ +XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); + +/** + * Really internal functions + */ +XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); + +// XMLENGINE: NEW CODE -- XForms extensions support +void addNodeSetsFromStackToDependencyList(xmlXPathParserContextPtr ctxt, int nargs); +// END NEW CODE + +#ifdef __cplusplus +} +#endif +#endif /* XML_XPATH_INTERNALS_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/libxml2_xpointer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/libxml2_xpointer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,115 @@ +/* + * Summary: API to handle XML Pointers + * Description: API to handle XML Pointers + * Base implementation was made accordingly to + * W3C Candidate Recommendation 7 June 2000 + * http://www.w3.org/TR/2000/CR-xptr-20000607 + * + * Added support for the element() scheme described in: + * W3C Proposed Recommendation 13 November 2002 + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** @file +@publishedAll +@released +*/ + +#ifndef XML_XPTR_H +#define XML_XPTR_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A Location Set + */ +typedef struct _xmlLocationSet xmlLocationSet; +typedef xmlLocationSet *xmlLocationSetPtr; +struct _xmlLocationSet { + int locNr; /* number of locations in the set */ + int locMax; /* size of the array as allocated */ + xmlXPathObjectPtr *locTab;/* array of locations */ +}; + +/* + * Handling of location sets. + */ + +XMLPUBFUN xmlLocationSetPtr XMLCALL + xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); +XMLPUBFUN xmlLocationSetPtr XMLCALL + xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, + xmlLocationSetPtr val2); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRange (xmlNodePtr start, + int startindex, + xmlNodePtr end, + int endindex); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangePoints (xmlXPathObjectPtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodePoint (xmlNodePtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodes (xmlNodePtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewLocationSetNodes (xmlNodePtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodeObject (xmlNodePtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewCollapsedRange (xmlNodePtr start); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrWrapLocationSet (xmlLocationSetPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetDel (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, + int val); + +/* + * Functions. + */ +XMLPUBFUN xmlXPathContextPtr XMLCALL + xmlXPtrNewContext (xmlDocPtr doc, + xmlNodePtr here, + xmlNodePtr origin); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrEval (const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN void XMLCALL + xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XMLPUBFUN xmlNodePtr XMLCALL + xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); +XMLPUBFUN void XMLCALL + xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); +#ifdef __cplusplus +} +#endif +#endif /* XML_XPTR_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/xmlengconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/xmlengconfig.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definitions/Declarations for XMLEngine +// + + + +/** + @file + @publishedAll + @released +*/ + +#ifndef XMLENGCONFIG_H +#define XMLENGCONFIG_H + +/** + * This file contains definitions/declarations that affect XML Engine Core + * + */ + +#include + +#define XMLENGINE_EXCLUDE_UNUSED +#define XMLENGINE_EXCLUDE_FILE_FUNC + +#ifndef HAVE_ERRNO_H +#define HAVE_ERRNO_H +#endif + +#ifdef _DEBUG +// Debug-builds only +# define XMLENGINE_MEM_DEBUG +#else +// Release-builds only +# define XMLENGINE_EXCLUDE_EMBED_MSG +#endif + +#ifndef HAVE_CTYPE_H +#define HAVE_CTYPE_H +#endif + +#ifndef HAVE_STDLIB_H +#define HAVE_STDLIB_H +#endif + +#ifndef HAVE_MATH_H +#define HAVE_MATH_H +#endif + +#ifndef HAVE_UNISTD_H +#define HAVE_UNISTD_H +#endif + +#ifndef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H +#endif + +//---------------------------------------------------- +#if defined(XMLENGINE_XPATH) && !defined(XMLENGINE_DOM) +# define XMLENGINE_DOM +#endif /* XMLENGINE_XPATH */ +//---------------------------------------------------- + +typedef struct _DOMStringConverterData DOMStringConverterData; +struct _DOMStringConverterData +{ + unsigned int lastSaved; // index: 0-3 + unsigned int maxReusableSize; // cut-off limit for buffers (0 = unrestricted) + char* cleanupItem[4]; // temporary DOMString used in API method calls + unsigned int itemSize[4]; // size of memory allocated (an item may be reused) +}; + +#endif /* XMLENGCONFIG_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/xmlengtriodef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/xmlengtriodef.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,225 @@ +/************************************************************************* + * + * Copyright (C) 2001 Bjorn Reese + * + * 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. + * + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + ************************************************************************/ + +/** @file +@publishedPartner +@released +*/ + +#ifndef TRIO_TRIODEF_H +#define TRIO_TRIODEF_H + +/************************************************************************* + * Platform and compiler support detection + */ +#if defined(__GNUC__) +# define TRIO_COMPILER_GCC +#elif defined(__SUNPRO_C) +# define TRIO_COMPILER_SUNPRO +#elif defined(__SUNPRO_CC) +# define TRIO_COMPILER_SUNPRO +# define __SUNPRO_C __SUNPRO_CC +#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__) +# define TRIO_COMPILER_XLC +#elif defined(_AIX) && !defined(__GNUC__) +# define TRIO_COMPILER_XLC /* Workaround for old xlc */ +#elif defined(__DECC) || defined(__DECCXX) +# define TRIO_COMPILER_DECC +#elif defined(__osf__) && defined(__LANGUAGE_C__) +# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */ +#elif defined(_MSC_VER) +//# define TRIO_COMPILER_MSVC +#elif defined(__BORLANDC__) +# define TRIO_COMPILER_BCB +#endif + +#if defined(VMS) || defined(__VMS) +/* + * VMS is placed first to avoid identifying the platform as Unix + * based on the DECC compiler later on. + */ +# define TRIO_PLATFORM_VMS +#elif defined(unix) || defined(__unix) || defined(__unix__) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_XLC) || defined(_AIX) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_DECC) || defined(__osf___) +# define TRIO_PLATFORM_UNIX +#elif defined(__NetBSD__) +# define TRIO_PLATFORM_UNIX +#elif defined(__QNX__) +# define TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_QNX +#elif defined(__CYGWIN__) +# define TRIO_PLATFORM_UNIX +#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32) +# define TRIO_PLATFORM_WIN32 +#elif defined(mpeix) || defined(__mpexl) +# define TRIO_PLATFORM_MPEIX +#endif + +#if defined(_AIX) +# define TRIO_PLATFORM_AIX +#elif defined(__hpux) +# define TRIO_PLATFORM_HPUX +#elif defined(sun) || defined(__sun__) +# if defined(__SVR4) || defined(__svr4__) +# define TRIO_PLATFORM_SOLARIS +# else +# define TRIO_PLATFORM_SUNOS +# endif +#endif + +#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) +# define TRIO_COMPILER_SUPPORTS_C89 +# if defined(__STDC_VERSION__) +# define TRIO_COMPILER_SUPPORTS_C90 +# if (__STDC_VERSION__ >= 199409L) +# define TRIO_COMPILER_SUPPORTS_C94 +# endif +# if (__STDC_VERSION__ >= 199901L) +# define TRIO_COMPILER_SUPPORTS_C99 +# endif +# elif defined(TRIO_COMPILER_SUNPRO) +# if (__SUNPRO_C >= 0x420) +# define TRIO_COMPILER_SUPPORTS_C94 +# endif +# endif +#endif + +#if defined(_XOPEN_SOURCE) +# if defined(_XOPEN_SOURCE_EXTENDED) +# define TRIO_COMPILER_SUPPORTS_UNIX95 +# endif +# if (_XOPEN_VERSION >= 500) +# define TRIO_COMPILER_SUPPORTS_UNIX98 +# endif +# if (_XOPEN_VERSION >= 600) +# define TRIO_COMPILER_SUPPORTS_UNIX01 +# endif +#endif + +/************************************************************************* + * Generic defines + */ + +#if !defined(TRIO_PUBLIC) +# define TRIO_PUBLIC XMLPUBFUN +#endif +#if !defined(TRIO_PRIVATE) +# define TRIO_PRIVATE static +#endif + +#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus)) +# define TRIO_COMPILER_ANCIENT +#endif + +#if defined(TRIO_COMPILER_ANCIENT) +# define TRIO_CONST +# define TRIO_VOLATILE +# define TRIO_SIGNED +typedef double trio_long_double_t; +typedef char * trio_pointer_t; +# define TRIO_SUFFIX_LONG(x) x +# define TRIO_PROTO(x) () +# define TRIO_NOARGS +# define TRIO_ARGS1(list,a1) list a1; +# define TRIO_ARGS2(list,a1,a2) list a1; a2; +# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3; +# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4; +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5; +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6; +# define TRIO_VARGS2(list,a1,a2) list a1; a2 +# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3 +# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4 +# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5 +# define TRIO_VA_DECL va_dcl +# define TRIO_VA_START(x,y) va_start(x) +# define TRIO_VA_END(x) va_end(x) +#else /* ANSI C */ +# define TRIO_CONST const +# define TRIO_VOLATILE volatile +# define TRIO_SIGNED signed +typedef long double trio_long_double_t; +typedef void * trio_pointer_t; +# define TRIO_SUFFIX_LONG(x) x ## L +# define TRIO_PROTO(x) x +# define TRIO_NOARGS void +# define TRIO_ARGS1(list,a1) (a1) +# define TRIO_ARGS2(list,a1,a2) (a1,a2) +# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3) +# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4) +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5) +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6) +# define TRIO_VARGS2 TRIO_ARGS2 +# define TRIO_VARGS3 TRIO_ARGS3 +# define TRIO_VARGS4 TRIO_ARGS4 +# define TRIO_VARGS5 TRIO_ARGS5 +# define TRIO_VA_DECL ... +# define TRIO_VA_START(x,y) va_start(x,y) +# define TRIO_VA_END(x) va_end(x) +#endif + +#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus) +# define TRIO_INLINE inline +#elif defined(TRIO_COMPILER_GCC) +# define TRIO_INLINE __inline__ +#elif defined(TRIO_COMPILER_MSVC) +# define TRIO_INLINE _inline +#elif defined(TRIO_COMPILER_BCB) +# define TRIO_INLINE __inline +#else +# define TRIO_INLINE +#endif + +/************************************************************************* + * Workarounds + */ + +#if defined(TRIO_PLATFORM_VMS) +/* + * Computations done with constants at compile time can trigger these + * even when compiling with IEEE enabled. + */ +# pragma message disable (UNDERFLOW, FLOATOVERFL) + +# if (__CRTL_VER < 80000000) +/* + * Although the compiler supports C99 language constructs, the C + * run-time library does not contain all C99 functions. + * + * This was the case for 70300022. Update the 80000000 value when + * it has been accurately determined what version of the library + * supports C99. + */ +# if defined(TRIO_COMPILER_SUPPORTS_C99) +# undef TRIO_COMPILER_SUPPORTS_C99 +# endif +# endif +#endif + +/* + * Not all preprocessors supports the LL token. + */ +#if defined(TRIO_COMPILER_BCB) +#else +# define TRIO_COMPILER_SUPPORTS_LL +#endif + +#endif /* TRIO_TRIODEF_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/xmlengtrionan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/xmlengtrionan.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,88 @@ +/************************************************************************* + * + * Copyright (C) 2001 Bjorn Reese + * + * 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. + * + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + ************************************************************************/ + +/** @file +@publishedPartner +@released +*/ +#ifndef TRIO_NAN_H +#define TRIO_NAN_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + TRIO_FP_INFINITE, + TRIO_FP_NAN, + TRIO_FP_NORMAL, + TRIO_FP_SUBNORMAL, + TRIO_FP_ZERO +}; + +/* + * Return NaN (Not-a-Number). + */ +TRIO_PUBLIC double trio_nan TRIO_PROTO((void)); + +/* + * Return positive infinity. + */ +TRIO_PUBLIC double trio_pinf TRIO_PROTO((void)); + +/* + * Return negative infinity. + */ +TRIO_PUBLIC double trio_ninf TRIO_PROTO((void)); + +/* + * Return negative zero. + */ +TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS)); + +/* + * If number is a NaN return non-zero, otherwise return zero. + */ +TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number)); + +/* + * If number is positive infinity return 1, if number is negative + * infinity return -1, otherwise return 0. + */ +TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number)); + +/* + * If number is finite return non-zero, otherwise return zero. + */ +#if 0 + +TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number)); + +TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number)); +#endif + +TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number)); + +TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative)); + +#ifdef __cplusplus +} +#endif + +#endif /* TRIO_NAN_H */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2/xmlengxeconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2/xmlengxeconfig.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definitions/Declarations for XMLEngine +// This file contains declarations and definitions that affect +// all code of XML Engine: libxml2 and all C++ wrappers around it. +// + + + + +/** + @file + @publishedAll + @released +*/ + +#ifndef XMLXECONFIG_H +#define XMLXECONFIG_H + +//---------------------------------------------------- +#define XMLENGINE_DOM +#define XMLENGINE_XPATH + +#define XMLENGINE_XSLT +#define XSLT_EXTENSION +#define XMLENGINE_NODEFILTER +#define XMLENGINE_XMLSCHEMA_DATATYPES +//---------------------------------------------------- + +#endif /* XMLENGXECONFIG_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_globals_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_globals_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +/* + * Summary: globals private header + * Description: internal global variables and thread handling for + * those variables is handled by this module. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LIBXML2_GLOBALS_PRIVATE_H +#define LIBXML2_GLOBALS_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN xmlGlobalStatePtr XMLCALL xeGetTLS(); + +XMLPUBFUN void XMLCALL xmlSetOOM(); + +XMLPUBFUN void XMLCALL xmlResetOOM(); + +XMLPUBFUN void XMLCALL xmlCleanupGlobalData(); + +XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlCreateAndInitializeGlobalState(); + +/* Internal to Libxml2 dll functions - start */ + +void XMLCALL xeSetTLS(void* ptr); +unsigned int XMLCALL xeStackLimitAddress(); +void XMLCALL xeCleanupDOMStringConverter(); + +#define CHECK_ERRNO xeCheckErrno() +void XMLCALL xeCheckErrno(); + +#define snprintf symbian_snprintf +#define vsnprintf symbian_vsnprintf +int XMLCALL symbian_vsnprintf(char *str, size_t size, const char *format, va_list ap); +int XMLCALL symbian_snprintf(char *str, size_t size, const char *format, ...); + +void XMLCALL free_debug(void* mem); + +//Global const data +typedef struct _xeGlobalConstData xeGlobalConstData; +struct _xeGlobalConstData +{ + const char* const xeParserVersion; +}; +extern const xeGlobalConstData xeGlobalConsts; +const xeGlobalConstData* xeGetGlobalConsts(); +#define xeParserVersion (xeGlobalConsts.xeParserVersion) + + +xmlParserInputPtr XMLCALL xmlDefaultExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt); + +/* Internal to Libxml2 dll functions - end */ + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_GLOBALS_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_tree_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_tree_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,47 @@ +/* + * Summary: tree private header + * Description: this module describes the structures found in an tree resulting + * from an XML or HTML parsing, as well as the API provided for + * various processing on that tree + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @internalTechnology + @released +*/ +#ifndef LIBXML2_TREE_PRIVATE_H +#define LIBXML2_TREE_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN xmlNodePtr XMLCALL xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, int extended); + +XMLPUBFUN xmlNodePtr XMLCALL xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent); + +XMLPUBFUN int XMLCALL xmlAppendDataList(xmlNodePtr node, xmlDocPtr doc); + +/* Internal to Libxml2 dll functions - start */ + +xmlNodePtr XMLCALL xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content); + +/* Handling RChunks */ +int XMLCALL xmlReplaceInDataList(xmlNodePtr old, xmlNodePtr cur, xmlDocPtr doc); +int XMLCALL xmlRemoveFromDataList(xmlNodePtr node, xmlDocPtr doc); + +/* Internal to Libxml2 dll functions - end */ + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_TREE_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_valid_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_valid_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +/* + * Summary: valid private header + * Description: internal API for the DTD handling and the validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LIBXML2_VALID_PRIVATE_H +#define LIBXML2_VALID_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN int XMLCALL xmlAddIDs(xmlNodePtr root, const xmlChar** ids); + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_VALID_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_xmlio_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_xmlio_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +/* + * Summary: valid private header + * Description: internal interface for the I/O interfaces used by the parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LIBXML2_TREE_PRIVATE_H +#define LIBXML2_TREE_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Internal to Libxml2 dll functions - start */ + +void* XMLCALL xmlFileOpen_real(const char *filename); + +#ifdef LIBXML_OUTPUT_ENABLED +int XMLCALL xmlFileWrite (void * context, const char * buffer, int len); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Internal to Libxml2 dll functions - end */ + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_TREE_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_xmlsave_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_xmlsave_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +/* + * Summary: valid private header + * Description: the XML document serializer + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LIBXML2_XMLSAVE_PRIVATE_H +#define LIBXML2_XMLSAVE_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); + +XMLPUBFUN void XMLCALL xmlSaveCtxtInit(xmlSaveCtxtPtr ctxt); + +/* Internal to Libxml2 dll functions - start */ + +void XMLCALL xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); + +/* Internal to Libxml2 dll functions - end */ + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_XMLSAVE_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/libxml2_nonexport/libxml2_xpathinternals_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/libxml2_nonexport/libxml2_xpathinternals_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +/* + * Summary: valid private header + * Description: internal interfaces for XML Path Language implementation + * used to build new modules on top of XPath like XPointer and XSLT + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +// internal interfaces for XML Path Language implementation +// used to build new modules on top of XPath like XPointer and +// XSLT +// + + + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LIBXML2_XPATHINTERNALS_PRIVATE_H +#define LIBXML2_XPATHINTERNALS_PRIVATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathCompiledEvalWithDependencies(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx, xmlNodeSetPtr deplist); + +/* Internal to Libxml2 dll functions - start */ + +//moved from libxml2_xpath.h +void xeXPathCleanup (void); + +/* Internal to Libxml2 dll functions - end */ + +#ifdef __cplusplus +} +#endif + +#endif /*LIBXML2_XPATHINTERNALS_PRIVATE_H*/ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/xmlengineutils/xmlengmem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/xmlengineutils/xmlengmem.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains definitions that are related +// to memory mangement and OOM detection +// + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef XMLENGMEM_H +#define XMLENGMEM_H + +#include + +/** +Checks whether the OOM flag was set. If the OOM flag is set, it is cleared and +the function leaves with KErrNoMemory. +@leave KErrNoMemory OOM flag was set +*/ +IMPORT_C void XmlEngOOMTestL(); + +/** +Resets the OOM flag and leaves with KErrNoMemory +@leave KErrNoMemory This function always leaves +*/ +IMPORT_C void XmlEngLeaveOOML(); + +/** Memory handling macros */ +#define OOM_IF_NULL(condition) if (condition) {} else OOM_HAPPENED +#define OOM_IF(condition) if (!(condition)) {} else OOM_HAPPENED +#define TEST_OOM_FLAG XmlEngOOMTestL(); +#define OOM_HAPPENED XmlEngLeaveOOML() + +#endif /* XMLENGMEM_H */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/xmlengineutils/xmlengutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/xmlengineutils/xmlengutils.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains methods allow to change XmlChar to TDesC +// and TDesC to XmlChar +// + + + +/** + @file + @publishedPartner + @released +*/ +#ifndef XMLENGUTILS_H +#define XMLENGUTILS_H + +#include +#include + +/** +Converts a xml string that may contains entities to a xml string +with entity references, i.e. "t>x" -> "t>x" + +@param aUnescapedString The string to escape +@return The escaped string. Ownership is transferred to the caller. The +returned string should be freed with free(). +@leave KErrNoMemory Memory allocation error +@leave - Otherwise any other system wide error code +*/ +IMPORT_C char* XmlEngEscapeForXmlValueL(const char* aUnescapedString); + +/** +Convert a UTF-16 descriptor into a UTF-8 zero-terminated string + +@param aDes The descriptor to convert +@return The returned string. Ownership is transferred to the caller. The +returned string should be freed with delete. +@leave KErrNoMemory Memory allocation error +@leave - Otherwise any other system wide error code +*/ +IMPORT_C char* XmlEngXmlCharFromDesL(const TDesC& aDes); + +/** +Convert a TDesC8 descriptor with UTF-8 characters into a UTF-8 zero-terminated +string. + +@param aDes The descriptor to convert +@return The returned string. Ownership is transferred to the caller. The +returned string should be freed with delete. +@leave KErrNoMemory Memory allocation error +@leave - Otherwise any other system wide error code +*/ +IMPORT_C char* XmlEngXmlCharFromDes8L(const TDesC8& aDes); + +#endif // XMLENGUTILS_H + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/xmlengineutils/xmlengxestd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/xmlengineutils/xmlengxestd.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains methods definition +// that to add/remove XmlEngine user +// + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef XMLENGXESTD_H +#define XMLENGXESTD_H + +#include + +/** +Leaves with the specified error code. +@param aCode Leave code +@leave - Leaves with the specified error code +*/ +IMPORT_C void XmlEngLeaveL(TInt aCode); + +/** +Initializes the global data required for libxml2 and pushes a cleanup +item for XML Engine internal data to the CleanupStack. + +This function should be used before any use of the DOM Parser or +RXmlEngDocument::SaveL() method. + +This function should have matching call to XmlEnginePopAndClose(). + +@see XmlEnginePopAndClose +@see XmlEngineCleanup +@see XmlEngineAttachL + +@leave KErrNoMemory Memory allocation error +*/ +IMPORT_C void XmlEnginePushL(); + +/** +Removes a cleanup item for XML Engine internal data from the CLeanupStack +and frees any memory allocated by XML Engine's internals + +@see XmlEnginePushL +*/ +IMPORT_C void XmlEnginePopAndClose(); + +/** +Adds a user of Xml Engine and gets or initializes the global data required for libxml2. +It does NOT put a cleanup item on the CleanupStack. + +A "user" here is any processing entity that will use XML Engine's API (SAX, +DOM, XPath, etc)). If several instances of XML parser are used within one +thread, then XmlEngineAttach() should be called for each of them. + +Every call to this method should be matched with a call to XmlEngineCleanup(). + +@see XmlEngineCleanup +@see XmlEnginePushL +*/ +IMPORT_C void XmlEngineAttachL(); + +/** +Cleans up resources internally allocated by XML parser and (optionally) frees a +parser context provided as an argument. Does NOT pop a cleanup item off the +CleanupStack + +This function is to be used as a TCleanupItem on the CleanupStack +and may be invoked directly. + +Libxml2 uses the Symbian implementation of POSIX standard libraries. During +closure of XmlEngine library, the standard library is also closed by +default.User can choose not to close the standard library when XmlEngine shuts +down, by using overloaded XmlEngineCleanup(TBool) method instead. + +@see XmlEngineAttachL +@see XmlEnginePopAndClose + +@param aParserContext A pointer to xmlParserCtxt +*/ +IMPORT_C void XmlEngineCleanup(TAny* aParserContext = NULL); + +#endif // XMLENGXESTD_H + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/xmlengineutils/xmlengxestrings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/xmlengineutils/xmlengxestrings.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,339 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains definitions of string used by +// XmlEngine's modules. +// + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef XESTRINGS_H +#define XESTRINGS_H + +#include + +/** +Defines a constant string to be used as an argument value for arguments of type +TDOMString and TDOMStringArg. + +No '\0' character can appear in the string. + +Usage: +@code + _XMLLIT(KLitName, ""); + obj.SomeMethod(KLitName); // argument type is TXmlEngConstString or TDOMStringArg +@endcode +*/ +#define _XMLLIT(LitName, utf8String) const TUint8* const LitName = (const TUint8*) utf8String; + +/** +Implements a constant string used within libxml2-based API's. + +TXmlEngConstString contains a pointer to a zero-terminated UTF-8 string. The +contents of the string is not supposed to be changed. From this point of view +TXmlEngConstString instances are close to the concept of immutable strings. + +Ownership of the string is not defined for TXmlEngConstString. Thus, in +different contexts (APIs), different string-handling policies may be applied. +For instance, in XML Engine SAX API all reported via callbacks strings of +TXmlEngConstString type are assumed owned by the parser. + +TXmlEngConstString is a base class for other specialized string classes in XML +Engine APIs. +*/ +class TXmlEngConstString + { + friend class Libxml2_XmlAttributes; + +public: + /** Default constructor */ + inline TXmlEngConstString(); + + /** + Constructor + @param aString The string for initialization. Ownership is not transferred + and the string must stay in scope for the lifetime of this object. + */ + inline TXmlEngConstString(const char* aString); + + /** + Check if the string is not NULL + @return ETrue if the string is not null, EFalse otherwise + */ + inline TBool NotNull() const; + + /** + Check if the string is NULL + @return ETrue if the string is null, EFalse otherwise + */ + inline TBool IsNull() const; + + /** + Gets a c string + @return The string as a C string or NULL if null + */ + inline const char* Cstring() const; + + /** + Gets a c string or if NULL, return a default value. + @param aDefaultValue default value + @return If not NULL, the c string, otherwise aDefaultValue + */ + inline const char* CstringDef(const char* aDefaultValue) const; + + /** + Compares with another string. NULL and "" are considered equal. + + @param aString The string to compare + @return ETrue if equal, EFalse otherwise + */ + inline TBool Equals(TXmlEngConstString aString) const; + + /** + Compares with another string. NULL and "" are considered equal. + + @param aString The string to compare + @return 0 if equal, -1 otherwise + */ + IMPORT_C TInt Compare(TXmlEngConstString aString) const; + + /** + Allocates a HBufC from the string contents. Ownership is transferred to + the caller. + + Typical use: + @code + ... + HBufC* attrValue = attr.Value().AllocL(); + ... + @endcode + + @see AllocLC() + @leave KErrNoMemory Memory allocation failure + @leave KUriUtilsCannotConvert String cannot be converted + */ + IMPORT_C HBufC* AllocL() const; + + /** + Allocates a HBufC from the string contents and pushes the descriptor to + cleanup stack. Ownership is transferred to the caller. + + Typical use: + @code + ... + HBufC* attrValue = attr.Value().AllocLC(); + ... + @endcode + + @see AllocL() + @leave KErrNoMemory Memory allocation failure + @leave KUriUtilsCannotConvert String cannot be converted + */ + IMPORT_C HBufC* AllocLC() const; + + /** + Get a TPtrC8 that contains the string + @return A point descriptor that holds the string + */ + inline TPtrC8 PtrC8() const; + + /** + Creates a new copy of the string contents. Ownership for the new string is + transferred to the caller. + + @return A c string copy of the string contents + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C char* CopyL() const; + + /** + Returns the size of the string in bytes + @return The size + */ + IMPORT_C TUint Size() const; + + /** + Get the length of the string. For non-ASCII strings, Size() != Length() due + to the UTF-8 encoding used for non-ASCII characters. + @return The number of characters in the string + */ + IMPORT_C TUint Length() const; + +protected: + /** + Set a new string value. The old string is not freed. Ownership is not + transferred. + @param aString The new value + */ + inline void Set(char* aString); + +protected: + /** String value */ + char* iString; +}; + +/** +General-purpose string used in libxml2-based API's. + +This class holds a zero-terminated sequence of bytes (c-style string). It is +commonly used to represent a sequence of UTF-8 characters. + +TXmlEngString objects should be treated as if they were pointers. The +destructor for TXmlEngString does nothing. This means that the developer needs +to free the memory allocated by TXmlEngString by calling Free() or Close() +(Close() is an alias for Free()) and to do so only once. + +The reason for this design is that the goal is to have a string class that is +as small as a one-pointer sized object that is mostly stored on the stack, not +on the heap (and therefore no additional memory allocation is required). It is +also as flexible as possible to allow developers to create their own derived +classes which may provide auto_ptr-like or reference counting solutions. + +The contents of this class can be replaced, destroyed, copied and converted to +c strings and Symbian descriptor types. + +The contents of TXmlEngString may also be modified with AppendL(). + +When TXmlEngString is the return type in libxml2 based API's, this usually +indicates that a string has been newly allocated, which should be freed by the +method caller. +*/ +class TXmlEngString: public TXmlEngConstString +{ +public: + /** Default constructor */ + inline TXmlEngString(); + + /** + Constructs a new string from a given c string. Ownership is transferred + and the string must be freed with Free() or Close(). + + @param aString A heap-based c string + */ + inline TXmlEngString(char* aString); + + /** Frees the string */ + IMPORT_C void Free(); + + /** + Sets a new value. The old string is freed. Ownership is transferred and + the string must be freed with Free() or Close(). + + @param aStr The new string + */ + inline void Set(char* aStr); + + /** + Transfers a string and its ownership from another TXmlEngString object. If + this object currently stores a string it is freed. + + @param aSrc The source string + */ + IMPORT_C void Set(TXmlEngString& aSrc); + + /** Frees the string */ + inline void Close(); + + /** + Pushes this string to the cleanup stack. This must be matched with a + corresponding call to CleanupStack::Pop() or CleanupStack::PopAndDestroy(). + @return This object + @leave KErrNoMemory Memory allocation failure + */ + inline TXmlEngString PushL(); + + /** + Initializes the string, converting from a UTF-16 descriptor to + a UTF-8 zero-terminated string. + @param aDes The new value + @leave - One of the system-wide error codes + */ + IMPORT_C void SetL(const TDesC& aDes); + + /** + Initializes the string from a descriptor + @param aDes The new value + @leave - One of the system-wide error codes + */ + IMPORT_C void SetL(const TDesC8& aDes); + + /** + Creates a new UTF-16 HBufC from the UTF-8 string contents and transfers + ownership of the string. The string held by this object is freed. + + Typical use: + @code + ... + HBufC* attrValue = attr.WholeValueCopyL().AllocAndFreeL(); + ... + @endcode + + @see AllocAndFreeLC() + @return The copied string + @leave KErrNoMemory Memory allocation failure + @leave KUriUtilsCannotConvert String cannot be converted + */ + IMPORT_C HBufC* AllocAndFreeL(); + + /** + Creates a new UTF-16 HBufC from the UTF-8 string contents and transfers + ownership of the string. The result is placed on the cleanup stack. The + string held by this object is freed. + + Typical use: + @code + ... + HBufC* attrValue = attr.WholeValueCopyL().AllocAndFreeL(); + ... + @endcode + + @see AllocAndFreeL() + @return The copied string + @leave KErrNoMemory Memory allocation failure + @leave KUriUtilsCannotConvert String cannot be converted + */ + IMPORT_C HBufC* AllocAndFreeLC(); + + /** + Appends new text to the string + @param aStr The string to add + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C void AppendL(TXmlEngString aStr); + + /** + Appends new text to the string. + @param aStr1 The first string to append + @param aStr2 The second string to append + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C void AppendL(TXmlEngString aStr1, TXmlEngString aStr2); + +protected: + /** + Constructs the object from a TXmlEngConstString + @param aStr The string to initialize from + */ + inline TXmlEngString(const TXmlEngConstString& aStr): TXmlEngConstString(aStr.Cstring()) {} +}; + +#include + +#endif // XESTRINGS_H + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/inc/xmlengineutils/xmlengxestrings.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/inc/xmlengineutils/xmlengxestrings.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,78 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Declaration of methods from string classes. +// + +inline TXmlEngConstString::TXmlEngConstString() + : iString(NULL) {} + +inline TXmlEngConstString::TXmlEngConstString(const char* const aString) + :iString(const_cast(aString)) {} + +inline TBool TXmlEngConstString::NotNull() const + {return iString!=NULL;} + +inline TBool TXmlEngConstString::IsNull() const + {return iString==NULL;} + +inline const char* TXmlEngConstString::Cstring() const + {return iString;} + +inline const char* TXmlEngConstString::CstringDef(const char* aDefaultValue) const + {return iString ? iString : aDefaultValue;} + +inline TBool TXmlEngConstString::Equals(TXmlEngConstString aString) const + {return !Compare(aString);} + +inline TPtrC8 TXmlEngConstString::PtrC8() const + {return TPtrC8((TUint8*)iString, Size());} + +inline void TXmlEngConstString::Set(char* aString) + {iString = aString;} + +// ---------------------------------------------------- TXmlEngString + +// -------------------------------------------------------------------------------------- +// Default constructor +// -------------------------------------------------------------------------------------- +// +inline TXmlEngString::TXmlEngString() + :TXmlEngConstString(NULL) {} + +// -------------------------------------------------------------------------------------- +//Constructor for TDOMString initialized with given c-string +// -------------------------------------------------------------------------------------- +// +inline TXmlEngString::TXmlEngString(char* aString) + :TXmlEngConstString(aString) {} + +// -------------------------------------------------------------------------------------- +// Sets new value; old contents is freed +// -------------------------------------------------------------------------------------- +// +inline void TXmlEngString::Set(char* aStr) + {delete iString; iString = aStr;} + +inline void TXmlEngString::Close() + {Free();} + +// -------------------------------------------------------------------------------------- +// Pushes string pointer to CleanupStack. +// +// DO NOT forget to call CleanupStack::PopAndDestroy() for it +// (or CleanupStack::Pop() and then Free()) +// -------------------------------------------------------------------------------------- +// +inline TXmlEngString TXmlEngString::PushL() + {CleanupStack::PushL((TAny*)iString); return *this;} diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Daniel Veillard shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + +Copyright (C) 2000 Gary Pennington and Daniel Veillard. +Copyright (C) 2003 Daniel Veillard. +Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2000 Bjorn Reese and Daniel Veillard. +Copyright (C) 2001 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2000 Bjorn Reese and Daniel Stenberg. +Copyright (C) 2001 Bjorn Reese + +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. diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml/libxml2_trionan.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml/libxml2_trionan.inc Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,930 @@ +/************************************************************************* + * + * Copyright (C) 2001 Bjorn Reese + * + * 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. + * + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + ************************************************************************ + * + * Functions to handle special quantities in floating-point numbers + * (that is, NaNs and infinity). They provide the capability to detect + * and fabricate special quantities. + * + * Although written to be as portable as possible, it can never be + * guaranteed to work on all platforms, as not all hardware supports + * special quantities. + * + * The approach used here (approximately) is to: + * + * 1. Use C99 functionality when available. + * 2. Use IEEE 754 bit-patterns if possible. + * 3. Use platform-specific techniques. + * + ************************************************************************/ + +/* + * + * o Put all the magic into trio_fpclassify_and_signbit(), and use this from + * trio_isnan() etc. + */ + +/************************************************************************* + * Include files + */ +#include "xmlengtriodef.h" +#include "xmlengtrionan.h" + +#include +#include +#include + + +#if defined(TRIO_PLATFORM_UNIX) +# include +#endif +#if defined(TRIO_COMPILER_DECC) +# if defined(__linux__) +# include +# else +# include +# endif +#endif +#include + +#if defined(TRIO_DOCUMENTATION) +# include "doc/doc_nan.h" +#endif +/** @addtogroup SpecialQuantities + @{ +*/ + +/************************************************************************* + * Definitions + */ + +#define TRIO_TRUE (1 == 1) +#define TRIO_FALSE (0 == 1) + +/* + * We must enable IEEE floating-point on Alpha + */ + +#if defined(__alpha) && !defined(_IEEE_FP) +# if defined(TRIO_COMPILER_DECC) +# if defined(TRIO_PLATFORM_VMS) +# error "Must be compiled with option /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE" +# else +# if !defined(_CFE) +# error "Must be compiled with option -ieee" +# endif +# endif +# elif defined(TRIO_COMPILER_GCC) && (defined(__osf__) || defined(__linux__)) +# error "Must be compiled with option -mieee" +# endif +#endif /* __alpha && ! _IEEE_FP */ + +/* + * In ANSI/IEEE 754-1985 64-bits double format numbers have the + * following properties (amoungst others) + * + * o FLT_RADIX == 2: binary encoding + * o DBL_MAX_EXP == 1024: 11 bits exponent, where one bit is used + * to indicate special numbers (e.g. NaN and Infinity), so the + * maximum exponent is 10 bits wide (2^10 == 1024). + * o DBL_MANT_DIG == 53: The mantissa is 52 bits wide, but because + * numbers are normalized the initial binary 1 is represented + * implicitly (the so-called "hidden bit"), which leaves us with + * the ability to represent 53 bits wide mantissa. + */ +#if (FLT_RADIX == 2) && (DBL_MAX_EXP == 1024) && (DBL_MANT_DIG == 53) +# define USE_IEEE_754 +#endif + +#if defined(__SYMBIAN32__) || defined(WIN32) +# define USE_IEEE_754 +#endif + +#ifndef DBL_MAX +#define DBL_MAX 1.79769313486231500e+308 +#endif +#ifndef DBL_MIN +#define DBL_MIN 2.22507385850720200e-308 +#endif + +/************************************************************************* + * Constants + */ + +#if defined(USE_IEEE_754) + +/* + * Endian-agnostic indexing macro. + * + * The value of internalEndianMagic, when converted into a 64-bit + * integer, becomes 0x0706050403020100 (we could have used a 64-bit + * integer value instead of a double, but not all platforms supports + * that type). The value is automatically encoded with the correct + * endianess by the compiler, which means that we can support any + * kind of endianess. The individual bytes are then used as an index + * for the IEEE 754 bit-patterns and masks. + */ +#define TRIO_DOUBLE_INDEX(x) (((unsigned char *)&internalEndianMagic)[7-(x)]) + + + +static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275; + +/* Mask for the exponent */ +static TRIO_CONST unsigned char ieee_754_exponent_mask[] = { + 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* Mask for the mantissa */ +static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = { + 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; + +/* Mask for the sign bit */ +static TRIO_CONST unsigned char ieee_754_sign_mask[] = { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* Bit-pattern for negative zero */ +static TRIO_CONST unsigned char ieee_754_negzero_array[] = { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* Bit-pattern for infinity */ +static TRIO_CONST unsigned char ieee_754_infinity_array[] = { + 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* Bit-pattern for quiet NaN */ +static TRIO_CONST unsigned char ieee_754_qnan_array[] = { + 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + + +/************************************************************************* + * Functions + */ + +/* + * trio_make_double + */ +TRIO_PRIVATE double +trio_make_double +TRIO_ARGS1((values), + TRIO_CONST unsigned char *values) +{ + TRIO_VOLATILE double result; + int i; + + for (i = 0; i < (int)sizeof(double); i++) { + ((TRIO_VOLATILE unsigned char *)&result)[TRIO_DOUBLE_INDEX(i)] = values[i]; + } + return result; +} + +/* + * trio_is_special_quantity + */ +TRIO_PRIVATE int +trio_is_special_quantity +TRIO_ARGS2((number, has_mantissa), + double number, + int *has_mantissa) +{ + unsigned int i; + unsigned char current; + int is_special_quantity = TRIO_TRUE; + + *has_mantissa = 0; + + for (i = 0; i < (unsigned int)sizeof(double); i++) { + current = ((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)]; + is_special_quantity + &= ((current & ieee_754_exponent_mask[i]) == ieee_754_exponent_mask[i]); + *has_mantissa |= (current & ieee_754_mantissa_mask[i]); + } + return is_special_quantity; +} + +/* + * trio_is_negative + */ +TRIO_PRIVATE int +trio_is_negative +TRIO_ARGS1((number), + double number) +{ + unsigned int i; + int is_negative = TRIO_FALSE; + + for (i = 0; i < (unsigned int)sizeof(double); i++) { + is_negative |= (((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)] + & ieee_754_sign_mask[i]); + } + return is_negative; +} + +#endif /* USE_IEEE_754 */ + + +/** + Generate negative zero. + + @return Floating-point representation of negative zero. +*/ +TRIO_PUBLIC double +trio_nzero(TRIO_NOARGS) +{ +#if defined(USE_IEEE_754) + return trio_make_double(ieee_754_negzero_array); +#else + TRIO_VOLATILE double zero = 0.0; + + return -zero; +#endif +} + +/** + Generate positive infinity. + + @return Floating-point representation of positive infinity. +*/ +TRIO_PUBLIC double +trio_pinf(TRIO_NOARGS) +{ + /* Cache the result */ + //FIXIT +// static + double result = 0.0; + + if (result == 0.0) { + +#if defined(INFINITY) && defined(__STDC_IEC_559__) + result = (double)INFINITY; + +#elif defined(USE_IEEE_754) + result = trio_make_double(ieee_754_infinity_array); + +#else + /* + * If HUGE_VAL is different from DBL_MAX, then HUGE_VAL is used + * as infinity. Otherwise we have to resort to an overflow + * operation to generate infinity. + */ +# if defined(TRIO_PLATFORM_UNIX) + void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN); +# endif + + result = HUGE_VAL; + if (HUGE_VAL == DBL_MAX) { + /* Force overflow */ + result += HUGE_VAL; + } + +# if defined(TRIO_PLATFORM_UNIX) + signal(SIGFPE, signal_handler); +# endif + +#endif + } + return result; +} + +/** + Generate negative infinity. + + @return Floating-point value of negative infinity. +*/ +TRIO_PUBLIC double +trio_ninf(TRIO_NOARGS) +{ + //FIXIT + //static + double result = 0.0; + + if (result == 0.0) { + /* + * Negative infinity is calculated by negating positive infinity, + * which can be done because it is legal to do calculations on + * infinity (for example, 1 / infinity == 0). + */ + result = -trio_pinf(); + } + return result; +} + +/** + Generate NaN. + + @return Floating-point representation of NaN. +*/ +TRIO_PUBLIC double +trio_nan(TRIO_NOARGS) +{ + /* Cache the result */ + //FIXIT + //static + double result = 0.0; + + if (result == 0.0) { + +#if defined(TRIO_COMPILER_SUPPORTS_C99) + result = nan(""); + +#elif defined(NAN) && defined(__STDC_IEC_559__) + result = (double)NAN; + +#elif defined(USE_IEEE_754) + result = trio_make_double(ieee_754_qnan_array); + +#else + /* + * There are several ways to generate NaN. The one used here is + * to divide infinity by infinity. I would have preferred to add + * negative infinity to positive infinity, but that yields wrong + * result (infinity) on FreeBSD. + * + * This may fail if the hardware does not support NaN, or if + * the Invalid Operation floating-point exception is unmasked. + */ +# if defined(TRIO_PLATFORM_UNIX) + void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN); +# endif + + result = trio_pinf() / trio_pinf(); + +# if defined(TRIO_PLATFORM_UNIX) + signal(SIGFPE, signal_handler); +# endif + +#endif + } + return result; +} + +/** + Check for NaN. + + @param number An arbitrary floating-point number. + @return Boolean value indicating whether or not the number is a NaN. +*/ +TRIO_PUBLIC int +trio_isnan +TRIO_ARGS1((number), + double number) +{ +#if (defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isnan)) \ + || defined(TRIO_COMPILER_SUPPORTS_UNIX95) + /* + * C99 defines isnan() as a macro. UNIX95 defines isnan() as a + * function. This function was already present in XPG4, but this + * is a bit tricky to detect with compiler defines, so we choose + * the conservative approach and only use it for UNIX95. + */ + return isnan(number); + +#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) + /* + * Microsoft Visual C++ and Borland C++ Builder have an _isnan() + * function. + */ + return _isnan(number) ? TRIO_TRUE : TRIO_FALSE; + +#elif defined(USE_IEEE_754) + /* + * Examine IEEE 754 bit-pattern. A NaN must have a special exponent + * pattern, and a non-empty mantissa. + */ + int has_mantissa; + int is_special_quantity; + + is_special_quantity = trio_is_special_quantity(number, &has_mantissa); + + return (is_special_quantity && has_mantissa); + +#else + /* + * Fallback solution + */ + int status; + double integral, fraction; + +# if defined(TRIO_PLATFORM_UNIX) + void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN); +# endif + + status = (/* + * NaN is the only number which does not compare to itself + */ + ((TRIO_VOLATILE double)number != (TRIO_VOLATILE double)number) || + /* + * Fallback solution if NaN compares to NaN + */ + ((number != 0.0) && + (fraction = modf(number, &integral), + integral == fraction))); + +# if defined(TRIO_PLATFORM_UNIX) + signal(SIGFPE, signal_handler); +# endif + + return status; + +#endif +} + +/** + Check for infinity. + + @param number An arbitrary floating-point number. + @return 1 if positive infinity, -1 if negative infinity, 0 otherwise. +*/ +TRIO_PUBLIC int +trio_isinf +TRIO_ARGS1((number), + double number) +{ +#if defined(TRIO_COMPILER_DECC) && !defined(__linux__) + /* + * DECC has an isinf() macro, but it works differently than that + * of C99, so we use the fp_class() function instead. + */ + return ((fp_class(number) == FP_POS_INF) + ? 1 + : ((fp_class(number) == FP_NEG_INF) ? -1 : 0)); + +#elif defined(isinf) && !defined(WIN32) + /* + * C99 defines isinf() as a macro. + */ + return isinf(number) + ? ((number > 0.0) ? 1 : -1) + : 0; + +#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) + /* + * Microsoft Visual C++ and Borland C++ Builder have an _fpclass() + * function that can be used to detect infinity. + */ + return ((_fpclass(number) == _FPCLASS_PINF) + ? 1 + : ((_fpclass(number) == _FPCLASS_NINF) ? -1 : 0)); + +#elif defined(USE_IEEE_754) + /* + * Examine IEEE 754 bit-pattern. Infinity must have a special exponent + * pattern, and an empty mantissa. + */ + int has_mantissa; + int is_special_quantity; + + is_special_quantity = trio_is_special_quantity(number, &has_mantissa); + + return (is_special_quantity && !has_mantissa) + ? ((number < 0.0) ? -1 : 1) + : 0; + +#else + /* + * Fallback solution. + */ + int status; + +# if defined(TRIO_PLATFORM_UNIX) + void (*signal_handler)(int) = signal(SIGFPE, SIG_IGN); +# endif + + double infinity = trio_pinf(); + + status = ((number == infinity) + ? 1 + : ((number == -infinity) ? -1 : 0)); + +# if defined(TRIO_PLATFORM_UNIX) + signal(SIGFPE, signal_handler); +# endif + + return status; + +#endif +} + +#if 0 + /* Temporary - this routine is not used anywhere */ +/** + Check for finity. + + @param number An arbitrary floating-point number. + @return Boolean value indicating whether or not the number is a finite. +*/ +TRIO_PUBLIC int +trio_isfinite +TRIO_ARGS1((number), + double number) +{ +#if defined(TRIO_COMPILER_SUPPORTS_C99) && defined(isfinite) + /* + * C99 defines isfinite() as a macro. + */ + return isfinite(number); + +#elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) + /* + * Microsoft Visual C++ and Borland C++ Builder use _finite(). + */ + return _finite(number); + +#elif defined(USE_IEEE_754) + /* + * Examine IEEE 754 bit-pattern. For finity we do not care about the + * mantissa. + */ + int dummy; + + return (! trio_is_special_quantity(number, &dummy)); + +#else + /* + * Fallback solution. + */ + return ((trio_isinf(number) == 0) && (trio_isnan(number) == 0)); + +#endif +} + +#endif + +/* + * The sign of NaN is always false + */ +TRIO_PUBLIC int +trio_fpclassify_and_signbit +TRIO_ARGS2((number, is_negative), + double number, + int *is_negative) +{ +#if defined(fpclassify) && defined(signbit) + /* + * C99 defines fpclassify() and signbit() as a macros + */ + *is_negative = signbit(number); + switch (fpclassify(number)) { + case FP_NAN: + return TRIO_FP_NAN; + case FP_INFINITE: + return TRIO_FP_INFINITE; + case FP_SUBNORMAL: + return TRIO_FP_SUBNORMAL; + case FP_ZERO: + return TRIO_FP_ZERO; + default: + return TRIO_FP_NORMAL; + } + +#else +# if defined(TRIO_COMPILER_DECC) + /* + * DECC has an fp_class() function. + */ +# define TRIO_FPCLASSIFY(n) fp_class(n) +# define TRIO_QUIET_NAN FP_QNAN +# define TRIO_SIGNALLING_NAN FP_SNAN +# define TRIO_POSITIVE_INFINITY FP_POS_INF +# define TRIO_NEGATIVE_INFINITY FP_NEG_INF +# define TRIO_POSITIVE_SUBNORMAL FP_POS_DENORM +# define TRIO_NEGATIVE_SUBNORMAL FP_NEG_DENORM +# define TRIO_POSITIVE_ZERO FP_POS_ZERO +# define TRIO_NEGATIVE_ZERO FP_NEG_ZERO +# define TRIO_POSITIVE_NORMAL FP_POS_NORM +# define TRIO_NEGATIVE_NORMAL FP_NEG_NORM + +# elif defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) + /* + * Microsoft Visual C++ and Borland C++ Builder have an _fpclass() + * function. + */ +# define TRIO_FPCLASSIFY(n) _fpclass(n) +# define TRIO_QUIET_NAN _FPCLASS_QNAN +# define TRIO_SIGNALLING_NAN _FPCLASS_SNAN +# define TRIO_POSITIVE_INFINITY _FPCLASS_PINF +# define TRIO_NEGATIVE_INFINITY _FPCLASS_NINF +# define TRIO_POSITIVE_SUBNORMAL _FPCLASS_PD +# define TRIO_NEGATIVE_SUBNORMAL _FPCLASS_ND +# define TRIO_POSITIVE_ZERO _FPCLASS_PZ +# define TRIO_NEGATIVE_ZERO _FPCLASS_NZ +# define TRIO_POSITIVE_NORMAL _FPCLASS_PN +# define TRIO_NEGATIVE_NORMAL _FPCLASS_NN + +# elif defined(FP_PLUS_NORM) + /* + * HP-UX 9.x and 10.x have an fpclassify() function, that is different + * from the C99 fpclassify() macro supported on HP-UX 11.x. + * + * AIX has class() for C, and _class() for C++, which returns the + * same values as the HP-UX fpclassify() function. + */ +# if defined(TRIO_PLATFORM_AIX) +# if defined(__cplusplus) +# define TRIO_FPCLASSIFY(n) _class(n) +# else +# define TRIO_FPCLASSIFY(n) class(n) +# endif +# else +# define TRIO_FPCLASSIFY(n) fpclassify(n) +# endif +# define TRIO_QUIET_NAN FP_QNAN +# define TRIO_SIGNALLING_NAN FP_SNAN +# define TRIO_POSITIVE_INFINITY FP_PLUS_INF +# define TRIO_NEGATIVE_INFINITY FP_MINUS_INF +# define TRIO_POSITIVE_SUBNORMAL FP_PLUS_DENORM +# define TRIO_NEGATIVE_SUBNORMAL FP_MINUS_DENORM +# define TRIO_POSITIVE_ZERO FP_PLUS_ZERO +# define TRIO_NEGATIVE_ZERO FP_MINUS_ZERO +# define TRIO_POSITIVE_NORMAL FP_PLUS_NORM +# define TRIO_NEGATIVE_NORMAL FP_MINUS_NORM +# endif + +# if defined(TRIO_FPCLASSIFY) + switch (TRIO_FPCLASSIFY(number)) { + case TRIO_QUIET_NAN: + case TRIO_SIGNALLING_NAN: + *is_negative = TRIO_FALSE; /* NaN has no sign */ + return TRIO_FP_NAN; + case TRIO_POSITIVE_INFINITY: + *is_negative = TRIO_FALSE; + return TRIO_FP_INFINITE; + case TRIO_NEGATIVE_INFINITY: + *is_negative = TRIO_TRUE; + return TRIO_FP_INFINITE; + case TRIO_POSITIVE_SUBNORMAL: + *is_negative = TRIO_FALSE; + return TRIO_FP_SUBNORMAL; + case TRIO_NEGATIVE_SUBNORMAL: + *is_negative = TRIO_TRUE; + return TRIO_FP_SUBNORMAL; + case TRIO_POSITIVE_ZERO: + *is_negative = TRIO_FALSE; + return TRIO_FP_ZERO; + case TRIO_NEGATIVE_ZERO: + *is_negative = TRIO_TRUE; + return TRIO_FP_ZERO; + case TRIO_POSITIVE_NORMAL: + *is_negative = TRIO_FALSE; + return TRIO_FP_NORMAL; + case TRIO_NEGATIVE_NORMAL: + *is_negative = TRIO_TRUE; + return TRIO_FP_NORMAL; + default: + /* Just in case... */ + *is_negative = (number < 0.0); + return TRIO_FP_NORMAL; + } + +# else + /* + * Fallback solution. + */ + int rc; + + if (number == 0.0) { + /* + * In IEEE 754 the sign of zero is ignored in comparisons, so we + * have to handle this as a special case by examining the sign bit + * directly. + */ +# if defined(USE_IEEE_754) + *is_negative = trio_is_negative(number); +# else + *is_negative = TRIO_FALSE; +# endif + return TRIO_FP_ZERO; + } + if (trio_isnan(number)) { + *is_negative = TRIO_FALSE; + return TRIO_FP_NAN; + } + rc = trio_isinf(number); + if (rc) { + *is_negative = (rc == -1); + return TRIO_FP_INFINITE; + } + if ((number > 0.0) && (number < DBL_MIN)) { + *is_negative = TRIO_FALSE; + return TRIO_FP_SUBNORMAL; + } + if ((number < 0.0) && (number > -DBL_MIN)) { + *is_negative = TRIO_TRUE; + return TRIO_FP_SUBNORMAL; + } + *is_negative = (number < 0.0); + return TRIO_FP_NORMAL; + +# endif +#endif +} + +/** + Examine the sign of a number. + + @param number An arbitrary floating-point number. + @return Boolean value indicating whether or not the number has the + sign bit set (i.e. is negative). +*/ +TRIO_PUBLIC int +trio_signbit +TRIO_ARGS1((number), + double number) +{ + int is_negative; + + (void)trio_fpclassify_and_signbit(number, &is_negative); + return is_negative; +} + +#if 0 + /* Temporary - this routine is not used in libxml */ +/** + Examine the class of a number. + + @param number An arbitrary floating-point number. + @return Enumerable value indicating the class of @p number +*/ +TRIO_PUBLIC int +trio_fpclassify +TRIO_ARGS1((number), + double number) +{ + int dummy; + + return trio_fpclassify_and_signbit(number, &dummy); +} + +#endif + +/** @} SpecialQuantities */ + +/************************************************************************* + * For test purposes. + * + * Add the following compiler option to include this test code. + * + * Unix : -DSTANDALONE + * VMS : /DEFINE=(STANDALONE) + */ +#if defined(STANDALONE) +# include + +static TRIO_CONST char * +getClassification +TRIO_ARGS1((type), + int type) +{ + switch (type) { + case TRIO_FP_INFINITE: + return "FP_INFINITE"; + case TRIO_FP_NAN: + return "FP_NAN"; + case TRIO_FP_NORMAL: + return "FP_NORMAL"; + case TRIO_FP_SUBNORMAL: + return "FP_SUBNORMAL"; + case TRIO_FP_ZERO: + return "FP_ZERO"; + default: + return "FP_UNKNOWN"; + } +} + +static void +print_class +TRIO_ARGS2((prefix, number), + TRIO_CONST char *prefix, + double number) +{ + printf("%-6s: %s %-15s %g\n", + prefix, + trio_signbit(number) ? "-" : "+", + getClassification(TRIO_FPCLASSIFY(number)), + number); +} + + +int main(TRIO_NOARGS) +{ + double my_nan; + double my_pinf; + double my_ninf; +# if defined(TRIO_PLATFORM_UNIX) + void (*signal_handler) TRIO_PROTO((int)); +# endif + + my_nan = trio_nan(); + my_pinf = trio_pinf(); + my_ninf = trio_ninf(); + + print_class("Nan", my_nan); + print_class("PInf", my_pinf); + print_class("NInf", my_ninf); + print_class("PZero", 0.0); + print_class("NZero", -0.0); + print_class("PNorm", 1.0); + print_class("NNorm", -1.0); + print_class("PSub", 1.01e-307 - 1.00e-307); + print_class("NSub", 1.00e-307 - 1.01e-307); + + printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_nan, + ((unsigned char *)&my_nan)[0], + ((unsigned char *)&my_nan)[1], + ((unsigned char *)&my_nan)[2], + ((unsigned char *)&my_nan)[3], + ((unsigned char *)&my_nan)[4], + ((unsigned char *)&my_nan)[5], + ((unsigned char *)&my_nan)[6], + ((unsigned char *)&my_nan)[7], + trio_isnan(my_nan), trio_isinf(my_nan)); + printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_pinf, + ((unsigned char *)&my_pinf)[0], + ((unsigned char *)&my_pinf)[1], + ((unsigned char *)&my_pinf)[2], + ((unsigned char *)&my_pinf)[3], + ((unsigned char *)&my_pinf)[4], + ((unsigned char *)&my_pinf)[5], + ((unsigned char *)&my_pinf)[6], + ((unsigned char *)&my_pinf)[7], + trio_isnan(my_pinf), trio_isinf(my_pinf)); + printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_ninf, + ((unsigned char *)&my_ninf)[0], + ((unsigned char *)&my_ninf)[1], + ((unsigned char *)&my_ninf)[2], + ((unsigned char *)&my_ninf)[3], + ((unsigned char *)&my_ninf)[4], + ((unsigned char *)&my_ninf)[5], + ((unsigned char *)&my_ninf)[6], + ((unsigned char *)&my_ninf)[7], + trio_isnan(my_ninf), trio_isinf(my_ninf)); + +# if defined(TRIO_PLATFORM_UNIX) + signal_handler = signal(SIGFPE, SIG_IGN); +# endif + + my_pinf = DBL_MAX + DBL_MAX; + my_ninf = -my_pinf; + my_nan = my_pinf / my_pinf; + +# if defined(TRIO_PLATFORM_UNIX) + signal(SIGFPE, signal_handler); +# endif + + printf("NaN : %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_nan, + ((unsigned char *)&my_nan)[0], + ((unsigned char *)&my_nan)[1], + ((unsigned char *)&my_nan)[2], + ((unsigned char *)&my_nan)[3], + ((unsigned char *)&my_nan)[4], + ((unsigned char *)&my_nan)[5], + ((unsigned char *)&my_nan)[6], + ((unsigned char *)&my_nan)[7], + trio_isnan(my_nan), trio_isinf(my_nan)); + printf("PInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_pinf, + ((unsigned char *)&my_pinf)[0], + ((unsigned char *)&my_pinf)[1], + ((unsigned char *)&my_pinf)[2], + ((unsigned char *)&my_pinf)[3], + ((unsigned char *)&my_pinf)[4], + ((unsigned char *)&my_pinf)[5], + ((unsigned char *)&my_pinf)[6], + ((unsigned char *)&my_pinf)[7], + trio_isnan(my_pinf), trio_isinf(my_pinf)); + printf("NInf: %4g 0x%02x%02x%02x%02x%02x%02x%02x%02x (%2d, %2d)\n", + my_ninf, + ((unsigned char *)&my_ninf)[0], + ((unsigned char *)&my_ninf)[1], + ((unsigned char *)&my_ninf)[2], + ((unsigned char *)&my_ninf)[3], + ((unsigned char *)&my_ninf)[4], + ((unsigned char *)&my_ninf)[5], + ((unsigned char *)&my_ninf)[6], + ((unsigned char *)&my_ninf)[7], + trio_isnan(my_ninf), trio_isinf(my_ninf)); + + return 0; +} +#endif + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_c14n.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_c14n.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2009 @@ +/* + * "Canonical XML" implementation + * http://www.w3.org/TR/xml-c14n + * + * "Exclusive XML Canonicalization" implementation + * http://www.w3.org/TR/xml-exc-c14n + * + * See Copyright for the status of this software. + * + * Author: Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#define IN_LIBXML + +#include "xmlenglibxml.h" + +#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_C14N_ENABLED) + + +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +#include +#include +#include +#include +#include +#include "libxml2_xmlerror2.h" +#include +#include + +/************************************************************************ + * * + * Some declaration better left private ATM * + * * + ************************************************************************/ + +typedef enum { + XMLC14N_BEFORE_DOCUMENT_ELEMENT = 0, + XMLC14N_INSIDE_DOCUMENT_ELEMENT = 1, + XMLC14N_AFTER_DOCUMENT_ELEMENT = 2 +} xmlC14NPosition; + +typedef struct _xmlC14NVisibleNsStack { + int nsCurEnd; /* number of nodes in the set */ + int nsPrevStart; /* the begginning of the stack for previous visible node */ + int nsPrevEnd; /* the end of the stack for previous visible node */ + int nsMax; /* size of the array as allocated */ + xmlNsPtr *nsTab; /* array of ns in no particular order */ + xmlNodePtr *nodeTab;/* array of nodes in no particular order */ +} xmlC14NVisibleNsStack, *xmlC14NVisibleNsStackPtr; + +typedef struct _xmlC14NCtx { + /* input parameters */ + xmlDocPtr doc; + xmlC14NIsVisibleCallback is_visible_callback; + void* user_data; + int with_comments; + xmlOutputBufferPtr buf; + + /* position in the XML document */ + xmlC14NPosition pos; + int parent_is_doc; + xmlC14NVisibleNsStackPtr ns_rendered; + + /* exclusive canonicalization */ + int exclusive; + xmlChar **inclusive_ns_prefixes; + + /* error number */ + int error; +} xmlC14NCtx, *xmlC14NCtxPtr; + +static xmlC14NVisibleNsStackPtr xmlC14NVisibleNsStackCreate (void); +static void xmlC14NVisibleNsStackDestroy (xmlC14NVisibleNsStackPtr cur); +static void xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur, + xmlNsPtr ns, + xmlNodePtr node); +static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur, + xmlC14NVisibleNsStackPtr state); +static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur, + xmlC14NVisibleNsStackPtr state); +static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur); +static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, + xmlNsPtr ns); +static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, + xmlNsPtr ns, + xmlC14NCtxPtr ctx); + +static int xmlC14NIsNodeInNodeset (xmlNodeSetPtr nodes, + xmlNodePtr node, + xmlNodePtr parent); + + + +static int xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur); +static int xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur); +typedef enum { + XMLC14N_NORMALIZE_ATTR = 0, + XMLC14N_NORMALIZE_COMMENT = 1, + XMLC14N_NORMALIZE_PI = 2, + XMLC14N_NORMALIZE_TEXT = 3 +} xmlC14NNormalizationMode; + +static xmlChar *xmlC11NNormalizeString(const xmlChar * input, + xmlC14NNormalizationMode mode); + +#define xmlC11NNormalizeAttr( a ) \ + xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_ATTR) +#define xmlC11NNormalizeComment( a ) \ + xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_COMMENT) +#define xmlC11NNormalizePI( a ) \ + xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_PI) +#define xmlC11NNormalizeText( a ) \ + xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_TEXT) + +#define xmlC14NIsVisible( ctx, node, parent ) \ + (((ctx)->is_visible_callback != NULL) ? \ + (ctx)->is_visible_callback((ctx)->user_data, \ + (xmlNodePtr)(node), (xmlNodePtr)(parent)) : 1) + +/************************************************************************ + * * + * Some factorized error routines * + * * + ************************************************************************/ + +/** + * xmlC14NErrMemory: + * @param extra extra informations + * + * Handle a redefinition of attribute error + */ +static void +xmlC14NErrMemory(const char *extra) +{ + __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_C14N, + XML_ERR_NO_MEMORY, XML_ERR_ERROR, NULL, 0, extra, + NULL, NULL, 0, 0, + "Memory allocation failed : %s\n", extra); +} + +/** + * xmlC14NErr: + * @param ctxt a C14N evaluation context + * @param node the context node + * @param error the erorr code + * @param msg the message + * @param extra extra informations + * + * Handle a redefinition of attribute error + */ +static void +xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error, + const char * msg) +{ + if (ctxt != NULL) + ctxt->error = error; + __xmlRaiseError(NULL, NULL, NULL, + ctxt, node, XML_FROM_C14N, error, + XML_ERR_ERROR, NULL, 0, + NULL, NULL, NULL, 0, 0, msg); +} + +/************************************************************************ + * * + * The implementation internals * + * * + ************************************************************************/ +#define XML_NAMESPACES_DEFAULT 16 + +static int +xmlC14NIsNodeInNodeset(xmlNodeSetPtr nodes, xmlNodePtr node, xmlNodePtr parent) { + if((nodes != NULL) && (node != NULL)) { + if(node->type != XML_NAMESPACE_DECL) { + return(xmlXPathNodeSetContains(nodes, node)); + } else { + xmlNs ns; + + memcpy(&ns, node, sizeof(ns)); + + + if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) { + ns.next = (xmlNsPtr)parent->parent; + } else { + ns.next = (xmlNsPtr)parent; + } + + /* + * If the input is an XPath node-set, then the node-set must explicitly + * contain every node to be rendered to the canonical form. + */ + return(xmlXPathNodeSetContains(nodes, (xmlNodePtr)&ns)); + } + } + return(1); +} + +static xmlC14NVisibleNsStackPtr +xmlC14NVisibleNsStackCreate(void) { + xmlC14NVisibleNsStackPtr ret; + + ret = (xmlC14NVisibleNsStackPtr) xmlMalloc(sizeof(xmlC14NVisibleNsStack)); + if (!ret) { + xmlC14NErrMemory("creating stack"); + return(NULL); + } + memset(ret, 0 , (size_t) sizeof(xmlC14NVisibleNsStack)); + return(ret); +} + +static void +xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) { + if(cur == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackDestroy: cur is null.\n"); +#endif + return; + } + if(cur->nsTab != NULL) { + memset(cur->nsTab, 0, cur->nsMax * sizeof(xmlNsPtr)); + xmlFree(cur->nsTab); + } + if(cur->nodeTab != NULL) { + memset(cur->nodeTab, 0, cur->nsMax * sizeof(xmlNodePtr)); + xmlFree(cur->nodeTab); + } + memset(cur, 0, sizeof(xmlC14NVisibleNsStack)); + xmlFree(cur); + +} + +static void +xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node) { + if((cur == NULL) || + ((cur->nsTab == NULL) && (cur->nodeTab != NULL)) || + ((cur->nsTab != NULL) && (cur->nodeTab == NULL))) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackAdd: cur is null.\n"); +#endif + return; + } + + if ((cur->nsTab == NULL) && (cur->nodeTab == NULL)) { + cur->nsTab = (xmlNsPtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr)); + cur->nodeTab = (xmlNodePtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr)); + if ((cur->nsTab == NULL) || (cur->nodeTab == NULL)) { + xmlC14NErrMemory("adding node to stack"); + return; + } + memset(cur->nsTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr)); + memset(cur->nodeTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr)); + cur->nsMax = XML_NAMESPACES_DEFAULT; + } else if(cur->nsMax == cur->nsCurEnd) { + void *tmp; + int tmpSize; + + tmpSize = 2 * cur->nsMax; + tmp = xmlRealloc(cur->nsTab, tmpSize * sizeof(xmlNsPtr)); + if (tmp == NULL) { + xmlC14NErrMemory("adding node to stack"); + return; + } + cur->nsTab = (xmlNsPtr*)tmp; + + tmp = xmlRealloc(cur->nodeTab, tmpSize * sizeof(xmlNodePtr)); + if (tmp == NULL) { + xmlC14NErrMemory("adding node to stack"); + return; + } + cur->nodeTab = (xmlNodePtr*)tmp; + + cur->nsMax = tmpSize; + } + cur->nsTab[cur->nsCurEnd] = ns; + cur->nodeTab[cur->nsCurEnd] = node; + + ++cur->nsCurEnd; +} + +static void +xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) { + if(!cur || !state) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackSave: cur or state is null.\n"); +#endif + return; + } + + state->nsCurEnd = cur->nsCurEnd; + state->nsPrevStart = cur->nsPrevStart; + state->nsPrevEnd = cur->nsPrevEnd; +} + +static void +xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) { + if(!cur || !state) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackRestore: cur or state is null.\n"); +#endif + return; + } + cur->nsCurEnd = state->nsCurEnd; + cur->nsPrevStart = state->nsPrevStart; + cur->nsPrevEnd = state->nsPrevEnd; +} + +static void +xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) { + if(cur == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackRestore: cur is null.\n"); +#endif + return; + } + cur->nsPrevStart = cur->nsPrevEnd; + cur->nsPrevEnd = cur->nsCurEnd; +} + +static int +xmlC14NStrEqual(const xmlChar *str1, const xmlChar *str2) { + if (str1 == str2) return(1); + if (str1 == NULL) return((*str2) == '\0'); + if (str2 == NULL) return((*str1) == '\0'); + do { + if (*str1++ != *str2) return(0); + } while (*str2++); + return(1); +} + +/** + * xmlC14NVisibleNsStackFind: + * @param ctx the C14N context + * @param ns the namespace to check + * + * Checks whether the given namespace was already rendered or not + * + * Returns 1 if we already wrote this namespace or 0 otherwise + */ +static int +xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns) +{ + int i; + const xmlChar *prefix; + const xmlChar *href; + int has_empty_ns; + + if(cur == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NVisibleNsStackFind: cur is null.\n"); +#endif + return (0); + } + + /* + * if the default namespace xmlns="" is not defined yet then + * we do not want to print it out + */ + prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix; + href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href; + has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL)); + + if (cur->nsTab != NULL) { + int start = (has_empty_ns) ? 0 : cur->nsPrevStart; + for (i = cur->nsCurEnd - 1; i >= start; --i) { + xmlNsPtr ns1 = cur->nsTab[i]; + + if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) { + return(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)); + } + } + } + return(has_empty_ns); +} + +static int +xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) { + int i; + const xmlChar *prefix; + const xmlChar *href; + int has_empty_ns; + + if(cur == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlExcC14NVisibleNsStackFind: cur is null.\n"); +#endif + return (0); + } + + /* + * if the default namespace xmlns="" is not defined yet then + * we do not want to print it out + */ + prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix; + href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href; + has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL)); + + if (cur->nsTab != NULL) { + int start = 0; + for (i = cur->nsCurEnd - 1; i >= start; --i) { + xmlNsPtr ns1 = cur->nsTab[i]; + + if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) { + if(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)) { + return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i])); + } else { + return(0); + } + } + } + } + return(has_empty_ns); +} + + + + +/** + * xmlC14NIsXmlNs: + * @param ns the namespace to check + * + * Checks whether the given namespace is a default "xml:" namespace + * with href="http://www.w3.org/XML/1998/namespace" + * + * Returns 1 if the node is default or 0 otherwise + */ + + +static int +xmlC14NIsXmlNs(xmlNsPtr ns) +{ + return ((ns != NULL) && + (xmlStrEqual(ns->prefix, BAD_CAST "xml")) && + (xmlStrEqual(ns->href, + BAD_CAST + "http://www.w3.org/XML/1998/namespace"))); +} + + +/** + * xmlC14NNsCompare: + * @param ns1 the pointer to first namespace + * @param ns2 the pointer to second namespace + * + * Compares the namespaces by names (prefixes). + * + * Returns -1 if ns1 < ns2, 0 if ns1 == ns2 or 1 if ns1 > ns2. + */ +static int +xmlC14NNsCompare(xmlNsPtr ns1, xmlNsPtr ns2) +{ + if (ns1 == ns2) + return (0); + if (ns1 == NULL) + return (-1); + if (ns2 == NULL) + return (1); + + return (xmlStrcmp(ns1->prefix, ns2->prefix)); +} + + +/** + * xmlC14NPrintNamespaces: + * @param ns the pointer to namespace + * @param ctx the C14N context + * + * Prints the given namespace to the output buffer from C14N context. + * + * Returns 1 on success or 0 on fail. + */ +static int +xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx) +{ + + if ((ns == NULL) || (ctx == NULL)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NPrintNamespace: namespace or context pointer is null\n"); +#endif + return 0; + } + + if (ns->prefix != NULL) { + xmlOutputBufferWriteString(ctx->buf, " xmlns:"); + xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix); + xmlOutputBufferWriteString(ctx->buf, "=\""); + } else { + xmlOutputBufferWriteString(ctx->buf, " xmlns=\""); + } + if(ns->href != NULL) { + xmlOutputBufferWriteString(ctx->buf, (const char *) ns->href); + } + xmlOutputBufferWriteString(ctx->buf, "\""); + return (1); +} + +/** + * xmlC14NProcessNamespacesAxis: + * @param ctx the C14N context + * @param node the current node + * + * Prints out canonical namespace axis of the current node to the + * buffer from C14N context as follows + * + * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) + * + * Namespace Axis + * Consider a list L containing only namespace nodes in the + * axis and in the node-set in lexicographic order (ascending). To begin + * processing L, if the first node is not the default namespace node (a node + * with no namespace URI and no local name), then generate a space followed + * by xmlns="" if and only if the following conditions are met: + * - the element E that owns the axis is in the node-set + * - The nearest ancestor element of E in the node-set has a default + * namespace node in the node-set (default namespace nodes always + * have non-empty values in XPath) + * The latter condition eliminates unnecessary occurrences of xmlns="" in + * the canonical form since an element only receives an xmlns="" if its + * default namespace is empty and if it has an immediate parent in the + * canonical form that has a non-empty default namespace. To finish + * processing L, simply process every namespace node in L, except omit + * namespace node with local name xml, which defines the xml prefix, + * if its string value is http://www.w3.org/XML/1998/namespace. + * + * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n) + * Canonical XML applied to a document subset requires the search of the + * ancestor nodes of each orphan element node for attributes in the xml + * namespace, such as xml:lang and xml:space. These are copied into the + * element node except if a declaration of the same attribute is already + * in the attribute axis of the element (whether or not it is included in + * the document subset). This search and copying are omitted from the + * Exclusive XML Canonicalization method. + * + * Returns 0 on success or -1 on fail. + */ +static int +xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) +{ + xmlNodePtr n; + xmlNsPtr ns, tmp; + xmlListPtr list; + int already_rendered; + int has_empty_ns = 0; + + if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNamespacesAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n"); +#endif + return (-1); + } + + /* + * Create a sorted list to store element namespaces + */ + list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare); + if (list == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNamespacesAxis: list creation failed\n"); +#endif + return (-1); + } + + /* check all namespaces */ + for(n = cur; n != NULL; n = n->parent) { + for(ns = n->nsDef; ns != NULL; ns = ns->next) { + tmp = xmlSearchNs(cur->doc, cur, ns->prefix); + + if((tmp == ns) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) { + already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns); + if(visible) { + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + } + if(!already_rendered) { + xmlListInsert(list, ns); + } + if(xmlStrlen(ns->prefix) == 0) { + has_empty_ns = 1; + } + } + } + } + + /** + * if the first node is not the default namespace node (a node with no + * namespace URI and no local name), then generate a space followed by + * xmlns="" if and only if the following conditions are met: + * - the element E that owns the axis is in the node-set + * - the nearest ancestor element of E in the node-set has a default + * namespace node in the node-set (default namespace nodes always + * have non-empty values in XPath) + */ + if(visible && !has_empty_ns) { + //FIXIT + //static + xmlNs ns_default; + + memset(&ns_default, 0, sizeof(ns_default)); + if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) { + xmlC14NPrintNamespaces(&ns_default, ctx); + } + } + + + /* + * print out all elements from list + */ + xmlListWalk(list, (xmlListWalker)xmlC14NPrintNamespaces, (const void*)ctx); + + /* + * Cleanup + */ + xmlListDelete(list); + return (0); +} + + +/** + * xmlExcC14NProcessNamespacesAxis: + * @param ctx the C14N context + * @param node the current node + * + * Prints out exclusive canonical namespace axis of the current node to the + * buffer from C14N context as follows + * + * Exclusive XML Canonicalization + * http://www.w3.org/TR/xml-exc-c14n + * + * If the element node is in the XPath subset then output the node in + * accordance with Canonical XML except for namespace nodes which are + * rendered as follows: + * + * 1. Render each namespace node iff: + * * it is visibly utilized by the immediate parent element or one of + * its attributes, or is present in InclusiveNamespaces PrefixList, and + * * its prefix and value do not appear in ns_rendered. ns_rendered is + * obtained by popping the state stack in order to obtain a list of + * prefixes and their values which have already been rendered by + * an output ancestor of the namespace node's parent element. + * 2. Append the rendered namespace node to the list ns_rendered of namespace + * nodes rendered by output ancestors. Push ns_rendered on state stack and + * recurse. + * 3. After the recursion returns, pop thestate stack. + * + * + * Returns 0 on success or -1 on fail. + */ +static int +xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) +{ + xmlNsPtr ns; + xmlListPtr list; + xmlAttrPtr attr; + int already_rendered; + int has_empty_ns = 0; + int has_visibly_utilized_empty_ns = 0; + int has_empty_ns_in_inclusive_list = 0; + + if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlExcC14NProcessNamespacesAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n"); +#endif + return (-1); + } + + if(!ctx->exclusive) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlExcC14NProcessNamespacesAxis: called for non-exclusive canonization or rendered stack is NULL.\n"); +#endif + return (-1); + + } + + /* + * Create a sorted list to store element namespaces + */ + list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare); + if (list == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlExcC14NProcessNamespacesAxis: list creation failed\n"); +#endif + return (-1); + } + + /* + * process inclusive namespaces: + * All namespace nodes appearing on inclusive ns list are + * handled as provided in Canonical XML + */ + if(ctx->inclusive_ns_prefixes != NULL) { + xmlChar *prefix; + int i; + + for (i = 0; ctx->inclusive_ns_prefixes[i] != NULL; ++i) { + prefix = ctx->inclusive_ns_prefixes[i]; + /* + * Special values for namespace with empty prefix + */ + if (xmlStrEqual(prefix, BAD_CAST "#default") + || xmlStrEqual(prefix, BAD_CAST "")) { + prefix = NULL; + has_empty_ns_in_inclusive_list = 1; + } + + ns = xmlSearchNs(cur->doc, cur, prefix); + if((ns != NULL) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) { + already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns); + if(visible) { + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + } + if(!already_rendered) { + xmlListInsert(list, ns); + } + if(xmlStrlen(ns->prefix) == 0) { + has_empty_ns = 1; + } + } + } + } + + /* add node namespace */ + if(cur->ns != NULL) { + ns = cur->ns; + } else { + ns = xmlSearchNs(cur->doc, cur, NULL); + has_visibly_utilized_empty_ns = 1; + } + if((ns != NULL) && !xmlC14NIsXmlNs(ns)) { + if(visible && xmlC14NIsVisible(ctx, ns, cur)) { + if(!xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, ns, ctx)) { + xmlListInsert(list, ns); + } + } + if(visible) { + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + } + if(xmlStrlen(ns->prefix) == 0) { + has_empty_ns = 1; + } + } + + + /* add attributes */ + for(attr = cur->properties; attr != NULL; attr = attr->next) { + /* + * we need to check that attribute is visible and has non + * default namespace (XML Namespaces: "default namespaces + * do not apply directly to attributes") + */ + if((attr->ns != NULL) && !xmlC14NIsXmlNs(attr->ns) && xmlC14NIsVisible(ctx, attr, cur)) { + already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, attr->ns, ctx); + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, cur); + if(!already_rendered && visible) { + xmlListInsert(list, attr->ns); + } + if(xmlStrlen(attr->ns->prefix) == 0) { + has_empty_ns = 1; + } + } else if((attr->ns != NULL) && (xmlStrlen(attr->ns->prefix) == 0) && (xmlStrlen(attr->ns->href) == 0)) { + has_visibly_utilized_empty_ns = 1; + } + } + + /* + * Process xmlns="" + */ + if(visible && has_visibly_utilized_empty_ns && + !has_empty_ns && !has_empty_ns_in_inclusive_list) { + //static //FIXIT + xmlNs ns_default; + + memset(&ns_default, 0, sizeof(ns_default)); + + already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default, ctx); + if(!already_rendered) { + xmlC14NPrintNamespaces(&ns_default, ctx); + } + } else if(visible && !has_empty_ns && has_empty_ns_in_inclusive_list) { + //static FIXIT + xmlNs ns_default; + + memset(&ns_default, 0, sizeof(ns_default)); + if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) { + xmlC14NPrintNamespaces(&ns_default, ctx); + } + } + + + + /* + * print out all elements from list + */ + xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx); + + /* + * Cleanup + */ + xmlListDelete(list); + return (0); +} + + +/** + * xmlC14NAttrsCompare: + * @param attr1 the pointer tls o first attr + * @param attr2 the pointer to second attr + * + * Prints the given attribute to the output buffer from C14N context. + * + * Returns -1 if attr1 < attr2, 0 if attr1 == attr2 or 1 if attr1 > attr2. + */ +static int +xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2) +{ + int ret = 0; + + /* + * Simple cases + */ + if (attr1 == attr2) + return (0); + if (attr1 == NULL) + return (-1); + if (attr2 == NULL) + return (1); + if (attr1->ns == attr2->ns) { + return (xmlStrcmp(attr1->name, attr2->name)); + } + + /* + * Attributes in the default namespace are first + * because the default namespace is not applied to + * unqualified attributes + */ + if (attr1->ns == NULL) + return (-1); + if (attr2->ns == NULL) + return (1); + if (attr1->ns->prefix == NULL) + return (-1); + if (attr2->ns->prefix == NULL) + return (1); + + ret = xmlStrcmp(attr1->ns->href, attr2->ns->href); + if (ret == 0) { + ret = xmlStrcmp(attr1->name, attr2->name); + } + return (ret); +} + + +/** + * xmlC14NPrintAttrs: + * @param attr the pointer to attr + * @param ctx the C14N context + * + * Prints out canonical attribute urrent node to the + * buffer from C14N context as follows + * + * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) + * + * Returns 1 on success or 0 on fail. + */ +static int +xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx) +{ + xmlChar *value; + xmlChar *buffer; + + if ((attr == NULL) || (ctx == NULL)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NPrintAttrs: attr == NULL or ctx == NULL\n"); +#endif + return (0); + } + + xmlOutputBufferWriteString(ctx->buf, " "); + if (attr->ns != NULL && xmlStrlen(attr->ns->prefix) > 0) { + xmlOutputBufferWriteString(ctx->buf, + (const char *) attr->ns->prefix); + xmlOutputBufferWriteString(ctx->buf, ":"); + } + xmlOutputBufferWriteString(ctx->buf, (const char *) attr->name); + xmlOutputBufferWriteString(ctx->buf, "=\""); + + value = xmlNodeListGetString(attr->doc, attr->children, 1); + + if (value != NULL) { + buffer = xmlC11NNormalizeAttr(value); + xmlFree(value); + if (buffer != NULL) { + xmlOutputBufferWriteString(ctx->buf, (const char *) buffer); + xmlFree(buffer); + } else { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NPrintAttrs: xmlC11NNormalizeAttr failed\n"); +#endif + return (0); + } + } + xmlOutputBufferWriteString(ctx->buf, "\""); + return (1); +} + +/** + * xmlC14NProcessAttrsAxis: + * @param ctx the C14N context + * @param cur the current node + * + * Prints out canonical attribute axis of the current node to the + * buffer from C14N context as follows + * + * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) + * + * Attribute Axis + * In lexicographic order (ascending), process each node that + * is in the element's attribute axis and in the node-set. + * + * The processing of an element node E MUST be modified slightly + * when an XPath node-set is given as input and the element's + * parent is omitted from the node-set. + * + * + * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n) + * + * Canonical XML applied to a document subset requires the search of the + * ancestor nodes of each orphan element node for attributes in the xml + * namespace, such as xml:lang and xml:space. These are copied into the + * element node except if a declaration of the same attribute is already + * in the attribute axis of the element (whether or not it is included in + * the document subset). This search and copying are omitted from the + * Exclusive XML Canonicalization method. + * + * Returns 0 on success or -1 on fail. + */ +static int +xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur) +{ + xmlAttrPtr attr; + xmlListPtr list; + + if (!ctx || !cur || (cur->type != XML_ELEMENT_NODE)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessAttrsAxis: Null context or node pointer or type != XML_ELEMENT_NODE.\n"); +#endif + return (-1); + } + + /* + * Create a sorted list to store element attributes + */ + list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NAttrsCompare); + if (!list) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessAttrsAxis: list creation failed\n"); +#endif + return (-1); + } + + /* + * Add all visible attributes from current node. + */ + attr = cur->properties; + while (attr) { + /* check that attribute is visible */ + if (xmlC14NIsVisible(ctx, attr, cur)) { + xmlListInsert(list, attr); + } + attr = attr->next; + } + + /* + * include attributes in "xml" namespace defined in ancestors + * (only for non-exclusive XML Canonicalization) + */ + if (!ctx->exclusive && + cur->parent && + !xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent)) + { + /* + * If XPath node-set is not specified then the parent is always + * visible! + */ + cur = cur->parent; +// XML Engine: NEW CODE + // NOTE: We must check that 'cur' is not a document node, + // otherwise xmlDocPtr is wrongly treated as xmlNodePtr + // (node-specific fields are accessed) + // ORIGINAL: while (cur != NULL) + while(cur && cur->type != XML_DOCUMENT_NODE) +// + { + attr = cur->properties; // NOTE: We may still have problem here if *cur is xmlEntity + while (attr) + { + if (attr->ns && + xmlStrEqual(attr->ns->prefix, BAD_CAST "xml")) + { + if (xmlListSearch(list, attr) == NULL) { + xmlListInsert(list, attr); + } + } + attr = attr->next; + } + cur = cur->parent; + } + } + + /* + * print out all elements from list + */ + xmlListWalk(list, (xmlListWalker) xmlC14NPrintAttrs, (const void*) ctx); + + /* + * Cleanup + */ + xmlListDelete(list); + return (0); +} + +/** + * xmlC14NCheckForRelativeNamespaces: + * @param ctx the C14N context + * @param cur the current element node + * + * Checks that current element node has no relative namespaces defined + * + * Returns 0 if the node has no relative namespaces or -1 otherwise. + * + * OOM: possible --> check OOM flag + */ +static int +xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur) +{ + xmlNsPtr ns; + + if (!ctx || !cur || (cur->type != XML_ELEMENT_NODE)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NCheckForRelativeNamespaces: Null context or node pointer or type != XML_ELEMENT_NODE.\n"); +#endif + return (-1); + } + + ns = cur->nsDef; + while (ns) { + if (xmlStrlen(ns->href) > 0) { + xmlURIPtr uri; + + uri = xmlParseURI((const char*) ns->href); + if (!uri) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NCheckForRelativeNamespaces: unable to parse uri=\"%s\".\n", + ns->href); +#endif + return (-1); + } + if (xmlStrlen((const xmlChar *) uri->scheme) == 0) { + xmlFreeURI(uri); + return (-1); + } + if (!xmlStrEqual((const xmlChar*) uri->scheme, BAD_CAST "urn") && + xmlStrlen((const xmlChar *) uri->server) == 0) + { + xmlFreeURI(uri); + return (-1); + } + xmlFreeURI(uri); + } + ns = ns->next; + } + return (0); +} + +/** + * xmlC14NProcessElementNode: + * @param ctx the pointer to C14N context object + * @param cur the node to process + * + * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) + * + * Element Nodes + * If the element is not in the node-set, then the result is obtained + * by processing the namespace axis, then the attribute axis, then + * processing the child nodes of the element that are in the node-set + * (in document order). If the element is in the node-set, then the result + * is an open angle bracket (<), the element QName, the result of + * processing the namespace axis, the result of processing the attribute + * axis, a close angle bracket (>), the result of processing the child + * nodes of the element that are in the node-set (in document order), an + * open angle bracket, a forward slash (/), the element QName, and a close + * angle bracket. + * + * Returns non-negative value on success or negative value on fail + */ +static int +xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) +{ + int ret; + xmlC14NVisibleNsStack state ; + int parent_is_doc = 0; + LOAD_GS_SAFE_NODE(cur) + + if (!ctx || !cur || (cur->type != XML_ELEMENT_NODE)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessElementNode: Null context or node pointer or type != XML_ELEMENT_NODE.\n"); +#endif + return (-1); + } + + /* + * Check relative relative namespaces: + * implementations of XML canonicalization MUST report an operation + * failure on documents containing relative namespace URIs. + */ + if (xmlC14NCheckForRelativeNamespaces(ctx, cur) < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessElementNode: xmlC14NCheckForRelativeNamespaces failed.\n"); +#endif + return (-1); + } + if(OOM_FLAG) + return -1; + + /* + * Save ns_rendered stack position + */ + xmlC14NVisibleNsStackSave(ctx->ns_rendered, &state); + + if (visible) { + if (ctx->parent_is_doc) { + /* save this flag into the stack */ + parent_is_doc = ctx->parent_is_doc; + ctx->parent_is_doc = 0; + ctx->pos = XMLC14N_INSIDE_DOCUMENT_ELEMENT; + } + xmlOutputBufferWriteString(ctx->buf, "<"); + + if (cur->ns && xmlStrlen(cur->ns->prefix) > 0) { + xmlOutputBufferWriteString(ctx->buf,(const char*)cur->ns->prefix); + xmlOutputBufferWriteString(ctx->buf, ":"); + } + xmlOutputBufferWriteString(ctx->buf,(const char*)cur->name); + } + + if (!ctx->exclusive) { + ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible); + } else { + ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible); + } + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessElementNode: xmlC14NProcessNamespacesAxis failed.\n"); +#endif + return (-1); + } + + if(visible) { + xmlC14NVisibleNsStackShift(ctx->ns_rendered); + } + + if(visible) { + ret = xmlC14NProcessAttrsAxis(ctx, cur); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessElementNode: xmlC14NProcessAttrsAxis failed.\n"); +#endif + return (-1); + } + } + + if (visible) { + xmlOutputBufferWriteString(ctx->buf, ">"); + } + if (cur->children != NULL) { + ret = xmlC14NProcessNodeList(ctx, cur->children); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessElementNode: xmlC14NProcessNodeList failed.\n"); +#endif + return (-1); + } + } + if (visible) { + xmlOutputBufferWriteString(ctx->buf, "ns && (xmlStrlen(cur->ns->prefix) > 0)) { + xmlOutputBufferWriteString(ctx->buf,(const char*)cur->ns->prefix); + xmlOutputBufferWriteString(ctx->buf,":"); + } + xmlOutputBufferWriteString(ctx->buf,(const char*)cur->name); + xmlOutputBufferWriteString(ctx->buf,">"); + if (parent_is_doc) { + /* restore this flag from the stack for next node */ + ctx->parent_is_doc = parent_is_doc; + ctx->pos = XMLC14N_AFTER_DOCUMENT_ELEMENT; + } + } + + /* + * Restore ns_rendered stack position + */ + xmlC14NVisibleNsStackRestore(ctx->ns_rendered, &state); + + + return (0); +} + +/** + * xmlC14NProcessNode: + * @param ctx the pointer to C14N context object + * @param cur the node to process + * + * Processes the given node + * + * Returns non-negative value on success or negative value on fail + * + * OOM: possible + */ +static int +xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) +{ + int ret = 0; + int visible; + + if ((ctx == NULL) || (cur == NULL)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNode: Null context or node pointer.\n"); +#endif + return (-1); + } + + visible = xmlC14NIsVisible(ctx, cur, cur->parent); + switch (cur->type) { + case XML_ELEMENT_NODE: + ret = xmlC14NProcessElementNode(ctx, cur, visible); + break; + case XML_CDATA_SECTION_NODE: + case XML_TEXT_NODE: + /* + * Text Nodes + * the string value, except all ampersands are replaced + * by &, all open angle brackets (<) are replaced by <, all closing + * angle brackets (>) are replaced by >, and all #xD characters are + * replaced by . + */ + /* cdata sections are processed as text nodes */ + + if ((visible) && (cur->content != NULL)) { + xmlChar *buffer; + + buffer = xmlC11NNormalizeText(cur->content); + if (buffer != NULL) { + xmlOutputBufferWriteString(ctx->buf, + (const char *) buffer); + xmlFree(buffer); + } else { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNode: xmlC11NNormalizeText() failed\n"); +#endif + return (-1); + } + } + break; + case XML_PI_NODE: + /* + * Processing Instruction (PI) Nodes- + * The opening PI symbol (). If the string value is empty, + * then the leading space is not added. Also, a trailing #xA is + * rendered after the closing PI symbol for PI children of the + * root node with a lesser document order than the document + * element, and a leading #xA is rendered before the opening PI + * symbol of PI children of the root node with a greater document + * order than the document element. + */ + if (visible) { + if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) { + xmlOutputBufferWriteString(ctx->buf, "\x0Abuf, "buf, (const char*) cur->name); + if (cur->content && *cur->content) { + xmlChar *buffer; + + xmlOutputBufferWriteString(ctx->buf, " "); + + + buffer = xmlC11NNormalizePI(cur->content); + if (buffer) { + xmlOutputBufferWriteString(ctx->buf, (const char*)buffer); + xmlFree(buffer); + } else { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNode: xmlC11NNormalizePI() failed\n"); +#endif + return (-1); + } + } + + if (ctx->pos == XMLC14N_BEFORE_DOCUMENT_ELEMENT) { + xmlOutputBufferWriteString(ctx->buf, "?>\x0A"); + } else { + xmlOutputBufferWriteString(ctx->buf, "?>"); + } + } + break; + + case XML_COMMENT_NODE: + /* + * Comment Nodes + * Nothing if generating canonical XML without comments. For + * canonical XML with comments, generate the opening comment + * symbol (). Also, a trailing #xA is rendered + * after the closing comment symbol for comment children of the + * root node with a lesser document order than the document + * element, and a leading #xA is rendered before the opening + * comment symbol of comment children of the root node with a + * greater document order than the document element. (Comment + * children of the root node represent comments outside of the + * top-level document element and outside of the document type + * declaration). + */ + if (visible && ctx->with_comments) { + if (ctx->pos == XMLC14N_AFTER_DOCUMENT_ELEMENT) { + xmlOutputBufferWriteString(ctx->buf, "\x0A\x0A"); + } else { + xmlOutputBufferWriteString(ctx->buf, "-->"); + } + } + break; + + case XML_DOCUMENT_NODE: + case XML_DOCUMENT_FRAG_NODE: /* should be processed as document? */ +#ifdef LIBXML_DOCB_ENABLED + case XML_DOCB_DOCUMENT_NODE: /* should be processed as document? */ +#endif +#ifdef LIBXML_HTML_ENABLED + case XML_HTML_DOCUMENT_NODE: /* should be processed as document? */ +#endif + if (cur->children) { + ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT; + ctx->parent_is_doc = 1; + ret = xmlC14NProcessNodeList(ctx, cur->children); + } + break; + + case XML_ATTRIBUTE_NODE: + xmlC14NErr(ctx, cur, XML_C14N_INVALID_NODE, + "xmlC14NProcessNode: XML_ATTRIBUTE_NODE is illegal here\n"); + return (-1); + case XML_NAMESPACE_DECL: + xmlC14NErr(ctx, cur, XML_C14N_INVALID_NODE, + "xmlC14NProcessNode: XML_NAMESPACE_DECL is illegal here\n"); + return (-1); + case XML_ENTITY_REF_NODE: + xmlC14NErr(ctx, cur, XML_C14N_INVALID_NODE, + "xmlC14NProcessNode: XML_ENTITY_REF_NODE is illegal here\n"); + return (-1); + case XML_ENTITY_NODE: + xmlC14NErr(ctx, cur, XML_C14N_INVALID_NODE, + "xmlC14NProcessNode: XML_ENTITY_NODE is illegal here\n"); + return (-1); + + case XML_DOCUMENT_TYPE_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: +#ifdef LIBXML_XINCLUDE_ENABLED + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: +#endif + /* + * should be ignored according to "W3C Canonical XML" + */ + break; + default: +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNode: unknown node type = %d\n", + cur->type); +#endif + return (-1); + } + + return (ret); +} + +/** + * xmlC14NProcessNodeList: + * @param ctx the pointer to C14N context object + * @param cur the node to start from + * + * Processes all nodes in the row starting from cur. + * + * Returns non-negative value on success or negative value on fail + * + * OOM: possible + */ +static int +xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur) +{ + int ret; + + if (!ctx) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NProcessNodeList: Null context pointer.\n"); +#endif + return (-1); + } + + for (ret = 0; cur && ret >= 0; cur = cur->next) { + ret = xmlC14NProcessNode(ctx, cur); + } + return (ret); +} + + +/** + * xmlC14NFreeCtx: + * @param ctx the pointer to C14N context object + * + * Cleanups the C14N context object. + */ + +static void +xmlC14NFreeCtx(xmlC14NCtxPtr ctx) +{ + if (ctx == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NFreeCtx: ctx == NULL\n"); +#endif + return; + } + + if (ctx->ns_rendered != NULL) { + xmlC14NVisibleNsStackDestroy(ctx->ns_rendered); + } + xmlFree(ctx); +} + +/** + * xmlC14NNewCtx: + * @param doc the XML document for canonization + * @param is_visible_callback the function to use to determine is node visible + * or not + * @param user_data the first parameter for is_visible_callback function + * (in most cases, it is nodes set) + * inclusive_ns_prefixe the list of inclusive namespace prefixes + * ended with a NULL or NULL if there is no + * inclusive namespaces (only for exclusive + * canonicalization) + * @param with_comments include comments in the result (!=0) or not (==0) + * @param buf the output buffer to store canonical XML; this + * buffer MUST have encoder==NULL because C14N requires + * UTF-8 output + * + * Creates new C14N context object to store C14N parameters. + * + * Returns pointer to newly created object (success) or NULL (fail) + * + * OOM: possible --> NULL is returned for valid arguments + */ +static xmlC14NCtxPtr +xmlC14NNewCtx(xmlDocPtr doc, + xmlC14NIsVisibleCallback is_visible_callback, void* user_data, + int exclusive, xmlChar ** inclusive_ns_prefixes, + int with_comments, xmlOutputBufferPtr buf) +{ + xmlC14NCtxPtr ctx; + + if (!doc || !buf) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NNewCtx: pointer to document or output buffer is NULL\n"); +#endif + return (NULL); + } + + /* + * Validate the encoding output buffer encoding + */ + if (buf->encoder) { + xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_REQUIRES_UTF8, +"xmlC14NNewCtx: output buffer encoder != NULL but C14N requires UTF8 output\n"); + return (NULL); + } + + /* + * Validate the XML document encoding value, if provided. + */ + if (doc->charset != XML_CHAR_ENCODING_UTF8) { + xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_REQUIRES_UTF8, + "xmlC14NNewCtx: source document not in UTF8\n"); + return (NULL); + } + + /* + * Allocate a new xmlC14NCtxPtr and fill the fields. + */ + ctx = (xmlC14NCtxPtr) xmlMalloc(sizeof(xmlC14NCtx)); + if (!ctx) { + xmlC14NErrMemory("creating context"); + return (NULL); + } + memset(ctx, 0, sizeof(xmlC14NCtx)); + + /* + * initialize C14N context + */ + ctx->doc = doc; + ctx->with_comments = with_comments; + ctx->is_visible_callback = is_visible_callback; + ctx->user_data = user_data; + ctx->buf = buf; + ctx->parent_is_doc = 1; + ctx->pos = XMLC14N_BEFORE_DOCUMENT_ELEMENT; + ctx->ns_rendered = xmlC14NVisibleNsStackCreate(); + + if(!ctx->ns_rendered) { + xmlC14NErr(ctx, (xmlNodePtr) doc, XML_C14N_CREATE_STACK, + "xmlC14NNewCtx: xmlC14NVisibleNsStackCreate failed\n"); + xmlC14NFreeCtx(ctx); + return (NULL); + } + + /* + * Set "exclusive" flag, create a nodes set for namespaces + * stack and remember list of incluseve prefixes + */ + if (exclusive) { + ctx->exclusive = 1; + ctx->inclusive_ns_prefixes = inclusive_ns_prefixes; + } + return (ctx); +} + +/** + * xmlC14NExecute: + * @param doc the XML document for canonization + * @param is_visible_callback the function to use to determine is node visible + * or not + * @param user_data the first parameter for is_visible_callback function + * (in most cases, it is nodes set) + * @param exclusive the exclusive flag (0 - non-exclusive canonicalization; + * otherwise - exclusive canonicalization) + * @param inclusive_ns_prefixes the list of inclusive namespace prefixes + * ended with a NULL or NULL if there is no + * inclusive namespaces (only for exclusive + * canonicalization, ignored otherwise) + * @param with_comments include comments in the result (!=0) or not (==0) + * @param buf the output buffer to store canonical XML; this + * buffer MUST have encoder==NULL because C14N requires + * UTF-8 output + * + * Dumps the canonized image of given XML document into the provided buffer. + * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or + * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) + * + * Returns non-negative value on success or a negative value on fail + */ +XMLPUBFUNEXPORT int +xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, + void* user_data, int exclusive, xmlChar **inclusive_ns_prefixes, + int with_comments, xmlOutputBufferPtr buf) { + + xmlC14NCtxPtr ctx; + int ret; + + if (!buf || !doc) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NExecute: null return buffer or doc pointer\n"); +#endif + return (-1); + } + + /* + * Validate the encoding output buffer encoding + */ + if (buf->encoder) { + xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_REQUIRES_UTF8, +"xmlC14NExecute: output buffer encoder != NULL but C14N requires UTF8 output\n"); + return (-1); + } + + ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data, + exclusive, inclusive_ns_prefixes, with_comments, buf); + if (!ctx) { + xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_CREATE_CTXT, + "xmlC14NExecute: unable to create C14N context\n"); + return (-1); + } + + /* + * Root Node + * The root node is the parent of the top-level document element. The + * result of processing each of its child nodes that is in the node-set + * in document order. The root node does not generate a byte order mark, + * XML declaration, nor anything from within the document type + * declaration. + */ + if (doc->children) { + ret = xmlC14NProcessNodeList(ctx, doc->children); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NExecute: process childrens' list failed.\n"); +#endif + xmlC14NFreeCtx(ctx); + return (-1); + } + } + + /* + * Flush buffer to get number of bytes written + */ + ret = xmlOutputBufferFlush(buf); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NExecute: buffer flush failed.\n"); +#endif + xmlC14NFreeCtx(ctx); + return (-1); + } + + /* + * Cleanup + */ + xmlC14NFreeCtx(ctx); + return (ret); +} + +/** + * xmlC14NDocSaveTo: + * @param doc the XML document for canonization + * @param nodes the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @param exclusive the exclusive flag (0 - non-exclusive canonicalization; + * otherwise - exclusive canonicalization) + * @param inclusive_ns_prefixes the list of inclusive namespace prefixes + * ended with a NULL or NULL if there is no + * inclusive namespaces (only for exclusive + * canonicalization, ignored otherwise) + * @param with_comments include comments in the result (!=0) or not (==0) + * @param buf the output buffer to store canonical XML; this + * buffer MUST have encoder==NULL because C14N requires + * UTF-8 output + * + * Dumps the canonized image of given XML document into the provided buffer. + * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or + * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) + * + * Returns non-negative value on success or a negative value on fail + */ +XMLPUBFUNEXPORT int +xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes, + int exclusive, xmlChar ** inclusive_ns_prefixes, + int with_comments, xmlOutputBufferPtr buf) { + return(xmlC14NExecute(doc, + (xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset, + nodes, + exclusive, + inclusive_ns_prefixes, + with_comments, + buf)); +} + + +/** + * xmlC14NDocDumpMemory: + * @param doc the XML document for canonization + * @param nodes the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @param exclusive the exclusive flag (0 - non-exclusive canonicalization; + * otherwise - exclusive canonicalization) + * @param inclusive_ns_prefixes the list of inclusive namespace prefixes + * ended with a NULL or NULL if there is no + * inclusive namespaces (only for exclusive + * canonicalization, ignored otherwise) + * @param with_comments include comments in the result (!=0) or not (==0) + * @param doc_txt_ptr the memory pointer for allocated canonical XML text; + * the caller of this functions is responsible for calling + * xmlFree() to free allocated memory + * + * Dumps the canonized image of given XML document into memory. + * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or + * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) + * + * Returns the number of bytes written on success or a negative value on fail + */ +XMLPUBFUNEXPORT int +xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, + int exclusive, xmlChar ** inclusive_ns_prefixes, + int with_comments, xmlChar ** doc_txt_ptr) +{ + int ret; + xmlOutputBufferPtr buf; + + if (doc_txt_ptr == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocDumpMemory: null return buffer pointer\n"); +#endif + return (-1); + } + + *doc_txt_ptr = NULL; + + /* + * create memory buffer with UTF8 (default) encoding + */ + buf = xmlAllocOutputBuffer(NULL); + if (buf == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocDumpMemory: failed to allocate output buffer.\n"); +#endif + return (-1); + } + + /* + * canonize document and write to buffer + */ + ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, + with_comments, buf); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocDumpMemory: xmlC14NDocSaveTo failed.\n"); +#endif + (void) xmlOutputBufferClose(buf); + return (-1); + } + + ret = buf->buffer->use; + if (ret > 0) { + *doc_txt_ptr = xmlStrndup(buf->buffer->content, ret); + } + (void) xmlOutputBufferClose(buf); + + if ((*doc_txt_ptr == NULL) && (ret > 0)) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocDumpMemory: failed to allocate memory for document text representation\n"); +#endif + return (-1); + } + return (ret); +} + +/** + * xmlC14NDocSave: + * @param doc the XML document for canonization + * @param nodes the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @param exclusive the exclusive flag (0 - non-exclusive canonicalization; + * otherwise - exclusive canonicalization) + * @param inclusive_ns_prefixes the list of inclusive namespace prefixes + * ended with a NULL or NULL if there is no + * inclusive namespaces (only for exclusive + * canonicalization, ignored otherwise) + * @param with_comments include comments in the result (!=0) or not (==0) + * @param filename the filename to store canonical XML image + * @param compression the compression level (zlib requred): + * -1 - libxml default, + * 0 - uncompressed, + * >0 - compression level + * + * Dumps the canonized image of given XML document into the file. + * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or + * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) + * + * Returns the number of bytes written success or a negative value on fail + */ +XMLPUBFUNEXPORT int +xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, + int exclusive, xmlChar ** inclusive_ns_prefixes, + int with_comments, const char *filename, int compression) +{ + xmlOutputBufferPtr buf; + int ret; + + if (filename == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocSave: filename is NULL\n"); +#endif + return (-1); + } +#ifdef HAVE_ZLIB_H + if (compression < 0) + compression = xmlGetCompressMode(); +#endif + + /* + * save the content to a temp buffer, use default UTF8 encoding. + */ + buf = xmlOutputBufferCreateFilename(filename, NULL, compression); + if (buf == NULL) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocSave: unable to create buffer for file=\"%s\" with compressin=%d\n", + filename, compression); +#endif + return (-1); + } + + /* + * canonize document and write to buffer + */ + ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, + with_comments, buf); + if (ret < 0) { +#ifdef DEBUG_C14N + xmlGenericError(xmlGenericErrorContext, + "xmlC14NDocSave: xmlC14NDocSaveTo failed.\n"); +#endif + (void) xmlOutputBufferClose(buf); + return (-1); + } + + /* + * get the numbers of bytes written + */ + ret = xmlOutputBufferClose(buf); + return (ret); +} + + + +/* + * Macro used to grow the current buffer. + */ // DONE: Fix xmlRealloc +#define growBufferReentrant() { \ + void* tmp; \ + buffer_size *= 2; \ + tmp = xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ + if (!tmp) { \ + /* Note: must free the buffer */ \ + xmlFree(buffer); \ + xmlC14NErrMemory("growing buffer"); \ + return(NULL); \ + } \ + buffer = (xmlChar*) tmp; \ +} + +/** + * xmlC11NNormalizeString: + * @param input the input string + * @param mode the normalization mode (attribute, comment, PI or text) + * + * Converts a string to a canonical (normalized) format. The code is stolen + * from xmlEncodeEntitiesReentrant(). Added normalization of \x09, \x0a, \x0A + * and the mode parameter + * + * Returns a normalized string (caller is responsible for calling xmlFree()) + * or NULL if an error occurs + */ +static xmlChar * +xmlC11NNormalizeString(const xmlChar * input, + xmlC14NNormalizationMode mode) +{ + const xmlChar *cur = input; + xmlChar *buffer = NULL; + xmlChar *out = NULL; + int buffer_size = 0; + + if (input == NULL) + return (NULL); + + /* + * allocate an translation buffer. + */ + buffer_size = 1000; + buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); + if (buffer == NULL) { + xmlC14NErrMemory("allocating buffer"); + return (NULL); + } + out = buffer; + + while (*cur != '\0') { + if ((out - buffer) > (buffer_size - 10)) { + int indx = out - buffer; + + growBufferReentrant(); + out = &buffer[indx]; + } + + if ((*cur == '<') && ((mode == XMLC14N_NORMALIZE_ATTR) || + (mode == XMLC14N_NORMALIZE_TEXT))) { + *out++ = '&'; + *out++ = 'l'; + *out++ = 't'; + *out++ = ';'; + } else if ((*cur == '>') && (mode == XMLC14N_NORMALIZE_TEXT)) { + *out++ = '&'; + *out++ = 'g'; + *out++ = 't'; + *out++ = ';'; + } else if ((*cur == '&') && ((mode == XMLC14N_NORMALIZE_ATTR) || + (mode == XMLC14N_NORMALIZE_TEXT))) { + *out++ = '&'; + *out++ = 'a'; + *out++ = 'm'; + *out++ = 'p'; + *out++ = ';'; + } else if ((*cur == '"') && (mode == XMLC14N_NORMALIZE_ATTR)) { + *out++ = '&'; + *out++ = 'q'; + *out++ = 'u'; + *out++ = 'o'; + *out++ = 't'; + *out++ = ';'; + } else if ((*cur == '\x09') && (mode == XMLC14N_NORMALIZE_ATTR)) { + *out++ = '&'; + *out++ = '#'; + *out++ = 'x'; + *out++ = '9'; + *out++ = ';'; + } else if ((*cur == '\x0A') && (mode == XMLC14N_NORMALIZE_ATTR)) { + *out++ = '&'; + *out++ = '#'; + *out++ = 'x'; + *out++ = 'A'; + *out++ = ';'; + } else if ((*cur == '\x0D') && ((mode == XMLC14N_NORMALIZE_ATTR) || + (mode == XMLC14N_NORMALIZE_TEXT) || + (mode == XMLC14N_NORMALIZE_COMMENT) || + (mode == XMLC14N_NORMALIZE_PI))) { + *out++ = '&'; + *out++ = '#'; + *out++ = 'x'; + *out++ = 'D'; + *out++ = ';'; + } else { + /* + * Works because on UTF-8, all extended sequences cannot + * result in bytes in the ASCII range. + */ + *out++ = *cur; + } + cur++; + } + *out++ = 0; + return (buffer); +} + +#endif /* defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_C14N_ENABLED) */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_chvalid.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_chvalid.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,345 @@ +/* + * libxml2_chvalid.c: this module implements the character range + * validation APIs + * + * This file is automatically generated from the cvs source + * definition files using the genChRanges.py Python script + * + * Generation date: Tue Nov 18 08:14:21 2003 + * Sources: chvalid.def + * William Brack + * + * See Copyright for the status of this software. + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#define UNDEF_IMPORT_C_IN_DATA +#include "xmlenglibxml.h" +#include + +/* + ===================================================================================== + GLOBAL CONSTANTS (moved from _xmlGlobalState struct) + ===================================================================================== +*/ +XMLPUBFUNEXPORT const xmlChSRange xmlIsBaseChar_srng[197] = { {0x100, 0x131}, {0x134, 0x13e}, + {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3}, {0x1cd, 0x1f0}, + {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8}, {0x2bb, 0x2c1}, + {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, {0x38e, 0x3a1}, + {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da}, {0x3dc, 0x3dc}, + {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3}, {0x401, 0x40c}, + {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481}, {0x490, 0x4c4}, + {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb}, {0x4ee, 0x4f5}, + {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559}, {0x561, 0x586}, + {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a}, + {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce}, {0x6d0, 0x6d3}, + {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939}, {0x93d, 0x93d}, + {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, + {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9dc, 0x9dd}, + {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, + {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, + {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, + {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, + {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, {0xabd, 0xabd}, + {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, + {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39}, {0xb3d, 0xb3d}, + {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, + {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, + {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, {0xbb7, 0xbb9}, + {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc33}, + {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcde, 0xcde}, + {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd28}, + {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e}, {0xe30, 0xe30}, + {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82}, {0xe84, 0xe84}, + {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, {0xe94, 0xe97}, + {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, {0xea7, 0xea7}, + {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0}, {0xeb2, 0xeb3}, + {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47}, {0xf49, 0xf69}, + {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100}, {0x1102, 0x1103}, + {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c}, {0x110e, 0x1112}, + {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140}, {0x114c, 0x114c}, + {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155}, {0x1159, 0x1159}, + {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165}, {0x1167, 0x1167}, + {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173}, {0x1175, 0x1175}, + {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab}, {0x11ae, 0x11af}, + {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2}, {0x11eb, 0x11eb}, + {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b}, {0x1ea0, 0x1ef9}, + {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, + {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, + {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, + {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, + {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2126, 0x2126}, + {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, {0x3041, 0x3094}, + {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}}; + +XMLPUBFUNEXPORT const xmlChRangeGroup xmlIsBaseCharGroup = + {197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0}; + +XMLPUBFUNEXPORT const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345}, + {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, + {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, + {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df}, + {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903}, + {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954}, + {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be}, + {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, + {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c}, + {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48}, + {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc}, + {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03}, + {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, + {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, + {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, + {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, + {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, + {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, + {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e}, + {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd}, + {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39}, + {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b}, + {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7}, + {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f}, + {0x3099, 0x3099}, {0x309a, 0x309a}}; + +XMLPUBFUNEXPORT const xmlChRangeGroup xmlIsCombiningGroup = + {95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0}; + +const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff}, {0xe000, 0xfffd}}; + +const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}}; + +const xmlChRangeGroup xmlIsCharGroup = {2, 1, xmlIsChar_srng, xmlIsChar_lrng}; + +const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007}, + {0x3021, 0x3029}, {0x4e00, 0x9fa5}}; + +const xmlChRangeGroup xmlIsIdeographicGroup = {3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0}; + + +XMLPUBFUNEXPORT const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669}, {0x6f0, 0x6f9}, + {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, {0xae6, 0xaef}, + {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, {0xce6, 0xcef}, + {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, {0xf20, 0xf29}}; + +XMLPUBFUNEXPORT const xmlChRangeGroup xmlIsDigitGroup = + {14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0}; + +XMLPUBFUNEXPORT const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0}, {0x2d1, 0x2d1}, + {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, {0xec6, 0xec6}, + {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, {0x30fc, 0x30fe}}; + +XMLPUBFUNEXPORT const xmlChRangeGroup xmlIsExtenderGroup = + {10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0}; + +/* + * The initial tables ({func_name}_tab) are used to validate whether a + * single-byte character is within the specified group. Each table + * contains 256 bytes, with each byte representing one of the 256 + * possible characters. If the table byte is set, the character is + * allowed. + * + */ +XMLPUBFUNEXPORT const unsigned char xmlIsPubidChar_tab[256] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; + +/** + * xmlCharInRange: + * @param val character to be validated + * @param rptr pointer to range to be used to validate + * + * Does a binary search of the range table to determine if char + * is valid + * + * Returns: true if character valid, false otherwise + */ +XMLPUBFUNEXPORT int +xmlCharInRange (unsigned int val, const xmlChRangeGroupPtr rptr) { + int low, high, mid; + xmlChSRangePtr sptr; + xmlChLRangePtr lptr; + if (val < 0x10000) { /* is val in 'short' or 'long' array? */ + if (rptr->nbShortRange == 0) + return 0; + low = 0; + high = rptr->nbShortRange - 1; + sptr = rptr->shortRange; + while (low <= high) + { + mid = (low + high) / 2; + if ((unsigned short) val < sptr[mid].low) { + high = mid - 1; + } else { + if ((unsigned short) val > sptr[mid].high) { + low = mid + 1; + } else { + return 1; + } + } + } + } else { + if (rptr->nbLongRange == 0) { + return 0; + } + low = 0; + high = rptr->nbLongRange - 1; + lptr = rptr->longRange; + while (low <= high) { + mid = (low + high) / 2; + if (val < lptr[mid].low) { + high = mid - 1; + } else { + if (val > lptr[mid].high) { + low = mid + 1; + } else { + return 1; + } + } + } + } + return 0; +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlIsBaseChar: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsBaseChar(unsigned int ch) { + return(xmlIsBaseCharQ(ch)); +} + + +/** + * xmlIsBlank: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsBlank_ch or xmlIsBlankQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsBlank(unsigned int ch) { + return(xmlIsBlankQ(ch)); +} + + +/** + * xmlIsChar: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsChar_ch or xmlIsCharQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsChar(unsigned int ch) { + return(xmlIsCharQ(ch)); +} + + +/** + * xmlIsCombining: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsCombiningQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsCombining(unsigned int ch) { + return(xmlIsCombiningQ(ch)); +} + + +/** + * xmlIsDigit: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsDigit_ch or xmlIsDigitQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsDigit(unsigned int ch) { + return(xmlIsDigitQ(ch)); +} + + +/** + * xmlIsExtender: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsExtender_ch or xmlIsExtenderQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsExtender(unsigned int ch) { + return(xmlIsExtenderQ(ch)); +} + + +/** + * xmlIsIdeographic: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsIdeographicQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsIdeographic(unsigned int ch) { + return(xmlIsIdeographicQ(ch)); +} + + +/** + * xmlIsPubidChar: + * @param ch character to validate + * + * This function is DEPRECATED. + * Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead + * + * Returns true if argument valid, false otherwise + */ +int +xmlIsPubidChar(unsigned int ch) { + return(xmlIsPubidCharQ(ch)); +} +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_dict.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_dict.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,763 @@ +/* + * libxml2_dict.c: dictionary of reusable strings, just used to avoid allocation + * and freeing operations. + * + * Copyright (C) 2003 Daniel Veillard. + * + * 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. + * + * Author: daniel@veillard.com + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#undef XE_ENABLE_GS_CACHING +#include "xmlenglibxml.h" + +#include +#include + +#define MAX_HASH_LEN 4 + + +#define MIN_DICT_SIZE 128 +#define MAX_DICT_HASH 8 * 2048 + +/* #define ALLOW_REMOVAL */ +/* #define DEBUG_GROW */ + +/* + * xmlDictAddString: + * @param dict the dictionnary + * @param name the name of the userdata + * @param len the length of the name, if -1 it is recomputed + * + * Add the string to the array[s] + * + * Returns the pointer of the local string, or NULL in case of error. + * + * OOM: possible --> NULL is returned, OOM flag is set + */ +static const xmlChar* +xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { + xmlDictStringsPtr pool; + const xmlChar *ret; + int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ + + pool = dict->strings; + while (pool) { + if (pool->end - pool->free > namelen) + goto found_pool; + if (pool->size > size) size = pool->size; + pool = pool->next; + } + /* + * Not found, need to allocate + */ + if (!pool) { + if (size == 0) + size = 1000; + else + size *= 4; /* exponential growth */ + + if (size < 4 * namelen) + size = 4 * namelen; /* just in case ! */ + + pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); + if (!pool) + return(NULL); // OOM + pool->size = size; + pool->nbStrings = 0; + pool->free = &pool->array[0]; + pool->end = &pool->array[size]; + pool->next = dict->strings; + dict->strings = pool; + } +found_pool: + ret = pool->free; + memcpy(pool->free, name, namelen); + pool->free += namelen; + *(pool->free++) = 0; + return(ret); +} + +/* + * xmlDictAddQString: + * @param dict the dictionnary + * @param prefix the prefix of the userdata + * @param name the name of the userdata + * @param len the length of the name, if -1 it is recomputed + * + * Add the QName to the array[s] + * + * Returns the pointer of the local string, or NULL in case of error. + */ +static const xmlChar * +xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, + const xmlChar *name, int namelen) +{ + xmlDictStringsPtr pool; + const xmlChar *ret; + int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ + int plen; + + if (!prefix) + return(xmlDictAddString(dict, name, namelen)); + plen = xmlStrlen(prefix); + + pool = dict->strings; + while (pool) { + if (pool->end - pool->free > namelen) + goto found_pool; + if (pool->size > size) + size = pool->size; + pool = pool->next; + } + /* + * Not found, need to allocate + */ + if (!pool) { + if (size == 0) + size = 1000; + else + size *= 4; /* exponential growth */ + if (size < 4 * namelen) + size = 4 * namelen; /* just in case ! */ + pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); + if (!pool) + return(NULL); + pool->size = size; + pool->nbStrings = 0; + pool->free = &pool->array[0]; + pool->end = &pool->array[size]; + pool->next = dict->strings; + dict->strings = pool; + } +found_pool: + ret = pool->free; + memcpy(pool->free, prefix, plen); + pool->free += plen; + *(pool->free++) = ':'; + namelen -= plen + 1; + memcpy(pool->free, name, namelen); + pool->free += namelen; + *(pool->free++) = 0; + return(ret); +} + +/* + * xmlDictComputeKey: + * Calculate the hash key + * + * OOM: never + */ + + +static unsigned long +xmlDictComputeKey(const xmlChar *name, int namelen) { + unsigned long value = 0L; + + if (!name) + return(0); + value = *name; + value <<= 5; + if (namelen > 10) { + value += name[namelen - 1]; + namelen = 10; + } + // DONE: OPTIMIZE: Will it be better to rewrite SWITCH as IF? : + // if(namelen > 1) // namelen by this point is <= 10 + // value+=name[namelen-1] + // + if (namelen > 1) + value += name[namelen-1]; + /* + switch (namelen) { + case 10: value += name[9]; + case 9: value += name[8]; + case 8: value += name[7]; + case 7: value += name[6]; + case 6: value += name[5]; + case 5: value += name[4]; + case 4: value += name[3]; + case 3: value += name[2]; + case 2: value += name[1]; + default: break; + } + */ + return(value); +} + +/* + * xmlDictComputeQKey: + * Calculate the hash key + */ +static unsigned long +xmlDictComputeQKey(const xmlChar *prefix, const xmlChar *name, int len) +{ + unsigned long value; // = 0L; //avoided initialization + int plen; + + if (!prefix) + return(xmlDictComputeKey(name, len)); + + plen = xmlStrlen(prefix); + value = 30 * (plen ? *prefix : (unsigned long) ':'); + + if (len > 10) { + value += name[len - (plen + 1 + 1)]; + len = 10; + if (plen > 10) + plen = 10; + } + + // DONE: OPTIMIZE: see "Optimize-It" note in xmlDictComputeKey + /* + switch (plen) { + case 10: value += prefix[9]; + case 9: value += prefix[8]; + case 8: value += prefix[7]; + case 7: value += prefix[6]; + case 6: value += prefix[5]; + case 5: value += prefix[4]; + case 4: value += prefix[3]; + case 3: value += prefix[2]; + case 2: value += prefix[1]; + case 1: value += prefix[0]; + default: break; + } + */ + // REPLACED WITH + if (plen < 11 && plen >0) + value += prefix[plen-1]; + //------------------------------------- + len -= plen; + if (len > 0) { + value += (unsigned long) ':'; + len--; + } + /* --- REPLACED + switch (len) { + case 10: value += name[9]; + case 9: value += name[8]; + case 8: value += name[7]; + case 7: value += name[6]; + case 6: value += name[5]; + case 5: value += name[4]; + case 4: value += name[3]; + case 3: value += name[2]; + case 2: value += name[1]; + case 1: value += name[0]; + default: break; + } + */ + //-- REPLACED WITH + if(len > 0 && len < 11) + value += name[len-1]; + //-------------------- + return(value); +} + +/** + * xmlDictCreate: + * + * Create a new dictionary + * + * Returns the newly created dictionnary, or NULL if an error occured. + * + * OOM: possible --> NULL is returned; OOM flag is set + */ +XMLPUBFUNEXPORT xmlDictPtr +xmlDictCreate(void) { + xmlDictPtr dict; + + dict = (xmlDictPtr)xmlMalloc(sizeof(xmlDict)); + if (dict) { + dict->ref_counter = 1; + + dict->size = MIN_DICT_SIZE; + dict->nbElems = 0; + dict->dict = (xmlDictEntryPtr)xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry)); + dict->strings = NULL; + dict->subdict = NULL; + if (dict->dict) { + memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); + return(dict); + } + xmlFree(dict); // OOM + } + return(NULL); // OOM +} + +/** + * xmlDictCreateSub: + * @param sub an existing dictionnary + * + * Create a new dictionary, inheriting strings from the read-only + * dictionnary sub. On lookup, strings are first searched in the + * new dictionnary, then in sub, and if not found are created in the + * new dictionnary. + * + * Returns the newly created dictionnary, or NULL if an error occured. + */ +XMLPUBFUNEXPORT xmlDictPtr +xmlDictCreateSub(xmlDictPtr sub) { + xmlDictPtr dict = xmlDictCreate(); + + if (dict && sub) { + dict->subdict = sub; + xmlDictReference(dict->subdict); + } + return(dict); +} + +/** + * xmlDictReference: + * @param dict the dictionnary + * + * Increment the reference counter of a dictionary + * + * Returns 0 in case of success and -1 in case of error + * + * OOM: never + */ +XMLPUBFUNEXPORT int +xmlDictReference(xmlDictPtr dict) { + if (!dict) + return -1; + dict->ref_counter++; + return(0); +} + +/** + * xmlDictGrow: + * @param dict the dictionnary + * @param size the new size of the dictionnary + * + * resize the dictionnary + * + * Returns 0 in case of success, -1 in case of failure + * + * OOM: possible --> returns -1, OOM is set + */ +static int +xmlDictGrow(xmlDictPtr dict, int size) { + unsigned long key; + int oldsize, i; + xmlDictEntryPtr iter, next; + struct _xmlDictEntry *olddict; +#ifdef DEBUG_GROW + unsigned long nbElem = 0; +#endif + + if (!dict || size < 8 || size > 8 * 2048) + return(-1); + + oldsize = dict->size; + olddict = dict->dict; + if (!olddict) + return(-1); + + dict->dict = (xmlDictEntryPtr)xmlMalloc(size * sizeof(xmlDictEntry)); + if (!dict->dict) { + dict->dict = olddict; + return(-1); + } + memset(dict->dict, 0, size * sizeof(xmlDictEntry)); + dict->size = size; + + /* If the two loops are merged, there would be situations where + a new entry needs to allocated and data copied into it from + the main dict. So instead, we run through the array twice, first + copying all the elements in the main array (where we can't get + conflicts) and then the rest, so we only free (and don't allocate) + */ + for (i = 0; i < oldsize; i++) + { + if (olddict[i].valid == 0) + continue; + key = xmlDictComputeKey(olddict[i].name, olddict[i].len) % dict->size; + memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); + dict->dict[key].next = NULL; +#ifdef DEBUG_GROW + nbElem++; +#endif + } + + for (i = 0; i < oldsize; i++) + { + iter = olddict[i].next; + while (iter) { + next = iter->next; + /* + * put back the entry in the new dict + */ + key = xmlDictComputeKey(iter->name, iter->len) % dict->size; + if (dict->dict[key].valid == 0) { + memcpy(&(dict->dict[key]), iter, sizeof(xmlDictEntry)); + dict->dict[key].next = NULL; + dict->dict[key].valid = 1; + xmlFree(iter); + } else { + iter->next = dict->dict[key].next; + dict->dict[key].next = iter; + } +#ifdef DEBUG_GROW + nbElem++; +#endif + iter = next; + } // while (iter) + } // for (i = 0; i < oldsize; i++) + + xmlFree(olddict); + +#ifdef DEBUG_GROW + xmlGenericError(xmlGenericErrorContext, + "xmlDictGrow : from %d to %d, %d elems\n", oldsize, size, nbElem); +#endif + + return(0); +} + +/** + * xmlDictFree: + * @param dict the dictionnary + * + * Free the hash dict and its contents. The userdata is + * deallocated with f if provided. + */ +XMLPUBFUNEXPORT void +xmlDictFree(xmlDictPtr dict) +{ + int i; + xmlDictEntryPtr iter; + xmlDictEntryPtr next; + int inside_dict = 0; + xmlDictStringsPtr pool, nextp; + + if (!dict) + return; + + /* decrement the counter, it may be shared by a parser and docs */ + dict->ref_counter--; + if (dict->ref_counter > 0) + return; + + if (dict->subdict) { + xmlDictFree(dict->subdict); + } + + if (dict->dict) { + for(i = 0; ((i < dict->size) && (dict->nbElems > 0)); i++) + { + iter = &(dict->dict[i]); + if (iter->valid == 0) + continue; + inside_dict = 1; + while (iter) + { + next = iter->next; + if (!inside_dict) + xmlFree(iter); + dict->nbElems--; + inside_dict = 0; + iter = next; + } + inside_dict = 0; + } + xmlFree(dict->dict); + } + + pool = dict->strings; + while (pool) { + nextp = pool->next; + xmlFree(pool); + pool = nextp; + } + xmlFree(dict); +} + +/** + * xmlDictLookup: + * @param dict the dictionnary + * @param name the name of the userdata + * @param len the length of the name, if -1 it is recomputed + * + * Add the name to the hash dict if not present. + * + * Returns the internal copy of the name or NULL in case of internal error + * + * OOM: possible --> returns NULL and OOM flag is set + */ +XMLPUBFUNEXPORT const xmlChar* +xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { + unsigned long key, okey, nbi = 0; + xmlDictEntryPtr entry; + xmlDictEntryPtr insert; + const xmlChar *ret; + + if (!dict || !name) + return(NULL); + + if (len < 0) + len = xmlStrlen(name); + + /* + * Check for duplicate and insertion location. + */ + okey = xmlDictComputeKey(name, len); + key = okey % dict->size; + if (dict->dict[key].valid == 0) { + insert = NULL; + } else { + for (insert = &(dict->dict[key]); + insert->next; + insert = insert->next) + { + +#ifdef __GNUC__ + if (insert->len == len) { + if (!memcmp(insert->name, name, len)) + return(insert->name); + } +#else + if ((insert->len == len) && (!xmlStrncmp(insert->name, name, len))) + return(insert->name); +#endif + nbi++; + } +#ifdef __GNUC__ + if (insert->len == len) { + if (!memcmp(insert->name, name, len)) + return(insert->name); + } +#else + if ((insert->len == len) && (!xmlStrncmp(insert->name, name, len))) + return(insert->name); +#endif + } + + if (dict->subdict) { + key = okey % dict->subdict->size; + if (dict->subdict->dict[key].valid != 0) { + xmlDictEntryPtr tmp; + + for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) + { +#ifdef __GNUC__ + if (tmp->len == len) { + if (!memcmp(tmp->name, name, len)) + return(tmp->name); + } +#else + if ((tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) + return(tmp->name); +#endif + nbi++; + } +#ifdef __GNUC__ + if (tmp->len == len) { + if (!memcmp(tmp->name, name, len)) + return(tmp->name); + } +#else + if ((tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) + return(tmp->name); +#endif + } // if (dict->subdict->dict[key].valid != 0) + + key = okey % dict->size; + } // if (dict->subdict) + + ret = xmlDictAddString(dict, name, len); // may set OOM flag + if (!ret) + return(NULL); + + if (!insert) { + entry = &(dict->dict[key]); + } else { + entry = (xmlDictEntryPtr)xmlMalloc(sizeof(xmlDictEntry)); + if (!entry) + return(NULL); //OOM + } + entry->name = ret; + entry->len = len; + entry->next = NULL; + entry->valid = 1; + + if (insert) + insert->next = entry; + + dict->nbElems++; + + if ((nbi > MAX_HASH_LEN) && + (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) + { + xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size); + if(OOM_FLAG) + return NULL; + } + + /* Note that entry may have been freed at this point by xmlDictGrow */ + + return(ret); +} + +/** + * xmlDictQLookup: + * @param dict the dictionnary + * @param prefix the prefix + * @param name the name + * + * Add the QName prefix:name to the hash dict if not present. + * + * Returns the internal copy of the QName or NULL in case of internal error + */ +XMLPUBFUNEXPORT const xmlChar * +xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { + unsigned long okey, key, nbi = 0; + xmlDictEntryPtr entry; + xmlDictEntryPtr insert; + const xmlChar *ret; + int len; + + if (!dict || !name) + return(NULL); + + len = xmlStrlen(name); + if (prefix) + len += 1 + xmlStrlen(prefix); + + /* + * Check for duplicate and insertion location. + */ + okey = xmlDictComputeQKey(prefix, name, len); + key = okey % dict->size; + if (dict->dict[key].valid == 0) { + insert = NULL; + } else { + for (insert = &(dict->dict[key]); + insert->next; + insert = insert->next) + { + if ((insert->len == len) && xmlStrQEqual(prefix, name, insert->name)) + return(insert->name); + nbi++; + } + if ((insert->len == len) && xmlStrQEqual(prefix, name, insert->name)) + return(insert->name); + } + + if (dict->subdict) + { + key = okey % dict->subdict->size; + if (dict->subdict->dict[key].valid != 0) + { + xmlDictEntryPtr tmp; + for (tmp = &(dict->subdict->dict[key]); + tmp->next; + tmp = tmp->next) + { + if ((tmp->len == len) && xmlStrQEqual(prefix, name, tmp->name)) + return(tmp->name); + nbi++; + } + if ((tmp->len == len) && xmlStrQEqual(prefix, name, tmp->name)) + return(tmp->name); + } + key = okey % dict->size; + } + + ret = xmlDictAddQString(dict, prefix, name, len); + if (!ret) + return(NULL); + if (!insert) { + entry = &(dict->dict[key]); + } else { + entry = (xmlDictEntryPtr)xmlMalloc(sizeof(xmlDictEntry)); + if (!entry) + return(NULL); + } + entry->name = ret; + entry->len = len; + entry->next = NULL; + entry->valid = 1; + + if (insert) + insert->next = entry; + + dict->nbElems++; + + if ((nbi > MAX_HASH_LEN) && + (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) + { + xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size); + } + /* Note that entry may have been freed at this point by xmlDictGrow */ + + return(ret); +} + + +/** + * xmlDictOwns: + * @param dict the dictionnary + * @param str the string + * + * check if a string is owned by the disctionary + * + * Returns 1 if true, 0 if false and -1 in case of error + * -1 in case of error + * + * OOM: impossible + */ +XMLPUBFUNEXPORT int +xmlDictOwns(xmlDictPtr dict, const xmlChar *str) { + xmlDictStringsPtr pool; + + if (!dict || !str) + { + return(-1); + } + + pool = dict->strings; + while (pool) { + if ((str >= pool->array) && (str <= pool->free)) + { + return(1); + } + pool = pool->next; + } + + if (dict->subdict) + return(xmlDictOwns(dict->subdict, str)); + return(0); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlDictSize: + * @param dict the dictionnary + * + * Query the number of elements installed in the hash dict. + * + * Returns the number of elements in the dictionnary or + * -1 in case of error + */ +int +xmlDictSize(xmlDictPtr dict) +{ + if (!dict) + return(-1); + if (dict->subdict) + return(dict->nbElems + dict->subdict->nbElems); + return(dict->nbElems); +} +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_encoding.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_encoding.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3279 @@ +/* + * libxml2_encoding.c : implements the encoding conversion functions needed for XML + * + * Related specs: + * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies + * rfc2781 UTF-16, an encoding of ISO 10646, P. Hoffman, F. Yergeau + * [ISO-10646] UTF-8 and UTF-16 in Annexes + * [ISO-8859-1] ISO Latin-1 characters codes. + * [UNICODE] The Unicode Consortium, "The Unicode Standard -- + * Worldwide Character Encoding -- Version 1.0", Addison- + * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is + * described in Unicode Technical Report #4. + * [US-ASCII] Coded Character Set--7-bit American Standard Code for + * Information Interchange, ANSI X3.4-1986. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * + * Original code for IsoLatin1 and UTF-16 by "Martin J. Duerst" + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML + +#include "xmlenglibxml.h" + +#include + +#if defined(HAVE_CTYPE_H) +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef LIBXML_ICONV_ENABLED +#ifdef HAVE_ERRNO_H +#include +#endif +#endif + +#include + +#ifdef LIBXML_HTML_ENABLED +#include "libxml2_htmlparser.h" +#endif + +#include +#ifdef LIBXML_ICONV_ENABLED +#if 0 +#define DEBUG_ENCODING /* Define this to get encoding traces */ +#endif +#else +#ifdef LIBXML_ISO8859X_ENABLED +static void xmlRegisterCharEncodingHandlersISO8859x (void); +#endif +#endif + +/************************************************************************ + * * + * Conversions To/From UTF8 encoding * + * * + ************************************************************************/ + +/** + * asciiToUTF8: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of ASCII chars + * @param inlen the length of in + * + * Take a block of ASCII chars in and try to convert it to an UTF-8 + * block of chars out. + * Returns 0 if success, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +static int +asciiToUTF8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + unsigned char* outstart = out; + const unsigned char* base = in; + const unsigned char* processed = in; + unsigned char* outend = out + *outlen; + const unsigned char* inend; + unsigned int c; + int bits; + + inend = in + (*inlen); + while ((in < inend) && (out - outstart + 5 < *outlen)) { + c= *in++; + + /* assertion: c is a single UTF-4 value */ + if (out >= outend) + break; + if (c < 0x80) { *out++= c; bits= -6; } + else { + *outlen = out - outstart; + *inlen = processed - base; + return(-1); + } + + for ( ; bits >= 0; bits-= 6) { + if (out >= outend) + break; + *out++= ((c >> bits) & 0x3F) | 0x80; + } + processed = (const unsigned char*) in; + } + *outlen = out - outstart; + *inlen = processed - base; + return(0); +} + +#ifdef LIBXML_OUTPUT_ENABLED +/** + * UTF8Toascii: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an ASCII + * block of chars out. + * + * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +static int +UTF8Toascii(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + const unsigned char* processed = in; + const unsigned char* outend; + const unsigned char* outstart = out; + const unsigned char* instart = in; + const unsigned char* inend; + unsigned int c, d; + int trailing; + + if (in == NULL) { + /* + * initialization nothing to do + */ + *outlen = 0; + *inlen = 0; + return(0); + } + inend = in + (*inlen); + outend = out + (*outlen); + while (in < inend) { + d = *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in Ascii */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) { + break; + } + + for ( ; trailing; trailing--) { + if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) + break; + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if (c < 0x80) { + if (out >= outend) + break; + *out++ = c; + } else { + /* no chance for this in Ascii */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + processed = in; + } + *outlen = out - outstart; + *inlen = processed - instart; + return(0); +} +#endif /* LIBXML_OUTPUT_ENABLED */ + +/** + * isolat1ToUTF8: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of ISO Latin 1 chars + * @param inlen the length of in + * + * Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 + * block of chars out. + * Returns 0 if success, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +XMLPUBFUNEXPORT int +isolat1ToUTF8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + unsigned char* outstart = out; + const unsigned char* base = in; + unsigned char* outend = out + *outlen; + const unsigned char* inend; + const unsigned char* instop; + + inend = in + (*inlen); + instop = inend; + + while (in < inend && out < outend - 1) { + if (*in >= 0x80) { + *out++ = (((*in) >> 6) & 0x1F) | 0xC0; + *out++ = ((*in) & 0x3F) | 0x80; + ++in; + } + if (instop - in > outend - out) instop = in + (outend - out); + while (in < instop && *in < 0x80) { + *out++ = *in++; + } + } + if (in < inend && out < outend && *in < 0x80) { + *out++ = *in++; + } + *outlen = out - outstart; + *inlen = in - base; + return(0); +} + +/** + * UTF8ToUTF8: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param inb a pointer to an array of UTF-8 chars + * @param inlenb the length of in in UTF-8 chars + * + * No op copy operation for UTF8 handling. + * + * Returns the number of bytes written, or -1 if lack of space. + * The value of *inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + */ +static int +UTF8ToUTF8(unsigned char* out, int *outlen, + const unsigned char* inb, int *inlenb) +{ + int len; + + if ((out == NULL) || + (inb == NULL) || + (outlen == NULL) || + (inlenb == NULL)) + return(-1); + + if (*outlen > *inlenb) { + len = *inlenb; + } else { + len = *outlen; + } + + if (len < 0) + return(-1); + + memcpy(out, inb, len); + + *outlen = len; + *inlenb = len; + return(0); +} + + +#ifdef LIBXML_OUTPUT_ENABLED +/** + * UTF8Toisolat1: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an ISO Latin 1 + * block of chars out. + * + * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +XMLPUBFUNEXPORT int +UTF8Toisolat1(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + const unsigned char* processed = in; + const unsigned char* outend; + const unsigned char* outstart = out; + const unsigned char* instart = in; + const unsigned char* inend; + unsigned int c, d; + int trailing; + + if (in == NULL) { + /* + * initialization nothing to do + */ + *outlen = 0; + *inlen = 0; + return(0); + } + inend = in + (*inlen); + outend = out + (*outlen); + while (in < inend) { + d = *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in IsoLat1 */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) { + break; + } + + for ( ; trailing; trailing--) { + if (in >= inend) + break; + if (((d= *in++) & 0xC0) != 0x80) { + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if (c <= 0xFF) { + if (out >= outend) + break; + *out++ = c; + } else { + /* no chance for this in IsoLat1 */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + processed = in; + } + *outlen = out - outstart; + *inlen = processed - instart; + return(0); +} +#endif /* LIBXML_OUTPUT_ENABLED */ + +/** + * UTF16LEToUTF8: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param inb a pointer to an array of UTF-16LE passwd as a byte array + * @param inlenb the length of in in UTF-16LE chars + * + * Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8 + * block of chars out. This function assumes the endian property + * is the same between the native type of this machine and the + * inputed one. + * + * Returns the number of bytes written, or -1 if lack of space, or -2 + * if the transcoding fails (if *in is not a valid utf16 string) + * The value of *inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + */ +static int +UTF16LEToUTF8(unsigned char* out, int *outlen, + const unsigned char* inb, int *inlenb) +{ + LOAD_GS_DIRECT + unsigned char* outstart = out; + const unsigned char* processed = inb; + unsigned char* outend = out + *outlen; + unsigned short* in = (unsigned short*) inb; + unsigned short* inend; + unsigned int c, d, inlen; + unsigned char *tmp; + int bits; + + if ((*inlenb % 2) == 1) + (*inlenb)--; + inlen = *inlenb / 2; + inend = in + inlen; + + while ((in < inend) && (out - outstart + 5 < *outlen)) { + if (xmlLittleEndian) { + c= *in++; + } else { + tmp = (unsigned char *) in; + c = *tmp++; + c = c | (((unsigned int)*tmp) << 8); + in++; + } + if ((c & 0xFC00) == 0xD800) { /* surrogates */ + if (in >= inend) { /* (in > inend) shouldn't happens */ + break; + } + if (xmlLittleEndian) { + d = *in++; + } else { + tmp = (unsigned char *) in; + d = *tmp++; + d = d | (((unsigned int)*tmp) << 8); + in++; + } + if ((d & 0xFC00) == 0xDC00) { + c &= 0x03FF; + c <<= 10; + c |= d & 0x03FF; + c += 0x10000; + } + else { + *outlen = out - outstart; + *inlenb = processed - inb; + return(-2); + } + } + + /* assertion: c is a single UTF-4 value */ + if (out >= outend) + break; + if (c < 0x80) { *out++= c; bits= -6; } + else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } + else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } + else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } + + for ( ; bits >= 0; bits-= 6) { + if (out >= outend) + break; + *out++= ((c >> bits) & 0x3F) | 0x80; + } + processed = (const unsigned char*) in; + } + *outlen = out - outstart; + *inlenb = processed - inb; + return(0); +} + +#ifdef LIBXML_OUTPUT_ENABLED +/** + * UTF8ToUTF16LE: + * @param outb a pointer to an array of bytes to store the result + * @param outlen the length of outb + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an UTF-16LE + * block of chars out. + * + * Returns the number of bytes written, or -1 if lack of space, or -2 + * if the transcoding failed. + */ +static int +UTF8ToUTF16LE(unsigned char* outb, int *outlen, + const unsigned char* in, int *inlen) +{ + LOAD_GS_DIRECT + unsigned short* out = (unsigned short*) outb; + const unsigned char* processed = in; + const unsigned char *const instart = in; + unsigned short* outstart= out; + unsigned short* outend; + const unsigned char* inend= in+*inlen; + unsigned int c, d; + int trailing; + unsigned char *tmp; + unsigned short tmp1, tmp2; + + /* UTF16LE encoding has no BOM */ + if (in == NULL) { + *outlen = 0; + *inlen = 0; + return(0); + } + outend = out + (*outlen / 2); + while (in < inend) { + d= *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = (out - outstart) * 2; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in UTF-16 */ + *outlen = (out - outstart) * 2; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) { + break; + } + + for ( ; trailing; trailing--) { + if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) + break; + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if (c < 0x10000) { + if (out >= outend) + break; + if (xmlLittleEndian) { + *out++ = c; + } else { + tmp = (unsigned char *) out; + *tmp = c ; + *(tmp + 1) = c >> 8 ; + out++; + } + } + else if (c < 0x110000) { + if (out+1 >= outend) + break; + c -= 0x10000; + if (xmlLittleEndian) { + *out++ = 0xD800 | (c >> 10); + *out++ = 0xDC00 | (c & 0x03FF); + } else { + tmp1 = 0xD800 | (c >> 10); + tmp = (unsigned char *) out; + *tmp = (unsigned char) tmp1; + *(tmp + 1) = tmp1 >> 8; + out++; + + tmp2 = 0xDC00 | (c & 0x03FF); + tmp = (unsigned char *) out; + *tmp = (unsigned char) tmp2; + *(tmp + 1) = tmp2 >> 8; + out++; + } + } + else + break; + processed = in; + } + *outlen = (out - outstart) * 2; + *inlen = processed - instart; + return(0); +} + +/** + * UTF8ToUTF16: + * @param outb a pointer to an array of bytes to store the result + * @param outlen the length of outb + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an UTF-16 + * block of chars out. + * + * Returns the number of bytes written, or -1 if lack of space, or -2 + * if the transcoding failed. + */ +static int +UTF8ToUTF16(unsigned char* outb, int *outlen, + const unsigned char* in, int *inlen) +{ + if (in == NULL) { + /* + * initialization, add the Byte Order Mark for UTF-16LE + */ + if (*outlen >= 2) { + outb[0] = 0xFF; + outb[1] = 0xFE; + *outlen = 2; + *inlen = 0; +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "Added FFFE Byte Order Mark\n"); +#endif + return(2); + } + *outlen = 0; + *inlen = 0; + return(0); + } + return (UTF8ToUTF16LE(outb, outlen, in, inlen)); +} +#endif /* LIBXML_OUTPUT_ENABLED */ + +/** + * UTF16BEToUTF8: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param inb a pointer to an array of UTF-16 passed as a byte array + * @param inlenb the length of in in UTF-16 chars + * + * Take a block of UTF-16 ushorts in and try to convert it to an UTF-8 + * block of chars out. This function assumes the endian property + * is the same between the native type of this machine and the + * inputed one. + * + * Returns the number of bytes written, or -1 if lack of space, or -2 + * if the transcoding fails (if *in is not a valid utf16 string) + * The value of *inlen after return is the number of octets consumed + * if the return value is positive, else unpredictable. + */ +static int +UTF16BEToUTF8(unsigned char* out, int *outlen, + const unsigned char* inb, int *inlenb) +{ + LOAD_GS_DIRECT + unsigned char* outstart = out; + const unsigned char* processed = inb; + unsigned char* outend = out + *outlen; + unsigned short* in = (unsigned short*) inb; + unsigned short* inend; + unsigned int c, d, inlen; + unsigned char *tmp; + int bits; + + if ((*inlenb % 2) == 1) + (*inlenb)--; + inlen = *inlenb / 2; + inend= in + inlen; + while (in < inend) { + if (xmlLittleEndian) { + tmp = (unsigned char *) in; + c = *tmp++; + c = c << 8; + c = c | (unsigned int) *tmp; + in++; + } else { + c= *in++; + } + if ((c & 0xFC00) == 0xD800) { /* surrogates */ + if (in >= inend) { /* (in > inend) shouldn't happens */ + *outlen = out - outstart; + *inlenb = processed - inb; + return(-2); + } + if (xmlLittleEndian) { + tmp = (unsigned char *) in; + d = *tmp++; + d = d << 8; + d = d | (unsigned int) *tmp; + in++; + } else { + d= *in++; + } + if ((d & 0xFC00) == 0xDC00) { + c &= 0x03FF; + c <<= 10; + c |= d & 0x03FF; + c += 0x10000; + } + else { + *outlen = out - outstart; + *inlenb = processed - inb; + return(-2); + } + } + + /* assertion: c is a single UTF-4 value */ + if (out >= outend) + break; + if (c < 0x80) { *out++= c; bits= -6; } + else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } + else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } + else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } + + for ( ; bits >= 0; bits-= 6) { + if (out >= outend) + break; + *out++= ((c >> bits) & 0x3F) | 0x80; + } + processed = (const unsigned char*) in; + } + *outlen = out - outstart; + *inlenb = processed - inb; + return(0); +} + +#ifdef LIBXML_OUTPUT_ENABLED +/** + * UTF8ToUTF16BE: + * @param outb a pointer to an array of bytes to store the result + * @param outlen the length of outb + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an UTF-16BE + * block of chars out. + * + * Returns the number of byte written, or -1 by lack of space, or -2 + * if the transcoding failed. + */ +static int +UTF8ToUTF16BE(unsigned char* outb, int *outlen, + const unsigned char* in, int *inlen) +{ + LOAD_GS_DIRECT + unsigned short* out = (unsigned short*) outb; + const unsigned char* processed = in; + const unsigned char *const instart = in; + unsigned short* outstart= out; + unsigned short* outend; + const unsigned char* inend= in+*inlen; + unsigned int c, d; + int trailing; + unsigned char *tmp; + unsigned short tmp1, tmp2; + + /* UTF-16BE has no BOM */ + if (in == NULL) { + *outlen = 0; + *inlen = 0; + return(0); + } + outend = out + (*outlen / 2); + while (in < inend) { + d= *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in UTF-16 */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) { + break; + } + + for ( ; trailing; trailing--) { + if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) break; + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if (c < 0x10000) { + if (out >= outend) break; + if (xmlLittleEndian) { + tmp = (unsigned char *) out; + *tmp = c >> 8; + *(tmp + 1) = c; + out++; + } else { + *out++ = c; + } + } + else if (c < 0x110000) { + if (out+1 >= outend) break; + c -= 0x10000; + if (xmlLittleEndian) { + tmp1 = 0xD800 | (c >> 10); + tmp = (unsigned char *) out; + *tmp = tmp1 >> 8; + *(tmp + 1) = (unsigned char) tmp1; + out++; + + tmp2 = 0xDC00 | (c & 0x03FF); + tmp = (unsigned char *) out; + *tmp = tmp2 >> 8; + *(tmp + 1) = (unsigned char) tmp2; + out++; + } else { + *out++ = 0xD800 | (c >> 10); + *out++ = 0xDC00 | (c & 0x03FF); + } + } + else + break; + processed = in; + } + *outlen = (out - outstart) * 2; + *inlen = processed - instart; + return(0); +} +#endif /* LIBXML_OUTPUT_ENABLED */ + +/************************************************************************ + * * + * Generic encoding handling routines * + * * + ************************************************************************/ + +/** + * xmlDetectCharEncoding: + * @param in a pointer to the first bytes of the XML entity, must be at least + * 2 bytes long (at least 4 if encoding is UTF4 variant). + * @param len pointer to the length of the buffer + * + * Guess the encoding of the entity using the first bytes of the entity content + * according to the non-normative appendix F of the XML-1.0 recommendation. + * + * Returns one of the XML_CHAR_ENCODING_... values. + * + * OOM: never + */ +XMLPUBFUNEXPORT xmlCharEncoding +xmlDetectCharEncoding(const unsigned char* in, int len) +{ + if (len >= 4) { + if ((in[0] == 0x00) && (in[1] == 0x00) && + (in[2] == 0x00) && (in[3] == 0x3C)) + return(XML_CHAR_ENCODING_UCS4BE); + if ((in[0] == 0x3C) && (in[1] == 0x00) && + (in[2] == 0x00) && (in[3] == 0x00)) + return(XML_CHAR_ENCODING_UCS4LE); + if ((in[0] == 0x00) && (in[1] == 0x00) && + (in[2] == 0x3C) && (in[3] == 0x00)) + return(XML_CHAR_ENCODING_UCS4_2143); + if ((in[0] == 0x00) && (in[1] == 0x3C) && + (in[2] == 0x00) && (in[3] == 0x00)) + return(XML_CHAR_ENCODING_UCS4_3412); + if ((in[0] == 0x4C) && (in[1] == 0x6F) && + (in[2] == 0xA7) && (in[3] == 0x94)) + return(XML_CHAR_ENCODING_EBCDIC); + if ((in[0] == 0x3C) && (in[1] == 0x3F) && + (in[2] == 0x78) && (in[3] == 0x6D)) + return(XML_CHAR_ENCODING_UTF8); + /* + * Although not part of the recommendation, we also + * attempt an "auto-recognition" of UTF-16LE and + * UTF-16BE encodings. + */ + if ((in[0] == 0x3C) && (in[1] == 0x00) && + (in[2] == 0x3F) && (in[3] == 0x00)) + return(XML_CHAR_ENCODING_UTF16LE); + if ((in[0] == 0x00) && (in[1] == 0x3C) && + (in[2] == 0x00) && (in[3] == 0x3F)) + return(XML_CHAR_ENCODING_UTF16BE); + } + if (len >= 3) { + /* + * Errata on XML-1.0 June 20 2001 + * We now allow an UTF8 encoded BOM + */ + if ((in[0] == 0xEF) && (in[1] == 0xBB) && + (in[2] == 0xBF)) + return(XML_CHAR_ENCODING_UTF8); + } + /* For UTF-16 we can recognize by the BOM */ + if (len >= 2) { + if ((in[0] == 0xFE) && (in[1] == 0xFF)) + return(XML_CHAR_ENCODING_UTF16BE); + if ((in[0] == 0xFF) && (in[1] == 0xFE)) + return(XML_CHAR_ENCODING_UTF16LE); + } + return(XML_CHAR_ENCODING_NONE); +} + +/** + * xmlCleanupEncodingAliases: + * + * Unregisters all aliases + */ +XMLPUBFUNEXPORT void +xmlCleanupEncodingAliases(void) { + LOAD_GS_DIRECT + int i; + + if (xmlCharEncodingAliases == NULL) + return; + + for (i = 0;i < xmlCharEncodingAliasesNb;i++) { + if (xmlCharEncodingAliases[i].name != NULL) + xmlFree((char *) xmlCharEncodingAliases[i].name); + if (xmlCharEncodingAliases[i].alias != NULL) + xmlFree((char *) xmlCharEncodingAliases[i].alias); + } + xmlCharEncodingAliasesNb = 0; + xmlCharEncodingAliasesMax = 0; + xmlFree(xmlCharEncodingAliases); + xmlCharEncodingAliases = NULL; +} + +/** + * xmlGetEncodingAlias: + * @param alias the alias name as parsed, in UTF-8 format (ASCII actually) + * + * Lookup an encoding name for the given alias. + * + * Returns NULL if not found, otherwise the original name + * + * OOM: never + */ +XMLPUBFUNEXPORT const char * +xmlGetEncodingAlias(const char *alias) { + LOAD_GS_DIRECT + int i; + char upper[100]; + + if (alias == NULL) + return(NULL); + + if (xmlCharEncodingAliases == NULL) + return(NULL); + + for (i = 0;i < 99;i++) { + upper[i] = toupper(alias[i]); + if (upper[i] == 0) + break; + } + upper[i] = 0; + + /* + * Walk down the list looking for a definition of the alias + */ + for (i = 0;i < xmlCharEncodingAliasesNb;i++) { + if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { + return(xmlCharEncodingAliases[i].name); + } + } + return(NULL); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlAddEncodingAlias: + * @param name the encoding name as parsed, in UTF-8 format (ASCII actually) + * @param alias the alias name as parsed, in UTF-8 format (ASCII actually) + * + * Registers an alias alias for an encoding named name. Existing alias + * will be overwritten. + * + * Returns 0 in case of success, -1 in case of error + */ +int +xmlAddEncodingAlias(const char* name, const char* alias) +{ + int i; + char upper[100]; + + if (!name || !alias) + return(-1); + + for (i = 0;i < 99;i++) { + upper[i] = toupper(alias[i]); + if (upper[i] == 0) + break; + } + upper[i] = 0; + + if (xmlCharEncodingAliases == NULL) { + xmlCharEncodingAliasesNb = 0; + xmlCharEncodingAliasesMax = 20; + xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) + xmlMalloc(xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); + if (xmlCharEncodingAliases == NULL) + return(-1); + } else if (xmlCharEncodingAliasesNb >= xmlCharEncodingAliasesMax) { + // DONE: Fix xmlRealloc + void* tmp; + xmlCharEncodingAliasesMax *= 2; + tmp = xmlRealloc(xmlCharEncodingAliases, + xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); + if(!tmp){ + xmlCharEncodingAliasesMax /= 2; + return -1; + } + xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) tmp; + } + /* + * Walk down the list looking for a definition of the alias + */ + for (i = 0;i < xmlCharEncodingAliasesNb;i++) { + if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { + /* + * Replace the definition. + */ + xmlFree((char*) xmlCharEncodingAliases[i].name); + xmlCharEncodingAliases[i].name = xmlMemStrdup(name); + return(0); + } + } + /* + * Add the definition + */ + xmlCharEncodingAliases[xmlCharEncodingAliasesNb].name = xmlMemStrdup(name); + xmlCharEncodingAliases[xmlCharEncodingAliasesNb].alias = xmlMemStrdup(upper); + xmlCharEncodingAliasesNb++; + + return(0); +} + +/** + * xmlDelEncodingAlias: + * @param alias the alias name as parsed, in UTF-8 format (ASCII actually) + * + * Unregisters an encoding alias alias + * + * Returns 0 in case of success, -1 in case of error + */ +int +xmlDelEncodingAlias(const char *alias) { + int i; + + if (alias == NULL) + return(-1); + + if (xmlCharEncodingAliases == NULL) + return(-1); + /* + * Walk down the list looking for a definition of the alias + */ + for (i = 0;i < xmlCharEncodingAliasesNb;i++) { + if (!strcmp(xmlCharEncodingAliases[i].alias, alias)) { + xmlFree((char *) xmlCharEncodingAliases[i].name); + xmlFree((char *) xmlCharEncodingAliases[i].alias); + xmlCharEncodingAliasesNb--; + memmove(&xmlCharEncodingAliases[i], &xmlCharEncodingAliases[i + 1], + sizeof(xmlCharEncodingAlias) * (xmlCharEncodingAliasesNb - i)); + return(0); + } + } + return(-1); +} + +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * xmlParseCharEncoding: + * @param name the encoding name as parsed, in UTF-8 format (ASCII actually) + * + * Compare the string to the encoding schemes already known. Note + * that the comparison is case insensitive accordingly to the section + * [XML] 4.3.3 Character Encoding in Entities. + * + * Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE + * if not recognized. + * + * OOM: never + */ +XMLPUBFUNEXPORT xmlCharEncoding +xmlParseCharEncoding(const char* name) +{ + const char *alias; + char upper[500]; + int i; + + if (name == NULL) + return(XML_CHAR_ENCODING_NONE); + + /* + * Do the alias resolution + */ + alias = xmlGetEncodingAlias(name); + if (alias != NULL) + name = alias; + + for (i = 0;i < 499;i++) { + upper[i] = toupper(name[i]); + if (upper[i] == 0) break; + } + upper[i] = 0; + + if (!strcmp(upper, "")) return(XML_CHAR_ENCODING_NONE); + if (!strcmp(upper, "UTF-8")) return(XML_CHAR_ENCODING_UTF8); + if (!strcmp(upper, "UTF8")) return(XML_CHAR_ENCODING_UTF8); + + /* + * NOTE: if we were able to parse this, the endianness of UTF16 is + * already found and in use + */ + if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE); + if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE); + + if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2); + if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2); + if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2); + + /* + * NOTE: if we were able to parse this, the endianness of UCS4 is + * already found and in use + */ + if (!strcmp(upper, "ISO-10646-UCS-4")) return(XML_CHAR_ENCODING_UCS4LE); + if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE); + if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE); + + + if (!strcmp(upper, "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1); + if (!strcmp(upper, "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1); + if (!strcmp(upper, "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1); + + if (!strcmp(upper, "ISO-8859-2")) return(XML_CHAR_ENCODING_8859_2); + if (!strcmp(upper, "ISO-LATIN-2")) return(XML_CHAR_ENCODING_8859_2); + if (!strcmp(upper, "ISO LATIN 2")) return(XML_CHAR_ENCODING_8859_2); + + if (!strcmp(upper, "ISO-8859-3")) return(XML_CHAR_ENCODING_8859_3); + if (!strcmp(upper, "ISO-8859-4")) return(XML_CHAR_ENCODING_8859_4); + if (!strcmp(upper, "ISO-8859-5")) return(XML_CHAR_ENCODING_8859_5); + if (!strcmp(upper, "ISO-8859-6")) return(XML_CHAR_ENCODING_8859_6); + if (!strcmp(upper, "ISO-8859-7")) return(XML_CHAR_ENCODING_8859_7); + if (!strcmp(upper, "ISO-8859-8")) return(XML_CHAR_ENCODING_8859_8); + if (!strcmp(upper, "ISO-8859-9")) return(XML_CHAR_ENCODING_8859_9); + + if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP); + if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS); + if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP); + +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "Unknown encoding %s\n", name); +#endif + return(XML_CHAR_ENCODING_ERROR); +} + +/** + * xmlGetCharEncodingName: + * @param enc the encoding + * + * The "canonical" name for XML encoding. + * C.f. http://www.w3.org/TR/REC-xml#charencoding + * Section 4.3.3 Character Encoding in Entities + * + * Returns the canonical name for the given encoding + */ + +XMLPUBFUNEXPORT const char* +xmlGetCharEncodingName(xmlCharEncoding enc) { + switch (enc) { + case XML_CHAR_ENCODING_ERROR: + return(NULL); + case XML_CHAR_ENCODING_NONE: + return(NULL); + case XML_CHAR_ENCODING_UTF8: + return("UTF-8"); + case XML_CHAR_ENCODING_UTF16LE: + return("UTF-16"); + case XML_CHAR_ENCODING_UTF16BE: + return("UTF-16"); + case XML_CHAR_ENCODING_EBCDIC: + return("EBCDIC"); + case XML_CHAR_ENCODING_UCS4LE: + return("ISO-10646-UCS-4"); + case XML_CHAR_ENCODING_UCS4BE: + return("ISO-10646-UCS-4"); + case XML_CHAR_ENCODING_UCS4_2143: + return("ISO-10646-UCS-4"); + case XML_CHAR_ENCODING_UCS4_3412: + return("ISO-10646-UCS-4"); + case XML_CHAR_ENCODING_UCS2: + return("ISO-10646-UCS-2"); + case XML_CHAR_ENCODING_8859_1: + return("ISO-8859-1"); + case XML_CHAR_ENCODING_8859_2: + return("ISO-8859-2"); + case XML_CHAR_ENCODING_8859_3: + return("ISO-8859-3"); + case XML_CHAR_ENCODING_8859_4: + return("ISO-8859-4"); + case XML_CHAR_ENCODING_8859_5: + return("ISO-8859-5"); + case XML_CHAR_ENCODING_8859_6: + return("ISO-8859-6"); + case XML_CHAR_ENCODING_8859_7: + return("ISO-8859-7"); + case XML_CHAR_ENCODING_8859_8: + return("ISO-8859-8"); + case XML_CHAR_ENCODING_8859_9: + return("ISO-8859-9"); + case XML_CHAR_ENCODING_2022_JP: + return("ISO-2022-JP"); + case XML_CHAR_ENCODING_SHIFT_JIS: + return("Shift-JIS"); + case XML_CHAR_ENCODING_EUC_JP: + return("EUC-JP"); + case XML_CHAR_ENCODING_ASCII: + return(NULL); + } + return(NULL); +} + +/************************************************************************ + * * + * Char encoding handlers * + * * + ************************************************************************/ + + +/* the size should be growable, but it's not a big deal ... */ +#define MAX_ENCODING_HANDLERS 50 + +/** + * xmlNewCharEncodingHandler: + * @param name the encoding name, in UTF-8 format (ASCII actually) + * @param input the xmlCharEncodingInputFunc to read that encoding + * @param output the xmlCharEncodingOutputFunc to write that encoding + * + * Create and registers an xmlCharEncodingHandler. + * + * Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error). + * + * OOM: possible --> OOM flag is set + */ +XMLPUBFUNEXPORT xmlCharEncodingHandlerPtr +xmlNewCharEncodingHandler(const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output) { + xmlCharEncodingHandlerPtr handler; + const char *alias; + char upper[500]; + int i; + char *up = 0; + + /* + * Do the alias resolution + */ + alias = xmlGetEncodingAlias(name); + if (alias != NULL) + name = alias; + + /* + * Keep only the uppercase version of the encoding. + */ + if (name == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlNewCharEncodingHandler : no name !\n")); + return(NULL); + } + for (i = 0;i < 499;i++) { + upper[i] = toupper(name[i]); + if (upper[i] == 0) break; + } + upper[i] = 0; + up = xmlMemStrdup(upper); + if (up == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlNewCharEncodingHandler : out of memory !\n")); + return(NULL); + } + + /* + * allocate and fill-up an handler block. + */ + handler = (xmlCharEncodingHandlerPtr) xmlMalloc(sizeof(xmlCharEncodingHandler)); + if (handler == NULL) { + xmlFree(up); + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlNewCharEncodingHandler : out of memory !\n")); + return(NULL); + } + handler->input = input; + handler->output = output; + handler->name = up; + +#ifdef LIBXML_ICONV_ENABLED + handler->iconv_in = NULL; + handler->iconv_out = NULL; +#endif /* LIBXML_ICONV_ENABLED */ + + /* + * registers and returns the handler. + */ + xmlRegisterCharEncodingHandler(handler); +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "Registered encoding handler for %s\n", name); +#endif + return(handler); +} + +/** + * xmlInitCharEncodingHandlers: + * + * Initialize the char encoding support, it registers the default + * encoding supported. + * NOTE: while public, this function usually doesn't need to be called + * in normal processing. + * + * OOM: possible --> OOM flag is set + */ +XMLPUBFUNEXPORT void +xmlInitCharEncodingHandlers(void) { + LOAD_GS_DIRECT + unsigned short int tst = 0x1234; + unsigned char *ptr = (unsigned char *) &tst; + + if (handlers != NULL) return; + + handlers = (xmlCharEncodingHandlerPtr *) + xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr)); + + if (handlers == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlInitCharEncodingHandlers : out of memory !\n")); + return; + } + + if (*ptr == 0x12) + xmlLittleEndian = 0; + else if (*ptr == 0x34) + xmlLittleEndian = 1; + else + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("Odd problem at endianness detection\n")); + + xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8); +#ifdef LIBXML_OUTPUT_ENABLED + xmlUTF16LEHandler = + xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE); + xmlUTF16BEHandler = + xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE); + xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, UTF8ToUTF16); + xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1); + xmlNewCharEncodingHandler("ASCII", asciiToUTF8, UTF8Toascii); + xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, UTF8Toascii); +#ifdef LIBXML_HTML_ENABLED + xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml); +#endif +#else + xmlUTF16LEHandler = + xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL); + xmlUTF16BEHandler = + xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL); + xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL); + xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL); + xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL); + xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL); +#endif /* LIBXML_OUTPUT_ENABLED */ +#ifndef LIBXML_ICONV_ENABLED +#ifdef LIBXML_ISO8859X_ENABLED + xmlRegisterCharEncodingHandlersISO8859x(); +#endif +#endif + +} + +/** + * xmlCleanupCharEncodingHandlers: + * + * Cleanup the memory allocated for the char encoding support, it + * unregisters all the encoding handlers and the aliases. + * + * OOM: never + */ +XMLPUBFUNEXPORT void +xmlCleanupCharEncodingHandlers(void) { + LOAD_GS_DIRECT + xmlCleanupEncodingAliases(); + + if (handlers == NULL) return; + + for (;nbCharEncodingHandler > 0;) { + nbCharEncodingHandler--; + if (handlers[nbCharEncodingHandler] != NULL) { + if (handlers[nbCharEncodingHandler]->name != NULL) + xmlFree(handlers[nbCharEncodingHandler]->name); + xmlFree(handlers[nbCharEncodingHandler]); + } + } + xmlFree(handlers); + handlers = NULL; + nbCharEncodingHandler = 0; + xmlDefaultCharEncodingHandler = NULL; +} + +/** + * xmlRegisterCharEncodingHandler: + * @param handler the xmlCharEncodingHandlerPtr handler block + * + * Register the char encoding handler, surprising, isn't it ? + * + * OOM: never + */ +XMLPUBFUNEXPORT void +xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { + LOAD_GS_DIRECT + if (handlers == NULL) xmlInitCharEncodingHandlers(); + if (handler == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlRegisterCharEncodingHandler: NULL handler !\n")); + return; + } + + if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlRegisterCharEncodingHandler: Too many handler registered\n")); + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("\tincrease MAX_ENCODING_HANDLERS : %s\n"), __FILE__); + return; + } + handlers[nbCharEncodingHandler++] = handler; +} + +/** + * xmlGetCharEncodingHandler: + * @param enc an xmlCharEncoding value. + * + * Search in the registered set the handler able to read/write that encoding. + * + * Returns the handler, NULL if not found + * + * OOM: possible --> OOM flag is set + */ +XMLPUBFUNEXPORT xmlCharEncodingHandlerPtr +xmlGetCharEncodingHandler(xmlCharEncoding enc) { + LOAD_GS_DIRECT + xmlCharEncodingHandlerPtr handler; + + if (handlers == NULL) + xmlInitCharEncodingHandlers(); + if(OOM_FLAG){ + xmlCleanupCharEncodingHandlers(); + return NULL; + } + + switch (enc) { + case XML_CHAR_ENCODING_ERROR: + return(NULL); + case XML_CHAR_ENCODING_NONE: + return(NULL); + case XML_CHAR_ENCODING_UTF8: + return(NULL); + case XML_CHAR_ENCODING_UTF16LE: + return(xmlUTF16LEHandler); + case XML_CHAR_ENCODING_UTF16BE: + return(xmlUTF16BEHandler); + case XML_CHAR_ENCODING_EBCDIC: + handler = xmlFindCharEncodingHandler("EBCDIC"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("ebcdic"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_UCS4BE: + handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS-4"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS4"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_UCS4LE: + handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS-4"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS4"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_UCS4_2143: + break; + case XML_CHAR_ENCODING_UCS4_3412: + break; + case XML_CHAR_ENCODING_UCS2: + handler = xmlFindCharEncodingHandler("ISO-10646-UCS-2"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS-2"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("UCS2"); + if (handler != NULL) return(handler); + break; + + /* + * We used to keep ISO Latin encodings native in the + * generated data. This led to so many problems that + * this has been removed. One can still change this + * back by registering no-ops encoders for those + */ + case XML_CHAR_ENCODING_8859_1: + handler = xmlFindCharEncodingHandler("ISO-8859-1"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_2: + handler = xmlFindCharEncodingHandler("ISO-8859-2"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_3: + handler = xmlFindCharEncodingHandler("ISO-8859-3"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_4: + handler = xmlFindCharEncodingHandler("ISO-8859-4"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_5: + handler = xmlFindCharEncodingHandler("ISO-8859-5"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_6: + handler = xmlFindCharEncodingHandler("ISO-8859-6"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_7: + handler = xmlFindCharEncodingHandler("ISO-8859-7"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_8: + handler = xmlFindCharEncodingHandler("ISO-8859-8"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_8859_9: + handler = xmlFindCharEncodingHandler("ISO-8859-9"); + if (handler != NULL) return(handler); + break; + + case XML_CHAR_ENCODING_2022_JP: + handler = xmlFindCharEncodingHandler("ISO-2022-JP"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_SHIFT_JIS: + handler = xmlFindCharEncodingHandler("SHIFT-JIS"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("SHIFT_JIS"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("Shift_JIS"); + if (handler != NULL) return(handler); + break; + case XML_CHAR_ENCODING_EUC_JP: + handler = xmlFindCharEncodingHandler("EUC-JP"); + if (handler != NULL) return(handler); + break; + default: + break; + } + +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "No handler found for encoding %d\n", enc); +#endif + return(NULL); +} + +/** + * xmlFindCharEncodingHandler: + * @param name a string describing the char encoding. + * + * Search in the registered set the handler able to read/write that encoding. + * + * Returns the handler or NULL if not found + * + * OOM: possible --> OOM flag is set + */ +XMLPUBFUNEXPORT xmlCharEncodingHandlerPtr +xmlFindCharEncodingHandler(const char *name) { + LOAD_GS_DIRECT + const char *nalias; + const char *norig; + xmlCharEncoding alias; +#ifdef LIBXML_ICONV_ENABLED + xmlCharEncodingHandlerPtr enc; + iconv_t icv_in, icv_out; +#endif /* LIBXML_ICONV_ENABLED */ + char upper[100]; + int i; + // 'handlers' is global variable: + if (handlers == NULL){ + xmlInitCharEncodingHandlers(); + if(OOM_FLAG) + return NULL; + } + // NULL and "" encoding name means 'default one' + if (!name || !*name) return(xmlDefaultCharEncodingHandler); + + /* + * Do the alias resolution + */ + norig = name; + nalias = xmlGetEncodingAlias(name); + if (nalias != NULL) + name = nalias; + + /* + * Check first for directly registered encoding names + */ + for (i = 0;i < 99;i++) { + upper[i] = toupper(name[i]); + if (upper[i] == 0) break; + } + upper[i] = 0; + + for (i = 0;i < nbCharEncodingHandler; i++) + if (!strcmp(upper, handlers[i]->name)) { +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "Found registered handler for encoding %s\n", name); +#endif + return(handlers[i]); + } + +#ifdef LIBXML_ICONV_ENABLED + /* check whether iconv can handle this */ + icv_in = iconv_open("UTF-8", name); + icv_out = iconv_open(name, "UTF-8"); + if ((icv_in != (iconv_t) -1) && (icv_out != (iconv_t) -1)) { + enc = (xmlCharEncodingHandlerPtr) + xmlMalloc(sizeof(xmlCharEncodingHandler)); + if (enc == NULL) { + iconv_close(icv_in); + iconv_close(icv_out); + return(NULL); + } + enc->name = xmlMemStrdup(name); + enc->input = NULL; + enc->output = NULL; + enc->iconv_in = icv_in; + enc->iconv_out = icv_out; +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "Found iconv handler for encoding %s\n", name); +#endif + return enc; + } else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) { + xmlGenericError(xmlGenericErrorContext, "iconv : problems with filters for '%s'\n", name); + } +#endif /* LIBXML_ICONV_ENABLED */ + +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "No handler found for encoding %s\n", name); +#endif + + /* + * Fallback using the canonical names + */ + alias = xmlParseCharEncoding(norig); + if (alias != XML_CHAR_ENCODING_ERROR) { + const char* canon; + canon = xmlGetCharEncodingName(alias); + if ((canon != NULL) && (strcmp(name, canon))) { + return(xmlFindCharEncodingHandler(canon)); + } + } + + /* If "none of the above", give up */ + return(NULL); +} + +/************************************************************************ + * * + * ICONV based generic conversion functions * + * * + ************************************************************************/ + +#ifdef LIBXML_ICONV_ENABLED +/** + * xmlIconvWrapper: + * @param cd iconv converter data structure + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of ISO Latin 1 chars + * @param inlen the length of in + * + * Returns 0 if success, or + * -1 by lack of space, or + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * -3 if there the last byte can't form a single output char. + * + * The value of inlen after return is the number of octets consumed + * as the return value is positive, else unpredictable. + * The value of outlen after return is the number of ocetes consumed. + * + * OOM: ??? + */ +static int +xmlIconvWrapper(iconv_t cd, + unsigned char *out, int *outlen, + const unsigned char *in, int *inlen) { + + size_t icv_inlen = *inlen, icv_outlen = *outlen; + const char *icv_in = (const char *) in; + char *icv_out = (char *) out; + int ret; + + ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); + if (in != NULL) { + *inlen -= icv_inlen; + *outlen -= icv_outlen; + } else { + *inlen = 0; + *outlen = 0; + } + if ((icv_inlen != 0) || (ret == -1)) { +#ifdef EILSEQ + if (errno == EILSEQ) { + return -2; + } else +#endif +#ifdef E2BIG + if (errno == E2BIG) { + return -1; + } else +#endif +#ifdef EINVAL + if (errno == EINVAL) { + return -3; + } else +#endif + { + return -3; + } + } + return 0; +} +#endif /* LIBXML_ICONV_ENABLED */ + +/************************************************************************ + * * + * The real API used by libxml for on-the-fly conversion * + * * + ************************************************************************/ + +/** + * xmlCharEncFirstLine: + * @param handler char enconding transformation data structure + * @param out an xmlBuffer for the output. + * @param in an xmlBuffer for the input + * + * Front-end for the encoding handler input function, but handle only + * the very first line, i.e. limit itself to 45 chars. + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * + * OOM: possible --> check OOM flag + */ +XMLPUBFUNEXPORT int +xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, + xmlBufferPtr in) { + int ret = -2; + int written; + int toconv; + + if (handler == NULL) return(-1); + if (out == NULL) return(-1); + if (in == NULL) return(-1); + + written = out->size - out->use; + toconv = in->use; + if (toconv * 2 >= written) { + xmlBufferGrow(out, toconv); // may set OOM flag + written = out->size - out->use - 1; + } + + /* + * echo '' | wc -c => 38 + * 45 chars should be sufficient to reach the end of the encoding + * declaration without going too far inside the document content. + */ + written = 45; + + if (handler->input != NULL) { + ret = handler->input(&out->content[out->use], &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + } +#ifdef LIBXML_ICONV_ENABLED + else if (handler->iconv_in != NULL) { + ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + if (ret == -1) ret = -3; + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef DEBUG_ENCODING + switch (ret) { + case 0: + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input\n", + toconv, written); + break; + case -1: + xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n", + toconv, written, in->use); + break; + case -2: + xmlGenericError(xmlGenericErrorContext, + "input conversion failed due to input error\n"); + break; + case -3: + xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n", + toconv, written, in->use); + break; + default: + xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret); + } +#endif /* DEBUG_ENCODING */ + /* + * Ignore when input buffer is not on a boundary + */ + if (ret == -3) ret = 0; + if (ret == -1) ret = 0; + return(ret); +} + +/** + * xmlCharEncInFunc: + * @param handler char encoding transformation data structure + * @param out an xmlBuffer for the output. + * @param in an xmlBuffer for the input + * + * Generic front-end for the encoding handler input function + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * + * ISSUE: OOM: possible + */ +XMLPUBFUNEXPORT int +xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, + xmlBufferPtr in) +{ + int ret = -2; + int written; + int toconv; + + if (handler == NULL) + return (-1); + if (out == NULL) + return (-1); + if (in == NULL) + return (-1); + + toconv = in->use; + if (toconv == 0) + return (0); + written = out->size - out->use; + if (toconv * 2 >= written) { + xmlBufferGrow(out, out->size + toconv * 2); // may set OOM flag + written = out->size - out->use - 1; + } + if (handler->input != NULL) { + ret = handler->input(&out->content[out->use], &written, + in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + } +#ifdef LIBXML_ICONV_ENABLED + else if (handler->iconv_in != NULL) { + ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICONV_ENABLED */ + switch (ret) { + case 0: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input\n", + toconv, written); +#endif + break; + case -1: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + toconv, written, in->use); +#endif + break; + case -3: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + toconv, written, in->use); +#endif + break; + case -2: + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("input conversion failed due to input error\n")); + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n"), + in->content[0], in->content[1], + in->content[2], in->content[3]); + } + /* + * Ignore when input buffer is not on a boundary + */ + if (ret == -3) + ret = 0; + return (written); +} + +/** + * xmlCharEncOutFunc: + * @param handler char enconding transformation data structure + * @param out an xmlBuffer for the output. + * @param in an xmlBuffer for the input + * + * Generic front-end for the encoding handler output function + * a first call with in == NULL has to be made firs to initiate the + * output in case of non-stateless encoding needing to initiate their + * state or the output (like the BOM in UTF16). + * In case of UTF8 sequence conversion errors for the given encoder, + * the content will be automatically remapped to a CharRef sequence. + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * + * OOM: unknown status / function pointers are in use + * possible, but reporting is not guaranteed + */ +XMLPUBFUNEXPORT int +xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out, + xmlBufferPtr in) { + int ret = -2; + int written; + int writtentot = 0; + int toconv; + int output = 0; + + if (handler == NULL) return(-1); + if (out == NULL) return(-1); + +retry: + + written = out->size - out->use; + + if (written > 0) + written--; /* Gennady: count '/0' */ + + /* + * First specific handling of in = NULL, i.e. the initialization call + */ + if (in == NULL) { + toconv = 0; + if (handler->output != NULL) { + ret = handler->output(&out->content[out->use], &written, + NULL, &toconv); + if (ret >= 0) { /* Gennady: check return value */ + out->use += written; + out->content[out->use] = 0; + } + } +#ifdef LIBXML_ICONV_ENABLED + else if (handler->iconv_out != NULL) { + ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use], + &written, NULL, &toconv); + out->use += written; + out->content[out->use] = 0; + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "initialized encoder\n"); +#endif + return(0); + } + + /* + * Conversion itself. + */ + toconv = in->use; + if (toconv == 0) + return(0); + if (toconv * 2 >= written) { + xmlBufferGrow(out, toconv * 2); + written = out->size - out->use - 1; + } + if (handler->output != NULL) { + ret = handler->output(&out->content[out->use], &written, + in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + writtentot += written; + out->content[out->use] = 0; + } +#ifdef LIBXML_ICONV_ENABLED + else if (handler->iconv_out != NULL) { + ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + writtentot += written; + out->content[out->use] = 0; + if (ret == -1) { + if (written > 0) { + /* + * Can be a limitation of iconv + */ + goto retry; + } + ret = -3; + } + } +#endif /* LIBXML_ICONV_ENABLED */ + else { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlCharEncOutFunc: no output function !\n")); + return(-1); + } + + if (ret >= 0) output += ret; + + /* + * Attempt to handle error cases + */ + switch (ret) { + case 0: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "converted %d bytes to %d bytes of output\n", toconv, written); +#endif + break; + case -1: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "output conversion failed by lack of space\n"); +#endif + break; + case -3: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n", + toconv, written, in->use); +#endif + break; + case -2: { + int len = in->use; + const xmlChar *utf = (const xmlChar *) in->content; + int cur; + + cur = xmlGetUTF8Char(utf, &len); + if (cur > 0) { + xmlChar charref[20]; + +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, "handling output conversion error\n"); + xmlGenericError(xmlGenericErrorContext, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + in->content[0], in->content[1], + in->content[2], in->content[3]); +#endif + /* + * Removes the UTF8 sequence, and replace it by a charref + * and continue the transcoding phase, hoping the error + * did not mangle the encoder state. + */ + snprintf((char *) charref, sizeof(charref), "&#%d;", cur); + xmlBufferShrink(in, len); + xmlBufferAddHead(in, charref, -1); + + goto retry; + } else { + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("output conversion failed due to conv error\n")); + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n"), + in->content[0], in->content[1], + in->content[2], in->content[3]); + in->content[0] = ' '; + } + break; + } + } + return(ret); +} + +/** + * xmlCharEncCloseFunc: + * @param handler char enconding transformation data structure + * + * Generic front-end for encoding handler close function + * + * Returns 0 if success, or -1 in case of error + * + * OOM: never / not clear (depends on ICONV support) + */ +XMLPUBFUNEXPORT int +xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { + int ret = 0; + if (handler == NULL) return(-1); + if (handler->name == NULL) return(-1); +#ifdef LIBXML_ICONV_ENABLED + /* + * Iconv handlers can be used only once, free the whole block. + * and the associated icon resources. + */ + if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) + { + if (handler->name != NULL) + xmlFree(handler->name); + handler->name = NULL; + if (handler->iconv_out != NULL) { + if (iconv_close(handler->iconv_out)) + ret = -1; + handler->iconv_out = NULL; + } + if (handler->iconv_in != NULL) { + if (iconv_close(handler->iconv_in)) + ret = -1; + handler->iconv_in = NULL; + } + xmlFree(handler); + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef DEBUG_ENCODING + if (ret) + xmlGenericError(xmlGenericErrorContext, "failed to close the encoding handler\n"); + else + xmlGenericError(xmlGenericErrorContext, "closed the encoding handler\n"); +#endif + + return(ret); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlByteConsumed: + * @param ctxt an XML parser context + * + * This function provides the current index of the parser relative + * to the start of the current entity. This function is computed in + * bytes from the beginning starting at zero and finishing at the + * size in byte of the file if parsing a file. The function is + * of constant cost if the input is UTF-8 but can be costly if run + * on non-UTF-8 input. + * + * Returns the index in bytes from the beginning of the entity or -1 + * in case the index could not be computed. + */ +long +xmlByteConsumed(xmlParserCtxtPtr ctxt) { + xmlParserInputPtr in; + + if (ctxt == NULL) return(-1); + in = ctxt->input; + if (in == NULL) return(-1); + if ((in->buf != NULL) && (in->buf->encoder != NULL)) { + unsigned int unused = 0; + xmlCharEncodingHandler * handler = in->buf->encoder; + /* + * Encoding conversion, compute the number of unused original + * bytes from the input not consumed and substract that from + * the raw consumed value, this is not a cheap operation + */ + if (in->end - in->cur > 0) { + //FIXIT? + //static unsigned char convbuf[32000]; + + unsigned const char *cur = (unsigned const char *)in->cur; + unsigned char *convbuf = (unsigned char *)malloc(32000); + int toconv = in->end - in->cur, written = 32000; + + int ret; + + if (handler->output != NULL) { + do { + toconv = in->end - cur; + written = 32000; + ret = handler->output(&convbuf[0], &written, + cur, &toconv); + if (ret == -1) return(-1); + unused += written; + cur += toconv; + } while (ret == -2); +#ifdef LIBXML_ICONV_ENABLED + } else if (handler->iconv_out != NULL) { + do { + toconv = in->end - cur; + written = 32000; + ret = xmlIconvWrapper(handler->iconv_out, &convbuf[0], + &written, cur, &toconv); + if (ret == -1) { + if (written > 0) + ret = -2; + else + return(-1); + } + unused += written; + cur += toconv; + } while (ret == -2); +#endif + } else { + /* could not find a converter */ +free(convbuf); + return(-1); + } +free(convbuf); + } + + if (in->buf->rawconsumed < unused) + return(-1); + return(in->buf->rawconsumed - unused); + } + return(in->consumed + (in->cur - in->base)); +} + +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +#ifndef LIBXML_ICONV_ENABLED +#ifdef LIBXML_ISO8859X_ENABLED + +/** + * UTF8ToISO8859x: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * @param xlattable the 2-level transcoding table + * + * Take a block of UTF-8 chars in and try to convert it to an ISO 8859-* + * block of chars out. + * + * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * as the return value is positive, else unpredictable. + * The value of outlen after return is the number of ocetes consumed. + */ +static int +UTF8ToISO8859x(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen, + unsigned char const *xlattable) { + const unsigned char* outstart = out; + const unsigned char* inend; + const unsigned char* instart = in; + + if (in == NULL) { + /* + * initialization nothing to do + */ + *outlen = 0; + *inlen = 0; + return(0); + } + inend = in + (*inlen); + while (in < inend) { + unsigned char d = *in++; + if (d < 0x80) { + *out++ = d; + } else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = in - instart - 1; + return(-2); + } else if (d < 0xE0) { + unsigned char c; + if (!(in < inend)) { + /* trailing byte not in input buffer */ + *outlen = out - outstart; + *inlen = in - instart - 1; + return(-2); + } + c = *in++; + if ((c & 0xC0) != 0xC0) { + /* not a trailing byte */ + *outlen = out - outstart; + *inlen = in - instart - 2; + return(-2); + } + c = c & 0x3F; + d = d & 0x1F; + d = xlattable [48 + c + xlattable [d] * 64]; + if (d == 0) { + /* not in character set */ + *outlen = out - outstart; + *inlen = in - instart - 2; + return(-2); + } + *out++ = d; + } else if (d < 0xF0) { + unsigned char c1; + unsigned char c2; + if (!(in < inend - 1)) { + /* trailing bytes not in input buffer */ + *outlen = out - outstart; + *inlen = in - instart - 1; + return(-2); + } + c1 = *in++; + if ((c1 & 0xC0) != 0xC0) { + /* not a trailing byte (c1) */ + *outlen = out - outstart; + *inlen = in - instart - 2; + return(-2); + } + c2 = *in++; + if ((c2 & 0xC0) != 0xC0) { + /* not a trailing byte (c2) */ + *outlen = out - outstart; + *inlen = in - instart - 2; + return(-2); + } + c1 = c1 & 0x3F; + c2 = c2 & 0x3F; + d = d & 0x0F; + d = xlattable [48 + c2 + xlattable [48 + c1 + xlattable [32 + d] * 64] * 64]; + if (d == 0) { + /* not in character set */ + *outlen = out - outstart; + *inlen = in - instart - 3; + return(-2); + } + *out++ = d; + } else { + /* cannot transcode >= U+010000 */ + *outlen = out - outstart; + *inlen = in - instart - 1; + return(-2); + } + } + *outlen = out - outstart; + *inlen = in - instart; + return(0); +} + +/** + * ISO8859xToUTF8 + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of ISO Latin 1 chars + * @param inlen the length of in + * + * Take a block of ISO 8859-* chars in and try to convert it to an UTF-8 + * block of chars out. + * Returns 0 if success, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * The value of outlen after return is the number of ocetes produced. + */ +static int +ISO8859xToUTF8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen, + unsigned short const *unicodetable) { + unsigned char* outstart = out; + unsigned char* outend = out + *outlen; + const unsigned char* instart = in; + const unsigned char* inend = in + *inlen; + const unsigned char* instop = inend; + unsigned int c = *in; + + while (in < inend && out < outend - 1) { + if (c >= 0x80) { + c = unicodetable [c - 0x80]; + if (c == 0) { + /* undefined code point */ + *outlen = out - outstart; + *inlen = in - instart; + return (-1); + } + if (c < 0x800) { + *out++ = ((c >> 6) & 0x1F) | 0xC0; + *out++ = (c & 0x3F) | 0x80; + } else { + *out++ = ((c >> 12) & 0x0F) | 0xE0; + *out++ = ((c >> 6) & 0x3F) | 0x80; + *out++ = (c & 0x3F) | 0x80; + } + ++in; + c = *in; + } + if (instop - in > outend - out) instop = in + (outend - out); + while (c < 0x80 && in < instop) { + *out++ = c; + ++in; + c = *in; + } + } + if (in < inend && out < outend && c < 0x80) { + *out++ = c; + ++in; + } + *outlen = out - outstart; + *inlen = in - instart; + return (0); +} + + +/************************************************************************ + * Lookup tables for ISO-8859-2..ISO-8859-16 transcoding * + ************************************************************************/ + +static unsigned short const xmlunicodetable_ISO8859_2 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, + 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, + 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, + 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, + 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, + 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, + 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, + 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, + 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, + 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, +}; + +static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { + "\x00\x00\x01\x05\x02\x04\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00" + "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\xc3\xe3\xa1\xb1\xc6\xe6\x00\x00\x00\x00\xc8\xe8\xcf\xef" + "\xd0\xf0\x00\x00\x00\x00\x00\x00\xca\xea\xcc\xec\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc5\xe5\x00\x00\xa5\xb5\x00" + "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\xb2\x00\xbd\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\xa3\xb3\xd1\xf1\x00\x00\xd2\xf2\x00\x00\x00\x00\x00\x00\x00" + "\xd5\xf5\x00\x00\xc0\xe0\x00\x00\xd8\xf8\xa6\xb6\x00\x00\xaa\xba" + "\xa9\xb9\xde\xfe\xab\xbb\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xf9" + "\xdb\xfb\x00\x00\x00\x00\x00\x00\x00\xac\xbc\xaf\xbf\xae\xbe\x00" + "\x00\xc1\xc2\x00\xc4\x00\x00\xc7\x00\xc9\x00\xcb\x00\xcd\xce\x00" + "\x00\x00\x00\xd3\xd4\x00\xd6\xd7\x00\x00\xda\x00\xdc\xdd\x00\xdf" + "\x00\xe1\xe2\x00\xe4\x00\x00\xe7\x00\xe9\x00\xeb\x00\xed\xee\x00" + "\x00\x00\x00\xf3\xf4\x00\xf6\xf7\x00\x00\xfa\x00\xfc\xfd\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_3 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, + 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, + 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, + 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c, + 0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, + 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, + 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, +}; + +static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { + "\x04\x00\x01\x06\x02\x05\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\xa3\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00" + "\xb0\x00\xb2\xb3\xb4\xb5\x00\xb7\xb8\x00\x00\x00\x00\xbd\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xe6\xc5\xe5\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xf8\xab\xbb" + "\xd5\xf5\x00\x00\xa6\xb6\xa1\xb1\x00\x00\x00\x00\x00\x00\x00\x00" + "\xa9\xb9\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe\xaa\xba" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaf\xbf\x00\x00\x00" + "\xc0\xc1\xc2\x00\xc4\x00\x00\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\x00\xd1\xd2\xd3\xd4\x00\xd6\xd7\x00\xd9\xda\xdb\xdc\x00\x00\xdf" + "\xe0\xe1\xe2\x00\xe4\x00\x00\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\x00\xf1\xf2\xf3\xf4\x00\xf6\xf7\x00\xf9\xfa\xfb\xfc\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_4 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, + 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, + 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, + 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, + 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, + 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, +}; + +static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { + "\x00\x00\x01\x05\x02\x03\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\xaf" + "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00" + "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00" + "\xd0\xf0\xaa\xba\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00" + "\x00\x00\xab\xbb\x00\x00\x00\x00\xa5\xb5\xcf\xef\x00\x00\xc7\xe7" + "\x00\x00\x00\x00\x00\x00\xd3\xf3\xa2\x00\x00\xa6\xb6\x00\x00\x00" + "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xbd\xbf\xd2\xf2\x00\x00" + "\x00\x00\x00\x00\x00\x00\xa3\xb3\x00\x00\x00\x00\x00\x00\x00\x00" + "\xa9\xb9\x00\x00\x00\x00\xac\xbc\xdd\xfd\xde\xfe\x00\x00\x00\x00" + "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xae\xbe\x00" + "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\xb2\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\x00" + "\x00\x00\x00\x00\xd4\xd5\xd6\xd7\xd8\x00\xda\xdb\xdc\x00\x00\xdf" + "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\x00" + "\x00\x00\x00\x00\xf4\xf5\xf6\xf7\xf8\x00\xfa\xfb\xfc\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_5 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, +}; + +static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { + "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\x00\x00\x00\xfd\x00\x00\x00\x00\x00\xad\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\x00\xae\xaf" + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\xfe\xff" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_6 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, + 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, + 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; + +static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { + "\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\xa4\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbb\x00\x00\x00\xbf" + "\x00\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\x00" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\xf0\xf1\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_7 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, + 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, + 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000, +}; + +static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { + "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\xa3\x00\x00\xa6\xa7\xa8\xa9\x00\xab\xac\xad\x00\x00" + "\xb0\xb1\xb2\xb3\x00\x00\x00\xb7\x00\x00\x00\xbb\x00\xbd\x00\x00" + "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\xaf\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\xb4\xb5\xb6\x00\xb8\xb9\xba\x00\xbc\x00\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\xd0\xd1\x00\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_8 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000, +}; + +static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { + "\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\x00\xab\xac\xad\xae\xaf" + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\x00\xbb\xbc\xbd\xbe\x00" + "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\xba\x00\x00\x00\x00\x00\x00\x00\x00" + "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfd\xfe" + "\x00\x00\x00\x00\x00\x00\x00\xdf\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_9 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, +}; + +static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { + "\x00\x00\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\x00\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\x00\x00\xdf" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\x00\xff" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xf0" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xdd\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_10 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, + 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, + 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, + 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, +}; + +static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { + "\x00\x00\x01\x06\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\x00\x00\x00\x00\xad\x00\x00" + "\xb0\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" + "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00" + "\xa9\xb9\xa2\xb2\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00" + "\x00\x00\xa3\xb3\x00\x00\x00\x00\xa5\xb5\xa4\xb4\x00\x00\xc7\xe7" + "\x00\x00\x00\x00\x00\x00\xa6\xb6\xff\x00\x00\xa8\xb8\x00\x00\x00" + "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xaf\xbf\xd2\xf2\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xaa\xba\x00\x00\x00\x00\xab\xbb\xd7\xf7\xae\xbe\x00\x00\x00\x00" + "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\xbc\x00" + "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\xcf" + "\xd0\x00\x00\xd3\xd4\xd5\xd6\x00\xd8\x00\xda\xdb\xdc\xdd\xde\xdf" + "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\xef" + "\xf0\x00\x00\xf3\xf4\xf5\xf6\x00\xf8\x00\xfa\xfb\xfc\xfd\xfe\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_11 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f, + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000, +}; + +static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { + "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00" + "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\xdf" + "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_13 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, + 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, + 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, + 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, + 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, + 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, + 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, + 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, + 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, + 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, + 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, +}; + +static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { + "\x00\x00\x01\x04\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\xa2\xa3\xa4\x00\xa6\xa7\x00\xa9\x00\xab\xac\xad\xae\x00" + "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\x00\xbb\xbc\xbd\xbe\x00" + "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\xb4\xa1\xa5\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\xc4\xc5\xaf\x00\x00\xc9\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\xd3\x00\xd5\xd6\xd7\xa8\x00\x00\x00\xdc\x00\x00\xdf" + "\x00\x00\x00\x00\xe4\xe5\xbf\x00\x00\xe9\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\xf3\x00\xf5\xf6\xf7\xb8\x00\x00\x00\xfc\x00\x00\x00" + "\x00\xd9\xf9\xd1\xf1\xd2\xf2\x00\x00\x00\x00\x00\xd4\xf4\x00\x00" + "\x00\x00\x00\x00\x00\x00\xaa\xba\x00\x00\xda\xfa\x00\x00\x00\x00" + "\xd0\xf0\x00\x00\x00\x00\x00\x00\x00\x00\xdb\xfb\x00\x00\x00\x00" + "\x00\x00\xd8\xf8\x00\x00\x00\x00\x00\xca\xea\xdd\xfd\xde\xfe\x00" + "\xc2\xe2\x00\x00\xc0\xe0\xc3\xe3\x00\x00\x00\x00\xc8\xe8\x00\x00" + "\x00\x00\xc7\xe7\x00\x00\xcb\xeb\xc6\xe6\x00\x00\x00\x00\x00\x00" + "\x00\x00\xcc\xec\x00\x00\x00\x00\x00\x00\xce\xee\x00\x00\xc1\xe1" + "\x00\x00\x00\x00\x00\x00\xcd\xed\x00\x00\x00\xcf\xef\x00\x00\x00" +}; + +static unsigned short const xmlunicodetable_ISO8859_14 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, + 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, + 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, +}; + +static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { + "\x00\x00\x01\x09\x04\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\xa3\x00\x00\x00\xa7\x00\xa9\x00\x00\x00\xad\xae\x00" + "\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x08\x05\x06\x00\x00\x00\x00" + "\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00\xa6\xab\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb1" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xa5\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xb2\xb3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xa8\xb8\xaa\xba\xbd\xbe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\xd0\xf0\xde\xfe\xaf\x00\x00\x00\x00\x00\x00\x00" + "\xb4\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\xb7\xb9\x00\x00\x00\x00\x00\x00\x00\x00" + "\xbb\xbf\x00\x00\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\x00\xd1\xd2\xd3\xd4\xd5\xd6\x00\xd8\xd9\xda\xdb\xdc\xdd\x00\xdf" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\x00\xf1\xf2\xf3\xf4\xf5\xf6\x00\xf8\xf9\xfa\xfb\xfc\xfd\x00\xff" +}; + +static unsigned short const xmlunicodetable_ISO8859_15 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, + 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, +}; + +static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { + "\x00\x00\x01\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\xa1\xa2\xa3\x00\xa5\x00\xa7\x00\xa9\xaa\xab\xac\xad\xae\xaf" + "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\xba\xbb\x00\x00\x00\xbf" + "\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\xbc\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\xbe\x00\x00\x00\x00\xb4\xb8\x00" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" + "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" +}; + +static unsigned short const xmlunicodetable_ISO8859_16 [128] = { + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, + 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, + 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, + 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, + 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, + 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, +}; + +static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = { + "\x00\x00\x01\x08\x02\x03\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" + "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\xa9\x00\xab\x00\xad\x00\x00" + "\xb0\xb1\x00\x00\x00\x00\xb6\xb7\x00\x00\x00\xbb\x00\x00\x00\x00" + "\x00\x00\xc3\xe3\xa1\xa2\xc5\xe5\x00\x00\x00\x00\xb2\xb9\x00\x00" + "\xd0\xf0\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\xa3\xb3\xd1\xf1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xd5\xf5\xbc\xbd\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00" + "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xd8\xf8\x00\x00\x00\x00\x00\x00\xbe\xac\xae\xaf\xbf\xb4\xb8\x00" + "\x06\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb5\xa5\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\xaa\xba\xde\xfe\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\xc0\xc1\xc2\x00\xc4\x00\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + "\x00\x00\xd2\xd3\xd4\x00\xd6\x00\x00\xd9\xda\xdb\xdc\x00\x00\xdf" + "\xe0\xe1\xe2\x00\xe4\x00\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" + "\x00\x00\xf2\xf3\xf4\x00\xf6\x00\x00\xf9\xfa\xfb\xfc\x00\x00\xff" +}; + + +/* + * auto-generated functions for ISO-8859-2 .. ISO-8859-16 + */ + +static int ISO8859_2ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_2); +} +static int UTF8ToISO8859_2 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_2); +} + +static int ISO8859_3ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_3); +} +static int UTF8ToISO8859_3 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_3); +} + +static int ISO8859_4ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_4); +} +static int UTF8ToISO8859_4 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_4); +} + +static int ISO8859_5ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_5); +} +static int UTF8ToISO8859_5 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_5); +} + +static int ISO8859_6ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_6); +} +static int UTF8ToISO8859_6 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_6); +} + +static int ISO8859_7ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_7); +} +static int UTF8ToISO8859_7 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_7); +} + +static int ISO8859_8ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_8); +} +static int UTF8ToISO8859_8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_8); +} + +static int ISO8859_9ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_9); +} +static int UTF8ToISO8859_9 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_9); +} + +static int ISO8859_10ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_10); +} +static int UTF8ToISO8859_10 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_10); +} + +static int ISO8859_11ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_11); +} +static int UTF8ToISO8859_11 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_11); +} + +static int ISO8859_13ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_13); +} +static int UTF8ToISO8859_13 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_13); +} + +static int ISO8859_14ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_14); +} +static int UTF8ToISO8859_14 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_14); +} + +static int ISO8859_15ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_15); +} +static int UTF8ToISO8859_15 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_15); +} + +static int ISO8859_16ToUTF8 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_16); +} +static int UTF8ToISO8859_16 (unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_16); +} + +/** +* +* OOM: possible --> OOM flag is set +*/ +static void +xmlRegisterCharEncodingHandlersISO8859x (void) { + xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2); + xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3); + xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4); + xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5); + xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6); + xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7); + xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8); + xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9); + xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10); + xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11); + xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13); + xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14); + xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15); + xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16); +} + +#endif +#endif + + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_entities.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_entities.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,983 @@ +/* + * libxml2_entities.c : implementation for the XML entities handling + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML + +#include "xmlenglibxml.h" + +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include +#include + +/* + * The XML predefined entities. + */ + +static const xmlEntity xmlEntityLt = { + NULL, XML_ENTITY_DECL, BAD_CAST "lt", + NULL, NULL, NULL, NULL, NULL, NULL, + BAD_CAST "<", BAD_CAST "<", 1, + XML_INTERNAL_PREDEFINED_ENTITY, + NULL, NULL, NULL, NULL, 0 +}; + +static const xmlEntity xmlEntityGt = { + NULL, XML_ENTITY_DECL, BAD_CAST "gt", + NULL, NULL, NULL, NULL, NULL, NULL, + BAD_CAST ">", BAD_CAST ">", 1, + XML_INTERNAL_PREDEFINED_ENTITY, + NULL, NULL, NULL, NULL, 0 +}; +static const xmlEntity xmlEntityAmp = { + NULL, XML_ENTITY_DECL, BAD_CAST "amp", + NULL, NULL, NULL, NULL, NULL, NULL, + BAD_CAST "&", BAD_CAST "&", 1, + XML_INTERNAL_PREDEFINED_ENTITY, + NULL, NULL, NULL, NULL, 0 +}; +static const xmlEntity xmlEntityQuot = { + NULL, XML_ENTITY_DECL, BAD_CAST "quot", + NULL, NULL, NULL, NULL, NULL, NULL, + BAD_CAST "\"", BAD_CAST "\"", 1, + XML_INTERNAL_PREDEFINED_ENTITY, + NULL, NULL, NULL, NULL, 0 +}; +static const xmlEntity xmlEntityApos = { + NULL, XML_ENTITY_DECL, BAD_CAST "apos", + NULL, NULL, NULL, NULL, NULL, NULL, + BAD_CAST "'", BAD_CAST "'", 1, + XML_INTERNAL_PREDEFINED_ENTITY, + NULL, NULL, NULL, NULL, 0 +}; + +/* + * xmlFreeEntity : clean-up an entity record. + */ +static void xmlFreeEntity(xmlEntityPtr entity) { + if (entity == NULL) return; + + if ((entity->children) && (entity->owner == 1) && + (entity == (xmlEntityPtr) entity->children->parent)) + { + xmlFreeNodeList(entity->children); + } + if (entity->name != NULL) + xmlFree((char *) entity->name); + if (entity->ExternalID != NULL) + xmlFree((char *) entity->ExternalID); + if (entity->SystemID != NULL) + xmlFree((char *) entity->SystemID); + if (entity->URI != NULL) + xmlFree((char *) entity->URI); + if (entity->content != NULL) + xmlFree((char *) entity->content); + if (entity->orig != NULL) + xmlFree((char *) entity->orig); + xmlFree(entity); +} + +/* + * xmlAddEntity : register a new entity for an entities table. + */ +static xmlEntityPtr +xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlEntitiesTablePtr table = NULL; + xmlEntityPtr ret; + + if (name == NULL) + return(NULL); + switch (type) { + case XML_INTERNAL_GENERAL_ENTITY: + case XML_EXTERNAL_GENERAL_PARSED_ENTITY: + case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + if (dtd->entities == NULL) + dtd->entities = xmlHashCreate(0); + table = (xmlEntitiesTablePtr)dtd->entities; + break; + case XML_INTERNAL_PARAMETER_ENTITY: + case XML_EXTERNAL_PARAMETER_ENTITY: + if (dtd->pentities == NULL) + dtd->pentities = xmlHashCreate(0); + table = (xmlEntitiesTablePtr)dtd->pentities; + break; + case XML_INTERNAL_PREDEFINED_ENTITY: + return(NULL); + } + if (table == NULL) + return(NULL); + + ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlAddEntity: out of memory\n")); + + return(NULL); + } + memset(ret, 0, sizeof(xmlEntity)); + ret->type = XML_ENTITY_DECL; + + /* + * fill the structure. + */ + + ret->name = xmlStrdup(name); + ret->etype = (xmlEntityType) type; + if (ExternalID != NULL) + ret->ExternalID = xmlStrdup(ExternalID); + if (SystemID != NULL) + ret->SystemID = xmlStrdup(SystemID); + if (content != NULL) { + ret->length = xmlStrlen(content); + ret->content = xmlStrndup(content, ret->length); + } else { + ret->length = 0; + ret->content = NULL; + } + ret->URI = NULL; /* to be computed by the layer knowing the defining entity */ + ret->orig = NULL; + ret->owner = 0; + + if (xmlHashAddEntry(table, name, ret)) { + /* + * entity was already defined at another level. + */ + xmlFreeEntity(ret); + return(NULL); + } + return(ret); +} + +/** + * xmlGetPredefinedEntity: + * @param name the entity name + * + * Check whether this name is an predefined entity. + * + * Returns NULL if not, otherwise the entity + * + * OOM: never + */ +XMLPUBFUNEXPORT xmlEntityPtr +xmlGetPredefinedEntity(const xmlChar *name) { + if (name == NULL) return(NULL); + // NOTE: Predefined entities are constants, so explicit casts + // of pointers to them to non-const pointer type is needed + + + switch (name[0]) { + case 'l': + if (xmlStrEqual(name, BAD_CAST "lt")) + return((xmlEntityPtr)&xmlEntityLt); + break; + case 'g': + if (xmlStrEqual(name, BAD_CAST "gt")) + return((xmlEntityPtr)&xmlEntityGt); + break; + case 'a': + if (xmlStrEqual(name, BAD_CAST "amp")) + return((xmlEntityPtr)&xmlEntityAmp); + if (xmlStrEqual(name, BAD_CAST "apos")) + return((xmlEntityPtr)&xmlEntityApos); + break; + case 'q': + if (xmlStrEqual(name, BAD_CAST "quot")) + return((xmlEntityPtr)&xmlEntityQuot); + break; + default: + break; + } + return(NULL); +} + +/** + * xmlAddDtdEntity: + * @param doc the document + * @param name the entity name + * @param type the entity type XML_xxx_yyy_ENTITY + * @param ExternalID the entity external ID if available + * @param SystemID the entity system ID if available + * @param content the entity content + * + * Register a new entity for this document DTD external subset. + * + * Returns a pointer to the entity or NULL in case of error + */ +XMLPUBFUNEXPORT xmlEntityPtr +xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlEntityPtr ret; + xmlDtdPtr dtd; + + if (doc == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlAddDtdEntity: doc == NULL !\n")); + return(NULL); + } + if (doc->extSubset == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlAddDtdEntity: document without external subset !\n")); + return(NULL); + } + + dtd = doc->extSubset; + ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content); + + if (ret == NULL) return(NULL); + + /* + * Link it to the DTD + */ + ret->parent = dtd; + ret->doc = dtd->doc; + if (dtd->last == NULL) { + dtd->children = dtd->last = (xmlNodePtr) ret; + } else { + dtd->last->next = (xmlNodePtr) ret; + ret->prev = dtd->last; + dtd->last = (xmlNodePtr) ret; + } + return(ret); +} + +/** + * xmlAddDocEntity: + * @param doc the document + * @param name the entity name + * @param type the entity type XML_xxx_yyy_ENTITY + * @param ExternalID the entity external ID if available + * @param SystemID the entity system ID if available + * @param content the entity content + * + * Register a new entity for this document. + * + * Returns a pointer to the entity or NULL in case of error + */ +XMLPUBFUNEXPORT xmlEntityPtr +xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlEntityPtr ret; + xmlDtdPtr dtd; + + if (doc == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlAddDocEntity: document is NULL !\n")); + return(NULL); + } + if (doc->intSubset == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlAddDocEntity: document without internal subset !\n")); + return(NULL); + } + dtd = doc->intSubset; + ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content); + + if (ret == NULL) return(NULL); + + /* + * Link it to the DTD + */ + ret->parent = dtd; + ret->doc = dtd->doc; + if (dtd->last == NULL) { + dtd->children = dtd->last = (xmlNodePtr) ret; + } else { + dtd->last->next = (xmlNodePtr) ret; + ret->prev = dtd->last; + dtd->last = (xmlNodePtr) ret; + } + return(ret); +} + +/** + * xmlGetEntityFromTable: + * @param table an entity table + * @param name the entity name + * @param parameter look for parameter entities + * + * Do an entity lookup in the table. + * returns the corresponding parameter entity, if found. + * + * Returns A pointer to the entity structure or NULL if not found. + */ +static xmlEntityPtr +xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name) { + return((xmlEntityPtr) xmlHashLookup(table, name)); +} + +/** + * xmlGetParameterEntity: + * @param doc the document referencing the entity + * @param name the entity name + * + * Do an entity lookup in the internal and external subsets and + * returns the corresponding parameter entity, if found. + * + * Returns A pointer to the entity structure or NULL if not found. + */ +XMLPUBFUNEXPORT xmlEntityPtr +xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) { + xmlEntitiesTablePtr table; + xmlEntityPtr ret; + + if (doc == NULL) + return(NULL); + if ((doc->intSubset != NULL) && (doc->intSubset->pentities != NULL)) { + table = (xmlEntitiesTablePtr) doc->intSubset->pentities; + ret = xmlGetEntityFromTable(table, name); + if (ret != NULL) + return(ret); + } + if ((doc->extSubset != NULL) && (doc->extSubset->pentities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->pentities; + return(xmlGetEntityFromTable(table, name)); + } + return(NULL); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlGetDtdEntity: + * @param doc the document referencing the entity + * @param name the entity name + * + * Do an entity lookup in the DTD entity hash table and + * returns the corresponding entity, if found. + * Note: the first argument is the document node, not the DTD node. + * + * Returns A pointer to the entity structure or NULL if not found. + */ +xmlEntityPtr +xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { + xmlEntitiesTablePtr table; + + if (doc == NULL) + return(NULL); + if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + return(xmlGetEntityFromTable(table, name)); + } + return(NULL); +} +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * xmlGetDocEntity: + * @param doc the document referencing the entity + * @param name the entity name + * + * Do an entity lookup in the document entity hash table and + * returns the corresponding entity, otherwise a lookup is done + * in the predefined entities too. + * + * Returns A pointer to the entity structure or NULL if not found. + * + * OOM: never + */ +XMLPUBFUNEXPORT xmlEntityPtr +xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { + xmlEntityPtr cur; + xmlEntitiesTablePtr table; + + if (doc) + { + if (doc->intSubset && doc->intSubset->entities) + { + table = (xmlEntitiesTablePtr) doc->intSubset->entities; + cur = xmlGetEntityFromTable(table, name); + if (cur) + return(cur); + } + if (doc->standalone != 1) { + if ((doc->extSubset != NULL) && + (doc->extSubset->entities != NULL)) + { + table = (xmlEntitiesTablePtr) doc->extSubset->entities; + cur = xmlGetEntityFromTable(table, name); + if (cur != NULL) + return(cur); + } + } + } + return(xmlGetPredefinedEntity(name)); +} + +/* + * Macro used to grow the current buffer. + */ + + + + + + +/* +#define GROW_BUFFER_REENTRANT() { \ + buffer_size *= 2; \ + buffer = (xmlChar *) \ + xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ + if (buffer == NULL) { \ + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("realloc failed\n")); \ + return(NULL); \ + } \ +} +*/ +static void* +xmlGrowBufferReentrant(int* buffer_size, void* buffer) { + void* ptr; + (*buffer_size) *= 2; + ptr = (xmlChar*) xmlRealloc(buffer, *buffer_size * sizeof(xmlChar)); + /// if(!ptr) removed -- handling is done by caller + return ptr; +} + +/** + * xmlEncodeEntitiesReentrant: + * @param doc the document containing the string + * @param input A string to convert to XML. + * + * Do a global encoding of a string, replacing the predefined entities + * and non ASCII values with their entities and CharRef counterparts. + * Contrary to xmlEncodeEntities, this routine is reentrant, and result + * must be deallocated. + * + * Returns A newly allocated string with the substitution done. + * + * OOM: possible --> returns NULL (for input!=NULL), sets OOM flag + */ +XMLPUBFUNEXPORT xmlChar* +xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { + const xmlChar* cur = input; + xmlChar* buffer = NULL; + xmlChar* out = NULL; + int buffer_size; + int html; + LOAD_GS_SAFE_DOC(doc) + + if (input == NULL) + return(NULL); + + html = doc && (doc->type == XML_HTML_DOCUMENT_NODE); + /* + * allocate an translation buffer. + */ + + + buffer_size = 1000; + buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); + if (buffer == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("malloc failed\n")); + return(NULL); + } + out = buffer; + + while (*cur != '\0') { + + if (out - buffer > buffer_size - 100) { + xmlChar* newbuf; + int indx = out - buffer; + + newbuf = (xmlChar*)xmlGrowBufferReentrant(&buffer_size, buffer); // on OOM returns NULL (buffer is not freed) + if(!buffer) + { + xmlFree(buffer); + return NULL; + } + buffer = newbuf; + out = &buffer[indx]; + } + + /* + * By default one have to encode at least '<', '>', '"' and '&' ! + */ + if (*cur == '<') { + *out++ = '&'; + *out++ = 'l'; + *out++ = 't'; + *out++ = ';'; + } else if (*cur == '>') { + *out++ = '&'; + *out++ = 'g'; + *out++ = 't'; + *out++ = ';'; + } else if (*cur == '&') { + *out++ = '&'; + *out++ = 'a'; + *out++ = 'm'; + *out++ = 'p'; + *out++ = ';'; + } else if (((*cur >= 0x20) && (*cur < 0x80)) || + (*cur == '\n') || (*cur == '\t') || ((html) && (*cur == '\r'))) { + /* + * default case, just copy ! + */ + *out++ = *cur; + } else if (*cur >= 0x80) { + if (((doc != NULL) && (doc->encoding != NULL)) || (html)) { + /* + * Bjorn Reese provided the patch + xmlChar xc; + xc = (*cur & 0x3F) << 6; + if (cur[1] != 0) { + xc += *(++cur) & 0x3F; + *out++ = xc; + } else + */ + *out++ = *cur; + } else { + /* + * We assume we have UTF-8 input. + */ + char buf[11], *ptr; + // DONE: rename 'l' variable -- hard to understand and error-prone otherwise (looks like '1') + int val = 0, len = 1; // 'l' became 'len' + + if (*cur < 0xC0) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlEncodeEntitiesReentrant : input not UTF-8\n")); + if (doc != NULL){ + doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); + if(OOM_FLAG) + goto OOM; + } + + + snprintf(buf, sizeof(buf), "&#%d;", *cur); + buf[sizeof(buf) - 1] = 0; + ptr = buf; + while (*ptr != 0) + { + *out++ = *ptr++; + } + cur++; + continue; + + } else if (*cur < 0xE0) { + val = (cur[0]) & 0x1F; + val <<= 6; + val |= (cur[1]) & 0x3F; + len = 2; + } else if (*cur < 0xF0) { + val = (cur[0]) & 0x0F; + val <<= 6; + val |= (cur[1]) & 0x3F; + val <<= 6; + val |= (cur[2]) & 0x3F; + len = 3; + } else if (*cur < 0xF8) { + val = (cur[0]) & 0x07; + val <<= 6; + val |= (cur[1]) & 0x3F; + val <<= 6; + val |= (cur[2]) & 0x3F; + val <<= 6; + val |= (cur[3]) & 0x3F; + len = 4; + } + if ((len == 1) || (!IS_CHAR(val))) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("xmlEncodeEntitiesReentrant : char out of range\n")); + if (doc != NULL){ + doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); + if(OOM_FLAG) + goto OOM; + } + // 2--> + snprintf(buf, sizeof(buf), "&#%d;", *cur); + buf[sizeof(buf) - 1] = 0; + ptr = buf; + while (*ptr != 0) + { + *out++ = *ptr++; + } + cur++; + continue; + // <--2 + } + /* + * We could do multiple things here. Just save as a char ref + */ + // 3--> + if (html) + snprintf(buf, sizeof(buf), "&#%d;", val); + else + snprintf(buf, sizeof(buf), "&#x%X;", val); + buf[sizeof(buf) - 1] = 0; + ptr = buf; + while (*ptr != 0) + { + *out++ = *ptr++; + } + cur += len; + continue; + // <--3 + } + } else if (IS_BYTE_CHAR(*cur)) { + char buf[11], *ptr; + // 4--> + snprintf(buf, sizeof(buf), "&#%d;", *cur); + buf[sizeof(buf) - 1] = 0; + ptr = buf; + while (*ptr != 0) + { + *out++ = *ptr++; + } + } + cur++; + // continue; is implied here + // <--4 + } // while (*cur != '\0') + *out++ = 0; + return(buffer); +OOM: + xmlFree(buffer); + return NULL; +} + +/** + * xmlEncodeSpecialChars: + * @param doc the document containing the string + * @param input A string to convert to XML. + * + * Do a global encoding of a string, replacing the predefined entities + * this routine is reentrant, and result must be deallocated. + * + * Returns A newly allocated string with the substitution done. + */ +XMLPUBFUNEXPORT xmlChar * +xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar* input) { + + const xmlChar* cur = input; + xmlChar* buffer = NULL; + xmlChar* out = NULL; + int buffer_size = 0; + + if (input == NULL) return(NULL); + /* + * allocate an translation buffer. + */ + buffer_size = 1000; + + buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); + if (buffer == NULL) { + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("malloc failed\n")); + return(NULL); + } + out = buffer; + + while (*cur != '\0') { + if (out - buffer > buffer_size - 10) { + xmlChar* newbuf; + int indx = out - buffer; + + newbuf = (xmlChar*)xmlGrowBufferReentrant(&buffer_size, buffer); // on OOM returns NULL (buffer is not freed) + if(!buffer) + { + xmlFree(buffer); + return NULL; + } + buffer = newbuf; + out = &buffer[indx]; + } + + /* + * By default one have to encode at least '<', '>', '"' and '&' ! + */ + if (*cur == '<') { + *out++ = '&'; + *out++ = 'l'; + *out++ = 't'; + *out++ = ';'; + } else if (*cur == '>') { + *out++ = '&'; + *out++ = 'g'; + *out++ = 't'; + *out++ = ';'; + } else if (*cur == '&') { + *out++ = '&'; + *out++ = 'a'; + *out++ = 'm'; + *out++ = 'p'; + *out++ = ';'; + } else if (*cur == '"') { + *out++ = '&'; + *out++ = 'q'; + *out++ = 'u'; + *out++ = 'o'; + *out++ = 't'; + *out++ = ';'; + } else if (*cur == '\r') { + *out++ = '&'; + *out++ = '#'; + *out++ = '1'; + *out++ = '3'; + *out++ = ';'; + } else { + /* + * Works because on UTF-8, all extended sequences cannot + * result in bytes in the ASCII range. + */ + *out++ = *cur; + } + cur++; + } + *out++ = 0; + return(buffer); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlCreateEntitiesTable: + * + * create and initialize an empty entities hash table. + * + * Returns the xmlEntitiesTablePtr just created or NULL in case of error. + */ +xmlEntitiesTablePtr +xmlCreateEntitiesTable(void) { + return((xmlEntitiesTablePtr) xmlHashCreate(0)); +} + +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * xmlFreeEntityWrapper: + * @param entity An entity + * @param name its name + * + * Deallocate the memory used by an entities in the hash table. + */ +static void +xmlFreeEntityWrapper(xmlEntityPtr entity, + const xmlChar *name ATTRIBUTE_UNUSED) { + if (entity != NULL) + xmlFreeEntity(entity); +} + +/** + * xmlFreeEntitiesTable: + * @param table An entity table + * + * Deallocate the memory used by an entities hash table. + */ +XMLPUBFUNEXPORT void +xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { + xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper); +} + +#ifdef LIBXML_TREE_ENABLED +/** + * xmlCopyEntity: + * @param ent An entity + * + * Build a copy of an entity + * + * Returns the new xmlEntitiesPtr or NULL in case of error. + */ +static xmlEntityPtr +xmlCopyEntity(xmlEntityPtr ent) { + xmlEntityPtr cur; + + cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); + if (cur == NULL) { + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("xmlCopyEntity: out of memory !\n")); + return(NULL); + } + memset(cur, 0, sizeof(xmlEntity)); + cur->type = XML_ENTITY_DECL; + + cur->etype = ent->etype; + if (ent->name != NULL) + cur->name = xmlStrdup(ent->name); + if (ent->ExternalID != NULL) + cur->ExternalID = xmlStrdup(ent->ExternalID); + if (ent->SystemID != NULL) + cur->SystemID = xmlStrdup(ent->SystemID); + if (ent->content != NULL) + cur->content = xmlStrdup(ent->content); + if (ent->orig != NULL) + cur->orig = xmlStrdup(ent->orig); + if (ent->URI != NULL) + cur->URI = xmlStrdup(ent->URI); + return(cur); +} + +/** + * xmlCopyEntitiesTable: + * @param table An entity table + * + * Build a copy of an entity table. + * + * Returns the new xmlEntitiesTablePtr or NULL in case of error. + * + * OOM: possible --> returns NULL, OOM flag is set + */ +XMLPUBFUNEXPORT xmlEntitiesTablePtr +xmlCopyEntitiesTable(xmlEntitiesTablePtr table) { + + return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity)); +} +#endif /* LIBXML_TREE_ENABLED */ + +#ifdef LIBXML_OUTPUT_ENABLED + +/** + * xmlDumpEntityContent: + * @param buf An XML buffer. + * @param content The entity content. + * + * This will dump the quoted string value, taking care of the special + * treatment required by % + */ +static void +xmlDumpEntityContent(xmlBufferPtr buf, const xmlChar *content) { + if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return; + if (xmlStrchr(content, '%')) { + const xmlChar * base, *cur; + + xmlBufferCCat(buf, "\""); + base = cur = content; + while (*cur != 0) { + if (*cur == '"') { + if (base != cur) + xmlBufferAdd(buf, base, cur - base); + xmlBufferAdd(buf, BAD_CAST """, 6); + cur++; + base = cur; + } else if (*cur == '%') { + if (base != cur) + xmlBufferAdd(buf, base, cur - base); + xmlBufferAdd(buf, BAD_CAST "%", 6); + cur++; + base = cur; + } else { + cur++; + } + } + if (base != cur) + xmlBufferAdd(buf, base, cur - base); + xmlBufferCCat(buf, "\""); + } else { + xmlBufferWriteQuotedString(buf, content); + } +} + +/** + * xmlDumpEntityDecl: + * @param buf An XML buffer. + * @param ent An entity table + * + * This will dump the content of the entity table as an XML DTD definition + */ +XMLPUBFUNEXPORT void +xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) { + switch (ent->etype) { + case XML_INTERNAL_GENERAL_ENTITY: + xmlBufferWriteChar(buf, "name); + xmlBufferWriteChar(buf, " "); + if (ent->orig != NULL) + xmlBufferWriteQuotedString(buf, ent->orig); + else + xmlDumpEntityContent(buf, ent->content); + xmlBufferWriteChar(buf, ">\n"); + break; + case XML_EXTERNAL_GENERAL_PARSED_ENTITY: + xmlBufferWriteChar(buf, "name); + if (ent->ExternalID != NULL) { + xmlBufferWriteChar(buf, " PUBLIC "); + xmlBufferWriteQuotedString(buf, ent->ExternalID); + xmlBufferWriteChar(buf, " "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } else { + xmlBufferWriteChar(buf, " SYSTEM "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } + xmlBufferWriteChar(buf, ">\n"); + break; + case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + xmlBufferWriteChar(buf, "name); + if (ent->ExternalID != NULL) { + xmlBufferWriteChar(buf, " PUBLIC "); + xmlBufferWriteQuotedString(buf, ent->ExternalID); + xmlBufferWriteChar(buf, " "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } else { + xmlBufferWriteChar(buf, " SYSTEM "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } + if (ent->content != NULL) { /* Should be true ! */ + xmlBufferWriteChar(buf, " NDATA "); + if (ent->orig != NULL) + xmlBufferWriteCHAR(buf, ent->orig); + else + xmlBufferWriteCHAR(buf, ent->content); + } + xmlBufferWriteChar(buf, ">\n"); + break; + case XML_INTERNAL_PARAMETER_ENTITY: + xmlBufferWriteChar(buf, "name); + xmlBufferWriteChar(buf, " "); + if (ent->orig == NULL) + xmlDumpEntityContent(buf, ent->content); + else + xmlBufferWriteQuotedString(buf, ent->orig); + xmlBufferWriteChar(buf, ">\n"); + break; + case XML_EXTERNAL_PARAMETER_ENTITY: + xmlBufferWriteChar(buf, "name); + if (ent->ExternalID != NULL) { + xmlBufferWriteChar(buf, " PUBLIC "); + xmlBufferWriteQuotedString(buf, ent->ExternalID); + xmlBufferWriteChar(buf, " "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } else { + xmlBufferWriteChar(buf, " SYSTEM "); + xmlBufferWriteQuotedString(buf, ent->SystemID); + } + xmlBufferWriteChar(buf, ">\n"); + break; + default: + xmlGenericError(xmlGenericErrorContext, + EMBED_ERRTXT("xmlDumpEntitiesDecl: internal: unknown type %d\n"), + ent->etype); + } +} + +/** + * xmlDumpEntityDeclScan: + * @param ent An entity table + * @param buf An XML buffer. + * + * When using the hash table scan function, arguments need to be reversed + */ +static void +xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { + xmlDumpEntityDecl(buf, ent); +} + +/** + * xmlDumpEntitiesTable: + * @param buf An XML buffer. + * @param table An entity table + * + * This will dump the content of the entity table as an XML DTD definition + */ +XMLPUBFUNEXPORT void +xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) { + xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDeclScan, buf); +} +#endif /* LIBXML_OUTPUT_ENABLED */ + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_error.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_error.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1028 @@ +/* + * libxml2_error.c: module displaying/handling XML parser errors + * + * See Copyright for the status of this software. + * + * Daniel Veillard + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#include "xmlenglibxml.h" + +#include +#include + +#include +#include "libxml2_xmlerror2.h" + +void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, + const char *msg, + ...); + +#define XML_GET_VAR_STR(msg, str) \ +{ \ + int size; \ + int chars; \ + char *larger; \ + va_list ap; \ + \ + str = (char *) xmlMalloc(150); \ + if (str != NULL) \ + { \ + size = 150; \ + \ + while (1) \ + { \ + va_start(ap, msg); \ + chars = vsnprintf(str, size, msg, ap); \ + va_end(ap); \ + if ((chars > -1) && (chars < size)) \ + break; \ + \ + size += (chars > -1) ? chars + 1 : 100; \ + larger = (char*) xmlRealloc(str, size); \ + if (!larger) \ + break; \ + \ + str = larger; \ + } \ + } \ +} + + +/************************************************************************ + * * + * Handling of out of context errors * + * * + ************************************************************************/ + +/** + * xmlGenericErrorDefaultFunc: + * @param ctx an error context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Default handler for out of context error messages. + */ +void +xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { + + return; +} + +/** + * initGenericErrorDefaultFunc: + * @param handler the handler + * + * Set or reset (if NULL) the default handler for generic errors + * to the builtin error function. + */ +XMLPUBFUNEXPORT void +initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler) +{ + xmlGenericError = handler ? (*handler) : xmlGenericErrorDefaultFunc; +} + +/** + * xmlSetGenericErrorFunc: + * @param ctx the new error handling context + * @param handler the new handler function + * + * Function to reset the handler and the error context for out of + * context error messages. + * This simply means that handler will be called for subsequent + * error messages while not parsing nor validating. And ctx will + * be passed as first argument to handler + * One can simply force messages to be emitted to another FILE * than + * stderr by setting ctx to this file handle and handler to NULL. + */ +XMLPUBFUNEXPORT void +xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { + xmlGenericErrorContext = ctx; + xmlGenericError = handler ? handler : xmlGenericErrorDefaultFunc; +} + +/** + * xmlSetStructuredErrorFunc: + * @param ctx the new error handling context + * @param handler the new handler function + * + * Function to reset the handler and the error context for out of + * context structured error messages. + * This simply means that handler will be called for subsequent + * error messages while not parsing nor validating. And ctx will + * be passed as first argument to handler + */ +XMLPUBFUNEXPORT void +xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { + LOAD_GS_DIRECT + xmlGenericErrorContext = ctx; + xmlStructuredError = handler; +} + +/************************************************************************ + * * + * Handling of parsing errors * + * * + ************************************************************************/ + +/** + * xmlParserPrintFileInfo: + * @param input an xmlParserInputPtr input + * + * Displays the associated file and line informations for the current input + */ + +XMLPUBFUNEXPORT void +xmlParserPrintFileInfo(xmlParserInputPtr input) { + if (input) { + xmlGenericError( + xmlGenericErrorContext, + "%s: line %d: ", + (input->filename ? input->filename : "Entity [no file name]"), + input->line); + } +} + +/** + * xmlParserPrintFileContext: + * @param input an xmlParserInputPtr input + * + * Displays current context within the input content for error tracking + */ + +static void +xmlParserPrintFileContextInternal(xmlParserInputPtr input , + xmlGenericErrorFunc channel, void *data ) { + const xmlChar *cur, *base; + unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ + xmlChar content[81]; /* space for 80 chars + line terminator */ + xmlChar *ctnt; + + if (input == NULL) return; + cur = input->cur; + base = input->base; + /* skip backwards over any end-of-lines */ + while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { + cur--; + } + n = 0; + /* search backwards for beginning-of-line (to max buff size) */ + while ((n++ < (sizeof(content)-1)) && (cur > base) && + (*(cur) != '\n') && (*(cur) != '\r')) + cur--; + if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; + /* calculate the error position in terms of the current position */ + col = input->cur - cur; + /* search forward for end-of-line (to max buff size) */ + n = 0; + ctnt = content; + /* copy selected text to our buffer */ + while ((*cur != 0) && (*(cur) != '\n') && + (*(cur) != '\r') && (n < sizeof(content)-1)) { + *ctnt++ = *cur++; + n++; + } + *ctnt = 0; + /* print out the selected text */ + channel(data ,"%s\n", content); + /* create blank line with problem pointer */ + n = 0; + ctnt = content; + /* (leave buffer space for pointer + line terminator) */ + while ((nfile; +#ifdef LIBXML_ENABLE_NODE_LINEINFO + line = err->line; +#endif + code = err->code; + domain = err->domain; + level = err->level; + node = (xmlNodePtr)err->node; + + if (code == XML_ERR_OK) + return; + + if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) + name = node->name; + + /* + * Maintain the compatibility with the legacy error handling + */ + if (ctxt != NULL) { + input = ctxt->input; + if ((input != NULL) && (input->filename == NULL) && + (ctxt->inputNr > 1)) { + cur = input; + input = ctxt->inputTab[ctxt->inputNr - 2]; + } + if (input != NULL) { + if (input->filename) + channel(data, "%s:%d: ", input->filename, input->line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: ", input->line); + } + } else { + if (file != NULL) + channel(data, "%s:%d: ", file, line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: ", line); + } + if (name != NULL) { + channel(data, "element %s: ", name); + } + if (code == XML_ERR_OK) + return; + switch (domain) { + case XML_FROM_PARSER: + channel(data, "parser "); + break; + case XML_FROM_NAMESPACE: + channel(data, "namespace "); + break; + case XML_FROM_DTD: + case XML_FROM_VALID: + channel(data, "validity "); + break; + case XML_FROM_HTML: + channel(data, "HTML parser "); + break; + case XML_FROM_MEMORY: + channel(data, "memory "); + break; + case XML_FROM_OUTPUT: + channel(data, "output "); + break; + case XML_FROM_IO: + channel(data, "I/O "); + break; + case XML_FROM_XINCLUDE: + channel(data, "XInclude "); + break; + case XML_FROM_XPATH: + channel(data, "XPath "); + break; + case XML_FROM_XPOINTER: + channel(data, "parser "); + break; + case XML_FROM_REGEXP: + channel(data, "regexp "); + break; + case XML_FROM_SCHEMASV: + channel(data, "Schemas validity "); + break; + case XML_FROM_SCHEMASP: + channel(data, "Schemas parser "); + break; + case XML_FROM_RELAXNGP: + channel(data, "Relax-NG parser "); + break; + case XML_FROM_RELAXNGV: + channel(data, "Relax-NG validity "); + break; + case XML_FROM_CATALOG: + channel(data, "Catalog "); + break; + case XML_FROM_C14N: + channel(data, "C14N "); + break; + case XML_FROM_XSLT: + channel(data, "XSLT "); + break; + default: + break; + } + if (code == XML_ERR_OK) + return; + switch (level) { + case XML_ERR_NONE: + channel(data, ": "); + break; + case XML_ERR_WARNING: + channel(data, "warning : "); + break; + case XML_ERR_ERROR: + channel(data, "error : "); + break; + case XML_ERR_FATAL: + channel(data, "error : "); + break; + } + if (code == XML_ERR_OK) + return; + if (str != NULL) { + int len; + len = xmlStrlen((const xmlChar *)str); + if ((len > 0) && (str[len - 1] != '\n')) + channel(data, "%s\n", str); + else + channel(data, "%s", str); + } else { + channel(data, "%s\n", "out of memory error"); + } + if (code == XML_ERR_OK) + return; + + if (ctxt != NULL) { + xmlParserPrintFileContextInternal(input, channel, data); + if (cur != NULL) { + if (cur->filename) + channel(data, "%s:%d: \n", cur->filename, cur->line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: \n", cur->line); + xmlParserPrintFileContextInternal(cur, channel, data); + } + } + if ((domain == XML_FROM_XPATH) && + (err->str1 != NULL) && + (err->int1 < 100) && + (err->int1 < xmlStrlen((const xmlChar *)err->str1))) + { + + xmlChar buf[150]; + int i; + + channel(data, "%s\n", err->str1); + for (i=0;i < err->int1;i++) + buf[i] = ' '; + buf[i++] = '^'; + buf[i] = 0; + channel(data, "%s\n", buf); + } +} + +/** + * __xmlRaiseError: + * @param schannel the structured callback channel + * @param channel the old callback channel + * @param data the callback data + * @param ctx the parser context or NULL + * @param ctx the parser context or NULL + * @param domain the domain for the error + * @param code the code for the error + * @param level the xmlErrorLevel for the error + * @param file the file source of the error (or NULL) + * @param line the line of the error or 0 if N/A + * @param str1 extra string info + * @param str2 extra string info + * @param str3 extra string info + * @param int1 extra int info + * @param int2 extra int info + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Update the appropriate global or contextual error structure, + * then forward the error message down the parser or generic + * error callback handler + */ +void +__xmlRaiseError(xmlStructuredErrorFunc schannel, + xmlGenericErrorFunc channel, void *data, void *ctx, + void *nod, int domain, int code, xmlErrorLevel level, + const char *file, int line, const char *str1, + const char *str2, const char *str3, int int1, int int2, + const char *msg, ...) +{ + LOAD_GS_DIRECT + xmlParserCtxtPtr ctxt = NULL; + xmlNodePtr node = (xmlNodePtr) nod; + char *str = NULL; + xmlParserInputPtr input = NULL; + xmlErrorPtr to = &xmlLastError; + xmlChar *base = NULL; + int wasOOM = (code == XML_ERR_NO_MEMORY); + + // Check, whether we must ignore warnings + if (!xmlGetWarningsDefaultValue && (level == XML_ERR_WARNING)) + return; + + if ((domain == XML_FROM_PARSER) || + (domain == XML_FROM_HTML) || + (domain == XML_FROM_DTD) || + (domain == XML_FROM_NAMESPACE) || + (domain == XML_FROM_IO)) + { + ctxt = (xmlParserCtxtPtr) ctx; + if ((schannel == NULL) && (ctxt != NULL) && + (ctxt->sax != NULL)&& (ctxt->sax->initialized == XML_SAX2_MAGIC)) + schannel = ctxt->sax->serror; + } + if (schannel == NULL) + schannel = xmlStructuredError; + if ((domain == XML_FROM_VALID) && + ((channel == xmlParserValidityError) || (channel == xmlParserValidityWarning))) + { + ctxt = (xmlParserCtxtPtr) ctx; + if ((schannel == NULL) && + (ctxt != NULL) && + (ctxt->sax != NULL) && + (ctxt->sax->initialized == XML_SAX2_MAGIC)) + { + schannel = ctxt->sax->serror; + } + } + if (code == XML_ERR_OK) + return; + + /* + * Formatting the message + */ +#ifndef XMLENGINE_EXCLUDE_EMBED_MSG + if (msg == NULL || wasOOM) { +#else + if (msg == NULL || msg == __embedded_errtxt_replacement || wasOOM) { +#endif + // DONE: do not copy if it was OOM + str = (code == XML_ERR_NO_MEMORY) ? NULL : (char *) xmlStrdup(BAD_CAST "No error message provided"); + str1 = str2 = str3 = NULL; + } else { + //XML_GET_VAR_STR(msg, str); //this causes panic when OOM + str = (char *) xmlStrdup(BAD_CAST msg); // NOTE: message is not filled with data from variable list + } + /* + * specific processing if a parser context is provided + */ + if (ctxt != NULL) { + if (file == NULL) { + input = ctxt->input; + if ((input != NULL) && + (input->filename == NULL) && + (ctxt->inputNr > 1)) + { + input = ctxt->inputTab[ctxt->inputNr - 2]; + } + if (input != NULL) { + file = input->filename; + line = input->line; + } + } + to = &ctxt->lastError; + } else if ((node != NULL) && (file == NULL)) { + + if(!wasOOM) + { + int i; + + if ((node->doc != NULL) && (node->doc->URL != NULL)) + base = xmlStrdup(node->doc->URL); + for (i = 0; + ((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE)); + i++) + { + node = node->parent; + } + if (!base && node && node->doc && node->doc->URL) + { + base = xmlStrdup(node->doc->URL); + } + } +#ifdef LIBXML_ENABLE_NODE_LINEINFO + if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) + line = node->line; +#endif + } + /* + * Save the information about the error + */ + xmlResetError(to); + to->domain = domain; + to->code = code; + to->message = str; + to->level = level; + if (file && !wasOOM) + to->file = (char *) xmlStrdup((const xmlChar *) file); + else if (base != NULL) { + to->file = (char *) base; + file = (char *) base; + } + +#ifdef LIBXML_ENABLE_NODE_LINEINFO + to->line = line; +#endif + + if(!wasOOM) + { + if (str1) + to->str1 = (char *) xmlStrdup((const xmlChar *) str1); + if (str2) + to->str2 = (char *) xmlStrdup((const xmlChar *) str2); + if (str3) + to->str3 = (char *) xmlStrdup((const xmlChar *) str3); + } + to->int1 = int1; + to->int2 = int2; + to->node = node; + to->ctxt = ctx; + + if (to != &xmlLastError) { + xmlResetError(&xmlLastError); + xmlCopyError(to,&xmlLastError); // NOTE: xmlCopyError checks error code whether it is OOM + } + + /* + * Find the callback channel. + */ + if ((ctxt != NULL) && + (channel == NULL) && + (xmlStructuredError == NULL)) + { + if (level == XML_ERR_WARNING) + channel = ctxt->sax->warning; + else + channel = ctxt->sax->error; + data = ctxt->userData; + } else { + if (channel == NULL) { + if (xmlStructuredError != NULL) + schannel = xmlStructuredError; + else + channel = xmlGenericError; + data = xmlGenericErrorContext; + } + } +// <--- At this point we have error structure "to" ready +// Implement Symbian logging if there is need to log errors (apply filtering by error codes and severity) +// + if (schannel != NULL) { + schannel(data, to); + return; + } + if (channel == NULL) + return; + + if ((channel == xmlParserError) || + (channel == xmlParserWarning) || + (channel == xmlParserValidityError) || + (channel == xmlParserValidityWarning)) + { + xmlReportError(to, ctxt, str, NULL, NULL); + } + else + { + if ((channel == (xmlGenericErrorFunc) fprintf) || + (channel == xmlGenericErrorDefaultFunc)) + xmlReportError(to, ctxt, str, channel, data); + else + channel(data, "%s", str); + } +} + +/** + * __xmlSimpleError: + * @param domain where the error comes from + * @param code the error code + * @param node the context node + * @param extra extra informations + * + * Handle an out of memory condition + */ +void +__xmlSimpleError(int domain, int code, xmlNodePtr node, + const char *msg, const char *extra) +{ + // DONE: OPTIMIZE: Combine all 3 calls into one +/* + if (code == XML_ERR_NO_MEMORY) { + if (extra) + __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra, + NULL, NULL, 0, 0, + EMBED_ERRTXT("Memory allocation failed : %s\n"), extra); + else + __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL, + NULL, NULL, 0, 0, EMBED_ERRTXT("Memory allocation failed\n")); + } else { + __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, + code, XML_ERR_ERROR, NULL, 0, extra, + NULL, NULL, 0, 0, msg, extra); + } +*/ + if (code == XML_ERR_NO_MEMORY) + { + msg = EMBED_ERRTXT("Memory allocation failed : %s\n"); + if (!extra) + extra = EMBED_ERRTXT("[location unspecified]"); + } + __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, + code, XML_ERR_ERROR, NULL, 0, extra, + NULL, NULL, 0, 0, msg, extra); +} + +/** + * xmlParserError: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format an error messages, gives file, line, position and + * extra parameters. + */ +XMLPUBFUNEXPORT void +xmlParserError(void *ctx, const char *msg, ...) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + xmlParserInputPtr input = NULL; + xmlParserInputPtr cur = NULL; + LOAD_GS_SAFE_CTXT(ctxt) + + if (ctxt) { + input = ctxt->input; + if (input && !input->filename && (ctxt->inputNr > 1)) + { + cur = input; + input = ctxt->inputTab[ctxt->inputNr - 2]; + } + xmlParserPrintFileInfo(input); + } + + if(OOM_FLAG){ + xmlGenericError(xmlGenericErrorContext, "error: [in OOM!] %s", msg); + } else { + char* str; + xmlGenericError(xmlGenericErrorContext, "error: "); + XML_GET_VAR_STR(msg, str); + xmlGenericError(xmlGenericErrorContext, "%s", str); + if (str) + xmlFree(str); + } + + if (ctxt) { + xmlParserPrintFileContext(input); + if (cur) { + xmlParserPrintFileInfo(cur); + xmlGenericError(xmlGenericErrorContext, "\n"); + xmlParserPrintFileContext(cur); + } + } +} + +/** + * xmlParserWarning: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format a warning messages, gives file, line, position and + * extra parameters. + */ +XMLPUBFUNEXPORT void +xmlParserWarning(void *ctx, const char *msg, ...) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + xmlParserInputPtr input = NULL; + xmlParserInputPtr cur = NULL; + LOAD_GS_SAFE_CTXT(ctxt) + + if (ctxt != NULL) { + input = ctxt->input; + if (input && !input->filename && (ctxt->inputNr > 1)) { + cur = input; + input = ctxt->inputTab[ctxt->inputNr - 2]; + } + xmlParserPrintFileInfo(input); + } + + if(OOM_FLAG){ + xmlGenericError(xmlGenericErrorContext, "warning: [in OOM!] %s", msg); + } else { + char* str; + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("warning: ")); + XML_GET_VAR_STR(msg, str); + xmlGenericError(xmlGenericErrorContext, "%s", str); + if (str != NULL) + xmlFree(str); + } + + if (ctxt) { + xmlParserPrintFileContext(input); + if (cur) { + xmlParserPrintFileInfo(cur); + xmlGenericError(xmlGenericErrorContext, "\n"); + xmlParserPrintFileContext(cur); + } + } +} + +/************************************************************************ + * * + * Handling of validation errors * + * * + ************************************************************************/ + +/** + * xmlParserValidityError: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format an validity error messages, gives file, + * line, position and extra parameters. + */ +XMLPUBFUNEXPORT void +xmlParserValidityError(void *ctx, const char *msg, ...) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + xmlParserInputPtr input = NULL; + + int len = xmlStrlen((const xmlChar *) msg); + LOAD_GS_SAFE_CTXT(ctxt) + + if ((len > 1) && (msg[len - 2] != ':')) { + if (ctxt != NULL) { + input = ctxt->input; + if ((input->filename == NULL) && (ctxt->inputNr > 1)) + input = ctxt->inputTab[ctxt->inputNr - 2]; + + if (had_info == 0) { + xmlParserPrintFileInfo(input); + } + } + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("validity error: ")); + had_info = 0; + } else { + had_info = 1; + } + + if(OOM_FLAG){ + xmlGenericError(xmlGenericErrorContext, "validity error: [in OOM!] %s", msg); + } else { + char* str; + XML_GET_VAR_STR(msg, str); + xmlGenericError(xmlGenericErrorContext, "%s", str); + if (str) + xmlFree(str); + } + + if (ctxt && input) { + xmlParserPrintFileContext(input); + } +} + +/** + * xmlParserValidityWarning: + * @param ctx an XML parser context + * @param msg the message to display/transmit + * @param # extra parameters for the message display + * + * Display and format a validity warning messages, gives file, line, + * position and extra parameters. + */ +XMLPUBFUNEXPORT void +xmlParserValidityWarning(void *ctx, const char *msg, ...) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + xmlParserInputPtr input = NULL; + int len = xmlStrlen((const xmlChar *) msg); + LOAD_GS_SAFE_CTXT(ctxt) + + if (ctxt && (len != 0) && (msg[len - 1] != ':')) + { + input = ctxt->input; + if ((input->filename == NULL) && (ctxt->inputNr > 1)) + input = ctxt->inputTab[ctxt->inputNr - 2]; + + xmlParserPrintFileInfo(input); + } + + if(OOM_FLAG){ + xmlGenericError(xmlGenericErrorContext, "validity warning: [in OOM!] %s", msg); + } else { + char* str; + xmlGenericError(xmlGenericErrorContext, EMBED_ERRTXT("warning: ")); + XML_GET_VAR_STR(msg, str); + xmlGenericError(xmlGenericErrorContext, "%s", str); + if (str) + xmlFree(str); + } + + if (ctxt) { + xmlParserPrintFileContext(input); + } +} + + +/************************************************************************ + * * + * Extended Error Handling * + * * + ************************************************************************/ + +/** + * xmlGetLastError: + * + * Get the last global error registered. This is per thread if compiled + * with thread support. + * + * Returns NULL if no error occured or a pointer to the error + */ +XMLPUBFUNEXPORT xmlErrorPtr +xmlGetLastError(void) +{ + LOAD_GS_DIRECT + if (xmlLastError.code == XML_ERR_OK) + return (NULL); + return (&xmlLastError); +} + +/** + * xmlResetError: + * @param err pointer to the error. + * + * Cleanup the error. + * + * OOM: never + */ +XMLPUBFUNEXPORT void +xmlResetError(xmlErrorPtr err) +{ + if (err == NULL) + return; + if (err->code == XML_ERR_OK) + return; + if (err->message != NULL) + xmlFree(err->message); + if (err->file != NULL) + xmlFree(err->file); + if (err->str1 != NULL) + xmlFree(err->str1); + if (err->str2 != NULL) + xmlFree(err->str2); + if (err->str3 != NULL) + xmlFree(err->str3); + memset(err, 0, sizeof(xmlError)); + err->code = XML_ERR_OK; +} + +/** + * xmlResetLastError: + * + * Cleanup the last global error registered. For parsing error + * this does not change the well-formedness result. + * + * OOM: never + */ +XMLPUBFUNEXPORT void +xmlResetLastError(void) +{ + LOAD_GS_DIRECT + if (xmlLastError.code == XML_ERR_OK) + return; + xmlResetError(&xmlLastError); +} + +/** + * xmlCtxtGetLastError: + * @param ctx an XML parser context + * + * Get the last parsing error registered. + * + * Returns NULL if no error occured or a pointer to the error + */ +XMLPUBFUNEXPORT xmlErrorPtr +xmlCtxtGetLastError(void *ctx) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + + if (ctxt == NULL) + return (NULL); + if (ctxt->lastError.code == XML_ERR_OK) + return (NULL); + return (&ctxt->lastError); +} + +/** + * xmlCtxtResetLastError: + * @param ctx an XML parser context + * + * Cleanup the last global error registered. For parsing error + * this does not change the well-formedness result. + */ +XMLPUBFUNEXPORT void +xmlCtxtResetLastError(void *ctx) +{ + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + + if (ctxt == NULL) + return; + if (ctxt->lastError.code == XML_ERR_OK) + return; + xmlResetError(&ctxt->lastError); +} + +/** + * xmlCopyError: + * @param from a source error + * @param to a target error + * + * Save the original error to the new place. + * + * Returns 0 in case of success and -1 in case of error. + */ +XMLPUBFUNEXPORT int +xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) { + if ((from == NULL) || (to == NULL)) + return(-1); + if (to->message != NULL) + xmlFree(to->message); + if (to->file != NULL) + xmlFree(to->file); + if (to->str1 != NULL) + xmlFree(to->str1); + if (to->str2 != NULL) + xmlFree(to->str2); + if (to->str3 != NULL) + xmlFree(to->str3); + to->domain = from->domain; + to->code = from->code; + to->level = from->level; +#ifdef LIBXML_ENABLE_NODE_LINEINFO + to->line = from->line; +#endif + to->node = from->node; + to->int1 = from->int1; + to->int2 = from->int2; + to->node = from->node; + to->ctxt = from->ctxt; + + // Do not try to allocate memory during OOM handling! + if(from->code != XML_ERR_NO_MEMORY) + { + if (from->message != NULL) + to->message = (char *) xmlStrdup((xmlChar *) from->message); + else + to->message = NULL; + if (from->file != NULL) + to->file = (char *) xmlStrdup((xmlChar *) from->file); + else + to->file = NULL; + if (from->str1 != NULL) + to->str1 = (char *) xmlStrdup((xmlChar *) from->str1); + else + to->str1 = NULL; + if (from->str2 != NULL) + to->str2 = (char *) xmlStrdup((xmlChar *) from->str2); + else + to->str2 = NULL; + if (from->str3 != NULL) + to->str3 = (char *) xmlStrdup((xmlChar *) from->str3); + else + to->str3 = NULL; + } + return(0); +} + + diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_globals.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_globals.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,852 @@ +/* + * libxml2_globals.c: definition and handling of the set of global variables + * of the library + * + * The bottom of this file is automatically generated by build_glob.py + * based on the description file global.data + * + * See Copyright for the status of this software. + * + * Gary Pennington + * daniel@veillard.com + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#define IN_LIBXML +#define UNDEF_IMPORT_C_IN_DATA + +#include +#include +#include +#include + +#include "xmlenglibxml.h" + +#include +#include "libxml2_xmlschemastypes.h" + + + + +const xeGlobalConstData xeGlobalConsts = + { + LIBXML_VERSION_STRING // xmlParserVersion field + }; + +const xeGlobalConstData* xeGetGlobalConsts() +{ + return &xeGlobalConsts; +} + +/** + * xmlParserVersion: + * + * Constant string describing the internal version of the library + */ +XMLPUBFUNEXPORT const char* const xmlParserVersion = LIBXML_VERSION_STRING; + + +/* +This function creates and initializes new xmlGlobalState structure +and stores pointer to it into Thread-Local Storage of this DLL. + +If TLS is not NULL, then nothing happens and pointer to existing global data is returned + +This function is used once prior any use of libxml2 code! +It called from XmlEngine::XmlEngineAttachL() function +and must be called by any other client of libxml2's API if XmlEngineAttachL() +is not used. +*/ +XMLPUBFUNEXPORT xmlGlobalStatePtr xmlCreateAndInitializeGlobalState() +{ + xmlGlobalStatePtr gs = xeGetTLS(); + if(gs) + return gs; // already initialized; + + gs = (xmlGlobalStatePtr) malloc(sizeof(xmlGlobalState)); + if(gs) + { + memset(gs, 0, sizeof(xmlGlobalState)); + xeSetTLS(gs); + xmlInitializeGlobalState(gs); + } + return gs; +} + +/* +Performs complete cleanup of the resource allocated for Libxml2. +Global state data is destroyed. + +On Symbian: + Thread-Local Storage is set to NULL after the cleanup finished. + + @note XmlEngine::XmlEngineCleanup(TAny*) calls this function + as part of XML Engine shutdown sequence; but it also adds + counter for multi-user (within one thread) processing support. + + @note This function should not be directly used by Symbian applications; + the only exception for this rule is usage of libxml2 by other + open-source libraries [XmlEngine::XmlEngineCleanup(TAny*) is preferred] +*/ +XMLPUBFUNEXPORT void xmlCleanupGlobalData() +{ + DEFINE_GS_PROXY /* NOTE: Initialize GS proxy initialize before using any GS member */ + xmlGlobalStatePtr gs = xeGetTLS(); + + if(!gs) + return; + SET_GS_PROXY(gs); + + xmlSchemaCleanupTypes(); + xmlResetLastError(); + xmlCleanupCharEncodingHandlers(); + xmlCleanupParser(); + xeXPathCleanup(); + xeCleanupDOMStringConverter(); +#ifdef XMLENGINE_XSLT + if(xsltGlobalsCleanupFunc) + ((void(*)())xsltGlobalsCleanupFunc)(); +#endif + free(gs); //using xmlFree(gs) is not right: GS was not initialized with xmlMalloc() ! + xeSetTLS(NULL); +} + + + + + +XMLPUBFUNEXPORT int xmlOOMFlag() + { + LOAD_GS_DIRECT +#ifdef _DEBUG + int f = OOM_FLAG; + if(f) + { + f |= 0; // SET BREAKPOINT HERE + } + return f; +#else + return OOM_FLAG; +#endif + } + +void XMLCALL xeCheckErrno() + { + int err = errno; + if (err == ENOMEM) + { + SET_OOM_FLAG; + } +#ifdef _DEBUG + else if (err) + { + // some other error!!! + err ^=err; + } +#endif + } + +XMLPUBFUNEXPORT void xmlSetOOM() + { + DEFINE_GS_PROXY //note: ensure GS proxy initialize before any GS member access + xmlGlobalStatePtr gs = xeGetTLS(); + SET_GS_PROXY(gs) + // Should be sure that globals state (contains the OOM flag) is initialized + if(gs) + { + OOM_FLAG = 1; + } + } + +XMLPUBFUNEXPORT void xmlResetOOM() + { + DEFINE_GS_PROXY //note: ensure GS proxy initialize before any GS member access + xmlGlobalStatePtr gs = xeGetTLS(); + SET_GS_PROXY(gs) + // We need this in case OOM happened during initialization of the 'global state' + if (!gs) + return; + OOM_FLAG = 0; + } + + +#define __lookup_ALLOC_ADDRES_ 0 + +#ifdef XMLENGINE_MEM_DEBUG +void __catchAllocatedAddress() + { + // Set breakpoint here + } +void __catchFreedAddress() + { + // Set breakpoint here + } +#endif + +#ifdef XMLENGINE_MEM_DEBUG +//#define XMLENGINE_MEM_DEBUG_SIZE +#endif + +/* + NOTE: XMLENGINE_MEM_DEBUG option is defined only in debug builds +*/ +XMLPUBFUNEXPORT void* XMLCALL malloc_impl(size_t size) +{ +#ifdef XMLENGINE_MEM_DEBUG + LOAD_GS_DIRECT +#endif +#ifndef XMLENGINE_MEM_DEBUG_SIZE + void* mem = malloc(size); + +#ifdef XMLENGINE_MEM_DEBUG + if((int)mem == __lookup_ALLOC_ADDRES_) { + __catchAllocatedAddress(); + } +#endif +#else + // when defined XMLENGINE_MEM_DEBUG_SIZE + // + // the previous 4 bytes before returned pointer is the size of a block + void *hdr; + void *mem; + + hdr = malloc(size + sizeof(size_t)); + if(hdr) + { + mem = ((char*)hdr) + sizeof(size_t); + *((size_t*)hdr) = size; + } + else + mem = NULL; + + if((int)hdr == __lookup_ALLOC_ADDRES_) { + __catchAllocatedAddress(); + } +#endif + + if(mem) + { +#ifdef XMLENGINE_MEM_DEBUG + xmlGlobalStatePtr gs = xeGetTLS(); + if(gs && !xmlOOM) // do not count "after allocations" during error-handling + { + gs->allocCount++; + gs->allocTotal += size; +#ifdef XMLENGINE_MEM_DEBUG_SIZE + gs->allocMemSize += size; + if(gs->allocMemSize > gs->allocMemSizeMax) + gs->allocMemSizeMax = gs->allocMemSize; +#endif + } +#endif + return mem; + } + else + { + SET_OOM_FLAG; + return NULL; // NULL + } +} + +XMLPUBFUNEXPORT void* XMLCALL realloc_impl(void *ptr, size_t size) +{ +#ifdef XMLENGINE_MEM_DEBUG + LOAD_GS_DIRECT +#endif +#ifndef XMLENGINE_MEM_DEBUG_SIZE + void* mem = realloc(ptr, size); + +# ifdef XMLENGINE_MEM_DEBUG + if((int)mem == __lookup_ALLOC_ADDRES_) { + __catchAllocatedAddress(); + } +# endif +#else + // XMLENGINE_MEM_DEBUG_SIZE is defined + void* hdr; + void* mem; + size_t prevSize; + + hdr = (((size_t*)ptr) - 1); + prevSize = *((size_t*)hdr); + + hdr = realloc(hdr, size + sizeof(size_t)); + if(hdr) + { + mem = ((size_t*)hdr) + 1; + *((size_t*)hdr) = size; + } + else + mem = NULL; + + if((int)hdr == __lookup_ALLOC_ADDRES_) { + __catchAllocatedAddress(); + } +#endif /* XMLENGINE_MEM_DEBUG_SIZE */ + + if(mem) + { +#ifdef XMLENGINE_MEM_DEBUG + xmlGlobalStatePtr gs = xeGetTLS(); + if(gs && !xmlOOM) // do not count "after allocations" during error-handling + { + gs->reallocCount++; +#ifdef XMLENGINE_MEM_DEBUG_SIZE + gs->allocMemSize += size - prevSize; + if(gs->allocMemSize > gs->allocMemSizeMax) + gs->allocMemSizeMax = gs->allocMemSize; +#endif + } +#endif + return mem; + } + else + { + SET_OOM_FLAG; + return NULL; + } +} + +// +// NOTE: in release builds free() is used directly +void free_debug(void* mem) +{ +#ifdef XMLENGINE_MEM_DEBUG + xmlGlobalStatePtr gs; + +#ifndef XMLENGINE_MEM_DEBUG_SIZE + if((int)mem == __lookup_ALLOC_ADDRES_) { + __catchFreedAddress(); + } + + free(mem); +#else + void* hdr; + size_t size; + + hdr = (((size_t*)mem) - 1); + + if((int)hdr == __lookup_ALLOC_ADDRES_) { + __catchFreedAddress(); + } + size = *((size_t*)hdr); + free(hdr); +#endif /* XMLENGINE_MEM_DEBUG_SIZE */ + + gs = xeGetTLS(); + if(gs) + { + gs->deallocCount++; +#ifdef XMLENGINE_MEM_DEBUG_SIZE + gs->allocMemSize -=size; +#endif + } +#endif /* XMLENGINE_MEM_DEBUG */ +} +// + +#ifdef XMLENGINE_EXCLUDE_EMBED_MSG +const char* const __embedded_errtxt_replacement = "DISABLED ERROR STRING\n"; +#endif + +void xeCleanupDOMStringConverter() +{ + DOMStringConverterData* data = &xmlGetGlobalState()->xeStringArgs; + char** buf; + int i; + for(i=0; i<4; i++){ + buf = &data->cleanupItem[i]; + if(*buf){ + xmlFree(*buf); + *buf = 0; + } + } +} + +int symbian_vsnprintf(char *str, size_t size, const char *format, va_list ap) +{ + int ret = 0; + + ret = vsprintf(str, format, ap); + + assert((size_t)ret < size); + return ret; +} + +int symbian_snprintf(char *str, size_t size, const char *format, ...) +{ + int ret = 0; + va_list args; + va_start(args, format); + symbian_vsnprintf(str, size, format, args); + va_end(args); + + assert((size_t)ret < size); + + return ret; +} + +#include + +/** + * xmlTreeIndentString: + * + * The string used to do one-level indent. By default is equal to " " (two spaces) + */ +XMLPUBFUNEXPORT const char* const xmlTreeIndentString = " "; +const char* const xmlTreeIndentStringThrDef = " "; + + +XMLPUBFUNEXPORT xmlRegisterNodeFunc +xmlRegisterNodeDefault(xmlRegisterNodeFunc func) +{ + LOAD_GS_DIRECT + xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue; + + __xmlRegisterCallbacks = 1; + xmlRegisterNodeDefaultValue = func; + return(old); +} + +XMLPUBFUNEXPORT xmlDeregisterNodeFunc +xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func) +{ + LOAD_GS_DIRECT + xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue; + + __xmlRegisterCallbacks = 1; + xmlDeregisterNodeDefaultValue = func; + return(old); +} + + +#define xmlBufferAllocSchemeThrDef XML_BUFFER_ALLOC_EXACT +#define xmlDefaultBufferSizeThrDef BASE_BUFFER_SIZE +#define xmlParserDebugEntitiesThrDef 0 +#define xmlDoValidityCheckingDefaultValueThrDef 0 +#define xmlGetWarningsDefaultValueThrDef 1 +#define xmlLoadExtDtdDefaultValueThrDef 0 +#define xmlPedanticParserDefaultValueThrDef 0 +#define xmlLineNumbersDefaultValueThrDef 0 +#define xmlKeepBlanksDefaultValueThrDef 1 +#define xmlSubstituteEntitiesDefaultValueThrDef 0 +#define xmlRegisterNodeDefaultValueThrDef NULL +#define xmlDeregisterNodeDefaultValueThrDef NULL + +void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, const char *msg, ...); + +#define xmlGenericErrorThrDef xmlGenericErrorDefaultFunc +#define xmlStructuredErrorThrDef NULL +#define xmlGenericErrorContextThrDef NULL +#define xmlIndentTreeOutputThrDef 1 +#define xmlTreeIndentStringThrDef " " +#define xmlSaveNoEmptyTagsThrDef 0 + +#undef docbDefaultSAXHandler +#undef htmlDefaultSAXHandler +#undef xmlBufferAllocScheme +#undef xmlDefaultBufferSize +#undef xmlDefaultSAXHandler +#undef xmlDefaultSAXLocator +#undef xmlDoValidityCheckingDefaultValue +#undef xmlGenericError +#undef xmlStructuredError +#undef xmlGenericErrorContext +#undef xmlGetWarningsDefaultValue +#undef xmlIndentTreeOutput +//#undef xmlTreeIndentString +#undef xmlKeepBlanksDefaultValue +#undef xmlLineNumbersDefaultValue +#undef xmlLoadExtDtdDefaultValue +#undef xmlParserDebugEntities +#undef xmlPedanticParserDefaultValue +#undef xmlSaveNoEmptyTags +#undef xmlSubstituteEntitiesDefaultValue +#undef xmlRegisterNodeDefaultValue +#undef xmlDeregisterNodeDefaultValue +#undef xmlLastError + +#undef xmlFree +#undef xmlMalloc +#undef xmlMallocAtomic +#undef xmlMemStrdup +#undef xmlRealloc + +/* html */ +#undef htmlStartCloseIndex +#undef htmlStartCloseIndexinitialized + +/* tree */ +#undef __xmlRegisterCallbacks +#undef xmlCompressMode +#undef xmlCheckDTD + +/* xmlmemory */ +#undef xmlMemInitialized +#undef debugMemSize +#undef debugMaxMemSize +#undef xmlMemMutex +#undef g_block +#undef xmlMemStopAtBlock +#undef xmlMemTraceBlockAt + +/* catalog */ +#undef xmlDebugCatalogs +#undef xmlCatalogDefaultAllow +#undef xmlCatalogDefaultPrefer +#undef xmlCatalogXMLFiles +#undef xmlDefaultCatalog +#undef xmlCatalogMutex +#undef xmlCatalogInitialized + +#undef xmlInputCallbackTable +#undef xmlInputCallbackNr +#undef xmlInputCallbackInitialized +#undef xmlOutputCallbackTable +#undef xmlOutputCallbackNr +#undef xmlOutputCallbackInitialized +#undef xmlCurrentExternalEntityLoader + +#undef xmlSAX2DefaultVersionValue + +#undef xmlParserMaxDepth +#undef xmlW3CPIs +#undef xmlParserInitialized +#undef xeStackLimit +// Now these are global constants +//#undef xmlEntityLt +//#undef xmlEntityGt +//#undef xmlEntityAmp +//#undef xmlEntityQuot +//#undef xmlEntityApos + +#undef xmlUTF16LEHandler +#undef xmlUTF16BEHandler +#undef xmlCharEncodingAliases +#undef xmlCharEncodingAliasesNb +#undef xmlCharEncodingAliasesMax +#undef xmlLittleEndian +#undef handlers +#undef nbCharEncodingHandler +#undef xmlDefaultCharEncodingHandler + +#undef xmlXPathNAN +#undef xmlXPathPINF +#undef xmlXPathNINF +#undef xmlXPathNZERO +#undef xmlXPathInitialized + +#ifndef LIBXML_THREAD_ENABLED +# undef xmlXPathDisableOptimizer +#endif + +#undef xmlXPathDefineExtensionFunctionsGlobally +#undef xmlXPathDefaultFunctionsHash +#undef xmlXPathIntermediaryExtensionFunctionsHash + +#undef xlinkDefaultHandler +#undef xlinkDefaultDetect + +#undef had_info +#undef xmlInputStreamId + +#undef xeUserCount + +/* XMLENGINE_XSLT */ +#undef g_calibration +//#undef default_token +#undef xsltExtensionsHash +#undef xsltFunctionsHash +#undef xsltElementsHash +#undef xsltGlobalsCleanupFunc +#undef xsltTopLevelsHash +#undef xsltDebuggerCurrentCallbacks + +#ifdef LIBXML_SAX1_ENABLED +/** + * xmlDefaultSAXHandler: + * + * Default SAX version1 handler for XML, builds the DOM tree + */ +const xmlSAXHandlerV1 xmlDefaultSAXHandler = { + xmlSAX2InternalSubset, + xmlSAX2IsStandalone, + xmlSAX2HasInternalSubset, + xmlSAX2HasExternalSubset, + xmlSAX2ResolveEntity, + xmlSAX2GetEntity, + xmlSAX2EntityDecl, + xmlSAX2NotationDecl, + xmlSAX2AttributeDecl, + xmlSAX2ElementDecl, + xmlSAX2UnparsedEntityDecl, + xmlSAX2SetDocumentLocator, + xmlSAX2StartDocument, + xmlSAX2EndDocument, + xmlSAX2StartElement, + xmlSAX2EndElement, + xmlSAX2Reference, + xmlSAX2Characters, + xmlSAX2Characters, + xmlSAX2ProcessingInstruction, + xmlSAX2Comment, + xmlParserWarning, + xmlParserError, + xmlParserError, + xmlSAX2GetParameterEntity, + xmlSAX2CDataBlock, + xmlSAX2ExternalSubset, + 0, +}; +#endif /* LIBXML_SAX1_ENABLED */ + +/** + * xmlDefaultSAXLocator: + * + * The default SAX Locator + * { getPublicId, getSystemId, getLineNumber, getColumnNumber} + */ +const xmlSAXLocator xmlDefaultSAXLocator = { + xmlSAX2GetPublicId, + xmlSAX2GetSystemId, + xmlSAX2GetLineNumber, + xmlSAX2GetColumnNumber +}; + +#ifdef LIBXML_HTML_ENABLED +/** + * htmlDefaultSAXHandler: + * + * Default old SAX v1 handler for HTML, builds the DOM tree + */ +const xmlSAXHandlerV1 htmlDefaultSAXHandler = { + xmlSAX2InternalSubset, + NULL, + NULL, + NULL, + NULL, + xmlSAX2GetEntity, + NULL, + NULL, + NULL, + NULL, + NULL, + xmlSAX2SetDocumentLocator, + xmlSAX2StartDocument, + xmlSAX2EndDocument, + xmlSAX2StartElement, + xmlSAX2EndElement, + NULL, + xmlSAX2Characters, + xmlSAX2IgnorableWhitespace, + NULL, + xmlSAX2Comment, + xmlParserWarning, + xmlParserError, + xmlParserError, + xmlSAX2GetParameterEntity, + xmlSAX2CDataBlock, + NULL, + 0, +}; +#endif /* LIBXML_HTML_ENABLED */ + +#ifdef LIBXML_DOCB_ENABLED +/** + * docbDefaultSAXHandler: + * + * Default old SAX v1 handler for SGML DocBook, builds the DOM tree + */ +const xmlSAXHandlerV1 docbDefaultSAXHandler = { + xmlSAX2InternalSubset, + xmlSAX2IsStandalone, + xmlSAX2HasInternalSubset, + xmlSAX2HasExternalSubset, + xmlSAX2ResolveEntity, + xmlSAX2GetEntity, + xmlSAX2EntityDecl, + NULL, + NULL, + NULL, + NULL, + xmlSAX2SetDocumentLocator, + xmlSAX2StartDocument, + xmlSAX2EndDocument, + xmlSAX2StartElement, + xmlSAX2EndElement, + xmlSAX2Reference, + xmlSAX2Characters, + xmlSAX2IgnorableWhitespace, + NULL, + xmlSAX2Comment, + xmlParserWarning, + xmlParserError, + xmlParserError, + xmlSAX2GetParameterEntity, + NULL, + NULL, + 0, +}; +#endif /* LIBXML_DOCB_ENABLED */ + + + +/** + * xmlInitializeGlobalState: + * @param gs a pointer to a newly allocated global state + * + * xmlInitializeGlobalState() initialize a global state with all the + * default values of the library. + */ +XMLPUBFUNEXPORT void +xmlInitializeGlobalState(xmlGlobalStatePtr gs) +{ + +#ifdef DEBUG_GLOBALS + fprintf(stderr, "Initializing globals at %lu for thread %d\n", + (unsigned long) gs, xmlGetThreadId()); +#endif + + /* + * Perform initialization as required by libxml + */ + if (xmlThrDefMutex == NULL) + xmlInitGlobals(); + + xmlMutexLock(xmlThrDefMutex); + +#ifdef LIBXML_DOCB_ENABLED + xmlSAX2InitDocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); +#endif +#ifdef LIBXML_HTML_ENABLED + + //xmlSAX2InitHtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); +#endif +// merge: agathe: I had removed this code for libxslt... +//#ifdef LIBXML_DOCB_ENABLED +// initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); +//#endif + +//#ifdef LIBXML_HTML_ENABLED + //inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); +//#endif + + gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef; + gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef; +#ifdef LIBXML_SAX1_ENABLED + initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1); +#endif /* LIBXML_SAX1_ENABLED */ + gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId; + gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId; + gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber; + gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber; + gs->xmlDoValidityCheckingDefaultValue = xmlDoValidityCheckingDefaultValueThrDef; + + gs->xeStackLimit = xeStackLimitAddress(); + + gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; + gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; + + gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef; +#ifdef LIBXML_ENABLE_NODE_LINEINFO + gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; +#endif + gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; + gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; + gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; + gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; + gs->xmlSubstituteEntitiesDefaultValue = xmlSubstituteEntitiesDefaultValueThrDef; + + gs->xmlGenericError = xmlGenericErrorThrDef; + gs->xmlStructuredError = xmlStructuredErrorThrDef; + gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; + gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; + gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; + memset(&gs->xmlLastError, 0, sizeof(xmlError)); + +// ================================================== +// XMLENEGINE: NOTE: All zero values are commented, +// since the whole structure is set to zeros prior +// initialization +// ================================================== + +// gs->had_info = 0; + +// gs->xmlInputStreamId = 0; + +// gs->xmlUTF16LEHandler = NULL; +// gs->xmlUTF16BEHandler = NULL; +// gs->xmlCharEncodingAliases = NULL; +// gs->xmlCharEncodingAliasesNb = 0; +// gs->xmlCharEncodingAliasesMax = 0; + gs->xmlLittleEndian = 1; +// gs->handlers = NULL; +// gs->nbCharEncodingHandler = 0; +// gs->xmlDefaultCharEncodingHandler = NULL; + + gs->xmlParserMaxDepth = 1024; + gs->xmlW3CPIs[0] = "xml-stylesheet"; + gs->xmlW3CPIs[1] = NULL; +// gs->xmlParserInitialized = 0; + + gs->xmlSAX2DefaultVersionValue = 2; + +// gs->xmlInputCallbackNr = 0; +// gs->xmlInputCallbackInitialized = 0; + +#ifdef LIBXML_OUTPUT_ENABLED +// gs->xmlOutputCallbackNr = 0; +// gs->xmlOutputCallbackInitialized = 0; +#endif /* LIBXML_OUTPUT_ENABLED*/ + + gs->xmlCurrentExternalEntityLoader = xmlDefaultExternalEntityLoader; + +// gs->xmlMemInitialized = 0; +// gs->debugMemSize = 0; +// gs->debugMaxMemSize = 0; +// gs->xmlMemMutex = NULL; +// gs->block = 0; +// gs->xmlMemStopAtBlock = 0; +// gs->xmlMemTraceBlockAt = NULL; + +//#ifdef LIBXML_TREE_ENABLED +// gs->__xmlRegisterCallbacks = 0; +//#endif +#ifdef LIBXML_TREE_ENABLED + +// gs->xmlCompressMode = 0; + gs->xmlCheckDTD = 1; +#endif + +#ifdef LIBXML_CATALOG_ENABLED +// gs->xmlDebugCatalogs = 0; + gs->xmlCatalogDefaultAllow = XML_CATA_ALLOW_ALL; + gs->xmlCatalogDefaultPrefer = XML_CATA_PREFER_PUBLIC; +// gs->xmlCatalogXMLFiles = NULL; +// gs->xmlDefaultCatalog = NULL; +// xmlCatalogMutex = NULL; +// gs->xmlCatalogInitialized = 0; +#endif + +#ifdef LIBXML_XPATH_ENABLED +// gs->xmlXPathNAN = 0; + gs->xmlXPathPINF = 1; + gs->xmlXPathNINF = -1; +// gs->xmlXPathNZERO = 0; +// gs->xmlXPathInitialized = 0; +#ifndef LIBXML_THREAD_ENABLED +// gs->xmlXPathDisableOptimizer = 0; +#endif + gs->xmlXPathDefineExtensionFunctionsGlobally = 1; +// gs->xmlXPathDefaultFunctionsHash = NULL; +// gs->xmlXPathIntermediaryExtensionFunctionsHash = NULL; +#endif /* LIBXML_XPATH_ENABLED */ + +#ifdef LIBXML_XPTR_ENABLED +// gs->xlinkDefaultHandler = NULL; +// gs->xlinkDefaultDetect = NULL; +#endif + + xmlMutexUnlock(xmlThrDefMutex); + + // gs->xmlOOM = gs->xeUserCount = 0; // +} diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_hash.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_hash.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1025 @@ +/* + * libxml2_hash.c: chained hash tables + * + * Reference: Your favorite introductory book on algorithms + * + * Copyright (C) 2000 Bjorn Reese and Daniel Veillard. + * + * 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. + * + * Author: breese@users.sourceforge.net + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#include "xmlenglibxml.h" + +#include +#include + +#define MAX_HASH_LEN 8 + +/* #define DEBUG_GROW */ + +/* + * A single entry in the hash table + */ +typedef struct _xmlHashEntry xmlHashEntry; +typedef xmlHashEntry* xmlHashEntryPtr; +struct _xmlHashEntry { + struct _xmlHashEntry *next; + xmlChar *name; + xmlChar *name2; + xmlChar *name3; + void *payload; + int valid; +}; + +/* + * The entire hash table + */ +struct _xmlHashTable { + xmlHashEntryPtr table; + int size; + int nbElems; +}; + +/* + * xmlHashComputeKey: + * Calculate the hash key + * + * OOM: never + */ +static unsigned long +xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3) { + unsigned long value = 0L; + char ch; + + if (name != NULL) { + value += 30 * (*name); + while ((ch = *name++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + if (name2 != NULL) { + while ((ch = *name2++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + if (name3 != NULL) { + while ((ch = *name3++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + return (value % table->size); +} + +static unsigned long +xmlHashComputeQKey(xmlHashTablePtr table, + const xmlChar *prefix, const xmlChar *name, + const xmlChar *prefix2, const xmlChar *name2, + const xmlChar *prefix3, const xmlChar *name3) { + unsigned long value = 0L; + char ch; + + if (prefix != NULL) + value += 30 * (*prefix); + else + value += 30 * (*name); + + if (prefix != NULL) { + while ((ch = *prefix++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); + } + if (name != NULL) { + while ((ch = *name++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + if (prefix2 != NULL) { + while ((ch = *prefix2++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); + } + if (name2 != NULL) { + while ((ch = *name2++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + if (prefix3 != NULL) { + while ((ch = *prefix3++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); + } + if (name3 != NULL) { + while ((ch = *name3++) != 0) { + value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); + } + } + return (value % table->size); +} + +/** + * xmlHashCreate: + * @param size the size of the hash table + * + * Create a new xmlHashTablePtr. + * + * Returns the newly created object, or NULL if an error occured. + * + * OOM: possible --> returns NULL, OOM flag is set + */ +XMLPUBFUNEXPORT xmlHashTablePtr +xmlHashCreate(int size) { + xmlHashTablePtr table; + + if (size <= 0) + size = 256; + + table = (xmlHashTablePtr) xmlMalloc(sizeof(xmlHashTable)); + if (table) { + table->size = size; + table->nbElems = 0; + table->table = (xmlHashEntryPtr)xmlMalloc(size * sizeof(xmlHashEntry)); // may set OOM flag + if (table->table) { + memset(table->table, 0, size * sizeof(xmlHashEntry)); + return(table); + } + xmlFree(table); + } + return(NULL); +} + +/** + * xmlHashGrow: + * @param table the hash table + * @param size the new size of the hash table + * + * resize the hash table + * + * Returns 0 in case of success, -1 in case of failure + * + * OOM: possible --> sets OOM flag when returns -1 + */ +static int +xmlHashGrow(xmlHashTablePtr table, int size) { + unsigned long key; + int oldsize, i; + xmlHashEntryPtr iter, next; + struct _xmlHashEntry *oldtable; +#ifdef DEBUG_GROW + unsigned long nbElem = 0; +#endif + + if (table == NULL) + return(-1); + if (size < 8) + return(-1); + if (size > 8 * 2048) + return(-1); + + oldsize = table->size; + oldtable = table->table; + if (oldtable == NULL) + return(-1); + + table->table = (xmlHashEntryPtr)xmlMalloc(size * sizeof(xmlHashEntry)); // may set OOM flag + if (table->table == NULL) { + table->table = oldtable; + return(-1); + } + memset(table->table, 0, size * sizeof(xmlHashEntry)); + table->size = size; + + /* If the two loops are merged, there would be situations where + a new entry needs to allocated and data copied into it from + the main table. So instead, we run through the array twice, first + copying all the elements in the main array (where we can't get + conflicts) and then the rest, so we only free (and don't allocate) + */ + for (i = 0; i < oldsize; i++) { + + if (oldtable[i].valid == 0) + continue; + key = xmlHashComputeKey( + table, + oldtable[i].name, + oldtable[i].name2, + oldtable[i].name3); + memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); + table->table[key].next = NULL; + } + + for (i = 0; i < oldsize; i++) { + iter = oldtable[i].next; + while (iter) { + next = iter->next; + + /* + * put back the entry in the new table + */ + + key = xmlHashComputeKey( + table, + iter->name, + iter->name2, + iter->name3); + if (table->table[key].valid == 0) { + memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); + table->table[key].next = NULL; + xmlFree(iter); + } else { + iter->next = table->table[key].next; + table->table[key].next = iter; + } + +#ifdef DEBUG_GROW + nbElem++; +#endif + iter = next; + } + } + + xmlFree(oldtable); + +#ifdef DEBUG_GROW + xmlGenericError(xmlGenericErrorContext, + "xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem); +#endif + return(0); +} + +/** + * xmlHashFree: + * @param table the hash table + * @param f the deallocator function for items in the hash + * + * Free the hash table and its contents. The userdata is + * deallocated with f if provided. + * + * OOM: never // same as argument 'f' has when f!=NULL + */ +XMLPUBFUNEXPORT void +xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { + int i; + xmlHashEntryPtr iter; + xmlHashEntryPtr next; + int inside_table = 0; + int nbElems; + + if (table == NULL) + return; + if (table->table) { + nbElems = table->nbElems; + for(i = 0; (i < table->size) && (nbElems > 0); i++) { + iter = &(table->table[i]); + if (iter->valid == 0) + continue; + inside_table = 1; + while (iter) { + next = iter->next; + if ((f != NULL) && (iter->payload != NULL)) + f(iter->payload, iter->name); + if (iter->name) + xmlFree(iter->name); + if (iter->name2) + xmlFree(iter->name2); + if (iter->name3) + xmlFree(iter->name3); + iter->payload = NULL; + if (!inside_table) + xmlFree(iter); + nbElems--; + inside_table = 0; + iter = next; + } + inside_table = 0; + } + xmlFree(table->table); + } + xmlFree(table); +} + +/** + * xmlHashAddEntry: + * @param table the hash table + * @param name the name of the userdata + * @param userdata a pointer to the userdata + * + * Add the userdata to the hash table. This can later be retrieved + * by using the name. Duplicate names generate errors. + * + * Returns 0 the addition succeeded and -1 in case of error. + * + * OOM: iif returns -1 and flag is set + */ +XMLPUBFUNEXPORT int +xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { + return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); +} + +/** + * xmlHashAddEntry2: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param userdata a pointer to the userdata + * + * Add the userdata to the hash table. This can later be retrieved + * by using the (name, name2) tuple. Duplicate tuples generate errors. + * + * Returns 0 the addition succeeded and -1 in case of error. + */ +XMLPUBFUNEXPORT int +xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, void *userdata) { + return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); +} + +/** + * xmlHashUpdateEntry: + * @param table the hash table + * @param name the name of the userdata + * @param userdata a pointer to the userdata + * @param f the deallocator function for replaced item (if any) + * + * Add the userdata to the hash table. This can later be retrieved + * by using the name. Existing entry for this name will be removed + * and freed with f if found. + * + * Returns 0 the addition succeeded and -1 in case of error. + */ +XMLPUBFUNEXPORT int +xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, + void *userdata, xmlHashDeallocator f) { + return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); +} + +/** + * xmlHashUpdateEntry2: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param userdata a pointer to the userdata + * @param f the deallocator function for replaced item (if any) + * + * Add the userdata to the hash table. This can later be retrieved + * by using the (name, name2) tuple. Existing entry for this tuple will + * be removed and freed with f if found. + * + * Returns 0 the addition succeeded and -1 in case of error. + */ +XMLPUBFUNEXPORT int +xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, void *userdata, + xmlHashDeallocator f) { + return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); +} + +/** + * xmlHashLookup: + * @param table the hash table + * @param name the name of the userdata + * + * Find the userdata specified by the name. + * + * Returns the pointer to the userdata + */ +XMLPUBFUNEXPORT void * +xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { + return(xmlHashLookup3(table, name, NULL, NULL)); +} + +/** + * xmlHashLookup2: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * + * Find the userdata specified by the (name, name2) tuple. + * + * Returns the pointer to the userdata + * + * OOM: never + */ +XMLPUBFUNEXPORT void* +xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2) { + return(xmlHashLookup3(table, name, name2, NULL)); +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlHashQLookup: + * @param table the hash table + * @param prefix the prefix of the userdata + * @param name the name of the userdata + * + * Find the userdata specified by the QName prefix:name/name. + * + * Returns the pointer to the userdata + * + * OOM: never + */ +void* +xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, + const xmlChar *name) { + return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); +} +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * xmlHashQLookup2: + * @param table the hash table + * @param prefix the prefix of the userdata + * @param name the name of the userdata + * @param prefix2 the second prefix of the userdata + * @param name2 a second name of the userdata + * + * Find the userdata specified by the QNames tuple + * + * Returns the pointer to the userdata + */ +XMLPUBFUNEXPORT void * +xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, + const xmlChar *name, const xmlChar *prefix2, + const xmlChar *name2) { + return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); +} + +/** + * xmlHashAddEntry3: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param name3 a third name of the userdata + * @param userdata a pointer to the userdata + * + * Add the userdata to the hash table. This can later be retrieved + * by using the tuple (name, name2, name3). Duplicate entries generate + * errors. + * + * Returns 0 the addition succeeded and -1 in case of error. + * + * OOM: iif returns -1 and flag is set + */ +XMLPUBFUNEXPORT int +xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + void *userdata) { + LOAD_GS_DIRECT + unsigned long key, len = 0; + xmlHashEntryPtr entry; + xmlHashEntryPtr insert; + int res; + + if ((table == NULL) || name == NULL) + return(-1); + + /* + * Check for duplicate and insertion location. + */ + key = xmlHashComputeKey(table, name, name2, name3); + if (table->table[key].valid == 0) { + insert = NULL; + } else { + for (insert = &(table->table[key]); insert->next != NULL; + insert = insert->next) { + if ((xmlStrEqual(insert->name, name)) && + (xmlStrEqual(insert->name2, name2)) && + (xmlStrEqual(insert->name3, name3))) + return(-1); + len++; + } + if ((xmlStrEqual(insert->name, name)) && + (xmlStrEqual(insert->name2, name2)) && + (xmlStrEqual(insert->name3, name3))) + return(-1); + } + + if (insert == NULL) { + entry = &(table->table[key]); + } else { + entry = (xmlHashEntryPtr) xmlMalloc(sizeof(xmlHashEntry)); // may set OOM flag + if (entry == NULL) + return(-1); + } + // DONE: Check OOM // DONE: Try to avoid xmlStrdup(NULL) + + + entry->name = xmlStrdup(name); // name is never NULL here + entry->name2 = name2 ? xmlStrdup(name2): (xmlChar*) name2 /* it's NULL here */; + entry->name3 = name3 ? xmlStrdup(name3): (xmlChar*) name3 /* it's NULL here */; + if(OOM_FLAG){ + if(entry->name) xmlFree(entry->name); + if(entry->name2) xmlFree(entry->name2); + if(entry->name3) xmlFree(entry->name3); + if(insert) xmlFree(entry); + return -1; + } + entry->payload = userdata; + entry->next = NULL; + entry->valid = 1; + + if (insert != NULL) + insert->next = entry; + + table->nbElems++; + + res = 0; + if (len > MAX_HASH_LEN){ + res = xmlHashGrow(table, MAX_HASH_LEN * table->size); + } + + return(res); +} + +/** + * xmlHashUpdateEntry3: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param name3 a third name of the userdata + * @param userdata a pointer to the userdata + * @param f the deallocator function for replaced item (if any) + * + * Add the userdata to the hash table. This can later be retrieved + * by using the tuple (name, name2, name3). Existing entry for this tuple + * will be removed and freed with f if found. + * + * Returns 0 the addition succeeded and -1 in case of error. + */ +XMLPUBFUNEXPORT int +xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + void *userdata, xmlHashDeallocator f) { + LOAD_GS_DIRECT + unsigned long key; + xmlHashEntryPtr entry; + xmlHashEntryPtr insert; + + if ((table == NULL) || name == NULL) + return(-1); + + /* + * Check for duplicate and insertion location. + */ + key = xmlHashComputeKey(table, name, name2, name3); + if (table->table[key].valid == 0) { + insert = NULL; + } else { + for (insert = &(table->table[key]); insert->next != NULL; + insert = insert->next) { + if ((xmlStrEqual(insert->name, name)) && + (xmlStrEqual(insert->name2, name2)) && + (xmlStrEqual(insert->name3, name3))) { + if (f) + f(insert->payload, insert->name); + insert->payload = userdata; + return(0); + } + } + if ((xmlStrEqual(insert->name, name)) && + (xmlStrEqual(insert->name2, name2)) && + (xmlStrEqual(insert->name3, name3))) { + if (f) + f(insert->payload, insert->name); + insert->payload = userdata; + return(0); + } + } + + if (!insert) { + entry = &(table->table[key]); + } else { + entry = (xmlHashEntryPtr)xmlMalloc(sizeof(xmlHashEntry)); + if (entry == NULL) + return(-1); + } + // DONE: Check OOM + entry->name = xmlStrdup(name); // name is never NULL here + entry->name2 = name2 ? xmlStrdup(name2): NULL; + entry->name3 = name3 ? xmlStrdup(name3): NULL; + if(OOM_FLAG){ + if(entry->name) xmlFree(entry->name); + if(entry->name2) xmlFree(entry->name2); + if(entry->name3) xmlFree(entry->name3); + if(insert) xmlFree(entry); + return -1; + } + entry->payload = userdata; + entry->next = NULL; + entry->valid = 1; + table->nbElems++; + + + if (insert) { + insert->next = entry; + } + return(0); +} + +/** + * xmlHashLookup3: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param name3 a third name of the userdata + * + * Find the userdata specified by the (name, name2, name3) tuple. + * + * Returns the a pointer to the userdata + * + * OOM: never + */ +XMLPUBFUNEXPORT void * +xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3) +{ + unsigned long key; + xmlHashEntryPtr entry; + + if (table == NULL) + return(NULL); + if (name == NULL) + return(NULL); + key = xmlHashComputeKey(table, name, name2, name3); + if (table->table[key].valid == 0) + return(NULL); + for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { + if ((xmlStrEqual(entry->name, name)) && + (xmlStrEqual(entry->name2, name2)) && + (xmlStrEqual(entry->name3, name3))) + return(entry->payload); + } + return(NULL); +} + +/** + * xmlHashQLookup3: + * @param table the hash table + * @param prefix the prefix of the userdata + * @param name the name of the userdata + * @param prefix2 the second prefix of the userdata + * @param name2 a second name of the userdata + * @param prefix3 the third prefix of the userdata + * @param name3 a third name of the userdata + * + * Find the userdata specified by the (name, name2, name3) tuple. + * + * Returns the a pointer to the userdata + */ +XMLPUBFUNEXPORT void * +xmlHashQLookup3(xmlHashTablePtr table, + const xmlChar *prefix, const xmlChar *name, + const xmlChar *prefix2, const xmlChar *name2, + const xmlChar *prefix3, const xmlChar *name3) { + unsigned long key; + xmlHashEntryPtr entry; + + if (table == NULL) + return(NULL); + if (name == NULL) + return(NULL); + key = xmlHashComputeQKey(table, prefix, name, prefix2, + name2, prefix3, name3); + if (table->table[key].valid == 0) + return(NULL); + for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { + if ((xmlStrQEqual(prefix, name, entry->name)) && + (xmlStrQEqual(prefix2, name2, entry->name2)) && + (xmlStrQEqual(prefix3, name3, entry->name3))) + return(entry->payload); + } + return(NULL); +} + +typedef struct { + xmlHashScanner hashscanner; + void *data; +} stubData; + +static void +stubHashScannerFull (void *payload, void *data, const xmlChar *name, + const xmlChar *name2 ATTRIBUTE_UNUSED, + const xmlChar *name3 ATTRIBUTE_UNUSED) { + stubData *stubdata = (stubData *) data; + stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name); +} + +/** + * xmlHashScan: + * @param table the hash table + * @param f the scanner function for items in the hash + * @param data extra data passed to f + * + * Scan the hash table and applied f to each value. + */ +XMLPUBFUNEXPORT void +xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { + stubData stubdata; + stubdata.data = data; + stubdata.hashscanner = f; + xmlHashScanFull (table, stubHashScannerFull, &stubdata); +} + +/** + * xmlHashScanFull: + * @param table the hash table + * @param f the scanner function for items in the hash + * @param data extra data passed to f + * + * Scan the hash table and applied f to each value. + */ +XMLPUBFUNEXPORT void +xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { + int i; + xmlHashEntryPtr iter; + xmlHashEntryPtr next; + + if (table == NULL) + return; + if (f == NULL) + return; + + if (table->table) { + for(i = 0; i < table->size; i++) { + if (table->table[i].valid == 0) + continue; + iter = &(table->table[i]); + while (iter) { + next = iter->next; + if ((f != NULL) && (iter->payload != NULL)) + f(iter->payload, data, iter->name, + iter->name2, iter->name3); + iter = next; + } + } + } +} + +/** + * xmlHashScan3: + * @param table the hash table + * @param name the name of the userdata or NULL + * @param name2 a second name of the userdata or NULL + * @param name3 a third name of the userdata or NULL + * @param f the scanner function for items in the hash + * @param data extra data passed to f + * + * Scan the hash table and applied f to each value matching + * (name, name2, name3) tuple. If one of the names is null, + * the comparison is considered to match. + */ +XMLPUBFUNEXPORT void +xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashScanner f, void *data) { + xmlHashScanFull3 (table, name, name2, name3, + (xmlHashScannerFull) f, data); +} + +/** + * xmlHashScanFull3: + * @param table the hash table + * @param name the name of the userdata or NULL + * @param name2 a second name of the userdata or NULL + * @param name3 a third name of the userdata or NULL + * @param f the scanner function for items in the hash + * @param data extra data passed to f + * + * Scan the hash table and applied f to each value matching + * (name, name2, name3) tuple. If one of the names is null, + * the comparison is considered to match. + */ +XMLPUBFUNEXPORT void +xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashScannerFull f, void *data) { + int i; + xmlHashEntryPtr iter; + xmlHashEntryPtr next; + + if (table == NULL) + return; + if (f == NULL) + return; + + if (table->table) { + for(i = 0; i < table->size; i++) { + if (table->table[i].valid == 0) + continue; + iter = &(table->table[i]); + while (iter) { + next = iter->next; + if (((name == NULL) || (xmlStrEqual(name, iter->name))) && + ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) && + ((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) && + (iter->payload != NULL)) { + f(iter->payload, data, iter->name, + iter->name2, iter->name3); + } + iter = next; + } + } + } +} + +/** + * xmlHashCopy: + * @param table the hash table + * @param f the copier function for items in the hash + * + * Scan the hash table and applied f to each value. + * + * Returns the new table or NULL in case of error. + * + * OOM: possible --> returns NULL, OOM flag is set + */ +XMLPUBFUNEXPORT xmlHashTablePtr +xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) +{ + LOAD_GS_DIRECT + int i; + xmlHashEntryPtr iter; + xmlHashEntryPtr next; + xmlHashTablePtr ret; + //int res; + void* pCopy; + + if (table == NULL) + return(NULL); + if (f == NULL) + return(NULL); + + ret = xmlHashCreate(table->size); // may set OOM flag + if(!ret) + return NULL; // OOM happened, the flag is set already + + if (table->table) { + for(i = 0; i < table->size; i++) + { + if (table->table[i].valid == 0) + continue; + iter = &(table->table[i]); + while (iter) + { + next = iter->next; + pCopy = f(iter->payload, iter->name); + if(OOM_FLAG) + goto oom; + //res = + xmlHashAddEntry3( + ret, + iter->name, + iter->name2, + iter->name3, + pCopy); + if(OOM_FLAG) + goto oom; + iter = next; + } + } + } + ret->nbElems = table->nbElems; + return(ret); +oom: + // OOM during copying entry in f() + xmlHashFree(ret, NULL); + return NULL; +} + +#ifndef XMLENGINE_EXCLUDE_UNUSED +/** + * xmlHashSize: + * @param table the hash table + * + * Query the number of elements installed in the hash table. + * + * Returns the number of elements in the hash table or + * -1 in case of error + */ +int +xmlHashSize(xmlHashTablePtr table) +{ + if (table == NULL) + return(-1); + return(table->nbElems); +} +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ + +/** + * xmlHashRemoveEntry: + * @param table the hash table + * @param name the name of the userdata + * @param f the deallocator function for removed item (if any) + * + * Find the userdata specified by the name and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + * + * OOM: never / same as argument function 'f' has, if f!=NULL* + */ +XMLPUBFUNEXPORT int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f) +{ + return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); +} + +/** + * xmlHashRemoveEntry2: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param f the deallocator function for removed item (if any) + * + * Find the userdata specified by the (name, name2) tuple and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + */ +XMLPUBFUNEXPORT int +xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f) { + return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); +} + +/** + * xmlHashRemoveEntry3: + * @param table the hash table + * @param name the name of the userdata + * @param name2 a second name of the userdata + * @param name3 a third name of the userdata + * @param f the deallocator function for removed item (if any) + * + * Find the userdata specified by the (name, name2, name3) tuple and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + * + * OOM: never / same as argument function 'f' has, if f!=NULL + */ +XMLPUBFUNEXPORT int +xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f) +{ + unsigned long key; + xmlHashEntryPtr entry; + xmlHashEntryPtr prev = NULL; + + if (table == NULL || name == NULL) + return(-1); + + key = xmlHashComputeKey(table, name, name2, name3); + if (table->table[key].valid == 0) { + return(-1); + } else { + for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { + if (xmlStrEqual(entry->name, name) && + xmlStrEqual(entry->name2, name2) && + xmlStrEqual(entry->name3, name3)) { + if ((f != NULL) && (entry->payload != NULL)) + f(entry->payload, entry->name); + entry->payload = NULL; + if(entry->name) + xmlFree(entry->name); + if(entry->name2) + xmlFree(entry->name2); + if(entry->name3) + xmlFree(entry->name3); + if(prev) { + prev->next = entry->next; + xmlFree(entry); + } else { + if (entry->next == NULL) { + entry->valid = 0; + } else { + entry = entry->next; + memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); + xmlFree(entry); + } + } + table->nbElems--; + return(0); + } + prev = entry; + } + return(-1); + } +} diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_htmlparser.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_htmlparser.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5978 @@ +/* + * libxml2_htmlparser.c : an HTML 4.0 non-verifying parser + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#include "xmlenglibxml.h" + +#include +#if defined(HAVE_CTYPE_H) +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_ZLIB_H +#include +#endif + + +#include +#include +#include +#include +#include +#include +#include "libxml2_xmlerror2.h" +#include "libxml2_htmlparser.h" +#include "libxml2_htmltree.h" +#include "libxml2_entities.h" +#include +#include +#include +#include + +#define HTML_MAX_NAMELEN 1000 +#define HTML_PARSER_BIG_BUFFER_SIZE 1000 +#define HTML_PARSER_BUFFER_SIZE 100 + +#ifdef LIBXML_HTML_ENABLED + +/* #define DEBUG */ +/* #define DEBUG_PUSH */ + +static const int htmlOmittedDefaultValue = 1; + +xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, + xmlChar end, xmlChar end2, xmlChar end3); +static void htmlParseComment(htmlParserCtxtPtr ctxt); + +/************************************************************************ + * * + * Some factorized error routines * + * * + ************************************************************************/ + +/** + * htmlErrMemory: + * @param ctxt an HTML parser context + * @param extra extra informations + * + * Handle a redefinition of attribute error + */ +void +htmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); // moved to XSLT-enabled part of this file + +/** + * htmlParseErr: + * @param ctxt an HTML parser context + * @param error the error number + * @param msg the error message + * @param str1 string infor + * @param str2 string infor + * + * Handle a fatal parser error, i.e. violating Well-Formedness constraints + */ +static void +htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, + const char *msg, const xmlChar *str1, const xmlChar *str2) +{ + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; + ctxt->errNo = error; + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, + XML_ERR_ERROR, NULL, 0, + (const char *) str1, (const char *) str2, + NULL, 0, 0, + msg, str1, str2); + ctxt->wellFormed = 0; +} + +/** + * htmlParseErrInt: + * @param ctxt an HTML parser context + * @param error the error number + * @param msg the error message + * @param val integer info + * + * Handle a fatal parser error, i.e. violating Well-Formedness constraints + */ +static void +htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, + const char *msg, int val) +{ + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; + ctxt->errNo = error; + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, + XML_ERR_ERROR, NULL, 0, NULL, NULL, + NULL, val, 0, msg, val); + ctxt->wellFormed = 0; +} + +/************************************************************************ + * * + * Parser stacks related functions and macros * + * * + ************************************************************************/ + +/** + * htmlnamePush: + * @param ctxt an HTML parser context + * @param value the element name + * + * Pushes a new element name on top of the name stack + * + * Returns 0 in case of error, the index in the stack otherwise + */ +static int +htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value) +{ + if (ctxt->nameNr >= ctxt->nameMax) { + void* allocTmp; // DONE: Fix xmlRealloc + allocTmp = xmlRealloc((xmlChar**)ctxt->nameTab, + ctxt->nameMax * 2 * sizeof(ctxt->nameTab[0])); + if (!allocTmp) { + htmlErrMemory(ctxt, NULL); + return (0); + } + ctxt->nameMax *= 2; + ctxt->nameTab = (const xmlChar**) allocTmp; + } + ctxt->nameTab[ctxt->nameNr] = value; + ctxt->name = value; + return (ctxt->nameNr++); +} +/** + * htmlnamePop: + * @param ctxt an HTML parser context + * + * Pops the top element name from the name stack + * + * Returns the name just removed + */ +static const xmlChar * +htmlnamePop(htmlParserCtxtPtr ctxt) +{ + const xmlChar *ret; + + if (ctxt->nameNr <= 0) + return (0); + ctxt->nameNr--; + if (ctxt->nameNr < 0) + return (0); + if (ctxt->nameNr > 0) + ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; + else + ctxt->name = NULL; + ret = ctxt->nameTab[ctxt->nameNr]; + ctxt->nameTab[ctxt->nameNr] = 0; + return (ret); +} + +/* + * Macros for accessing the content. Those should be used only by the parser, + * and not exported. + * + * Dirty macros, i.e. one need to make assumption on the context to use them + * + * CUR_PTR return the current pointer to the xmlChar to be parsed. + * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled + * in ISO-Latin or UTF-8, and the current 16 bit value if compiled + * in UNICODE mode. This should be used internally by the parser + * only to compare to ASCII values otherwise it would break when + * running with UTF-8 encoding. + * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only + * to compare on ASCII based substring. + * UPP(n) returns the n'th next xmlChar converted to uppercase. Same as CUR + * it should be used only to compare on ASCII based substring. + * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined + * strings without newlines within the parser. + * + * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding + * + * CURRENT Returns the current char value, with the full decoding of + * UTF-8 if we are using this mode. It returns an int. + * NEXT Skip to the next character, this does the proper decoding + * in UTF-8 mode. + * NEXTL(l) Skip the current unicode character of l xmlChars long. + * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly + */ + +#define UPPER (toupper(*ctxt->input->cur)) + +#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val) + +#define NXT(val) ctxt->input->cur[(val)] + +#define UPP(val) (toupper(ctxt->input->cur[(val)])) + +#define CUR_PTR ctxt->input->cur + +#define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \ + (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \ + xmlParserInputShrink(ctxt->input) + +#define GROW if ((ctxt->progressive == 0) && \ + (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \ + xmlParserInputGrow(ctxt->input, INPUT_CHUNK) + +#define CURRENT ((int) (*ctxt->input->cur)) + +#define SKIP_BLANKS htmlSkipBlankChars(ctxt) + +/* Inported from XML */ + +/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */ +#define CUR ((int) (*ctxt->input->cur)) +#define NEXT xmlNextChar(ctxt) + +#define RAW (ctxt->token ? -1 : (*ctxt->input->cur)) +#define NXT(val) ctxt->input->cur[(val)] +#define CUR_PTR ctxt->input->cur + + +#define NEXTL(l) do { \ + if (*(ctxt->input->cur) == '\n') { \ + ctxt->input->line++; ctxt->input->col = 1; \ + } else ctxt->input->col++; \ + ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \ + } while (0) + +/************ + \ + if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ + if (*ctxt->input->cur == '&') xmlParserHandleReference(ctxt); + ************/ + +#define CUR_CHAR(l) htmlCurrentChar(ctxt, &l) +#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) + +#define COPY_BUF(l,b,i,v) \ + if (l == 1) b[i++] = (xmlChar) v; \ + else i += xmlCopyChar(l,&b[i],v) + +/** + * htmlCurrentChar: + * @param ctxt the HTML parser context + * @param len pointer to the length of the char read + * + * The current char value, if using UTF-8 this may actually span multiple + * bytes in the input buffer. Implement the end of line normalization: + * 2.11 End-of-Line Handling + * If the encoding is unspecified, in the case we find an ISO-Latin-1 + * char, then the encoding converter is plugged in automatically. + * + * Returns the current char value and its length + */ + +static int +htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { + if (ctxt->instate == XML_PARSER_EOF) + return(0); + + if (ctxt->token != 0) { + *len = 0; + return(ctxt->token); + } + if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { + /* + * We are supposed to handle UTF8, check it's valid + * From rfc2044: encoding of the Unicode values on UTF-8: + * + * UCS-4 range (hex.) UTF-8 octet sequence (binary) + * 0000 0000-0000 007F 0xxxxxxx + * 0000 0080-0000 07FF 110xxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * + * Check for the 0x110000 limit too + */ + const unsigned char *cur = ctxt->input->cur; + unsigned char c; + unsigned int val; + + c = *cur; + if (c & 0x80) { + if (cur[1] == 0) + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + if ((cur[1] & 0xc0) != 0x80) + goto encoding_error; + if ((c & 0xe0) == 0xe0) { + + if (cur[2] == 0) + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + if ((cur[2] & 0xc0) != 0x80) + goto encoding_error; + if ((c & 0xf0) == 0xf0) { + if (cur[3] == 0) + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + if (((c & 0xf8) != 0xf0) || + ((cur[3] & 0xc0) != 0x80)) + goto encoding_error; + /* 4-byte code */ + *len = 4; + val = (cur[0] & 0x7) << 18; + val |= (cur[1] & 0x3f) << 12; + val |= (cur[2] & 0x3f) << 6; + val |= cur[3] & 0x3f; + } else { + /* 3-byte code */ + *len = 3; + val = (cur[0] & 0xf) << 12; + val |= (cur[1] & 0x3f) << 6; + val |= cur[2] & 0x3f; + } + } else { + /* 2-byte code */ + *len = 2; + val = (cur[0] & 0x1f) << 6; + val |= cur[1] & 0x3f; + } + if (!IS_CHAR(val)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Char 0x%X out of allowed range\n", val); + } + return(val); + } else { + /* 1-byte code */ + *len = 1; + return((int) *ctxt->input->cur); + } + } + /* + * Assume it's a fixed length encoding (1) with + * a compatible encoding for the ASCII set, since + * XML constructs only use < 128 chars + */ + *len = 1; + if ((int) *ctxt->input->cur < 0x80) + return((int) *ctxt->input->cur); + + /* + * Humm this is bad, do an automatic flow conversion + */ + xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); + ctxt->charset = XML_CHAR_ENCODING_UTF8; + return(xmlCurrentChar(ctxt, len)); + +encoding_error: + /* + * If we detect an UTF8 error that probably mean that the + * input encoding didn't get properly advertized in the + * declaration header. Report the error and switch the encoding + * to ISO-Latin-1 (if you don't like this policy, just declare the + * encoding !) + */ + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "Input is not proper UTF-8, indicate encoding !\n", + NULL, NULL); + if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { + ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + ctxt->input->cur[0], ctxt->input->cur[1], + ctxt->input->cur[2], ctxt->input->cur[3]); + } + + ctxt->charset = XML_CHAR_ENCODING_8859_1; + *len = 1; + return((int) *ctxt->input->cur); +} + +/** + * htmlSkipBlankChars: + * @param ctxt the HTML parser context + * + * skip all blanks character found at that point in the input streams. + * + * Returns the number of space chars skipped + */ + +static int +htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { + int res = 0; + + while (IS_BLANK_CH(*(ctxt->input->cur))) { + if ((*ctxt->input->cur == 0) && + (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { + xmlPopInput(ctxt); + } else { + if (*(ctxt->input->cur) == '\n') { + ctxt->input->line++; ctxt->input->col = 1; + } else ctxt->input->col++; + ctxt->input->cur++; + ctxt->nbChars++; + if (*ctxt->input->cur == 0) + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + } + res++; + } + return(res); +} + + +#endif /* defined(LIBXML_HTML_ENABLED */ + +#if defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) + +/************************************************************************ + * * + * The list of HTML elements and their properties * + * * + ************************************************************************/ + +/* + * Start Tag: 1 means the start tag can be ommited + * End Tag: 1 means the end tag can be ommited + * 2 means it's forbidden (empty elements) + * 3 means the tag is stylistic and should be closed easily + * Depr: this element is deprecated + * DTD: 1 means that this element is valid only in the Loose DTD + * 2 means that this element is valid only in the Frameset DTD + * + * Name,Start Tag,End Tag,Save End,Empty,Deprecated,DTD,inline,Description + , subElements , impliedsubelt , Attributes, userdata + */ + +/* Definitions and a couple of vars for HTML Elements */ + +#define FONTSTYLE "tt", "i", "b", "u", "s", "strike", "big", "small" +#define PHRASE "em", "strong", "dfn", "code", "samp", "kbd", "var", "cite", "abbr", "acronym" +#define SPECIAL "a", "img", "applet", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe" +#define INLINE PCDATA FONTSTYLE PHRASE SPECIAL FORMCTRL +#define BLOCK HEADING LIST "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address" +#define FORMCTRL "input", "select", "textarea", "label", "button" +#define PCDATA +#define HEADING "h1", "h2", "h3", "h4", "h5", "h6" +#define LIST "ul", "ol", "dir", "menu" +#define MODIFIER +#define FLOW BLOCK,INLINE +#define EMPTY NULL + +// TO DO libxslt added 2nd const in between +static const char* const html_flow [] = { FLOW, NULL } ; +static const char* const html_inline [] = { INLINE, NULL } ; + +/* placeholders: elts with content but no subelements */ +static const char* const html_pcdata[] = { NULL } ; +#define html_cdata html_pcdata + + +/* ... and for HTML Attributes */ + +#define COREATTRS "id", "class", "style", "title" +#define I18N "lang", "dir" +#define EVENTS "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmouseout", "onkeypress", "onkeydown", "onkeyup" +#define ATTRS COREATTRS,I18N,EVENTS +#define CELLHALIGN "align", "char", "charoff" +#define CELLVALIGN "valign" + +static const char* const html_attrs [] = { ATTRS, NULL } ; +static const char* const core_i18n_attrs [] = { COREATTRS, I18N, NULL } ; +static const char* const core_attrs [] = { COREATTRS, NULL } ; +static const char* const i18n_attrs [] = { I18N, NULL } ; + +/* Other declarations that should go inline ... */ +static const char* const a_attrs[] = { ATTRS, "charset", "type", "name", + "href", "hreflang", "rel", "rev", "accesskey", "shape", "coords", + "tabindex", "onfocus", "onblur", NULL } ; +static const char* const target_attr[] = { "target", NULL } ; +static const char* const rows_cols_attr[] = { "rows", "cols", NULL } ; +static const char* const alt_attr[] = { "alt", NULL } ; +static const char* const src_alt_attrs[] = { "src", "alt", NULL } ; +static const char* const href_attrs[] = { "href", NULL } ; +static const char* const clear_attrs[] = { "clear", NULL } ; +static const char* const inline_p[] = { INLINE, "p", NULL } ; +static const char* const flow_param[] = { FLOW, "param", NULL } ; +static const char* const applet_attrs[] = { COREATTRS , "codebase", + "archive", "alt", "name", "height", "width", "align", + "hspace", "vspace", NULL } ; +static const char* const area_attrs[] = { "shape", "coords", "href", "nohref", + "tabindex", "accesskey", "onfocus", "onblur", NULL } ; +static const char* const basefont_attrs[] = + { "id", "size", "color", "face", NULL } ; +static const char* const quote_attrs[] = { ATTRS, "cite", NULL } ; +static const char* const body_contents[] = { FLOW, "ins", "del", NULL } ; +static const char* const body_attrs[] = { ATTRS, "onload", "onunload", NULL } ; +static const char* const body_depr[] = { "background", "bgcolor", "text", + "link", "vlink", "alink", NULL } ; +static const char* const button_attrs[] = { ATTRS, "name", "value", "type", + "disabled", "tabindex", "accesskey", "onfocus", "onblur", NULL } ; + + +static const char* const col_attrs[] = { ATTRS, "span", "width", CELLHALIGN, CELLVALIGN, NULL } ; +static const char* const col_elt[] = { "col", NULL } ; +static const char* const edit_attrs[] = { ATTRS, "datetime", "cite", NULL } ; +static const char* const compact_attrs[] = { ATTRS, "compact", NULL } ; +static const char* const dl_contents[] = { "dt", "dd", NULL } ; +static const char* const compact_attr[] = { "compact", NULL } ; +static const char* const label_attr[] = { "label", NULL } ; +static const char* const fieldset_contents[] = { FLOW, "legend" } ; +static const char* const font_attrs[] = { COREATTRS, I18N, "size", "color", "face" , NULL } ; +static const char* const form_contents[] = { HEADING, LIST, INLINE, "pre", "p", "div", "center", "noscript", "noframes", "blockquote", "isindex", "hr", "table", "fieldset", "address", NULL } ; +static const char* const form_attrs[] = { ATTRS, "method", "enctype", "accept", "name", "onsubmit", "onreset", "accept-charset", NULL } ; +static const char* const frame_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "noresize", "scrolling" , NULL } ; +static const char* const frameset_attrs[] = { COREATTRS, "rows", "cols", "onload", "onunload", NULL } ; +static const char* const frameset_contents[] = { "frameset", "frame", "noframes", NULL } ; +static const char* const head_attrs[] = { I18N, "profile", NULL } ; +static const char* const head_contents[] = { "title", "isindex", "base", "script", "style", "meta", "link", "object", NULL } ; +static const char* const hr_depr[] = { "align", "noshade", "size", "width", NULL } ; +static const char* const version_attr[] = { "version", NULL } ; +static const char* const html_content[] = { "head", "body", "frameset", NULL } ; +static const char* const iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ; +static const char* const img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ; +static const char* const input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ; +static const char* const prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ; +static const char* const label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ; +static const char* const legend_attrs[] = { ATTRS, "accesskey", NULL } ; +static const char* const align_attr[] = { "align", NULL } ; +static const char* const link_attrs[] = { ATTRS, "charset", "href", "hreflang", "type", "rel", "rev", "media", NULL } ; +static const char* const map_contents[] = { BLOCK, "area", NULL } ; +static const char* const name_attr[] = { "name", NULL } ; +static const char* const action_attr[] = { "action", NULL } ; +static const char* const blockli_elt[] = { BLOCK, "li", NULL } ; +static const char* const meta_attrs[] = { I18N, "http-equiv", "name", "scheme", NULL } ; +static const char* const content_attr[] = { "content", NULL } ; +static const char* const type_attr[] = { "type", NULL } ; +static const char* const noframes_content[] = { "body", FLOW MODIFIER, NULL } ; +static const char* const object_contents[] = { FLOW, "param", NULL } ; +static const char* const object_attrs[] = { ATTRS, "declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex", NULL } ; +static const char* const object_depr[] = { "align", "border", "hspace", "vspace", NULL } ; +static const char* const ol_attrs[] = { "type", "compact", "start", NULL} ; +static const char* const option_elt[] = { "option", NULL } ; +static const char* const optgroup_attrs[] = { ATTRS, "disabled", NULL } ; +static const char* const option_attrs[] = { ATTRS, "disabled", "label", "selected", "value", NULL } ; +static const char* const param_attrs[] = { "id", "value", "valuetype", "type", NULL } ; +static const char* const width_attr[] = { "width", NULL } ; +static const char* const pre_content[] = { PHRASE, "tt", "i", "b", "u", "s", "strike", "a", "br", "script", "map", "q", "span", "bdo", "iframe", NULL } ; +static const char* const script_attrs[] = { "charset", "src", "defer", "event", "for", NULL } ; +static const char* const language_attr[] = { "language", NULL } ; +static const char* const select_content[] = { "optgroup", "option", NULL } ; +static const char* const select_attrs[] = { ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange", NULL } ; +static const char* const style_attrs[] = { I18N, "media", "title", NULL } ; +static const char* const table_attrs[] = { ATTRS "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ; +static const char* const table_depr[] = { "align", "bgcolor", NULL } ; +static const char* const table_contents[] = { "caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr", NULL} ; +static const char* const tr_elt[] = { "tr", NULL } ; +static const char* const talign_attrs[] = { ATTRS, CELLHALIGN, CELLVALIGN, NULL} ; +static const char* const th_td_depr[] = { "nowrap", "bgcolor", "width", "height", NULL } ; +static const char* const th_td_attr[] = { ATTRS, "abbr", "axis", "headers", "scope", "rowspan", "colspan", CELLHALIGN, CELLVALIGN, NULL } ; +static const char* const textarea_attrs[] = { ATTRS, "name", "disabled", "readonly", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", NULL } ; +static const char* const tr_contents[] = { "th", "td", NULL } ; +static const char* const bgcolor_attr[] = { "bgcolor", NULL } ; +static const char* const li_elt[] = { "li", NULL } ; +static const char* const ul_depr[] = { "type", "compact", NULL} ; +static const char* const dir_attr[] = { "dir", NULL} ; + +#define DECL (const char**) + +static const htmlElemDesc html40ElementTable [] = { +{ "a", 0, 0, 0, 0, 0, 0, 1, "anchor ", + DECL html_inline , NULL , DECL a_attrs , DECL target_attr, NULL +}, +{ "abbr", 0, 0, 0, 0, 0, 0, 1, "abbreviated form", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "acronym", 0, 0, 0, 0, 0, 0, 1, "", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "address", 0, 0, 0, 0, 0, 0, 0, "information on author ", + DECL inline_p , NULL , DECL html_attrs, NULL, NULL +}, +{ "applet", 0, 0, 0, 0, 1, 1, 2, "java applet ", + DECL flow_param , NULL , NULL , DECL applet_attrs, NULL +}, +{ "area", 0, 2, 2, 1, 0, 0, 0, "client-side image map area ", + EMPTY , NULL , DECL area_attrs , DECL target_attr, DECL alt_attr +}, +{ "b", 0, 3, 0, 0, 0, 0, 1, "bold text style", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "base", 0, 2, 2, 1, 0, 0, 0, "document base uri ", + EMPTY , NULL , NULL , DECL target_attr, DECL href_attrs +}, +{ "basefont", 0, 2, 2, 1, 1, 1, 1, "base font size " , + EMPTY , NULL , NULL, DECL basefont_attrs, NULL +}, +{ "bdo", 0, 0, 0, 0, 0, 0, 1, "i18n bidi over-ride ", + DECL html_inline , NULL , DECL core_i18n_attrs, NULL, DECL dir_attr +}, +{ "big", 0, 3, 0, 0, 0, 0, 1, "large text style", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "blockquote", 0, 0, 0, 0, 0, 0, 0, "long quotation ", + DECL html_flow , NULL , DECL quote_attrs , NULL, NULL +}, +{ "body", 1, 1, 0, 0, 0, 0, 0, "document body ", + DECL body_contents , "div" , DECL body_attrs, DECL body_depr, NULL +}, +{ "br", 0, 2, 2, 1, 0, 0, 1, "forced line break ", + EMPTY , NULL , DECL core_attrs, DECL clear_attrs , NULL +}, +{ "button", 0, 0, 0, 0, 0, 0, 2, "push button ", + DECL html_flow MODIFIER , NULL , DECL button_attrs, NULL, NULL +}, +{ "caption", 0, 0, 0, 0, 0, 0, 0, "table caption ", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "center", 0, 3, 0, 0, 1, 1, 0, "shorthand for div align=center ", + DECL html_flow , NULL , NULL, DECL html_attrs, NULL +}, +{ "cite", 0, 0, 0, 0, 0, 0, 1, "citation", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "code", 0, 0, 0, 0, 0, 0, 1, "computer code fragment", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "col", 0, 2, 2, 1, 0, 0, 0, "table column ", + EMPTY , NULL , DECL col_attrs , NULL, NULL +}, +{ "colgroup", 0, 1, 0, 0, 0, 0, 0, "table column group ", + DECL col_elt , "col" , DECL col_attrs , NULL, NULL +}, +{ "dd", 0, 1, 0, 0, 0, 0, 0, "definition description ", + DECL html_flow , NULL , DECL html_attrs, NULL, NULL +}, +{ "del", 0, 0, 0, 0, 0, 0, 2, "deleted text ", + DECL html_flow , NULL , DECL edit_attrs , NULL, NULL +}, +{ "dfn", 0, 0, 0, 0, 0, 0, 1, "instance definition", + DECL html_inline , NULL , DECL html_attrs, NULL, NULL +}, +{ "dir", 0, 0, 0, 0, 1, 1, 0, "directory list", + DECL blockli_elt, "li" , NULL, DECL compact_attrs, NULL +}, +{ "div", 0, 0, 0, 0, 0, 0, 0, "generic language/style container", + DECL html_flow, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "dl", 0, 0, 0, 0, 0, 0, 0, "definition list ", + DECL dl_contents , "dd" , DECL html_attrs, DECL compact_attr, NULL +}, +{ "dt", 0, 1, 0, 0, 0, 0, 0, "definition term ", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "em", 0, 3, 0, 0, 0, 0, 1, "emphasis", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "fieldset", 0, 0, 0, 0, 0, 0, 0, "form control group ", + DECL fieldset_contents , NULL, DECL html_attrs, NULL, NULL +}, +{ "font", 0, 3, 0, 0, 1, 1, 1, "local change to font ", + DECL html_inline, NULL, NULL, DECL font_attrs, NULL +}, +{ "form", 0, 0, 0, 0, 0, 0, 0, "interactive form ", + DECL form_contents, "fieldset", DECL form_attrs , DECL target_attr, DECL action_attr +}, +{ "frame", 0, 2, 2, 1, 0, 2, 0, "subwindow " , + EMPTY, NULL, NULL, DECL frame_attrs, NULL +}, +{ "frameset", 0, 0, 0, 0, 0, 2, 0, "window subdivision" , + DECL frameset_contents, "noframes" , NULL , DECL frameset_attrs, NULL +}, +{ "h1", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "h2", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "h3", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "h4", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "h5", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "h6", 0, 0, 0, 0, 0, 0, 0, "heading ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "head", 1, 1, 0, 0, 0, 0, 0, "document head ", + DECL head_contents, NULL, DECL head_attrs, NULL, NULL +}, +{ "hr", 0, 2, 2, 1, 0, 0, 0, "horizontal rule " , + EMPTY, NULL, DECL html_attrs, DECL hr_depr, NULL +}, +{ "html", 1, 1, 0, 0, 0, 0, 0, "document root element ", + DECL html_content , NULL , DECL i18n_attrs, DECL version_attr, NULL +}, +{ "i", 0, 3, 0, 0, 0, 0, 1, "italic text style", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "iframe", 0, 0, 0, 0, 0, 1, 2, "inline subwindow ", + DECL html_flow, NULL, NULL, DECL iframe_attrs, NULL +}, +{ "img", 0, 2, 2, 1, 0, 0, 1, "embedded image ", + EMPTY, NULL, DECL img_attrs, DECL align_attr, DECL src_alt_attrs +}, +{ "input", 0, 2, 2, 1, 0, 0, 1, "form control ", + EMPTY, NULL, DECL input_attrs , DECL align_attr, NULL +}, +{ "ins", 0, 0, 0, 0, 0, 0, 2, "inserted text", + DECL html_flow, NULL, DECL edit_attrs, NULL, NULL +}, +{ "isindex", 0, 2, 2, 1, 1, 1, 0, "single line prompt ", + EMPTY, NULL, NULL, DECL prompt_attrs, NULL +}, +{ "kbd", 0, 0, 0, 0, 0, 0, 1, "text to be entered by the user", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "label", 0, 0, 0, 0, 0, 0, 1, "form field label text ", + DECL html_inline MODIFIER, NULL, DECL label_attrs , NULL, NULL +}, +{ "legend", 0, 0, 0, 0, 0, 0, 0, "fieldset legend ", + DECL html_inline, NULL, DECL legend_attrs , DECL align_attr, NULL +}, +{ "li", 0, 1, 1, 0, 0, 0, 0, "list item ", + DECL html_flow, NULL, DECL html_attrs, NULL, NULL +}, +{ "link", 0, 2, 2, 1, 0, 0, 0, "a media-independent link ", + EMPTY, NULL, DECL link_attrs, DECL target_attr, NULL +}, +{ "map", 0, 0, 0, 0, 0, 0, 2, "client-side image map ", + DECL map_contents , NULL, DECL html_attrs , NULL, DECL name_attr +}, +{ "menu", 0, 0, 0, 0, 1, 1, 0, "menu list ", + DECL blockli_elt , NULL, NULL, DECL compact_attrs, NULL +}, +{ "meta", 0, 2, 2, 1, 0, 0, 0, "generic metainformation ", + EMPTY, NULL, DECL meta_attrs , NULL , DECL content_attr +}, +{ "noframes", 0, 0, 0, 0, 0, 2, 0, "alternate content container for non frame-based rendering ", + DECL noframes_content, "body" , DECL html_attrs, NULL, NULL +}, +{ "noscript", 0, 0, 0, 0, 0, 0, 0, "alternate content container for non script-based rendering ", + DECL html_flow, "div", DECL html_attrs, NULL, NULL +}, +{ "object", 0, 0, 0, 0, 0, 0, 2, "generic embedded object ", + DECL object_contents , "div" , DECL object_attrs, DECL object_depr, NULL +}, +{ "ol", 0, 0, 0, 0, 0, 0, 0, "ordered list ", + DECL li_elt , "li" , DECL html_attrs, DECL ol_attrs, NULL +}, +{ "optgroup", 0, 0, 0, 0, 0, 0, 0, "option group ", + DECL option_elt , "option", DECL optgroup_attrs, NULL, DECL label_attr +}, +{ "option", 0, 1, 0, 0, 0, 0, 0, "selectable choice " , + DECL html_pcdata, NULL, DECL option_attrs, NULL, NULL +}, +{ "p", 0, 1, 0, 0, 0, 0, 0, "paragraph ", + DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL +}, +{ "param", 0, 2, 2, 1, 0, 0, 0, "named property value ", + EMPTY, NULL, DECL param_attrs, NULL, DECL name_attr +}, +{ "pre", 0, 0, 0, 0, 0, 0, 0, "preformatted text ", + DECL pre_content, NULL, DECL html_attrs, DECL width_attr, NULL +}, +{ "q", 0, 0, 0, 0, 0, 0, 1, "short inline quotation ", + DECL html_inline, NULL, DECL quote_attrs, NULL, NULL +}, +{ "s", 0, 3, 0, 0, 1, 1, 1, "strike-through text style", + DECL html_inline, NULL, NULL, DECL html_attrs, NULL +}, +{ "samp", 0, 0, 0, 0, 0, 0, 1, "sample program output, scripts, etc.", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "script", 0, 0, 0, 0, 0, 0, 2, "script statements ", + DECL html_cdata, NULL, DECL script_attrs, DECL language_attr, DECL type_attr +}, +{ "select", 0, 0, 0, 0, 0, 0, 1, "option selector ", + DECL select_content, NULL, DECL select_attrs, NULL, NULL +}, +{ "small", 0, 3, 0, 0, 0, 0, 1, "small text style", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "span", 0, 0, 0, 0, 0, 0, 1, "generic language/style container ", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "strike", 0, 3, 0, 0, 1, 1, 1, "strike-through text", + DECL html_inline, NULL, NULL, DECL html_attrs, NULL +}, +{ "strong", 0, 3, 0, 0, 0, 0, 1, "strong emphasis", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "style", 0, 0, 0, 0, 0, 0, 0, "style info ", + DECL html_cdata, NULL, DECL style_attrs, NULL, DECL type_attr +}, +{ "sub", 0, 3, 0, 0, 0, 0, 1, "subscript", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "sup", 0, 3, 0, 0, 0, 0, 1, "superscript ", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "table", 0, 0, 0, 0, 0, 0, 0, "", + DECL table_contents , "tr" , DECL table_attrs , DECL table_depr, NULL +}, +{ "tbody", 1, 0, 0, 0, 0, 0, 0, "table body ", + DECL tr_elt , "tr" , DECL talign_attrs, NULL, NULL +}, +{ "td", 0, 0, 0, 0, 0, 0, 0, "table data cell", + DECL html_flow, NULL, DECL th_td_attr, DECL th_td_depr, NULL +}, +{ "textarea", 0, 0, 0, 0, 0, 0, 1, "multi-line text field ", + DECL html_pcdata, NULL, DECL textarea_attrs, NULL, DECL rows_cols_attr +}, +{ "tfoot", 0, 1, 0, 0, 0, 0, 0, "table footer ", + DECL tr_elt , "tr" , DECL talign_attrs, NULL, NULL +}, +{ "th", 0, 1, 0, 0, 0, 0, 0, "table header cell", + DECL html_flow, NULL, DECL th_td_attr, DECL th_td_depr, NULL +}, +{ "thead", 0, 1, 0, 0, 0, 0, 0, "table header ", + DECL tr_elt , "tr" , DECL talign_attrs, NULL, NULL +}, +{ "title", 0, 0, 0, 0, 0, 0, 0, "document title ", + DECL html_pcdata, NULL, DECL i18n_attrs, NULL, NULL +}, +{ "tr", 0, 0, 0, 0, 0, 0, 0, "table row ", + DECL tr_contents , "td" , DECL talign_attrs, DECL bgcolor_attr, NULL +}, +{ "tt", 0, 3, 0, 0, 0, 0, 1, "teletype or monospaced text style", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +}, +{ "u", 0, 3, 0, 0, 1, 1, 1, "underlined text style", + DECL html_inline, NULL, NULL, DECL html_attrs, NULL +}, +{ "ul", 0, 0, 0, 0, 0, 0, 0, "unordered list ", + DECL li_elt , "li" , DECL html_attrs, DECL ul_depr, NULL +}, +{ "var", 0, 0, 0, 0, 0, 0, 1, "instance of a variable or program argument", + DECL html_inline, NULL, DECL html_attrs, NULL, NULL +} +}; + +#endif /* defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) */ + +#ifdef LIBXML_HTML_ENABLED + +/* + * start tags that imply the end of current element + */ +static const char * const htmlStartClose [] = { +"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6", + "dl", "ul", "ol", "menu", "dir", "address", "pre", + "listing", "xmp", "head", NULL, +"head", "p", NULL, +"title", "p", NULL, +"body", "head", "style", "link", "title", "p", NULL, +"frameset", "head", "style", "link", "title", "p", NULL, +"li", "p", "h1", "h2", "h3", "h4", "h5", "h6", "dl", "address", + "pre", "listing", "xmp", "head", "li", NULL, +"hr", "p", "head", NULL, +"h1", "p", "head", NULL, +"h2", "p", "head", NULL, +"h3", "p", "head", NULL, +"h4", "p", "head", NULL, +"h5", "p", "head", NULL, +"h6", "p", "head", NULL, +"dir", "p", "head", NULL, +"address", "p", "head", "ul", NULL, +"pre", "p", "head", "ul", NULL, +"listing", "p", "head", NULL, +"xmp", "p", "head", NULL, +"blockquote", "p", "head", NULL, +"dl", "p", "dt", "menu", "dir", "address", "pre", "listing", + "xmp", "head", NULL, +"dt", "p", "menu", "dir", "address", "pre", "listing", "xmp", + "head", "dd", NULL, +"dd", "p", "menu", "dir", "address", "pre", "listing", "xmp", + "head", "dt", NULL, +"ul", "p", "head", "ol", "menu", "dir", "address", "pre", + "listing", "xmp", NULL, +"ol", "p", "head", "ul", NULL, +"menu", "p", "head", "ul", NULL, +"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", NULL, +"div", "p", "head", NULL, +"noscript", "p", "head", NULL, +"center", "font", "b", "i", "p", "head", NULL, +"a", "a", NULL, +"caption", "p", NULL, +"colgroup", "caption", "colgroup", "col", "p", NULL, +"col", "caption", "col", "p", NULL, +"table", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre", + "listing", "xmp", "a", NULL, +"th", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, +"td", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, +"tr", "th", "td", "tr", "caption", "col", "colgroup", "p", NULL, +"thead", "caption", "col", "colgroup", NULL, +"tfoot", "th", "td", "tr", "caption", "col", "colgroup", "thead", + "tbody", "p", NULL, +"tbody", "th", "td", "tr", "caption", "col", "colgroup", "thead", + "tfoot", "tbody", "p", NULL, +"optgroup", "option", NULL, +"option", "option", NULL, +"fieldset", "legend", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", + "pre", "listing", "xmp", "a", NULL, +NULL +}; + +/* + * The list of HTML elements which are supposed not to have + * CDATA content and where a p element will be implied + * + + + */ +static const char * const htmlNoContentElements[] = { + "html", + "head", + "body", + NULL +}; + +/* + * The list of HTML attributes which are of content %Script; + * NOTE: when adding ones, check htmlIsScriptAttribute() since + * it assumes the name starts with 'on' + */ +static const char * const htmlScriptAttributes[] = { + "onclick", + "ondblclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmousemove", + "onmouseout", + "onkeypress", + "onkeydown", + "onkeyup", + "onload", + "onunload", + "onfocus", + "onblur", + "onsubmit", + "onrest", + "onchange", + "onselect" +}; + +/* + * This table is used by the htmlparser to know what to do with + * broken html pages. By assigning different priorities to different + * elements the parser can decide how to handle extra endtags. + * Endtags are only allowed to close elements with lower or equal + * priority. + */ + +typedef struct { + const char *name; + int priority; +} elementPriority; + +static const elementPriority htmlEndPriority [] = { + {"div", 150}, + {"td", 160}, + {"th", 160}, + {"tr", 170}, + {"thead", 180}, + {"tbody", 180}, + {"tfoot", 180}, + {"table", 190}, + {"head", 200}, + {"body", 200}, + {"html", 220}, + {NULL, 100} /* Default priority */ +}; + +/************************************************************************ + * * + * functions to handle HTML specific data * + * * + ************************************************************************/ + +/** + * htmlInitAutoClose: + * + * Initialize the htmlStartCloseIndex for fast lookup of closing tags names. + * This is not reentrant. Call xmlInitParser() once before processing in + * case of use in multithreaded programs. + */ +void +htmlInitAutoClose(void) { + int indx, i = 0; + + if (htmlStartCloseIndexinitialized) return; + + for (indx = 0;indx < 100;indx ++) htmlStartCloseIndex[indx] = NULL; + indx = 0; + while ((htmlStartClose[i] != NULL) && (indx < 100 - 1)) { + // libxslt port: (const char**) cast was added + htmlStartCloseIndex[indx++] = (const char**)&htmlStartClose[i]; + while(htmlStartClose[i++]) {}; + i++; + } + htmlStartCloseIndexinitialized = 1; +} + +/** + * htmlGetEndPriority: + * @param name The name of the element to look up the priority for. + * + * Return value: The "endtag" priority. + **/ +static int +htmlGetEndPriority (const xmlChar *name) { + int i = 0; + + while ((htmlEndPriority[i].name != NULL) && + (!xmlStrEqual((const xmlChar *)htmlEndPriority[i].name, name))) + i++; + + return(htmlEndPriority[i].priority); +} + + +/** + * htmlCheckAutoClose: + * @param newtag The new tag name + * @param oldtag The old tag name + * + * Checks whether the new tag is one of the registered valid tags for + * closing old. + * Initialize the htmlStartCloseIndex for fast lookup of closing tags names. + * + * Returns 0 if no, 1 if yes. + */ +static int +htmlCheckAutoClose(const xmlChar * newtag, const xmlChar * oldtag) +{ + int i, indx; + const char **closed = NULL; + + if (htmlStartCloseIndexinitialized == 0) + htmlInitAutoClose(); + + /* inefficient, but not a big deal */ + for (indx = 0; indx < 100; indx++) { + closed = htmlStartCloseIndex[indx]; + if (closed == NULL) + return (0); + if (xmlStrEqual(BAD_CAST * closed, newtag)) + break; + } + + i = closed - htmlStartClose; + i++; + while (htmlStartClose[i] != NULL) { + if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) { + return (1); + } + i++; + } + return (0); +} + +/** + * htmlAutoCloseOnClose: + * @param ctxt an HTML parser context + * @param newtag The new tag name + * @param force force the tag closure + * + * The HTML DTD allows an ending tag to implicitly close other tags. + */ +static void +htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) +{ + const htmlElemDesc *info; + int i, priority; + + priority = htmlGetEndPriority(newtag); + + for (i = (ctxt->nameNr - 1); i >= 0; i--) { + + if (xmlStrEqual(newtag, ctxt->nameTab[i])) + break; + /* + * A missplaced endtag can only close elements with lower + * or equal priority, so if we find an element with higher + * priority before we find an element with + * matching name, we just ignore this endtag + */ + if (htmlGetEndPriority(ctxt->nameTab[i]) > priority) + return; + } + if (i < 0) + return; + + while (!xmlStrEqual(newtag, ctxt->name)) { + info = htmlTagLookup(ctxt->name); + if ((info != NULL) && (info->endTag == 3)) { + htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, + "Opening and ending tag mismatch: %s and %s\n", + newtag, ctxt->name); + } + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, ctxt->name); + htmlnamePop(ctxt); + } +} + +/** + * htmlAutoCloseOnEnd: + * @param ctxt an HTML parser context + * + * Close all remaining tags at the end of the stream + */ +static void +htmlAutoCloseOnEnd(htmlParserCtxtPtr ctxt) +{ + int i; + + if (ctxt->nameNr == 0) + return; + for (i = (ctxt->nameNr - 1); i >= 0; i--) { + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, ctxt->name); + htmlnamePop(ctxt); + } +} + +/** + * htmlAutoClose: + * @param ctxt an HTML parser context + * @param newtag The new tag name or NULL + * + * The HTML DTD allows a tag to implicitly close other tags. + * The list is kept in htmlStartClose array. This function is + * called when a new tag has been detected and generates the + * appropriates closes if possible/needed. + * If newtag is NULL this mean we are at the end of the resource + * and we should check + */ +static void +htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) +{ + while ((newtag != NULL) && (ctxt->name != NULL) && + (htmlCheckAutoClose(newtag, ctxt->name))) { + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, ctxt->name); + htmlnamePop(ctxt); + } + if (newtag == NULL) { + htmlAutoCloseOnEnd(ctxt); + return; + } + while ((newtag == NULL) && (ctxt->name != NULL) && + ((xmlStrEqual(ctxt->name, BAD_CAST "head")) || + (xmlStrEqual(ctxt->name, BAD_CAST "body")) || + (xmlStrEqual(ctxt->name, BAD_CAST "html")))) { + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, ctxt->name); + htmlnamePop(ctxt); + } +} + +/** + * htmlAutoCloseTag: + * @param doc the HTML document + * @param name The tag name + * @param elem the HTML element + * + * The HTML DTD allows a tag to implicitly close other tags. + * The list is kept in htmlStartClose array. This function checks + * if the element or one of it's children would autoclose the + * given tag. + * + * Returns 1 if autoclose, 0 otherwise + */ +int +htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem) { + htmlNodePtr child; + + if (elem == NULL) return(1); + if (xmlStrEqual(name, elem->name)) return(0); + if (htmlCheckAutoClose(elem->name, name)) return(1); + child = elem->children; + while (child != NULL) { + if (htmlAutoCloseTag(doc, name, child)) return(1); + child = child->next; + } + return(0); +} + +/** + * htmlIsAutoClosed: + * @param doc the HTML document + * @param elem the HTML element + * + * The HTML DTD allows a tag to implicitly close other tags. + * The list is kept in htmlStartClose array. This function checks + * if a tag is autoclosed by one of it's child + * + * Returns 1 if autoclosed, 0 otherwise + */ +int +htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) { + htmlNodePtr child; + + if (elem == NULL) return(1); + child = elem->children; + while (child != NULL) { + if (htmlAutoCloseTag(doc, elem->name, child)) return(1); + child = child->next; + } + return(0); +} + +/** + * htmlCheckImplied: + * @param ctxt an HTML parser context + * @param newtag The new tag name + * + * The HTML DTD allows a tag to exists only implicitly + * called when a new tag has been detected and generates the + * appropriates implicit tags if missing + */ +static void +htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { + if (!htmlOmittedDefaultValue) + return; + if (xmlStrEqual(newtag, BAD_CAST"html")) + return; + if (ctxt->nameNr <= 0) { + htmlnamePush(ctxt, BAD_CAST"html"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL); + } + if ((xmlStrEqual(newtag, BAD_CAST"body")) || (xmlStrEqual(newtag, BAD_CAST"head"))) + return; + if ((ctxt->nameNr <= 1) && + ((xmlStrEqual(newtag, BAD_CAST"script")) || + (xmlStrEqual(newtag, BAD_CAST"style")) || + (xmlStrEqual(newtag, BAD_CAST"meta")) || + (xmlStrEqual(newtag, BAD_CAST"link")) || + (xmlStrEqual(newtag, BAD_CAST"title")) || + (xmlStrEqual(newtag, BAD_CAST"base")))) { + /* + * dropped OBJECT ... i you put it first BODY will be + * assumed ! + */ + htmlnamePush(ctxt, BAD_CAST"head"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL); + } else if ((!xmlStrEqual(newtag, BAD_CAST"noframes")) && + (!xmlStrEqual(newtag, BAD_CAST"frame")) && + (!xmlStrEqual(newtag, BAD_CAST"frameset"))) { + int i; + for (i = 0;i < ctxt->nameNr;i++) { + if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) { + return; + } + if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"head")) { + return; + } + } + + htmlnamePush(ctxt, BAD_CAST"body"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"body", NULL); + } +} + +/** + * htmlCheckParagraph + * @param ctxt an HTML parser context + * + * Check whether a p element need to be implied before inserting + * characters in the current element. + * + * Returns 1 if a paragraph has been inserted, 0 if not and -1 + * in case of error. + */ + +static int +htmlCheckParagraph(htmlParserCtxtPtr ctxt) { + const xmlChar *tag; + int i; + + if (ctxt == NULL) + return(-1); + tag = ctxt->name; + if (tag == NULL) { + htmlAutoClose(ctxt, BAD_CAST"p"); + htmlCheckImplied(ctxt, BAD_CAST"p"); + htmlnamePush(ctxt, BAD_CAST"p"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); + return(1); + } + if (!htmlOmittedDefaultValue) + return(0); + for (i = 0; htmlNoContentElements[i] != NULL; i++) { + if (xmlStrEqual(tag, BAD_CAST htmlNoContentElements[i])) { + htmlAutoClose(ctxt, BAD_CAST"p"); + htmlCheckImplied(ctxt, BAD_CAST"p"); + htmlnamePush(ctxt, BAD_CAST"p"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); + return(1); + } + } + return(0); +} + +/** + * htmlIsScriptAttribute: + * @param name an attribute name + * + * Check if an attribute is of content type Script + * + * Returns 1 is the attribute is a script 0 otherwise + */ +int +htmlIsScriptAttribute(const xmlChar *name) { + unsigned int i; + + if (name == NULL) + return(0); + /* + * all script attributes start with 'on' + */ + if ((name[0] != 'o') || (name[1] != 'n')) + return(0); + for (i = 0; + i < sizeof(htmlScriptAttributes)/sizeof(htmlScriptAttributes[0]); + i++) { + if (xmlStrEqual(name, (const xmlChar *) htmlScriptAttributes[i])) + return(1); + } + return(0); +} + +/************************************************************************ + * * + * The list of HTML predefined entities * + * * + ************************************************************************/ + + +static const htmlEntityDesc html40EntitiesTable[] = { +/* + * the 4 absolute ones, plus apostrophe. + */ +{ 34, "quot", "quotation mark = APL quote, U+0022 ISOnum" }, +{ 38, "amp", "ampersand, U+0026 ISOnum" }, +{ 39, "apos", "single quote" }, +{ 60, "lt", "less-than sign, U+003C ISOnum" }, +{ 62, "gt", "greater-than sign, U+003E ISOnum" }, + +/* + * A bunch still in the 128-255 range + * Replacing them depend really on the charset used. + */ +{ 160, "nbsp", "no-break space = non-breaking space, U+00A0 ISOnum" }, +{ 161, "iexcl","inverted exclamation mark, U+00A1 ISOnum" }, +{ 162, "cent", "cent sign, U+00A2 ISOnum" }, +{ 163, "pound","pound sign, U+00A3 ISOnum" }, +{ 164, "curren","currency sign, U+00A4 ISOnum" }, +{ 165, "yen", "yen sign = yuan sign, U+00A5 ISOnum" }, +{ 166, "brvbar","broken bar = broken vertical bar, U+00A6 ISOnum" }, +{ 167, "sect", "section sign, U+00A7 ISOnum" }, +{ 168, "uml", "diaeresis = spacing diaeresis, U+00A8 ISOdia" }, +{ 169, "copy", "copyright sign, U+00A9 ISOnum" }, +{ 170, "ordf", "feminine ordinal indicator, U+00AA ISOnum" }, +{ 171, "laquo","left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum" }, +{ 172, "not", "not sign, U+00AC ISOnum" }, +{ 173, "shy", "soft hyphen = discretionary hyphen, U+00AD ISOnum" }, +{ 174, "reg", "registered sign = registered trade mark sign, U+00AE ISOnum" }, +{ 175, "macr", "macron = spacing macron = overline = APL overbar, U+00AF ISOdia" }, +{ 176, "deg", "degree sign, U+00B0 ISOnum" }, +{ 177, "plusmn","plus-minus sign = plus-or-minus sign, U+00B1 ISOnum" }, +{ 178, "sup2", "superscript two = superscript digit two = squared, U+00B2 ISOnum" }, +{ 179, "sup3", "superscript three = superscript digit three = cubed, U+00B3 ISOnum" }, +{ 180, "acute","acute accent = spacing acute, U+00B4 ISOdia" }, +{ 181, "micro","micro sign, U+00B5 ISOnum" }, +{ 182, "para", "pilcrow sign = paragraph sign, U+00B6 ISOnum" }, +{ 183, "middot","middle dot = Georgian comma Greek middle dot, U+00B7 ISOnum" }, +{ 184, "cedil","cedilla = spacing cedilla, U+00B8 ISOdia" }, +{ 185, "sup1", "superscript one = superscript digit one, U+00B9 ISOnum" }, +{ 186, "ordm", "masculine ordinal indicator, U+00BA ISOnum" }, +{ 187, "raquo","right-pointing double angle quotation mark right pointing guillemet, U+00BB ISOnum" }, +{ 188, "frac14","vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum" }, +{ 189, "frac12","vulgar fraction one half = fraction one half, U+00BD ISOnum" }, +{ 190, "frac34","vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum" }, +{ 191, "iquest","inverted question mark = turned question mark, U+00BF ISOnum" }, +{ 192, "Agrave","latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1" }, +{ 193, "Aacute","latin capital letter A with acute, U+00C1 ISOlat1" }, +{ 194, "Acirc","latin capital letter A with circumflex, U+00C2 ISOlat1" }, +{ 195, "Atilde","latin capital letter A with tilde, U+00C3 ISOlat1" }, +{ 196, "Auml", "latin capital letter A with diaeresis, U+00C4 ISOlat1" }, +{ 197, "Aring","latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1" }, +{ 198, "AElig","latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1" }, +{ 199, "Ccedil","latin capital letter C with cedilla, U+00C7 ISOlat1" }, +{ 200, "Egrave","latin capital letter E with grave, U+00C8 ISOlat1" }, +{ 201, "Eacute","latin capital letter E with acute, U+00C9 ISOlat1" }, +{ 202, "Ecirc","latin capital letter E with circumflex, U+00CA ISOlat1" }, +{ 203, "Euml", "latin capital letter E with diaeresis, U+00CB ISOlat1" }, +{ 204, "Igrave","latin capital letter I with grave, U+00CC ISOlat1" }, +{ 205, "Iacute","latin capital letter I with acute, U+00CD ISOlat1" }, +{ 206, "Icirc","latin capital letter I with circumflex, U+00CE ISOlat1" }, +{ 207, "Iuml", "latin capital letter I with diaeresis, U+00CF ISOlat1" }, +{ 208, "ETH", "latin capital letter ETH, U+00D0 ISOlat1" }, +{ 209, "Ntilde","latin capital letter N with tilde, U+00D1 ISOlat1" }, +{ 210, "Ograve","latin capital letter O with grave, U+00D2 ISOlat1" }, +{ 211, "Oacute","latin capital letter O with acute, U+00D3 ISOlat1" }, +{ 212, "Ocirc","latin capital letter O with circumflex, U+00D4 ISOlat1" }, +{ 213, "Otilde","latin capital letter O with tilde, U+00D5 ISOlat1" }, +{ 214, "Ouml", "latin capital letter O with diaeresis, U+00D6 ISOlat1" }, +{ 215, "times","multiplication sign, U+00D7 ISOnum" }, +{ 216, "Oslash","latin capital letter O with stroke latin capital letter O slash, U+00D8 ISOlat1" }, +{ 217, "Ugrave","latin capital letter U with grave, U+00D9 ISOlat1" }, +{ 218, "Uacute","latin capital letter U with acute, U+00DA ISOlat1" }, +{ 219, "Ucirc","latin capital letter U with circumflex, U+00DB ISOlat1" }, +{ 220, "Uuml", "latin capital letter U with diaeresis, U+00DC ISOlat1" }, +{ 221, "Yacute","latin capital letter Y with acute, U+00DD ISOlat1" }, +{ 222, "THORN","latin capital letter THORN, U+00DE ISOlat1" }, +{ 223, "szlig","latin small letter sharp s = ess-zed, U+00DF ISOlat1" }, +{ 224, "agrave","latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1" }, +{ 225, "aacute","latin small letter a with acute, U+00E1 ISOlat1" }, +{ 226, "acirc","latin small letter a with circumflex, U+00E2 ISOlat1" }, +{ 227, "atilde","latin small letter a with tilde, U+00E3 ISOlat1" }, +{ 228, "auml", "latin small letter a with diaeresis, U+00E4 ISOlat1" }, +{ 229, "aring","latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1" }, +{ 230, "aelig","latin small letter ae = latin small ligature ae, U+00E6 ISOlat1" }, +{ 231, "ccedil","latin small letter c with cedilla, U+00E7 ISOlat1" }, +{ 232, "egrave","latin small letter e with grave, U+00E8 ISOlat1" }, +{ 233, "eacute","latin small letter e with acute, U+00E9 ISOlat1" }, +{ 234, "ecirc","latin small letter e with circumflex, U+00EA ISOlat1" }, +{ 235, "euml", "latin small letter e with diaeresis, U+00EB ISOlat1" }, +{ 236, "igrave","latin small letter i with grave, U+00EC ISOlat1" }, +{ 237, "iacute","latin small letter i with acute, U+00ED ISOlat1" }, +{ 238, "icirc","latin small letter i with circumflex, U+00EE ISOlat1" }, +{ 239, "iuml", "latin small letter i with diaeresis, U+00EF ISOlat1" }, +{ 240, "eth", "latin small letter eth, U+00F0 ISOlat1" }, +{ 241, "ntilde","latin small letter n with tilde, U+00F1 ISOlat1" }, +{ 242, "ograve","latin small letter o with grave, U+00F2 ISOlat1" }, +{ 243, "oacute","latin small letter o with acute, U+00F3 ISOlat1" }, +{ 244, "ocirc","latin small letter o with circumflex, U+00F4 ISOlat1" }, +{ 245, "otilde","latin small letter o with tilde, U+00F5 ISOlat1" }, +{ 246, "ouml", "latin small letter o with diaeresis, U+00F6 ISOlat1" }, +{ 247, "divide","division sign, U+00F7 ISOnum" }, +{ 248, "oslash","latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1" }, +{ 249, "ugrave","latin small letter u with grave, U+00F9 ISOlat1" }, +{ 250, "uacute","latin small letter u with acute, U+00FA ISOlat1" }, +{ 251, "ucirc","latin small letter u with circumflex, U+00FB ISOlat1" }, +{ 252, "uuml", "latin small letter u with diaeresis, U+00FC ISOlat1" }, +{ 253, "yacute","latin small letter y with acute, U+00FD ISOlat1" }, +{ 254, "thorn","latin small letter thorn with, U+00FE ISOlat1" }, +{ 255, "yuml", "latin small letter y with diaeresis, U+00FF ISOlat1" }, + +{ 338, "OElig","latin capital ligature OE, U+0152 ISOlat2" }, +{ 339, "oelig","latin small ligature oe, U+0153 ISOlat2" }, +{ 352, "Scaron","latin capital letter S with caron, U+0160 ISOlat2" }, +{ 353, "scaron","latin small letter s with caron, U+0161 ISOlat2" }, +{ 376, "Yuml", "latin capital letter Y with diaeresis, U+0178 ISOlat2" }, + +/* + * Anything below should really be kept as entities references + */ +{ 402, "fnof", "latin small f with hook = function = florin, U+0192 ISOtech" }, + +{ 710, "circ", "modifier letter circumflex accent, U+02C6 ISOpub" }, +{ 732, "tilde","small tilde, U+02DC ISOdia" }, + +{ 913, "Alpha","greek capital letter alpha, U+0391" }, +{ 914, "Beta", "greek capital letter beta, U+0392" }, +{ 915, "Gamma","greek capital letter gamma, U+0393 ISOgrk3" }, +{ 916, "Delta","greek capital letter delta, U+0394 ISOgrk3" }, +{ 917, "Epsilon","greek capital letter epsilon, U+0395" }, +{ 918, "Zeta", "greek capital letter zeta, U+0396" }, +{ 919, "Eta", "greek capital letter eta, U+0397" }, +{ 920, "Theta","greek capital letter theta, U+0398 ISOgrk3" }, +{ 921, "Iota", "greek capital letter iota, U+0399" }, +{ 922, "Kappa","greek capital letter kappa, U+039A" }, +{ 923, "Lambda", "greek capital letter lambda, U+039B ISOgrk3" }, +{ 924, "Mu", "greek capital letter mu, U+039C" }, +{ 925, "Nu", "greek capital letter nu, U+039D" }, +{ 926, "Xi", "greek capital letter xi, U+039E ISOgrk3" }, +{ 927, "Omicron","greek capital letter omicron, U+039F" }, +{ 928, "Pi", "greek capital letter pi, U+03A0 ISOgrk3" }, +{ 929, "Rho", "greek capital letter rho, U+03A1" }, +{ 931, "Sigma","greek capital letter sigma, U+03A3 ISOgrk3" }, +{ 932, "Tau", "greek capital letter tau, U+03A4" }, +{ 933, "Upsilon","greek capital letter upsilon, U+03A5 ISOgrk3" }, +{ 934, "Phi", "greek capital letter phi, U+03A6 ISOgrk3" }, +{ 935, "Chi", "greek capital letter chi, U+03A7" }, +{ 936, "Psi", "greek capital letter psi, U+03A8 ISOgrk3" }, +{ 937, "Omega","greek capital letter omega, U+03A9 ISOgrk3" }, + +{ 945, "alpha","greek small letter alpha, U+03B1 ISOgrk3" }, +{ 946, "beta", "greek small letter beta, U+03B2 ISOgrk3" }, +{ 947, "gamma","greek small letter gamma, U+03B3 ISOgrk3" }, +{ 948, "delta","greek small letter delta, U+03B4 ISOgrk3" }, +{ 949, "epsilon","greek small letter epsilon, U+03B5 ISOgrk3" }, +{ 950, "zeta", "greek small letter zeta, U+03B6 ISOgrk3" }, +{ 951, "eta", "greek small letter eta, U+03B7 ISOgrk3" }, +{ 952, "theta","greek small letter theta, U+03B8 ISOgrk3" }, +{ 953, "iota", "greek small letter iota, U+03B9 ISOgrk3" }, +{ 954, "kappa","greek small letter kappa, U+03BA ISOgrk3" }, +{ 955, "lambda","greek small letter lambda, U+03BB ISOgrk3" }, +{ 956, "mu", "greek small letter mu, U+03BC ISOgrk3" }, +{ 957, "nu", "greek small letter nu, U+03BD ISOgrk3" }, +{ 958, "xi", "greek small letter xi, U+03BE ISOgrk3" }, +{ 959, "omicron","greek small letter omicron, U+03BF NEW" }, +{ 960, "pi", "greek small letter pi, U+03C0 ISOgrk3" }, +{ 961, "rho", "greek small letter rho, U+03C1 ISOgrk3" }, +{ 962, "sigmaf","greek small letter final sigma, U+03C2 ISOgrk3" }, +{ 963, "sigma","greek small letter sigma, U+03C3 ISOgrk3" }, +{ 964, "tau", "greek small letter tau, U+03C4 ISOgrk3" }, +{ 965, "upsilon","greek small letter upsilon, U+03C5 ISOgrk3" }, +{ 966, "phi", "greek small letter phi, U+03C6 ISOgrk3" }, +{ 967, "chi", "greek small letter chi, U+03C7 ISOgrk3" }, +{ 968, "psi", "greek small letter psi, U+03C8 ISOgrk3" }, +{ 969, "omega","greek small letter omega, U+03C9 ISOgrk3" }, +{ 977, "thetasym","greek small letter theta symbol, U+03D1 NEW" }, +{ 978, "upsih","greek upsilon with hook symbol, U+03D2 NEW" }, +{ 982, "piv", "greek pi symbol, U+03D6 ISOgrk3" }, + +{ 8194, "ensp", "en space, U+2002 ISOpub" }, +{ 8195, "emsp", "em space, U+2003 ISOpub" }, +{ 8201, "thinsp","thin space, U+2009 ISOpub" }, +{ 8204, "zwnj", "zero width non-joiner, U+200C NEW RFC 2070" }, +{ 8205, "zwj", "zero width joiner, U+200D NEW RFC 2070" }, +{ 8206, "lrm", "left-to-right mark, U+200E NEW RFC 2070" }, +{ 8207, "rlm", "right-to-left mark, U+200F NEW RFC 2070" }, +{ 8211, "ndash","en dash, U+2013 ISOpub" }, +{ 8212, "mdash","em dash, U+2014 ISOpub" }, +{ 8216, "lsquo","left single quotation mark, U+2018 ISOnum" }, +{ 8217, "rsquo","right single quotation mark, U+2019 ISOnum" }, +{ 8218, "sbquo","single low-9 quotation mark, U+201A NEW" }, +{ 8220, "ldquo","left double quotation mark, U+201C ISOnum" }, +{ 8221, "rdquo","right double quotation mark, U+201D ISOnum" }, +{ 8222, "bdquo","double low-9 quotation mark, U+201E NEW" }, +{ 8224, "dagger","dagger, U+2020 ISOpub" }, +{ 8225, "Dagger","double dagger, U+2021 ISOpub" }, + +{ 8226, "bull", "bullet = black small circle, U+2022 ISOpub" }, +{ 8230, "hellip","horizontal ellipsis = three dot leader, U+2026 ISOpub" }, + +{ 8240, "permil","per mille sign, U+2030 ISOtech" }, + +{ 8242, "prime","prime = minutes = feet, U+2032 ISOtech" }, +{ 8243, "Prime","double prime = seconds = inches, U+2033 ISOtech" }, + +{ 8249, "lsaquo","single left-pointing angle quotation mark, U+2039 ISO proposed" }, +{ 8250, "rsaquo","single right-pointing angle quotation mark, U+203A ISO proposed" }, + +{ 8254, "oline","overline = spacing overscore, U+203E NEW" }, +{ 8260, "frasl","fraction slash, U+2044 NEW" }, + +{ 8364, "euro", "euro sign, U+20AC NEW" }, + +{ 8465, "image","blackletter capital I = imaginary part, U+2111 ISOamso" }, +{ 8472, "weierp","script capital P = power set = Weierstrass p, U+2118 ISOamso" }, +{ 8476, "real", "blackletter capital R = real part symbol, U+211C ISOamso" }, +{ 8482, "trade","trade mark sign, U+2122 ISOnum" }, +{ 8501, "alefsym","alef symbol = first transfinite cardinal, U+2135 NEW" }, +{ 8592, "larr", "leftwards arrow, U+2190 ISOnum" }, +{ 8593, "uarr", "upwards arrow, U+2191 ISOnum" }, +{ 8594, "rarr", "rightwards arrow, U+2192 ISOnum" }, +{ 8595, "darr", "downwards arrow, U+2193 ISOnum" }, +{ 8596, "harr", "left right arrow, U+2194 ISOamsa" }, +{ 8629, "crarr","downwards arrow with corner leftwards = carriage return, U+21B5 NEW" }, +{ 8656, "lArr", "leftwards double arrow, U+21D0 ISOtech" }, +{ 8657, "uArr", "upwards double arrow, U+21D1 ISOamsa" }, +{ 8658, "rArr", "rightwards double arrow, U+21D2 ISOtech" }, +{ 8659, "dArr", "downwards double arrow, U+21D3 ISOamsa" }, +{ 8660, "hArr", "left right double arrow, U+21D4 ISOamsa" }, + +{ 8704, "forall","for all, U+2200 ISOtech" }, +{ 8706, "part", "partial differential, U+2202 ISOtech" }, +{ 8707, "exist","there exists, U+2203 ISOtech" }, +{ 8709, "empty","empty set = null set = diameter, U+2205 ISOamso" }, +{ 8711, "nabla","nabla = backward difference, U+2207 ISOtech" }, +{ 8712, "isin", "element of, U+2208 ISOtech" }, +{ 8713, "notin","not an element of, U+2209 ISOtech" }, +{ 8715, "ni", "contains as member, U+220B ISOtech" }, +{ 8719, "prod", "n-ary product = product sign, U+220F ISOamsb" }, +{ 8721, "sum", "n-ary summation, U+2211 ISOamsb" }, +{ 8722, "minus","minus sign, U+2212 ISOtech" }, +{ 8727, "lowast","asterisk operator, U+2217 ISOtech" }, +{ 8730, "radic","square root = radical sign, U+221A ISOtech" }, +{ 8733, "prop", "proportional to, U+221D ISOtech" }, +{ 8734, "infin","infinity, U+221E ISOtech" }, +{ 8736, "ang", "angle, U+2220 ISOamso" }, +{ 8743, "and", "logical and = wedge, U+2227 ISOtech" }, +{ 8744, "or", "logical or = vee, U+2228 ISOtech" }, +{ 8745, "cap", "intersection = cap, U+2229 ISOtech" }, +{ 8746, "cup", "union = cup, U+222A ISOtech" }, +{ 8747, "int", "integral, U+222B ISOtech" }, +{ 8756, "there4","therefore, U+2234 ISOtech" }, +{ 8764, "sim", "tilde operator = varies with = similar to, U+223C ISOtech" }, +{ 8773, "cong", "approximately equal to, U+2245 ISOtech" }, +{ 8776, "asymp","almost equal to = asymptotic to, U+2248 ISOamsr" }, +{ 8800, "ne", "not equal to, U+2260 ISOtech" }, +{ 8801, "equiv","identical to, U+2261 ISOtech" }, +{ 8804, "le", "less-than or equal to, U+2264 ISOtech" }, +{ 8805, "ge", "greater-than or equal to, U+2265 ISOtech" }, +{ 8834, "sub", "subset of, U+2282 ISOtech" }, +{ 8835, "sup", "superset of, U+2283 ISOtech" }, +{ 8836, "nsub", "not a subset of, U+2284 ISOamsn" }, +{ 8838, "sube", "subset of or equal to, U+2286 ISOtech" }, +{ 8839, "supe", "superset of or equal to, U+2287 ISOtech" }, +{ 8853, "oplus","circled plus = direct sum, U+2295 ISOamsb" }, +{ 8855, "otimes","circled times = vector product, U+2297 ISOamsb" }, +{ 8869, "perp", "up tack = orthogonal to = perpendicular, U+22A5 ISOtech" }, +{ 8901, "sdot", "dot operator, U+22C5 ISOamsb" }, +{ 8968, "lceil","left ceiling = apl upstile, U+2308 ISOamsc" }, +{ 8969, "rceil","right ceiling, U+2309 ISOamsc" }, +{ 8970, "lfloor","left floor = apl downstile, U+230A ISOamsc" }, +{ 8971, "rfloor","right floor, U+230B ISOamsc" }, +{ 9001, "lang", "left-pointing angle bracket = bra, U+2329 ISOtech" }, +{ 9002, "rang", "right-pointing angle bracket = ket, U+232A ISOtech" }, +{ 9674, "loz", "lozenge, U+25CA ISOpub" }, + +{ 9824, "spades","black spade suit, U+2660 ISOpub" }, +{ 9827, "clubs","black club suit = shamrock, U+2663 ISOpub" }, +{ 9829, "hearts","black heart suit = valentine, U+2665 ISOpub" }, +{ 9830, "diams","black diamond suit, U+2666 ISOpub" }, + +}; + +/************************************************************************ + * * + * Commodity functions to handle entities * + * * + ************************************************************************/ + +/* + * Macro used to grow the current buffer. Buffer is freed in OOM. + */ // DONE: Fix xmlRealloc +#define growBuffer(buffer) { \ + void* allocTmp; \ + buffer##_size *= 2; \ + allocTmp = xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ + if (!allocTmp) { \ + xmlFree(buffer); \ + htmlErrMemory(ctxt, "growing buffer\n"); \ + return(NULL); \ + } \ + buffer = (xmlChar*) allocTmp; \ +} + +/** + * htmlEntityLookup: + * @param name the entity name + * + * Lookup the given entity in EntitiesTable + * + + * + * Returns the associated htmlEntityDescPtr if found, NULL otherwise. + */ +const htmlEntityDesc * +htmlEntityLookup(const xmlChar *name) { + unsigned int i; + + for (i = 0;i < (sizeof(html40EntitiesTable)/ + sizeof(html40EntitiesTable[0]));i++) { + if (xmlStrEqual(name, BAD_CAST html40EntitiesTable[i].name)) { + return((htmlEntityDescPtr) &html40EntitiesTable[i]); + } + } + return(NULL); +} + +/** + * htmlEntityValueLookup: + * @param value the entity's unicode value + * + * Lookup the given entity in EntitiesTable + * + + * + * Returns the associated htmlEntityDescPtr if found, NULL otherwise. + */ +const htmlEntityDesc * +htmlEntityValueLookup(unsigned int value) { + unsigned int i; + + for (i = 0;i < (sizeof(html40EntitiesTable)/ + sizeof(html40EntitiesTable[0]));i++) { + if (html40EntitiesTable[i].value >= value) { + if (html40EntitiesTable[i].value > value) + break; + return((htmlEntityDescPtr) &html40EntitiesTable[i]); + } + } + return(NULL); +} + +/** + * UTF8ToHtml: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * + * Take a block of UTF-8 chars in and try to convert it to an ASCII + * plus HTML entities block of chars out. + * + * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * as the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +int +UTF8ToHtml(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + const unsigned char* processed = in; + const unsigned char* outend; + const unsigned char* outstart = out; + const unsigned char* instart = in; + const unsigned char* inend; + unsigned int c, d; + int trailing; + + if (in == NULL) { + /* + * initialization nothing to do + */ + *outlen = 0; + *inlen = 0; + return(0); + } + inend = in + (*inlen); + outend = out + (*outlen); + while (in < inend) { + d = *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in Ascii */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) { + break; + } + + for ( ; trailing; trailing--) { + if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) + break; + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if (c < 0x80) { + if (out + 1 >= outend) + break; + *out++ = c; + } else { + int len; + const htmlEntityDesc * ent; + + /* + * Try to lookup a predefined HTML entity for it + */ + + ent = htmlEntityValueLookup(c); + if (ent == NULL) { + /* no chance for this in Ascii */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + len = strlen(ent->name); + if (out + 2 + len >= outend) + break; + *out++ = '&'; + memcpy(out, ent->name, len); + out += len; + *out++ = ';'; + } + processed = in; + } + *outlen = out - outstart; + *inlen = processed - instart; + return(0); +} + +/** + * htmlEncodeEntities: + * @param out a pointer to an array of bytes to store the result + * @param outlen the length of out + * @param in a pointer to an array of UTF-8 chars + * @param inlen the length of in + * @param quoteChar the quote character to escape (' or ") or zero. + * + * Take a block of UTF-8 chars in and try to convert it to an ASCII + * plus HTML entities block of chars out. + * + * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise + * The value of inlen after return is the number of octets consumed + * as the return value is positive, else unpredictable. + * The value of outlen after return is the number of octets consumed. + */ +int +htmlEncodeEntities(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen, int quoteChar) { + const unsigned char* processed = in; + const unsigned char* outend = out + (*outlen); + const unsigned char* outstart = out; + const unsigned char* instart = in; + const unsigned char* inend = in + (*inlen); + unsigned int c, d; + int trailing; + + while (in < inend) { + d = *in++; + if (d < 0x80) { c= d; trailing= 0; } + else if (d < 0xC0) { + /* trailing byte in leading position */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } else if (d < 0xE0) { c= d & 0x1F; trailing= 1; } + else if (d < 0xF0) { c= d & 0x0F; trailing= 2; } + else if (d < 0xF8) { c= d & 0x07; trailing= 3; } + else { + /* no chance for this in Ascii */ + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + + if (inend - in < trailing) + break; + + while (trailing--) { + if (((d= *in++) & 0xC0) != 0x80) { + *outlen = out - outstart; + *inlen = processed - instart; + return(-2); + } + c <<= 6; + c |= d & 0x3F; + } + + /* assertion: c is a single UTF-4 value */ + if ((c < 0x80) && (c != (unsigned int) quoteChar) && + (c != '&') && (c != '<') && (c != '>')) { + if (out >= outend) + break; + *out++ = c; + } else { + const htmlEntityDesc * ent; + const char *cp; + char nbuf[16]; + int len; + + /* + * Try to lookup a predefined HTML entity for it + */ + ent = htmlEntityValueLookup(c); + if (ent == NULL) { + snprintf(nbuf, sizeof(nbuf), "#%u", c); + cp = nbuf; + } + else + cp = ent->name; + len = strlen(cp); + if (out + 2 + len > outend) + break; + *out++ = '&'; + memcpy(out, cp, len); + out += len; + *out++ = ';'; + } + processed = in; + } + *outlen = out - outstart; + *inlen = processed - instart; + return(0); +} + +/************************************************************************ + * * + * Commodity functions to handle streams * + * * + ************************************************************************/ + +/** + * htmlNewInputStream: + * @param ctxt an HTML parser context + * + * Create a new input stream structure + * Returns the new input stream or NULL + */ +static htmlParserInputPtr +htmlNewInputStream(htmlParserCtxtPtr ctxt) { + htmlParserInputPtr input; + + input = (xmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput)); + if (input == NULL) { + htmlErrMemory(ctxt, "couldn't allocate a new input stream\n"); + return(NULL); + } + memset(input, 0, sizeof(htmlParserInput)); + input->filename = NULL; + input->directory = NULL; + input->base = NULL; + input->cur = NULL; + input->buf = NULL; + input->line = 1; + input->col = 1; + input->buf = NULL; + input->free = NULL; + input->version = NULL; + input->consumed = 0; + input->length = 0; + return(input); +} + + +/************************************************************************ + * * + * Commodity functions, cleanup needed ? * + * * + ************************************************************************/ +/* + * all tags allowing pc data from the html 4.01 loose dtd + * NOTE: it might be more apropriate to integrate this information + * into the html40ElementTable array but I don't want to risk any + * binary incomptibility + */ +static const char * const allowPCData[] = { + "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big", + "blockquote", "body", "button", "caption", "center", "cite", "code", + "dd", "del", "dfn", "div", "dt", "em", "font", "form", "h1", "h2", + "h3", "h4", "h5", "h6", "i", "iframe", "ins", "kbd", "label", "legend", + "li", "noframes", "noscript", "object", "p", "pre", "q", "s", "samp", + "small", "span", "strike", "strong", "td", "th", "tt", "u", "var" +}; + +/** + * areBlanks: + * @param ctxt an HTML parser context + * @param str a xmlChar * + * @param len the size of str + * + * Is this a sequence of blank chars that one can ignore ? + * + * Returns 1 if ignorable 0 otherwise. + */ + +static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { + unsigned int i; + int j; + xmlNodePtr lastChild; + + for (j = 0;j < len;j++) + if (!(IS_BLANK_CH(str[j]))) return(0); + + if (CUR == 0) return(1); + if (CUR != '<') return(0); + if (ctxt->name == NULL) + return(1); + if (xmlStrEqual(ctxt->name, BAD_CAST"html")) + return(1); + if (xmlStrEqual(ctxt->name, BAD_CAST"head")) + return(1); + if (xmlStrEqual(ctxt->name, BAD_CAST"body")) + return(1); + if (ctxt->node == NULL) return(0); + lastChild = xmlGetLastChild(ctxt->node); + while ((lastChild) && (lastChild->type == XML_COMMENT_NODE)) + lastChild = lastChild->prev; + if (lastChild == NULL) { + if ((ctxt->node->type != XML_ELEMENT_NODE) && + (ctxt->node->content != NULL)) return(0); + /* keep ws in constructs like ... ... + for all tags "b" allowing PCDATA */ + for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) { + if ( xmlStrEqual(ctxt->name, BAD_CAST allowPCData[i]) ) { + return(0); + } + } + } else if (xmlNodeIsText(lastChild)) { + return(0); + } else { + /* keep ws in constructs like

xy z

+ for all tags "p" allowing PCDATA */ + for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) { + if ( xmlStrEqual(lastChild->name, BAD_CAST allowPCData[i]) ) { + return(0); + } + } + } + return(1); +} +#endif /* defined(LIBXML_HTML_ENABLED */ + +#if defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) + +/** + * htmlErrMemory: + * @param ctxt an HTML parser context + * @param extra extra informations + * + * Handle a redefinition of attribute error + */ +static void +htmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra) +{ + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; + if (ctxt != NULL) { + ctxt->errNo = XML_ERR_NO_MEMORY; + ctxt->instate = XML_PARSER_EOF; + ctxt->disableSAX = 1; + } + if (extra) + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra, + NULL, NULL, 0, 0, + "Memory allocation failed : %s\n", extra); + else + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL, + NULL, NULL, 0, 0, "Memory allocation failed\n"); +} + +/** + * htmlNewDocNoDtD: + * @param URI URI for the dtd, or NULL + * @param ExternalID the external ID of the DTD, or NULL + * + * Creates a new HTML document without a DTD node if URI and ExternalID + * are NULL + * + * Returns a new document, do not initialize the DTD if not provided + */ +XMLPUBFUNEXPORT htmlDocPtr +htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) { + xmlDocPtr cur; + + /* + * Allocate a new document and fill the fields. + */ + cur = (xmlDocPtr) xmlMalloc(sizeof(xmlDoc)); + if (cur == NULL) { + htmlErrMemory(NULL, "HTML document creation failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xmlDoc)); + + cur->type = XML_HTML_DOCUMENT_NODE; +#ifdef XE_ENABLE_GS_CACHING + cur->cachedGs = xmlGetGlobalState(); +#endif + + //cur->version = NULL; + //cur->intSubset = NULL; + cur->doc = cur; + //cur->name = NULL; + //cur->children = NULL; + //cur->extSubset = NULL; + //cur->oldNs = NULL; + //cur->encoding = NULL; + cur->standalone = 1; + //cur->compression = 0; + //cur->ids = NULL; + //cur->refs = NULL; + //cur->_private = NULL; + + if (ExternalID || URI) + xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI); + + return(cur); +} + +/** + * htmlNewDoc: + * @param URI URI for the dtd, or NULL + * @param ExternalID the external ID of the DTD, or NULL + * + * Creates a new HTML document + * + * Returns a new document + */ +XMLPUBFUNEXPORT htmlDocPtr +htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) { + if ((URI == NULL) && (ExternalID == NULL)) + return(htmlNewDocNoDtD( + BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd", + BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN")); + + return(htmlNewDocNoDtD(URI, ExternalID)); +} + +/** + * htmlTagLookup: + * @param tag The tag name in lowercase + * + * Lookup the HTML tag in the ElementTable + * + * Returns the related htmlElemDescPtr or NULL if not found. + */ +XMLPUBFUNEXPORT const htmlElemDesc * +htmlTagLookup(const xmlChar *tag) { + unsigned int i; + + for (i = 0; i < (sizeof(html40ElementTable) / + sizeof(html40ElementTable[0]));i++) { + if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name)) + return((htmlElemDescPtr) &html40ElementTable[i]); + } + return(NULL); +} + +#endif /* defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) */ + +#if defined(LIBXML_HTML_ENABLED) + +/************************************************************************ + * * + * The parser itself * + * Relates to http://www.w3.org/TR/html40 * + * * + ************************************************************************/ + +/************************************************************************ + * * + * The parser itself * + * * + ************************************************************************/ + +static const xmlChar * htmlParseNameComplex(xmlParserCtxtPtr ctxt); + +/** + * htmlParseHTMLName: + * @param ctxt an HTML parser context + * + * parse an HTML tag or attribute name, note that we convert it to lowercase + * since HTML names are not case-sensitive. + * + * Returns the Tag Name parsed or NULL + */ + +static const xmlChar * +htmlParseHTMLName(htmlParserCtxtPtr ctxt) { + int i = 0; + xmlChar loc[HTML_PARSER_BUFFER_SIZE]; + + if (!IS_LETTER_CH(CUR) && (CUR != '_') && + (CUR != ':')) return(NULL); + + while ((i < HTML_PARSER_BUFFER_SIZE) && + ((IS_LETTER_CH(CUR)) || (IS_DIGIT_CH(CUR)) || + (CUR == ':') || (CUR == '-') || (CUR == '_'))) { + if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20; + else loc[i] = CUR; + i++; + + NEXT; + } + + return(xmlDictLookup(ctxt->dict, loc, i)); +} + +/** + * htmlParseName: + * @param ctxt an HTML parser context + * + * parse an HTML name, this routine is case sensitive. + * + * Returns the Name parsed or NULL + */ + +static const xmlChar * +htmlParseName(htmlParserCtxtPtr ctxt) { + const xmlChar *in; + const xmlChar *ret; + int count = 0; + + GROW; + + /* + * Accelerator for simple ASCII names + */ + in = ctxt->input->cur; + if (((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + (*in == '_') || (*in == ':')) { + in++; + while (((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + ((*in >= 0x30) && (*in <= 0x39)) || + (*in == '_') || (*in == '-') || + (*in == ':') || (*in == '.')) + in++; + if ((*in > 0) && (*in < 0x80)) { + count = in - ctxt->input->cur; + ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); + ctxt->input->cur = in; + ctxt->nbChars += count; + ctxt->input->col += count; + return(ret); + } + } + return(htmlParseNameComplex(ctxt)); +} + +static const xmlChar * +htmlParseNameComplex(xmlParserCtxtPtr ctxt) { + int len = 0, l; + int c; + int count = 0; + + /* + * Handler for more complex cases + */ + GROW; + c = CUR_CHAR(l); + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!IS_LETTER(c) && (c != '_') && + (c != ':'))) { + return(NULL); + } + + while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ + ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c)))) { + if (count++ > 100) { + count = 0; + GROW; + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + } + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); +} + + +/** + * htmlParseHTMLAttribute: + * @param ctxt an HTML parser context + * @param stop a char stop value + * + * parse an HTML attribute value till the stop (quote), if + * stop is 0 then it stops at the first space + * + * Returns the attribute parsed or NULL + */ + +static xmlChar * +htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { + xmlChar *buffer = NULL; + int buffer_size = 0; + xmlChar *out = NULL; + const xmlChar *name = NULL; + const xmlChar *cur = NULL; + const htmlEntityDesc * ent; + + /* + * allocate a translation buffer. + */ + buffer_size = HTML_PARSER_BUFFER_SIZE; + buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); + if (buffer == NULL) { + htmlErrMemory(ctxt, "buffer allocation failed\n"); + return(NULL); + } + out = buffer; + + /* + * Ok loop until we reach one of the ending chars + */ + while ((CUR != 0) && (CUR != stop)) { + if ((stop == 0) && (CUR == '>')) break; + if ((stop == 0) && (IS_BLANK_CH(CUR))) break; + if (CUR == '&') { + if (NXT(1) == '#') { + unsigned int c; + int bits; + + c = htmlParseCharRef(ctxt); + if (c < 0x80) + { *out++ = c; bits= -6; } + else if (c < 0x800) + { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } + else if (c < 0x10000) + { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } + else + { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } + + for ( ; bits >= 0; bits-= 6) { + *out++ = ((c >> bits) & 0x3F) | 0x80; + } + + if (out - buffer > buffer_size - 100) { + int indx = out - buffer; + + growBuffer(buffer); + out = &buffer[indx]; + } + } else { + ent = htmlParseEntityRef(ctxt, &name); + if (name == NULL) { + *out++ = '&'; + if (out - buffer > buffer_size - 100) { + int indx = out - buffer; + + growBuffer(buffer); + out = &buffer[indx]; + } + } else if (ent == NULL) { + *out++ = '&'; + cur = name; + while (*cur != 0) { + if (out - buffer > buffer_size - 100) { + int indx = out - buffer; + + growBuffer(buffer); + out = &buffer[indx]; + } + *out++ = *cur++; + } + } else { + unsigned int c; + int bits; + + if (out - buffer > buffer_size - 100) { + int indx = out - buffer; + + growBuffer(buffer); + out = &buffer[indx]; + } + c = (xmlChar)ent->value; + if (c < 0x80) + { *out++ = c; bits= -6; } + else if (c < 0x800) + { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } + else if (c < 0x10000) + { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } + else + { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } + + for ( ; bits >= 0; bits-= 6) { + *out++ = ((c >> bits) & 0x3F) | 0x80; + } + } + } + } else { + unsigned int c; + int bits, l; + + if (out - buffer > buffer_size - 100) { + int indx = out - buffer; + + growBuffer(buffer); + out = &buffer[indx]; + } + c = CUR_CHAR(l); + if (c < 0x80) + { *out++ = c; bits= -6; } + else if (c < 0x800) + { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } + else if (c < 0x10000) + { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } + else + { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } + + for ( ; bits >= 0; bits-= 6) { + *out++ = ((c >> bits) & 0x3F) | 0x80; + } + NEXT; + } + } + *out++ = 0; + return(buffer); +} + +/** + * htmlParseEntityRef: + * @param ctxt an HTML parser context + * @param str location to store the entity name + * + * parse an HTML ENTITY references + * + * [68] EntityRef ::= '&' Name ';' + * + * Returns the associated htmlEntityDescPtr if found, or NULL otherwise, + * if non-NULL *str will have to be freed by the caller. + */ +const htmlEntityDesc * +htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { + const xmlChar *name; + const htmlEntityDesc * ent = NULL; + *str = NULL; + + if (CUR == '&') { + NEXT; + name = htmlParseName(ctxt); + if (name == NULL) { + htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, + "htmlParseEntityRef: no name\n", NULL, NULL); + } else { + GROW; + if (CUR == ';') { + *str = name; + + /* + * Lookup the entity in the table. + */ + ent = htmlEntityLookup(name); + if (ent != NULL) /* OK that's ugly !!! */ + NEXT; + } else { + htmlParseErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, + "htmlParseEntityRef: expecting ';'\n", + NULL, NULL); + *str = name; + } + } + } + return(ent); +} + +/** + * htmlParseAttValue: + * @param ctxt an HTML parser context + * + * parse a value for an attribute + * Note: the parser won't do substitution of entities here, this + * will be handled later in xmlStringGetNodeList, unless it was + * asked for ctxt->replaceEntities != 0 + * + * Returns the AttValue parsed or NULL. + */ + +static xmlChar * +htmlParseAttValue(htmlParserCtxtPtr ctxt) { + xmlChar *ret = NULL; + + if (CUR == '"') { + NEXT; + ret = htmlParseHTMLAttribute(ctxt, '"'); + if (CUR != '"') { + htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue: \" expected\n", NULL, NULL); + } else + NEXT; + } else if (CUR == '\'') { + NEXT; + ret = htmlParseHTMLAttribute(ctxt, '\''); + if (CUR != '\'') { + htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue: ' expected\n", NULL, NULL); + } else + NEXT; + } else { + /* + * That's an HTMLism, the attribute value may not be quoted + */ + ret = htmlParseHTMLAttribute(ctxt, 0); + if (ret == NULL) { + htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, + "AttValue: no value found\n", NULL, NULL); + } + } + return(ret); +} + +/** + * htmlParseSystemLiteral: + * @param ctxt an HTML parser context + * + * parse an HTML Literal + * + * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") + * + * Returns the SystemLiteral parsed or NULL + */ + +static xmlChar * +htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { + const xmlChar *q; + xmlChar *ret = NULL; + + if (CUR == '"') { + NEXT; + q = CUR_PTR; + while ((IS_CHAR_CH(CUR)) && (CUR != '"')) + NEXT; + if (!IS_CHAR_CH(CUR)) { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished SystemLiteral\n", NULL, NULL); + } else { + ret = xmlStrndup(q, CUR_PTR - q); + NEXT; + } + } else if (CUR == '\'') { + NEXT; + q = CUR_PTR; + while ((IS_CHAR_CH(CUR)) && (CUR != '\'')) + NEXT; + if (!IS_CHAR_CH(CUR)) { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished SystemLiteral\n", NULL, NULL); + } else { + ret = xmlStrndup(q, CUR_PTR - q); + NEXT; + } + } else { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, + " or ' expected\n", NULL, NULL); + } + + return(ret); +} + +/** + * htmlParsePubidLiteral: + * @param ctxt an HTML parser context + * + * parse an HTML public literal + * + * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" + * + * Returns the PubidLiteral parsed or NULL. + */ + +static xmlChar * +htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { + const xmlChar *q; + xmlChar *ret = NULL; + /* + * Name ::= (Letter | '_') (NameChar)* + */ + if (CUR == '"') { + NEXT; + q = CUR_PTR; + while (IS_PUBIDCHAR_CH(CUR)) NEXT; + if (CUR != '"') { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished PubidLiteral\n", NULL, NULL); + } else { + ret = xmlStrndup(q, CUR_PTR - q); + NEXT; + } + } else if (CUR == '\'') { + NEXT; + q = CUR_PTR; + while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\'')) + NEXT; + if (CUR != '\'') { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished PubidLiteral\n", NULL, NULL); + } else { + ret = xmlStrndup(q, CUR_PTR - q); + NEXT; + } + } else { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, + "PubidLiteral \" or ' expected\n", NULL, NULL); + } + + return(ret); +} + +/** + * htmlParseScript: + * @param ctxt an HTML parser context + * + * parse the content of an HTML SCRIPT or STYLE element + * http://www.w3.org/TR/html4/sgml/dtd.html#Script + * http://www.w3.org/TR/html4/sgml/dtd.html#StyleSheet + * http://www.w3.org/TR/html4/types.html#type-script + * http://www.w3.org/TR/html4/types.html#h-6.15 + * http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.2.1 + * + * Script data ( %Script; in the DTD) can be the content of the SCRIPT + * element and the value of intrinsic event attributes. User agents must + * not evaluate script data as HTML markup but instead must pass it on as + * data to a script engine. + * NOTES: + * - The content is passed like CDATA + * - the attributes for style and scripting "onXXX" are also described + * as CDATA but SGML allows entities references in attributes so their + * processing is identical as other attributes + */ +static void +htmlParseScript(htmlParserCtxtPtr ctxt) { + xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 1]; + int nbchar = 0; + xmlChar cur; + + SHRINK; + cur = CUR; + while (IS_CHAR_CH(cur)) { + if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && + (NXT(3) == '-')) { + if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { + if (ctxt->sax->cdataBlock!= NULL) { + /* + * Insert as CDATA, which is the same as HTML_PRESERVE_NODE + */ + ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } + nbchar = 0; + htmlParseComment(ctxt); + cur = CUR; + continue; + } else if ((cur == '<') && (NXT(1) == '/')) { + /* + * One should break here, the specification is clear: + * Authors should therefore escape "= 'A') && (NXT(2) <= 'Z')) || + ((NXT(2) >= 'a') && (NXT(2) <= 'z'))) + break; /* while */ + } + buf[nbchar++] = cur; + if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { + if (ctxt->sax->cdataBlock!= NULL) { + /* + * Insert as CDATA, which is the same as HTML_PRESERVE_NODE + */ + ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + nbchar = 0; + } + NEXT; + cur = CUR; + } + if (!(IS_CHAR_CH(cur))) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in CDATA 0x%X\n", cur); + NEXT; + } + + if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { + if (ctxt->sax->cdataBlock!= NULL) { + /* + * Insert as CDATA, which is the same as HTML_PRESERVE_NODE + */ + ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } +} + + +/** + * htmlParseCharData: + * @param ctxt an HTML parser context + * + * parse a CharData section. + * if we are within a CDATA section ']]>' marks an end of section. + * + * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + */ + +static void +htmlParseCharData(htmlParserCtxtPtr ctxt) { + xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5]; + int nbchar = 0; + int cur, l; + + SHRINK; + cur = CUR_CHAR(l); + while (((cur != '<') || (ctxt->token == '<')) && + ((cur != '&') || (ctxt->token == '&')) && + (IS_CHAR(cur))) { + COPY_BUF(l,buf,nbchar,cur); + if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { + /* + * Ok the segment is to be consumed as chars. + */ + if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { + if (areBlanks(ctxt, buf, nbchar)) { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, + buf, nbchar); + } else { + htmlCheckParagraph(ctxt); + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } + nbchar = 0; + } + NEXTL(l); + cur = CUR_CHAR(l); + if (cur == 0) { + SHRINK; + GROW; + cur = CUR_CHAR(l); + } + } + if (nbchar != 0) { + /* + * Ok the segment is to be consumed as chars. + */ + if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { + if (areBlanks(ctxt, buf, nbchar)) { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); + } else { + htmlCheckParagraph(ctxt); + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } + } else { + /* + * Loop detection + */ + if (cur == 0) + ctxt->instate = XML_PARSER_EOF; + } +} + +/** + * htmlParseExternalID: + * @param ctxt an HTML parser context + * @param publicID a xmlChar** receiving PubidLiteral + * + * Parse an External ID or a Public ID + * + * [75] ExternalID ::= 'SYSTEM' S SystemLiteral + * | 'PUBLIC' S PubidLiteral S SystemLiteral + * + * [83] PublicID ::= 'PUBLIC' S PubidLiteral + * + * Returns the function returns SystemLiteral and in the second + * case publicID receives PubidLiteral, is strict is off + * it is possible to return NULL and have publicID set. + */ + +static xmlChar * +htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { + xmlChar *URI = NULL; + + if ((UPPER == 'S') && (UPP(1) == 'Y') && + (UPP(2) == 'S') && (UPP(3) == 'T') && + (UPP(4) == 'E') && (UPP(5) == 'M')) { + SKIP(6); + if (!IS_BLANK_CH(CUR)) { + htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, + "Space required after 'SYSTEM'\n", NULL, NULL); + } + SKIP_BLANKS; + URI = htmlParseSystemLiteral(ctxt); + if (URI == NULL) { + htmlParseErr(ctxt, XML_ERR_URI_REQUIRED, + "htmlParseExternalID: SYSTEM, no URI\n", NULL, NULL); + } + } else if ((UPPER == 'P') && (UPP(1) == 'U') && + (UPP(2) == 'B') && (UPP(3) == 'L') && + (UPP(4) == 'I') && (UPP(5) == 'C')) { + SKIP(6); + if (!IS_BLANK_CH(CUR)) { + htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, + "Space required after 'PUBLIC'\n", NULL, NULL); + } + SKIP_BLANKS; + *publicID = htmlParsePubidLiteral(ctxt); + if (*publicID == NULL) { + htmlParseErr(ctxt, XML_ERR_PUBID_REQUIRED, + "htmlParseExternalID: PUBLIC, no Public Identifier\n", + NULL, NULL); + } + SKIP_BLANKS; + if ((CUR == '"') || (CUR == '\'')) { + URI = htmlParseSystemLiteral(ctxt); + } + } + return(URI); +} + +/** + * htmlParseComment: + * @param ctxt an HTML parser context + * + * Parse an XML (SGML) comment + * + * [15] Comment ::= '' + */ +static void +htmlParseComment(htmlParserCtxtPtr ctxt) +{ + xmlChar* buf = NULL; + int len; + int size = HTML_PARSER_BUFFER_SIZE; + int q, ql; + int r, rl; + int cur, l; + xmlParserInputState state; + + /* + * Check that there is a comment right here. + */ + if ((RAW != '<') || (NXT(1) != '!') || + (NXT(2) != '-') || (NXT(3) != '-')) return; + + state = ctxt->instate; + ctxt->instate = XML_PARSER_COMMENT; + SHRINK; + SKIP(4); + buf = (xmlChar*) xmlMallocAtomic(size * sizeof(xmlChar)); + if (!buf) + goto OOM_exit; + // Now we must free 'buf' before returning + q = CUR_CHAR(ql); + NEXTL(ql); + r = CUR_CHAR(rl); + NEXTL(rl); + cur = CUR_CHAR(l); + len = 0; + while (IS_CHAR(cur) && + ((cur != '>') || (r != '-') || (q != '-'))) + { + if (len + 5 >= size) + { // DONE: Fix xmlRealloc + void* tmp; + size *= 2; + tmp = xmlRealloc(buf, size * sizeof(xmlChar)); + if (!tmp) + { +OOM: + xmlFree(buf); +OOM_exit: + htmlErrMemory(ctxt, "buffer allocation failed\n"); + ctxt->instate = state; + return; + } + buf = (xmlChar*) tmp; + } + COPY_BUF(ql,buf,len,q); + q = r; + ql = rl; + r = cur; + rl = l; + NEXTL(l); + cur = CUR_CHAR(l); + if (cur == 0) { + SHRINK; + GROW; + cur = CUR_CHAR(l); + } + } // end of "while good character and not the end of comment (-->)" + + buf[len] = 0; + if (!IS_CHAR(cur)) { + htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, + "Comment not terminated \n */ + base += 2; + } + } + if (incomment) { + if (base + 3 > len) + return(-1); + if ((buf[base] == '-') && (buf[base + 1] == '-') && + (buf[base + 2] == '>')) { + incomment = 0; + base += 2; + } + continue; + } + if (buf[base] == first) { + if (third != 0) { + if ((buf[base + 1] != next) || + (buf[base + 2] != third)) continue; + } else if (next != 0) { + if (buf[base + 1] != next) continue; + } + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + if (next == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c' found at %d\n", + first, base); + else if (third == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c' found at %d\n", + first, next, base); + else + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c%c' found at %d\n", + first, next, third, base); +#endif + return(base - (in->cur - in->base)); + } + } + ctxt->checkIndex = base; +#ifdef DEBUG_PUSH + if (next == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c' failed\n", first); + else if (third == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c' failed\n", first, next); + else + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c%c' failed\n", first, next, third); +#endif + return(-1); +} + +/** + * htmlParseTryOrFinish: + * @param ctxt an HTML parser context + * @param terminate last chunk indicator + * + * Try to progress on parsing + * + * Returns zero if no parsing was possible + */ +static int +htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { + int ret = 0; + htmlParserInputPtr in; + int avail = 0; + xmlChar cur, next; + +#ifdef DEBUG_PUSH + switch (ctxt->instate) { + case XML_PARSER_EOF: + xmlGenericError(xmlGenericErrorContext, + "HPP: try EOF\n"); break; + case XML_PARSER_START: + xmlGenericError(xmlGenericErrorContext, + "HPP: try START\n"); break; + case XML_PARSER_MISC: + xmlGenericError(xmlGenericErrorContext, + "HPP: try MISC\n");break; + case XML_PARSER_COMMENT: + xmlGenericError(xmlGenericErrorContext, + "HPP: try COMMENT\n");break; + case XML_PARSER_PROLOG: + xmlGenericError(xmlGenericErrorContext, + "HPP: try PROLOG\n");break; + case XML_PARSER_START_TAG: + xmlGenericError(xmlGenericErrorContext, + "HPP: try START_TAG\n");break; + case XML_PARSER_CONTENT: + xmlGenericError(xmlGenericErrorContext, + "HPP: try CONTENT\n");break; + case XML_PARSER_CDATA_SECTION: + xmlGenericError(xmlGenericErrorContext, + "HPP: try CDATA_SECTION\n");break; + case XML_PARSER_END_TAG: + xmlGenericError(xmlGenericErrorContext, + "HPP: try END_TAG\n");break; + case XML_PARSER_ENTITY_DECL: + xmlGenericError(xmlGenericErrorContext, + "HPP: try ENTITY_DECL\n");break; + case XML_PARSER_ENTITY_VALUE: + xmlGenericError(xmlGenericErrorContext, + "HPP: try ENTITY_VALUE\n");break; + case XML_PARSER_ATTRIBUTE_VALUE: + xmlGenericError(xmlGenericErrorContext, + "HPP: try ATTRIBUTE_VALUE\n");break; + case XML_PARSER_DTD: + xmlGenericError(xmlGenericErrorContext, + "HPP: try DTD\n");break; + case XML_PARSER_EPILOG: + xmlGenericError(xmlGenericErrorContext, + "HPP: try EPILOG\n");break; + case XML_PARSER_PI: + xmlGenericError(xmlGenericErrorContext, + "HPP: try PI\n");break; + case XML_PARSER_SYSTEM_LITERAL: + xmlGenericError(xmlGenericErrorContext, + "HPP: try SYSTEM_LITERAL\n");break; + } +#endif + + while (1) { + + in = ctxt->input; + if (in == NULL) break; + if (in->buf == NULL) + avail = in->length - (in->cur - in->base); + else + avail = in->buf->buffer->use - (in->cur - in->base); + if ((avail == 0) && (terminate)) { + htmlAutoCloseOnEnd(ctxt); + if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { + /* + * SAX: end of the document processing. + */ + ctxt->instate = XML_PARSER_EOF; + if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) + ctxt->sax->endDocument(ctxt->userData); + } + } + if (avail < 1) + goto done; + cur = in->cur[0]; + if (cur == 0) { + SKIP(1); + continue; + } + + switch (ctxt->instate) { + case XML_PARSER_EOF: + /* + * Document parsing is done ! + */ + goto done; + case XML_PARSER_START: + /* + * Very first chars read from the document flow. + */ + cur = in->cur[0]; + if (IS_BLANK_CH(cur)) { + SKIP_BLANKS; + if (in->buf == NULL) + avail = in->length - (in->cur - in->base); + else + avail = in->buf->buffer->use - (in->cur - in->base); + } + if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) + ctxt->sax->setDocumentLocator(ctxt->userData, + &xmlDefaultSAXLocator); + if ((ctxt->sax) && (ctxt->sax->startDocument) && + (!ctxt->disableSAX)) + ctxt->sax->startDocument(ctxt->userData); + + cur = in->cur[0]; + next = in->cur[1]; + if ((cur == '<') && (next == '!') && + (UPP(2) == 'D') && (UPP(3) == 'O') && + (UPP(4) == 'C') && (UPP(5) == 'T') && + (UPP(6) == 'Y') && (UPP(7) == 'P') && + (UPP(8) == 'E')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing internal subset\n"); +#endif + htmlParseDocTypeDecl(ctxt); + ctxt->instate = XML_PARSER_PROLOG; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering PROLOG\n"); +#endif + } else { + ctxt->instate = XML_PARSER_MISC; + } +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering MISC\n"); +#endif + break; + case XML_PARSER_MISC: + SKIP_BLANKS; + if (in->buf == NULL) + avail = in->length - (in->cur - in->base); + else + avail = in->buf->buffer->use - (in->cur - in->base); + if (avail < 2) + goto done; + cur = in->cur[0]; + next = in->cur[1]; + if ((cur == '<') && (next == '!') && + (in->cur[2] == '-') && (in->cur[3] == '-')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing Comment\n"); +#endif + htmlParseComment(ctxt); + ctxt->instate = XML_PARSER_MISC; + } else if ((cur == '<') && (next == '!') && + (UPP(2) == 'D') && (UPP(3) == 'O') && + (UPP(4) == 'C') && (UPP(5) == 'T') && + (UPP(6) == 'Y') && (UPP(7) == 'P') && + (UPP(8) == 'E')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing internal subset\n"); +#endif + htmlParseDocTypeDecl(ctxt); + ctxt->instate = XML_PARSER_PROLOG; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering PROLOG\n"); +#endif + } else if ((cur == '<') && (next == '!') && + (avail < 9)) { + goto done; + } else { + ctxt->instate = XML_PARSER_START_TAG; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering START_TAG\n"); +#endif + } + break; + case XML_PARSER_PROLOG: + SKIP_BLANKS; + if (in->buf == NULL) + avail = in->length - (in->cur - in->base); + else + avail = in->buf->buffer->use - (in->cur - in->base); + if (avail < 2) + goto done; + cur = in->cur[0]; + next = in->cur[1]; + if ((cur == '<') && (next == '!') && + (in->cur[2] == '-') && (in->cur[3] == '-')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing Comment\n"); +#endif + htmlParseComment(ctxt); + ctxt->instate = XML_PARSER_PROLOG; + } else if ((cur == '<') && (next == '!') && + (avail < 4)) { + goto done; + } else { + ctxt->instate = XML_PARSER_START_TAG; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering START_TAG\n"); +#endif + } + break; + case XML_PARSER_EPILOG: + if (in->buf == NULL) + avail = in->length - (in->cur - in->base); + else + avail = in->buf->buffer->use - (in->cur - in->base); + if (avail < 1) + goto done; + cur = in->cur[0]; + if (IS_BLANK_CH(cur)) { + htmlParseCharData(ctxt); + goto done; + } + if (avail < 2) + goto done; + next = in->cur[1]; + if ((cur == '<') && (next == '!') && + (in->cur[2] == '-') && (in->cur[3] == '-')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing Comment\n"); +#endif + htmlParseComment(ctxt); + ctxt->instate = XML_PARSER_EPILOG; + } else if ((cur == '<') && (next == '!') && + (avail < 4)) { + goto done; + } else { + ctxt->errNo = XML_ERR_DOCUMENT_END; + ctxt->wellFormed = 0; + ctxt->instate = XML_PARSER_EOF; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering EOF\n"); +#endif + if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) + ctxt->sax->endDocument(ctxt->userData); + goto done; + } + break; + case XML_PARSER_START_TAG: { + const xmlChar *name, *oldname; + int depth = ctxt->nameNr; + const htmlElemDesc * info; + + if (avail < 2) + goto done; + cur = in->cur[0]; + if (cur != '<') { + ctxt->instate = XML_PARSER_CONTENT; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + } + if (in->cur[1] == '/') { + ctxt->instate = XML_PARSER_END_TAG; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering END_TAG\n"); +#endif + break; + } + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + goto done; + + oldname = ctxt->name; + htmlParseStartTag(ctxt); + name = ctxt->name; + if (((depth == ctxt->nameNr) && + (xmlStrEqual(oldname, ctxt->name))) || + (name == NULL)) { + if (CUR == '>') + NEXT; + break; + } + + /* + * Lookup the info for that element. + */ + info = htmlTagLookup(name); + if (info == NULL) { + htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG, + "Tag %s invalid\n", name, NULL); + } + + /* + * Check for an Empty Element labeled the XML/SGML way + */ + if ((CUR == '/') && (NXT(1) == '>')) { + SKIP(2); + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, name); + oldname = htmlnamePop(ctxt); + ctxt->instate = XML_PARSER_CONTENT; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + } + + if (CUR == '>') { + NEXT; + } else { + htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, + "Couldn't find end of Start Tag %s\n", + name, NULL); + + /* + * end of parsing of this node. + */ + if (xmlStrEqual(name, ctxt->name)) { + nodePop(ctxt); + oldname = htmlnamePop(ctxt); + } + + ctxt->instate = XML_PARSER_CONTENT; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + } + + /* + * Check for an Empty Element from DTD definition + */ + if ((info != NULL) && (info->empty)) { + if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) + ctxt->sax->endElement(ctxt->userData, name); + oldname = htmlnamePop(ctxt); + } + ctxt->instate = XML_PARSER_CONTENT; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + } + case XML_PARSER_CONTENT: { + long cons; + /* + * Handle preparsed entities and charRef + */ + if (ctxt->token != 0) { + xmlChar chr[2] = { 0 , 0 } ; + + chr[0] = (xmlChar) ctxt->token; + htmlCheckParagraph(ctxt); + if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) + ctxt->sax->characters(ctxt->userData, chr, 1); + ctxt->token = 0; + ctxt->checkIndex = 0; + } + if ((avail == 1) && (terminate)) { + cur = in->cur[0]; + if ((cur != '<') && (cur != '&')) { + if (ctxt->sax != NULL) { + if (IS_BLANK_CH(cur)) { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace( + ctxt->userData, &cur, 1); + } else { + htmlCheckParagraph(ctxt); + if (ctxt->sax->characters != NULL) + ctxt->sax->characters( + ctxt->userData, &cur, 1); + } + } + ctxt->token = 0; + ctxt->checkIndex = 0; + in->cur++; + break; + } + } + if (avail < 2) + goto done; + cur = in->cur[0]; + next = in->cur[1]; + cons = ctxt->nbChars; + if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) || + (xmlStrEqual(ctxt->name, BAD_CAST"style"))) { + /* + * Handle SCRIPT/STYLE separately + */ + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '<', '/', 0, 0) < 0)) + goto done; + htmlParseScript(ctxt); + if ((cur == '<') && (next == '/')) { + ctxt->instate = XML_PARSER_END_TAG; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering END_TAG\n"); +#endif + break; + } + } else { + /* + * Sometimes DOCTYPE arrives in the middle of the document + */ + if ((cur == '<') && (next == '!') && + (UPP(2) == 'D') && (UPP(3) == 'O') && + (UPP(4) == 'C') && (UPP(5) == 'T') && + (UPP(6) == 'Y') && (UPP(7) == 'P') && + (UPP(8) == 'E')) { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + goto done; + htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, + "Misplaced DOCTYPE declaration\n", + BAD_CAST "DOCTYPE" , NULL); + htmlParseDocTypeDecl(ctxt); + } else if ((cur == '<') && (next == '!') && + (in->cur[2] == '-') && (in->cur[3] == '-')) { + if ((!terminate) && + (htmlParseLookupSequence( + ctxt, '-', '-', '>', 1) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing Comment\n"); +#endif + htmlParseComment(ctxt); + ctxt->instate = XML_PARSER_CONTENT; + } else if ((cur == '<') && (next == '!') && (avail < 4)) { + goto done; + } else if ((cur == '<') && (next == '/')) { + ctxt->instate = XML_PARSER_END_TAG; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering END_TAG\n"); +#endif + break; + } else if (cur == '<') { + ctxt->instate = XML_PARSER_START_TAG; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering START_TAG\n"); +#endif + break; + } else if (cur == '&') { + if ((!terminate) && + (htmlParseLookupSequence(ctxt, ';', 0, 0, 0) < 0)) + goto done; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing Reference\n"); +#endif + + htmlParseReference(ctxt); + } else { + /* + * check that the text sequence is complete + * before handing out the data to the parser + * to avoid problems with erroneous end of + * data detection. + */ + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0)) + goto done; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: Parsing char data\n"); +#endif + htmlParseCharData(ctxt); + } + } + if (cons == ctxt->nbChars) { + if (ctxt->node != NULL) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "detected an error in element content\n", + NULL, NULL); + } + NEXT; + break; + } + + break; + } + case XML_PARSER_END_TAG: + if (avail < 2) + goto done; + if ((!terminate) && + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + goto done; + htmlParseEndTag(ctxt); + if (ctxt->nameNr == 0) { + ctxt->instate = XML_PARSER_EPILOG; + } else { + ctxt->instate = XML_PARSER_CONTENT; + } + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_CDATA_SECTION: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == CDATA\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_DTD: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == DTD\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_COMMENT: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == COMMENT\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_PI: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == PI\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_ENTITY_DECL: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == ENTITY_DECL\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_ENTITY_VALUE: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == ENTITY_VALUE\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering DTD\n"); +#endif + break; + case XML_PARSER_ATTRIBUTE_VALUE: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == ATTRIBUTE_VALUE\n", + NULL, NULL); + ctxt->instate = XML_PARSER_START_TAG; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering START_TAG\n"); +#endif + break; + case XML_PARSER_SYSTEM_LITERAL: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == XML_PARSER_SYSTEM_LITERAL\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_IGNORE: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == XML_PARSER_IGNORE\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + case XML_PARSER_PUBLIC_LITERAL: + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "HPP: internal error, state == XML_PARSER_LITERAL\n", + NULL, NULL); + ctxt->instate = XML_PARSER_CONTENT; + ctxt->checkIndex = 0; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, + "HPP: entering CONTENT\n"); +#endif + break; + + } + } +done: + if ((avail == 0) && (terminate)) { + htmlAutoCloseOnEnd(ctxt); + if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { + /* + * SAX: end of the document processing. + */ + ctxt->instate = XML_PARSER_EOF; + if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) + ctxt->sax->endDocument(ctxt->userData); + } + } + if ((ctxt->myDoc != NULL) && + ((terminate) || (ctxt->instate == XML_PARSER_EOF) || + (ctxt->instate == XML_PARSER_EPILOG))) { + xmlDtdPtr dtd; + dtd = xmlGetIntSubset(ctxt->myDoc); + if (dtd == NULL) + ctxt->myDoc->intSubset = + xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html", + BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN", + BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd"); + } +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, "HPP: done %d\n", ret); +#endif + return(ret); +} + +/** + * htmlParseChunk: + * @param ctxt an HTML parser context + * @param chunk an char array + * @param size the size in byte of the chunk + * @param terminate last chunk indicator + * + * Parse a Chunk of memory + * + * Returns zero if no error, the xmlParserErrors otherwise. + */ +int +htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, + int terminate) { + if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && + (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { + int base = ctxt->input->base - ctxt->input->buf->buffer->content; + int cur = ctxt->input->cur - ctxt->input->base; + + xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + ctxt->input->base = ctxt->input->buf->buffer->content + base; + ctxt->input->cur = ctxt->input->base + cur; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); +#endif + +#if 0 + if ((terminate) || (ctxt->input->buf->buffer->use > 80)) + htmlParseTryOrFinish(ctxt, terminate); +#endif + } else if (ctxt->instate != XML_PARSER_EOF) { + if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { + xmlParserInputBufferPtr in = ctxt->input->buf; + if ((in->encoder != NULL) && (in->buffer != NULL) && + (in->raw != NULL)) { + int nbchars; + + nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); + if (nbchars < 0) { + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "encoder error\n", NULL, NULL); + return(XML_ERR_INVALID_ENCODING); + } + } + } + } + htmlParseTryOrFinish(ctxt, terminate); + if (terminate) { + if ((ctxt->instate != XML_PARSER_EOF) && + (ctxt->instate != XML_PARSER_EPILOG) && + (ctxt->instate != XML_PARSER_MISC)) { + ctxt->errNo = XML_ERR_DOCUMENT_END; + ctxt->wellFormed = 0; + } + if (ctxt->instate != XML_PARSER_EOF) { + if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) + ctxt->sax->endDocument(ctxt->userData); + } + ctxt->instate = XML_PARSER_EOF; + } + return((xmlParserErrors) ctxt->errNo); +} +#endif /* LIBXML_PUSH_ENABLED */ + +/************************************************************************ + * * + * User entry points * + * * + ************************************************************************/ + +/** + * htmlCreatePushParserCtxt: + * @param sax a SAX handler + * @param user_data The user data returned on SAX callbacks + * @param chunk a pointer to an array of chars + * @param size number of chars in the array + * @param filename an optional file name or URI + * @param enc an optional encoding + * + * Create a parser context for using the HTML parser in push mode + * The value of filename is used for fetching external entities + * and error/warning reports. + * + * Returns the new parser context or NULL + */ +htmlParserCtxtPtr +htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, + const char *chunk, int size, const char *filename, + xmlCharEncoding enc) { + htmlParserCtxtPtr ctxt; + htmlParserInputPtr inputStream; + xmlParserInputBufferPtr buf; + + xmlInitParser(); + + buf = xmlAllocParserInputBuffer(enc); + if (buf == NULL) return(NULL); + + ctxt = htmlNewParserCtxt(); + if (ctxt == NULL) { + xmlFreeParserInputBuffer(buf); + return(NULL); + } + if(enc==XML_CHAR_ENCODING_UTF8 || buf->encoder) + ctxt->charset=XML_CHAR_ENCODING_UTF8; + if (sax != NULL) { + if (ctxt->sax != (xmlSAXHandlerPtr) &htmlDefaultSAXHandler) + xmlFree(ctxt->sax); + ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler)); + if (ctxt->sax == NULL) { + xmlFree(buf); + xmlFree(ctxt); + return(NULL); + } + memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler)); + if (user_data != NULL) + ctxt->userData = user_data; + } + if (filename == NULL) { + ctxt->directory = NULL; + } else { + ctxt->directory = xmlParserGetDirectory(filename); + } + + inputStream = htmlNewInputStream(ctxt); + if (inputStream == NULL) { + xmlFreeParserCtxt(ctxt); + xmlFree(buf); + return(NULL); + } + + if (filename == NULL) + inputStream->filename = NULL; + else + inputStream->filename = (char *) + xmlCanonicPath((const xmlChar *) filename); + inputStream->buf = buf; + inputStream->base = inputStream->buf->buffer->content; + inputStream->cur = inputStream->buf->buffer->content; + inputStream->end = + &inputStream->buf->buffer->content[inputStream->buf->buffer->use]; + + inputPush(ctxt, inputStream); + + if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && + (ctxt->input->buf != NULL)) { + int base = ctxt->input->base - ctxt->input->buf->buffer->content; + int cur = ctxt->input->cur - ctxt->input->base; + + xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + + ctxt->input->base = ctxt->input->buf->buffer->content + base; + ctxt->input->cur = ctxt->input->base + cur; + ctxt->input->end = + &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; +#ifdef DEBUG_PUSH + xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); +#endif + } + + return(ctxt); +} + +/** + * htmlSAXParseDoc: + * @param cur a pointer to an array of xmlChar + * @param encoding a free form C string describing the HTML document encoding, or NULL + * @param sax the SAX handler block + * @param userData if using SAX, this pointer will be provided on callbacks. + * + * Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks + * to handle parse events. If sax is NULL, fallback to the default DOM + * behavior and return a tree. + * + * Returns the resulting document tree unless SAX is NULL or the document is + * not well formed. + */ + +htmlDocPtr +htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData) { + htmlDocPtr ret; + htmlParserCtxtPtr ctxt; + + xmlInitParser(); + + if (cur == NULL) return(NULL); + + + ctxt = htmlCreateDocParserCtxt(cur, encoding); + if (ctxt == NULL) return(NULL); + if (sax != NULL) { + if (ctxt->sax != NULL) xmlFree (ctxt->sax); + ctxt->sax = sax; + ctxt->userData = userData; + } + + htmlParseDocument(ctxt); + ret = ctxt->myDoc; + if (sax != NULL) { + ctxt->sax = NULL; + ctxt->userData = NULL; + } + htmlFreeParserCtxt(ctxt); + + return(ret); +} + +/** + * htmlParseDoc: + * @param cur a pointer to an array of xmlChar + * @param encoding a free form C string describing the HTML document encoding, or NULL + * + * parse an HTML in-memory document and build a tree. + * + * Returns the resulting document tree + */ + +htmlDocPtr +htmlParseDoc(xmlChar *cur, const char *encoding) { + return(htmlSAXParseDoc(cur, encoding, NULL, NULL)); +} + + +/** + * htmlCreateFileParserCtxt: + * @param filename the filename + * @param encoding a free form C string describing the HTML document encoding, or NULL + * + * Create a parser context for a file content. + * Automatic support for ZLIB/Compress compressed document is provided + * by default if found at compile-time. + * + * Returns the new parser context or NULL + */ +htmlParserCtxtPtr +htmlCreateFileParserCtxt(const char *filename, const char *encoding) +{ + htmlParserCtxtPtr ctxt; + htmlParserInputPtr inputStream; + char *canonicFilename; + /* htmlCharEncoding enc; */ + xmlChar *content, *content_line = (xmlChar *) "charset="; + + ctxt = htmlNewParserCtxt(); + if (ctxt == NULL) { + return(NULL); + } + canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename); + if (canonicFilename == NULL) { +#ifdef LIBXML_SAX1_ENABLED + if (xmlDefaultSAXHandler.error != NULL) { + xmlDefaultSAXHandler.error(NULL, "out of memory\n"); + } +#endif + xmlFreeParserCtxt(ctxt); + return(NULL); + } + + inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt); + xmlFree(canonicFilename); + if (inputStream == NULL) { + xmlFreeParserCtxt(ctxt); + return(NULL); + } + + inputPush(ctxt, inputStream); + + /* set encoding */ + if (encoding) { + content = (xmlChar*)xmlMallocAtomic (xmlStrlen(content_line) + strlen(encoding) + 1); + if (content) { + strcpy ((char *)content, (char *)content_line); + strcat ((char *)content, (char *)encoding); + htmlCheckEncoding (ctxt, content); + xmlFree (content); + } + } + + return(ctxt); +} + +/** + * htmlSAXParseFile: + * @param filename the filename + * @param encoding a free form C string describing the HTML document encoding, or NULL + * @param sax the SAX handler block + * @param userData if using SAX, this pointer will be provided on callbacks. + * + * parse an HTML file and build a tree. Automatic support for ZLIB/Compress + * compressed document is provided by default if found at compile-time. + * It use the given SAX function block to handle the parsing callback. + * If sax is NULL, fallback to the default DOM tree building routines. + * + * Returns the resulting document tree unless SAX is NULL or the document is + * not well formed. + */ + +htmlDocPtr +htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, + void *userData) { + htmlDocPtr ret; + htmlParserCtxtPtr ctxt; + htmlSAXHandlerPtr oldsax = NULL; + + xmlInitParser(); + + ctxt = htmlCreateFileParserCtxt(filename, encoding); + if (ctxt == NULL) return(NULL); + if (sax != NULL) { + oldsax = ctxt->sax; + ctxt->sax = sax; + ctxt->userData = userData; + } + + htmlParseDocument(ctxt); + + ret = ctxt->myDoc; + if (sax != NULL) { + ctxt->sax = oldsax; + ctxt->userData = NULL; + } + htmlFreeParserCtxt(ctxt); + + return(ret); +} + +/** + * htmlParseFile: + * @param filename the filename + * @param encoding a free form C string describing the HTML document encoding, or NULL + * + * parse an HTML file and build a tree. Automatic support for ZLIB/Compress + * compressed document is provided by default if found at compile-time. + * + * Returns the resulting document tree + */ + +htmlDocPtr +htmlParseFile(const char *filename, const char *encoding) { + return(htmlSAXParseFile(filename, encoding, NULL, NULL)); +} + +/** + * htmlHandleOmittedElem: + * @param val int 0 or 1 + * + * Set and return the previous value for handling HTML omitted tags. + * + * Returns the last value for 0 for no handling, 1 for auto insertion. + */ + +int +htmlHandleOmittedElem(int val) { + int old = htmlOmittedDefaultValue; + + + return(old); +} + +/** + * htmlElementAllowedHere: + * @param parent HTML parent element + * @param elt HTML element + * + * Checks whether an HTML element may be a direct child of a parent element. + * Note - doesn't check for deprecated elements + * + * Returns 1 if allowed; 0 otherwise. + */ +int +htmlElementAllowedHere(const htmlElemDesc* parent, const xmlChar* elt) { + const char** p ; + + if ( ! elt || ! parent || ! parent->subelts ) + return 0 ; + + for ( p = parent->subelts; *p; ++p ) + if ( !xmlStrcmp((const xmlChar *)*p, elt) ) + return 1 ; + + return 0 ; +} +/** + * htmlElementStatusHere: + * @param parent HTML parent element + * @param elt HTML element + * + * Checks whether an HTML element may be a direct child of a parent element. + * and if so whether it is valid or deprecated. + * + * Returns one of HTML_VALID, HTML_DEPRECATED, HTML_INVALID + */ +htmlStatus +htmlElementStatusHere(const htmlElemDesc* parent, const htmlElemDesc* elt) { + if ( ! parent || ! elt ) + return HTML_INVALID ; + if ( ! htmlElementAllowedHere(parent, (const xmlChar*) elt->name ) ) + return HTML_INVALID ; + + return ( elt->dtd == 0 ) ? HTML_VALID : HTML_DEPRECATED ; +} +/** + * htmlAttrAllowed: + * @param elt HTML element + * @param attr HTML attribute + * @param legacy whether to allow deprecated attributes + * + * Checks whether an attribute is valid for an element + * Has full knowledge of Required and Deprecated attributes + * + * Returns one of HTML_REQUIRED, HTML_VALID, HTML_DEPRECATED, HTML_INVALID + */ +htmlStatus +htmlAttrAllowed(const htmlElemDesc* elt, const xmlChar* attr, int legacy) { + const char** p ; + + if ( !elt || ! attr ) + return HTML_INVALID ; + + if ( elt->attrs_req ) + for ( p = elt->attrs_req; *p; ++p) + if ( !xmlStrcmp((const xmlChar*)*p, attr) ) + return HTML_REQUIRED ; + + if ( elt->attrs_opt ) + for ( p = elt->attrs_opt; *p; ++p) + if ( !xmlStrcmp((const xmlChar*)*p, attr) ) + return HTML_VALID ; + + if ( legacy && elt->attrs_depr ) + for ( p = elt->attrs_depr; *p; ++p) + if ( !xmlStrcmp((const xmlChar*)*p, attr) ) + return HTML_DEPRECATED ; + + return HTML_INVALID ; +} +/** + * htmlNodeStatus: + * @param node an htmlNodePtr in a tree + * @param legacy whether to allow deprecated elements (YES is faster here + * for Element nodes) + * + * Checks whether the tree node is valid. Experimental (the author + * only uses the HTML enhancements in a SAX parser) + * + * Return: for Element nodes, a return from htmlElementAllowedHere (if + * legacy allowed) or htmlElementStatusHere (otherwise). + * for Attribute nodes, a return from htmlAttrAllowed + * for other nodes, HTML_NA (no checks performed) + */ +htmlStatus +htmlNodeStatus(const htmlNodePtr node, int legacy) { + if ( ! node ) + return HTML_INVALID ; + + switch ( node->type ) { + case XML_ELEMENT_NODE: + return legacy + ? ( htmlElementAllowedHere ( + htmlTagLookup(node->parent->name) , node->name + ) ? HTML_VALID : HTML_INVALID ) + : htmlElementStatusHere( + htmlTagLookup(node->parent->name) , + htmlTagLookup(node->name) ) + ; + case XML_ATTRIBUTE_NODE: + return htmlAttrAllowed( + htmlTagLookup(node->parent->name) , node->name, legacy) ; + default: return HTML_NA ; + } +} +/************************************************************************ + * * + * New set (2.6.0) of simpler and more flexible APIs * + * * + ************************************************************************/ +/** + * DICT_FREE: + * @param str a string + * + * Free a string if it is not owned by the "dict" dictionnary in the + * current scope + */ +#define DICT_FREE(str) \ + if ((str) && ((!dict) || \ + (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ + xmlFree((char *)(str)); + +/** + * htmlCtxtReset: + * @param ctxt an HTML parser context + * + * Reset a parser context + */ +void +htmlCtxtReset(htmlParserCtxtPtr ctxt) +{ + xmlParserInputPtr input; + xmlDictPtr dict = ctxt->dict; + + while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ + xmlFreeInputStream(input); + } + ctxt->inputNr = 0; + ctxt->input = NULL; + + ctxt->spaceNr = 0; + ctxt->spaceTab[0] = -1; + ctxt->space = &ctxt->spaceTab[0]; + + + ctxt->nodeNr = 0; + ctxt->node = NULL; + + ctxt->nameNr = 0; + ctxt->name = NULL; + + DICT_FREE(ctxt->version); + ctxt->version = NULL; + DICT_FREE(ctxt->encoding); + ctxt->encoding = NULL; + DICT_FREE(ctxt->directory); + ctxt->directory = NULL; + DICT_FREE(ctxt->extSubURI); + ctxt->extSubURI = NULL; + DICT_FREE(ctxt->extSubSystem); + ctxt->extSubSystem = NULL; + if (ctxt->myDoc != NULL) + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + + ctxt->standalone = -1; + ctxt->hasExternalSubset = 0; + ctxt->hasPErefs = 0; + ctxt->html = 1; + ctxt->external = 0; + ctxt->instate = XML_PARSER_START; + ctxt->token = 0; + + ctxt->wellFormed = 1; + ctxt->nsWellFormed = 1; + ctxt->valid = 1; + ctxt->vctxt.userData = ctxt; + ctxt->vctxt.error = xmlParserValidityError; + ctxt->vctxt.warning = xmlParserValidityWarning; + ctxt->record_info = 0; + ctxt->nbChars = 0; + ctxt->checkIndex = 0; + ctxt->inSubset = 0; + ctxt->errNo = XML_ERR_OK; + ctxt->depth = 0; + ctxt->charset = XML_CHAR_ENCODING_UTF8; + ctxt->catalogs = NULL; + xmlInitNodeInfoSeq(&ctxt->node_seq); + + if (ctxt->attsDefault != NULL) { + xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); + ctxt->attsDefault = NULL; + } + if (ctxt->attsSpecial != NULL) { + xmlHashFree(ctxt->attsSpecial, NULL); + ctxt->attsSpecial = NULL; + } +} + +/** + * htmlCtxtUseOptions: + * @param ctxt an HTML parser context + * @param options a combination of htmlParserOption(s) + * + * Applies the options to the parser context + * + * Returns 0 in case of success, the set of unknown or unimplemented options + * in case of error. + */ +int +htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) +{ + if (options & HTML_PARSE_NOWARNING) { + ctxt->sax->warning = NULL; + ctxt->vctxt.warning = NULL; + options -= XML_PARSE_NOWARNING; + ctxt->options |= XML_PARSE_NOWARNING; + } + if (options & HTML_PARSE_NOERROR) { + ctxt->sax->error = NULL; + ctxt->vctxt.error = NULL; + ctxt->sax->fatalError = NULL; + options -= XML_PARSE_NOERROR; + ctxt->options |= XML_PARSE_NOERROR; + } + if (options & HTML_PARSE_PEDANTIC) { + ctxt->pedantic = 1; + options -= XML_PARSE_PEDANTIC; + ctxt->options |= XML_PARSE_PEDANTIC; + } else + ctxt->pedantic = 0; + if (options & XML_PARSE_NOBLANKS) { + ctxt->keepBlanks = 0; + ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; + options -= XML_PARSE_NOBLANKS; + ctxt->options |= XML_PARSE_NOBLANKS; + } else + ctxt->keepBlanks = 1; + ctxt->dictNames = 0; + return (options); +} + +/** + * htmlDoRead: + * @param ctxt an HTML parser context + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * @param reuse keep the context for reuse + * + * Common front-end for the htmlRead functions + * + * Returns the resulting document tree or NULL + */ +static htmlDocPtr +htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding, + int options, int reuse) +{ + htmlDocPtr ret; + + htmlCtxtUseOptions(ctxt, options); + ctxt->html = 1; + if (encoding != NULL) { + xmlCharEncodingHandlerPtr hdlr; + + hdlr = xmlFindCharEncodingHandler(encoding); + if (hdlr != NULL) + xmlSwitchToEncoding(ctxt, hdlr); + } + if ((URL != NULL) && (ctxt->input != NULL) && + (ctxt->input->filename == NULL)) + ctxt->input->filename = (char *) xmlStrdup((const xmlChar *) URL); + htmlParseDocument(ctxt); + ret = ctxt->myDoc; + ctxt->myDoc = NULL; + if (!reuse) { + if ((ctxt->dictNames) && + (ret != NULL) && + (ret->dict == ctxt->dict)) + ctxt->dict = NULL; + xmlFreeParserCtxt(ctxt); + } + return (ret); +} + +/** + * htmlReadDoc: + * @param cur a pointer to a zero terminated string + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML in-memory document and build a tree. + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int options) +{ + htmlParserCtxtPtr ctxt; + + if (cur == NULL) + return (NULL); + + ctxt = xmlCreateDocParserCtxt(cur, sizeof(cur)); + if (ctxt == NULL) + return (NULL); + return (htmlDoRead(ctxt, URL, encoding, options, 0)); +} + +/** + * htmlReadFile: + * @param filename a file or URL + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML file from the filesystem or the network. + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlReadFile(const char *filename, const char *encoding, int options) +{ + htmlParserCtxtPtr ctxt; + + ctxt = htmlCreateFileParserCtxt(filename, encoding); + if (ctxt == NULL) + return (NULL); + return (htmlDoRead(ctxt, NULL, NULL, options, 0)); +} + +/** + * htmlReadMemory: + * @param buffer a pointer to a char array + * @param size the size of the array + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML in-memory document and build a tree. + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlReadMemory(const char *buffer, int size, const char *URL, const char *encoding, int options) +{ + htmlParserCtxtPtr ctxt; + + ctxt = xmlCreateMemoryParserCtxt(buffer, size); + if (ctxt == NULL) + return (NULL); + return (htmlDoRead(ctxt, URL, encoding, options, 0)); +} + +/** + * htmlReadFd: + * @param fd an open file descriptor + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML from a file descriptor and build a tree. + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlReadFd(int fd, const char *URL, const char *encoding, int options) +{ + htmlParserCtxtPtr ctxt; + xmlParserInputBufferPtr input; + xmlParserInputPtr stream; + + if (fd < 0) + return (NULL); + + input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); + if (input == NULL) + return (NULL); + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + xmlFreeParserInputBuffer(input); + return (NULL); + } + stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); + if (stream == NULL) { + xmlFreeParserInputBuffer(input); + xmlFreeParserCtxt(ctxt); + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 0)); +} + +/** + * htmlReadIO: + * @param ioread an I/O read function + * @param ioclose an I/O close function + * @param ioctx an I/O handler + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an HTML document from I/O functions and source and build a tree. + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, + void *ioctx, const char *URL, const char *encoding, int options) +{ + htmlParserCtxtPtr ctxt; + xmlParserInputBufferPtr input; + xmlParserInputPtr stream; + + if (ioread == NULL) + return (NULL); + + input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, + XML_CHAR_ENCODING_NONE); + if (input == NULL) + return (NULL); + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + xmlFreeParserInputBuffer(input); + return (NULL); + } + stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); + if (stream == NULL) { + xmlFreeParserInputBuffer(input); + xmlFreeParserCtxt(ctxt); + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 0)); +} + +/** + * htmlCtxtReadDoc: + * @param ctxt an HTML parser context + * @param cur a pointer to a zero terminated string + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML in-memory document and build a tree. + * This reuses the existing ctxt parser context + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur, + const char *URL, const char *encoding, int options) +{ + xmlParserInputPtr stream; + + if (cur == NULL) + return (NULL); + if (ctxt == NULL) + return (NULL); + + htmlCtxtReset(ctxt); + + stream = xmlNewStringInputStream(ctxt, cur); + if (stream == NULL) { + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 1)); +} + +/** + * htmlCtxtReadFile: + * @param ctxt an HTML parser context + * @param filename a file or URL + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML file from the filesystem or the network. + * This reuses the existing ctxt parser context + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename, + const char *encoding, int options) +{ + xmlParserInputPtr stream; + + if (filename == NULL) + return (NULL); + if (ctxt == NULL) + return (NULL); + + htmlCtxtReset(ctxt); + + stream = xmlNewInputFromFile(ctxt, filename); + if (stream == NULL) { + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, NULL, encoding, options, 1)); +} + +/** + * htmlCtxtReadMemory: + * @param ctxt an HTML parser context + * @param buffer a pointer to a char array + * @param size the size of the array + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML in-memory document and build a tree. + * This reuses the existing ctxt parser context + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size, + const char *URL, const char *encoding, int options) +{ + xmlParserInputBufferPtr input; + xmlParserInputPtr stream; + + if (ctxt == NULL) + return (NULL); + if (buffer == NULL) + return (NULL); + + htmlCtxtReset(ctxt); + + input = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE); + if (input == NULL) { + return(NULL); + } + + stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); + if (stream == NULL) { + xmlFreeParserInputBuffer(input); + return(NULL); + } + + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 1)); +} + +/** + * htmlCtxtReadFd: + * @param ctxt an HTML parser context + * @param fd an open file descriptor + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an XML from a file descriptor and build a tree. + * This reuses the existing ctxt parser context + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, + const char *URL, const char *encoding, int options) +{ + xmlParserInputBufferPtr input; + xmlParserInputPtr stream; + + if (fd < 0) + return (NULL); + if (ctxt == NULL) + return (NULL); + + htmlCtxtReset(ctxt); + + + input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); + if (input == NULL) + return (NULL); + stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); + if (stream == NULL) { + xmlFreeParserInputBuffer(input); + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 1)); +} + +/** + * htmlCtxtReadIO: + * @param ctxt an HTML parser context + * @param ioread an I/O read function + * @param ioclose an I/O close function + * @param ioctx an I/O handler + * @param URL the base URL to use for the document + * @param encoding the document encoding, or NULL + * @param options a combination of htmlParserOption(s) + * + * parse an HTML document from I/O functions and source and build a tree. + * This reuses the existing ctxt parser context + * + * Returns the resulting document tree + */ +htmlDocPtr +htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, void *ioctx, + const char *URL, + const char *encoding, int options) +{ + xmlParserInputBufferPtr input; + xmlParserInputPtr stream; + + if (ioread == NULL) + return (NULL); + if (ctxt == NULL) + return (NULL); + + htmlCtxtReset(ctxt); + + input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, + XML_CHAR_ENCODING_NONE); + if (input == NULL) + return (NULL); + stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); + if (stream == NULL) { + xmlFreeParserInputBuffer(input); + return (NULL); + } + inputPush(ctxt, stream); + return (htmlDoRead(ctxt, URL, encoding, options, 1)); +} + +#endif /* LIBXML_HTML_ENABLED */ diff -r 000000000000 -r e35f40988205 xml/libxml2libs/src/libxml2/libxml2_htmltree.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/libxml2libs/src/libxml2/libxml2_htmltree.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1222 @@ +/* + * libxml2_htmltree.c : implementation of access function for an HTML tree. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#define IN_LIBXML +#include "xmlenglibxml.h" + +#include /* for memset() only ! */ + +#ifdef HAVE_CTYPE_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#include +#include "libxml2_htmlparser.h" +#include "libxml2_htmltree.h" +#include +#include +#include +#include "libxml2_xmlerror2.h" +#include +#include +#include +#include + +#ifdef LIBXML_HTML_ENABLED + +/************************************************************************ + * * + * Getting/Setting encoding meta tags * + * * + ************************************************************************/ + +/** + * htmlGetMetaEncoding: + * @param doc the document + * + * Encoding definition lookup in the Meta tags + * + * Returns the current encoding as flagged in the HTML source + */ +const xmlChar * +htmlGetMetaEncoding(htmlDocPtr doc) { + htmlNodePtr cur; + const xmlChar *content; + const xmlChar *encoding; + + if (doc == NULL) + return(NULL); + cur = doc->children; + + /* + * Search the html + */ + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrEqual(cur->name, BAD_CAST"html")) + break; + if (xmlStrEqual(cur->name, BAD_CAST"head")) + goto found_head; + if (xmlStrEqual(cur->name, BAD_CAST"meta")) + goto found_meta; + } + cur = cur->next; + } + if (cur == NULL) + return(NULL); + cur = cur->children; + + /* + * Search the head + */ + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrEqual(cur->name, BAD_CAST"head")) + break; + if (xmlStrEqual(cur->name, BAD_CAST"meta")) + goto found_meta; + } + cur = cur->next; + } + if (cur == NULL) + return(NULL); +found_head: + cur = cur->children; + + /* + * Search the meta elements + */ +found_meta: + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrEqual(cur->name, BAD_CAST"meta")) { + xmlAttrPtr attr = cur->properties; + int http; + const xmlChar *value; + + content = NULL; + http = 0; + while (attr != NULL) { + if ((attr->children != NULL) && + (attr->children->type == XML_TEXT_NODE) && + (attr->children->next == NULL)) { + value = attr->children->content; + if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) + && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) + http = 1; + else if ((value != NULL) + && (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) + content = value; + if ((http != 0) && (content != NULL)) + goto found_content; + } + attr = attr->next; + } + } + } + cur = cur->next; + } + return(NULL); + +found_content: + encoding = xmlStrstr(content, BAD_CAST"charset="); + if (encoding == NULL) + encoding = xmlStrstr(content, BAD_CAST"Charset="); + if (encoding == NULL) + encoding = xmlStrstr(content, BAD_CAST"CHARSET="); + if (encoding != NULL) { + encoding += 8; + } else { + encoding = xmlStrstr(content, BAD_CAST"charset ="); + if (encoding == NULL) + encoding = xmlStrstr(content, BAD_CAST"Charset ="); + if (encoding == NULL) + encoding = xmlStrstr(content, BAD_CAST"CHARSET ="); + if (encoding != NULL) + encoding += 9; + } + if (encoding != NULL) { + while ((*encoding == ' ') || (*encoding == '\t')) encoding++; + } + return(encoding); +} + + +#endif /* LIBXML_HTML_ENABLED */ + +#if defined(LIBXML_HTML_ENABLED) || defined(XMLENGINE_XSLT) +/** + * htmlSetMetaEncoding: + * @param doc the document + * @param encoding the encoding string + * + * Sets the current encoding in the Meta tags + * NOTE: this will not change the document content encoding, just + * the META flag associated. + * + * Returns 0 in case of success and -1 in case of error + */ +XMLPUBFUNEXPORT int +htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { + htmlNodePtr cur, meta; + const xmlChar *content; + char newcontent[100]; + LOAD_GS_SAFE_DOC(doc) + + if (doc == NULL) + return(-1); + + if (encoding != NULL) { + snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s", + encoding); + newcontent[sizeof(newcontent) - 1] = 0; + } + + cur = doc->children; + + /* + * Search the html + */ + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrcasecmp(cur->name, BAD_CAST"html") == 0) + break; + if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) + goto found_head; + if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) + goto found_meta; + } + cur = cur->next; + } + if (cur == NULL) + return(-1); + cur = cur->children; + + /* + * Search the head + */ + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) + break; + if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) + goto found_meta; + } + cur = cur->next; + } + if (cur == NULL) + return(-1); +found_head: + if (cur->children == NULL) { + if (encoding == NULL) + return(0); + meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); + xmlAddChild(cur, meta); + xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); + xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); + if ( OOM_FLAG ) //oom set in xmlNewProp + return(-1); + return(0); + } + cur = cur->children; + +found_meta: + if (encoding != NULL) { + /* + * Create a new Meta element with the right attributes + */ + + meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); + xmlAddPrevSibling(cur, meta); + xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); + xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); + } + + /* + * Search and destroy all the remaining the meta elements carrying + * encoding informations + */ + while (cur != NULL) { + if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { + if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) { + xmlAttrPtr attr = cur->properties; + int http; + const xmlChar *value; + + content = NULL; + http = 0; + while (attr != NULL) { + if ((attr->children != NULL) && + (attr->children->type == XML_TEXT_NODE) && + (attr->children->next == NULL)) { + value = attr->children->content; + if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) + && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) + http = 1; + else + { + if ((value != NULL) && + (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) + content = value; + } + if ((http != 0) && (content != NULL)) + break; + } + attr = attr->next; + } + if ((http != 0) && (content != NULL)) { + meta = cur; + cur = cur->next; + xmlUnlinkNode(meta); + xmlFreeNode(meta); + continue; + } + + } + } + cur = cur->next; + } + return(0); +} + +/** + * booleanHTMLAttrs: + * + * These are the HTML attributes which will be output + * in minimized form, i.e.

"); +_LIT (KDataComparison4_9, "

#PCDATA ephasizedstrong"); +_LIT (KDataComparison4_10, " Biu
"); +_LIT (KDataComparison4_11, " big tiny

"); +_LIT (KDataComparison4_12, "\"alternative"); +_LIT (KDataComparison4_13, ""); +_LIT (KDataComparison4_14, "
link"); +_LIT (KDataComparison4_15, ""); +_LIT (KDataComparison4_16, "
Stuff
"); +_LIT (KDataComparison4_17, "

"); +_LIT (KDataComparison4_20, ""); + +_LIT (KDataComparison5_1, ""); +_LIT (KDataComparison5_2, ""); +_LIT (KDataComparison5_3, "   ­ $\">"); +_LIT (KDataComparison5_4, "

Quote: \"

Ampersand: &
"); +_LIT (KDataComparison5_5, "
Apos: \'

Lesser: <

Greater: >"); +_LIT (KDataComparison5_6, "

NBSP:  

S-hyp: ­
"); +_LIT (KDataComparison5_7, "
$


"); +_LIT (KDataComparison5_8, "
[[0x82 : Entities in attribute: var]]

"); + +_LIT (KDataComparison6_1, ""); +_LIT (KDataComparison6_2, "




"); +_LIT (KDataComparison6_3, "


Welcome"); +_LIT (KDataComparison6_4, "

to the

"); +_LIT (KDataComparison6_5, "Mib\'s World!

"); +_LIT (KDataComparison6_6, "

"); +_LIT (KDataComparison6_7, "

"); +_LIT (KDataComparison6_8, "

Well, that\'s pretty much it."); +_LIT (KDataComparison6_9, "



"); +_LIT (KDataComparison6_10, "Prev card"); +_LIT (KDataComparison6_11, "



"); +_LIT (KDataComparison6_12, "

"); +_LIT (KDataComparison6_13, "\"image\"

"); + +_LIT (KDataComparison7_1, ""); +_LIT (KDataComparison7_2, ""); +_LIT (KDataComparison7_3, "

"); +_LIT (KDataComparison7_4, "Sport Headlines

"); +_LIT (KDataComparison7_5, "at 14:45 on 31/5/2000

"); +_LIT (KDataComparison7_6, "TOP STORIES

"); +_LIT (KDataComparison7_7, "FOOTBALL

"); +_LIT (KDataComparison7_8, "GOLF

"); +_LIT (KDataComparison7_9, "CRICKET

"); +_LIT (KDataComparison7_10, "MOTORSPORT

"); +_LIT (KDataComparison7_11, "RUGBY UNION

"); +_LIT (KDataComparison7_12, "RUGBY LEAGUE

"); +_LIT (KDataComparison7_13, "TENNIS

"); +_LIT (KDataComparison7_14, "SNOOKER

"); +_LIT (KDataComparison7_15, "

BBC Sport programmes Alert

"); +_LIT (KDataComparison7_16, "

Sports Headlines

"); +_LIT (KDataComparison7_17, "

BBC Homepage

"); + +_LIT (KDataComparison8_1, "

"); +_LIT (KDataComparison8_4, "

1. Enter Stock Code"); +_LIT (KDataComparison8_5, "

2. Name Search

"); +_LIT (KDataComparison8_6, "

_____________

"); +_LIT (KDataComparison8_7, "Main Menu

"); +_LIT (KDataComparison8_8, "Help

"); +_LIT (KDataComparison8_9, "

Enter Stock Code

"); +_LIT (KDataComparison8_10, "[[0x80 : price.wml?s=s]]Get Quote"); +_LIT (KDataComparison8_11, "

[[0x80 : graph.wml?s=s]]Get 12 month"); +_LIT (KDataComparison8_12, "

[[0x80 : graph.wml?s=s]]Get Intraday

"); +_LIT (KDataComparison8_13, "

_____________

"); +_LIT (KDataComparison8_14, "Main Menu

"); +_LIT (KDataComparison8_15, "Help

"); +_LIT (KDataComparison8_16, "

Enter search term:"); +_LIT (KDataComparison8_17, "[[0x80 : name.wml?n=n]]Search

"); +_LIT (KDataComparison8_18, "

_____________

"); +_LIT (KDataComparison8_19, "Main Menu

"); +_LIT (KDataComparison8_20, "Help

"); + +_LIT (KDataComparison9_1, ""); +_LIT (KDataComparison9_2, ""); +_LIT (KDataComparison9_3, "

[[0x82 : Plain variable: var]]

[[0x82 : NoEsc: var]]
"); +_LIT (KDataComparison9_4, "
[[0x80 : Escape: var]]

[[0x81 : UnEsc: var]]

"); + +_LIT (KDataComparison10_1, ""); +_LIT (KDataComparison10_4, "

"); +_LIT (KDataComparison10_5, "\"Welcome

"); +_LIT (KDataComparison10_6, "

"); +_LIT (KDataComparison10_7, "» RouteWAP

"); +_LIT (KDataComparison10_8, "» Outlook Bridge

"); +_LIT (KDataComparison10_9, "» HKL Timetables

"); +_LIT (KDataComparison10_10, "» YTV Timetables

"); +_LIT (KDataComparison10_11, "» Wireless Investor

"); +_LIT (KDataComparison10_12, "» HangMan

"); +_LIT (KDataComparison10_13, "

Contact Us

"); +_LIT (KDataComparison10_14, "What\'s New

"); + +_LIT (KDataComparison11_1, ""); +_LIT (KDataComparison11_2, "







"); +_LIT (KDataComparison11_3, " Welcome

to the

"); +_LIT (KDataComparison11_4, "Mib\'s World!

"); +_LIT (KDataComparison11_5, "

"); +_LIT (KDataComparison11_6, "

Well, that\'s pretty much it.



"); +_LIT (KDataComparison11_7, "Prev card"); +_LIT (KDataComparison11_8, "



"); +_LIT (KDataComparison11_9, "

\"image\"

"); + + +static RTest test(_L("t_wbxmloomparsertests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3729 +@SYMTestCaseDesc Parsing large documents. +@SYMTestPriority Medium +@SYMTestActions Parsing large documents and comparing the output. +@SYMTestExpectedResults Parsed documents and expected output should match. +@SYMREQ REQ0000 +*/ +static void ParserTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3729 ParserTestsL tests... ")); + + __UHEAP_MARK; + + TBuf16<8000> *expectedOutput = new(ELeave) TBuf16<8000>; + CleanupStack::PushL(expectedOutput); + + CStabilityTestClass* parserTest = CStabilityTestClass::NewL(test, ETrue, KMaxChunkSize); + CleanupStack::PushL(parserTest); + + parserTest->iOutput->Zero(); + + + // Test1 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison1_1); + expectedOutput->Append(KDataComparison1_2); + expectedOutput->Append(KDataComparison1_3); + expectedOutput->Append(KDataComparison1_4); + expectedOutput->Append(KDataComparison1_5); + expectedOutput->Append(KDataComparison1_6); + expectedOutput->Append(KDataComparison1_7); + expectedOutput->Append(KDataComparison1_8); + expectedOutput->Append(KDataComparison1_9); + expectedOutput->Append(KDataComparison1_10); + expectedOutput->Append(KDataComparison1_11); + expectedOutput->Append(KDataComparison1_12); + expectedOutput->Append(KDataComparison1_13); + expectedOutput->Append(KDataComparison1_14); + expectedOutput->Append(KDataComparison1_15); + expectedOutput->Append(KDataComparison1_16); + expectedOutput->Append(KDataComparison1_17); + expectedOutput->Append(KDataComparison1_18); + expectedOutput->Append(KDataComparison1_19); + expectedOutput->Append(KDataComparison1_20); + expectedOutput->Append(KDataComparison1_21); + expectedOutput->Append(KDataComparison1_22); + + parserTest->ParseEntryL(KTestDocument1(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument1(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test2 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison2_1); + expectedOutput->Append(KDataComparison2_2); + expectedOutput->Append(KDataComparison2_3); + expectedOutput->Append(KDataComparison2_4); + expectedOutput->Append(KDataComparison2_5); + expectedOutput->Append(KDataComparison2_6); + expectedOutput->Append(KDataComparison2_7); + expectedOutput->Append(KDataComparison2_8); + expectedOutput->Append(KDataComparison2_9); + expectedOutput->Append(KDataComparison2_10); + expectedOutput->Append(KDataComparison2_11); + expectedOutput->Append(KDataComparison2_12); + expectedOutput->Append(KDataComparison2_13); + expectedOutput->Append(KDataComparison2_14); + expectedOutput->Append(KDataComparison2_15); + expectedOutput->Append(KDataComparison2_16); + expectedOutput->Append(KDataComparison2_17); + expectedOutput->Append(KDataComparison2_18); + expectedOutput->Append(KDataComparison2_19); + expectedOutput->Append(KDataComparison2_20); + expectedOutput->Append(KDataComparison2_21); + expectedOutput->Append(KDataComparison2_22); + expectedOutput->Append(KDataComparison2_23); + expectedOutput->Append(KDataComparison2_24); + expectedOutput->Append(KDataComparison2_25); + expectedOutput->Append(KDataComparison2_26); + expectedOutput->Append(KDataComparison2_27); + expectedOutput->Append(KDataComparison2_28); + expectedOutput->Append(KDataComparison2_29); + expectedOutput->Append(KDataComparison2_30); + expectedOutput->Append(KDataComparison2_31); + expectedOutput->Append(KDataComparison2_32); + expectedOutput->Append(KDataComparison2_33); + expectedOutput->Append(KDataComparison2_34); + expectedOutput->Append(KDataComparison2_35); + expectedOutput->Append(KDataComparison2_36); + expectedOutput->Append(KDataComparison2_37); + expectedOutput->Append(KDataComparison2_38); + expectedOutput->Append(KDataComparison2_39); + expectedOutput->Append(KDataComparison2_40); + expectedOutput->Append(KDataComparison2_41); + + parserTest->ParseEntryL(KTestDocument2(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument2(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test3 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison3_1); + expectedOutput->Append(KDataComparison3_2); + expectedOutput->Append(KDataComparison3_3); + expectedOutput->Append(KDataComparison3_4); + expectedOutput->Append(KDataComparison3_5); + expectedOutput->Append(KDataComparison3_6); + expectedOutput->Append(KDataComparison3_7); + expectedOutput->Append(KDataComparison3_8); + expectedOutput->Append(KDataComparison3_9); + expectedOutput->Append(KDataComparison3_10); + expectedOutput->Append(KDataComparison3_11); + expectedOutput->Append(KDataComparison3_12); + expectedOutput->Append(KDataComparison3_13); + expectedOutput->Append(KDataComparison3_14); + expectedOutput->Append(KDataComparison3_15); + expectedOutput->Append(KDataComparison3_16); + expectedOutput->Append(KDataComparison3_17); + expectedOutput->Append(KDataComparison3_18); + expectedOutput->Append(KDataComparison3_19); + expectedOutput->Append(KDataComparison3_20); + expectedOutput->Append(KDataComparison3_21); + expectedOutput->Append(KDataComparison3_22); + expectedOutput->Append(KDataComparison3_23); + expectedOutput->Append(KDataComparison3_24); + expectedOutput->Append(KDataComparison3_25); + expectedOutput->Append(KDataComparison3_26); + expectedOutput->Append(KDataComparison3_27); + expectedOutput->Append(KDataComparison3_28); + expectedOutput->Append(KDataComparison3_29); + expectedOutput->Append(KDataComparison3_30); + expectedOutput->Append(KDataComparison3_31); + expectedOutput->Append(KDataComparison3_32); + expectedOutput->Append(KDataComparison3_33); + expectedOutput->Append(KDataComparison3_34); + expectedOutput->Append(KDataComparison3_35); + expectedOutput->Append(KDataComparison3_36); + expectedOutput->Append(KDataComparison3_37); + expectedOutput->Append(KDataComparison3_38); + expectedOutput->Append(KDataComparison3_39); + expectedOutput->Append(KDataComparison3_40); + expectedOutput->Append(KDataComparison3_41); + expectedOutput->Append(KDataComparison3_42); + + parserTest->ParseEntryL(KTestDocument3(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument3(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test4 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison4_1); + expectedOutput->Append(KDataComparison4_2); + expectedOutput->Append(KDataComparison4_3); + expectedOutput->Append(KDataComparison4_4); + expectedOutput->Append(KDataComparison4_5); + expectedOutput->Append(KDataComparison4_6); + expectedOutput->Append(KDataComparison4_7); + expectedOutput->Append(KDataComparison4_8); + expectedOutput->Append(KDataComparison4_9); + expectedOutput->Append(KDataComparison4_10); + expectedOutput->Append(KDataComparison4_11); + expectedOutput->Append(KDataComparison4_12); + expectedOutput->Append(KDataComparison4_13); + expectedOutput->Append(KDataComparison4_14); + expectedOutput->Append(KDataComparison4_15); + expectedOutput->Append(KDataComparison4_16); + expectedOutput->Append(KDataComparison4_17); + expectedOutput->Append(KDataComparison4_18); + expectedOutput->Append(KDataComparison4_19); + expectedOutput->Append(KDataComparison4_20); + + parserTest->ParseEntryL(KTestDocument4(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument4(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test5 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison5_1); + expectedOutput->Append(KDataComparison5_2); + expectedOutput->Append(KDataComparison5_3); + expectedOutput->Append(KDataComparison5_4); + expectedOutput->Append(KDataComparison5_5); + expectedOutput->Append(KDataComparison5_6); + expectedOutput->Append(KDataComparison5_7); + expectedOutput->Append(KDataComparison5_8); + + parserTest->ParseEntryL(KTestDocument5(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument5(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test6 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison6_1); + expectedOutput->Append(KDataComparison6_2); + expectedOutput->Append(KDataComparison6_3); + expectedOutput->Append(KDataComparison6_4); + expectedOutput->Append(KDataComparison6_5); + expectedOutput->Append(KDataComparison6_6); + expectedOutput->Append(KDataComparison6_7); + expectedOutput->Append(KDataComparison6_8); + expectedOutput->Append(KDataComparison6_9); + expectedOutput->Append(KDataComparison6_10); + expectedOutput->Append(KDataComparison6_11); + expectedOutput->Append(KDataComparison6_12); + expectedOutput->Append(KDataComparison6_13); + + parserTest->ParseEntryL(KTestDocument6(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument6(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test7 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison7_1); + expectedOutput->Append(KDataComparison7_2); + expectedOutput->Append(KDataComparison7_3); + expectedOutput->Append(KDataComparison7_4); + expectedOutput->Append(KDataComparison7_5); + expectedOutput->Append(KDataComparison7_6); + expectedOutput->Append(KDataComparison7_7); + expectedOutput->Append(KDataComparison7_8); + expectedOutput->Append(KDataComparison7_9); + expectedOutput->Append(KDataComparison7_10); + expectedOutput->Append(KDataComparison7_11); + expectedOutput->Append(KDataComparison7_12); + expectedOutput->Append(KDataComparison7_13); + expectedOutput->Append(KDataComparison7_14); + expectedOutput->Append(KDataComparison7_15); + expectedOutput->Append(KDataComparison7_16); + expectedOutput->Append(KDataComparison7_17); + + parserTest->ParseEntryL(KTestDocument7(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument7(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test8 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison8_1); + expectedOutput->Append(KDataComparison8_2); + expectedOutput->Append(KDataComparison8_3); + expectedOutput->Append(KDataComparison8_4); + expectedOutput->Append(KDataComparison8_5); + expectedOutput->Append(KDataComparison8_6); + expectedOutput->Append(KDataComparison8_7); + expectedOutput->Append(KDataComparison8_8); + expectedOutput->Append(KDataComparison8_9); + expectedOutput->Append(KDataComparison8_10); + expectedOutput->Append(KDataComparison8_11); + expectedOutput->Append(KDataComparison8_12); + expectedOutput->Append(KDataComparison8_13); + expectedOutput->Append(KDataComparison8_14); + expectedOutput->Append(KDataComparison8_15); + expectedOutput->Append(KDataComparison8_16); + expectedOutput->Append(KDataComparison8_17); + expectedOutput->Append(KDataComparison8_18); + expectedOutput->Append(KDataComparison8_19); + expectedOutput->Append(KDataComparison8_20); + + parserTest->ParseEntryL(KTestDocument8(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument8(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test9 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison9_1); + expectedOutput->Append(KDataComparison9_2); + expectedOutput->Append(KDataComparison9_3); + expectedOutput->Append(KDataComparison9_4); + + parserTest->ParseEntryL(KTestDocument9(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument9(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test10 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison10_1); + expectedOutput->Append(KDataComparison10_2); + expectedOutput->Append(KDataComparison10_3); + expectedOutput->Append(KDataComparison10_4); + expectedOutput->Append(KDataComparison10_5); + expectedOutput->Append(KDataComparison10_6); + expectedOutput->Append(KDataComparison10_7); + expectedOutput->Append(KDataComparison10_8); + expectedOutput->Append(KDataComparison10_9); + expectedOutput->Append(KDataComparison10_10); + expectedOutput->Append(KDataComparison10_11); + expectedOutput->Append(KDataComparison10_12); + expectedOutput->Append(KDataComparison10_13); + expectedOutput->Append(KDataComparison10_14); + + parserTest->ParseEntryL(KTestDocument10(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument10(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test11 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison11_1); + expectedOutput->Append(KDataComparison11_2); + expectedOutput->Append(KDataComparison11_3); + expectedOutput->Append(KDataComparison11_4); + expectedOutput->Append(KDataComparison11_5); + expectedOutput->Append(KDataComparison11_6); + expectedOutput->Append(KDataComparison11_7); + expectedOutput->Append(KDataComparison11_8); + expectedOutput->Append(KDataComparison11_9); + + parserTest->ParseEntryL(KTestDocument11(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument11(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + + CleanupStack::PopAndDestroy(parserTest); + CleanupStack::PopAndDestroy(expectedOutput); + + __UHEAP_MARKEND; + } + +static void MainL() + { + ParserTestsL(); + } + +TInt E32Main() + { + + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + + return KErrNone; + } + diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomsiparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomsiparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmloomsiparserstabilitytests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3751 +@SYMTestCaseDesc Parsing Service Indication documents. +@SYMTestPriority Medium +@SYMTestActions Parsers .bdy files in the specified directory. +@SYMTestExpectedResults Parser should cope with parsing the files. +@SYMREQ REQ0000 +*/ +static void SiOomTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3751 SiOomTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* siTest = CStabilityTestClass::NewL(test, ETrue); + CleanupStack::PushL(siTest); + siTest->StabilityTestL(KSi1_0Directory(), KSiExt(), &CStabilityTestClass::TestWholeL); + CleanupStack::PopAndDestroy(siTest); + + CStabilityTestClass* siTestMin = CStabilityTestClass::NewL(test, ETrue, KMinChunkSize); + CleanupStack::PushL(siTestMin); + siTestMin->StabilityTestL(KSi1_0Directory(), KSiExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(siTestMin); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + SiOomTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomsyncmlparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomsyncmlparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,109 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmloomsyncmlparserstabilitytests")); + +static void DeleteTestDirL() + { + RFs fsSession; + TInt err = fsSession.Connect(); + if(err == KErrNone) + { + CleanupClosePushL(fsSession); + RDebug::Print(_L("Deleting \"%S\" directory.\n"), &KOpaqueDirectory); + CFileMan* fileMan = CFileMan::NewL(fsSession); + CleanupStack::PushL(fileMan); + TInt err = fileMan->RmDir(KOpaqueDirectory); + if(err == KErrPathNotFound) + { + err = KErrNone; + } + User::LeaveIfError(err); + CleanupStack::PopAndDestroy(fileMan); + CleanupStack::PopAndDestroy(&fsSession); + } + else + { + RDebug::Print(_L("Error %d connecting file session. Directory: %S.\n"), err, &KOpaqueDirectory); + } + } + + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3728 +@SYMTestCaseDesc OOM Testing. +@SYMTestPriority Medium +@SYMTestActions Parse some SyncML documents. +@SYMTestExpectedResults Tests should pass. +@SYMREQ REQ0000 +*/ +static void SyncmlOomTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3728 SyncmlTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* syncmlTestMaxWithOpaque = CStabilityTestClass::NewL(test, ETrue, KMaxChunkSize); + CleanupStack::PushL(syncmlTestMaxWithOpaque); + syncmlTestMaxWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncmlTestMaxWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncmlTestMaxWithOpaque); + + CStabilityTestClass* syncmlTestMax = CStabilityTestClass::NewL(test, ETrue, KMaxChunkSize); + CleanupStack::PushL(syncmlTestMax); + syncmlTestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncmlTestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncmlTestMax); + + ::DeleteTestDirL(); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + SyncmlOomTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomwmlparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomwmlparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmloomwmlparserstabilitytests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3727 +@SYMTestCaseDesc OOM Testing. +@SYMTestPriority Medium +@SYMTestActions Parsing wml documents. +@SYMTestExpectedResults Parser should be able to cope with parsing. +@SYMREQ REQ0000 +*/ +static void WmlOomTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3727 WmlOomTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* wmlTest = CStabilityTestClass::NewL(test, ETrue); + CleanupStack::PushL(wmlTest); + wmlTest->StabilityTestL(KWml1_1Directory(), KWmlcExt(), &CStabilityTestClass::TestWholeL); + CleanupStack::PopAndDestroy(wmlTest); + + CStabilityTestClass* wmlTestMid = CStabilityTestClass::NewL(test, ETrue, KMidChunkSize); + CleanupStack::PushL(wmlTestMid); + wmlTestMid->StabilityTestL(KWml1_1Directory(), KWmlcExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(wmlTestMid); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + WmlOomTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlparsertests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlparsertests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,764 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" +_LIT (KTestDocument0, "z:\\system\\XmlTest\\SyncML\\1.1\\add-to-client\\FromServer0.wbxml"); +_LIT (KTestDocument1, "z:\\system\\XmlTest\\SyncML\\1.1\\add-to-client\\FromServer1.wbxml"); +_LIT (KTestDocument2, "z:\\system\\XmlTest\\SyncML\\1.1\\add-to-server\\FromServer1.wbxml"); +_LIT (KTestDocument3, "z:\\system\\XmlTest\\SyncML\\1.1\\Atomic\\FromServer1.wbxml"); +_LIT (KTestDocument4, "z:\\system\\XmlTest\\Wml\\1.1\\AllElements.wmlc"); +_LIT (KTestDocument5, "z:\\system\\XmlTest\\Wml\\1.1\\CharEntities.wmlc"); +_LIT (KTestDocument6, "z:\\system\\XmlTest\\Wml\\1.1\\data.wmlc"); +_LIT (KTestDocument7, "z:\\system\\XmlTest\\Wml\\1.1\\http___www.bbc.co.uk_mobile_sportheads1.wmlc"); +_LIT (KTestDocument8, "z:\\system\\XmlTest\\Wml\\1.1\\mob.wmlc"); +_LIT (KTestDocument9, "z:\\system\\XmlTest\\Wml\\1.1\\Variables.wmlc"); +_LIT (KTestDocument10,"z:\\system\\XmlTest\\Wml\\1.1\\wireless_char.wmlc"); +_LIT (KTestDocument11,"z:\\system\\XmlTest\\Wml\\Codepage\\wml_data_attr_copepage_255.wmlc"); + +// Some characters had to have their string representation amended. +// i.e. dir paths should be seperated by '\\' +// carriage return (0D) replaced with \r +// line feed (0A) replaced with \n +// double quotes (") replaced with \" +// single quotes (') replaced with \' + +_LIT (KDataComparison0_1, "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111333333333333333333333333333333333333333333333333321.1SyncML/1.1"); +_LIT (KDataComparison0_2, "18713512941"); +_LIT (KDataComparison0_3, "63157234976619000http://208.184.103.62/servlet/fde.sync.SyncML"); +_LIT (KDataComparison0_4, "http://208.184.103.62/servlet/fde.sync.SyncML?f1sess=194.200.144.243sync1871351294"); +_LIT (KDataComparison0_5, "122881"); +_LIT (KDataComparison0_6, "10SyncHdr"); +_LIT (KDataComparison0_7, "http://208.184.103.62/servlet/fde.sync.SyncML63157234976619000"); +_LIT (KDataComparison0_8, "21221"); +_LIT (KDataComparison0_9, "1Put./bookmarks"); +_LIT (KDataComparison0_10, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison0_11, "20010510T120024Z"); +_LIT (KDataComparison0_12, "312"); +_LIT (KDataComparison0_13, "Get./bookmarks2C:\\System\\Data\\SyncML\\bookmarks2.dat"); +_LIT (KDataComparison0_14, "20020010510T120024Z"); +_LIT (KDataComparison0_15, "41"); +_LIT (KDataComparison0_16, "3Alert./bookmarks"); +_LIT (KDataComparison0_17, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison0_18, "20010509T105003Z"); +_LIT (KDataComparison0_19, "5200"); +_LIT (KDataComparison0_20, "C:\\System\\Data\\SyncML\\bookmarks1.dat"); +_LIT (KDataComparison0_21, "./bookmarks0"); +_LIT (KDataComparison0_22, "20010509T105145"); + + +_LIT (KDataComparison1_1, "1.1SyncML/1.1"); +_LIT (KDataComparison1_2, "18713512941"); +_LIT (KDataComparison1_3, "63157234976619000http://208.184.103.62/servlet/fde.sync.SyncML"); +_LIT (KDataComparison1_4, "http://208.184.103.62/servlet/fde.sync.SyncML?f1sess=194.200.144.243sync1871351294"); +_LIT (KDataComparison1_5, "122881"); +_LIT (KDataComparison1_6, "10SyncHdr"); +_LIT (KDataComparison1_7, "http://208.184.103.62/servlet/fde.sync.SyncML63157234976619000"); +_LIT (KDataComparison1_8, "21221"); +_LIT (KDataComparison1_9, "1Put./bookmarks"); +_LIT (KDataComparison1_10, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison1_11, "20010510T120024Z"); +_LIT (KDataComparison1_12, "312"); +_LIT (KDataComparison1_13, "Get./bookmarks2C:\\System\\Data\\SyncML\\bookmarks2.dat"); +_LIT (KDataComparison1_14, "20020010510T120024Z"); +_LIT (KDataComparison1_15, "41"); +_LIT (KDataComparison1_16, "3Alert./bookmarks"); +_LIT (KDataComparison1_17, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison1_18, "20010509T105003Z"); +_LIT (KDataComparison1_19, "5200"); +_LIT (KDataComparison1_20, "C:\\System\\Data\\SyncML\\bookmarks1.dat"); +_LIT (KDataComparison1_21, "./bookmarks0"); +_LIT (KDataComparison1_22, "20010509T105145"); + + +_LIT (KDataComparison2_1, "1.1SyncML/1.1"); +_LIT (KDataComparison2_2, "430497861"); +_LIT (KDataComparison2_3, "63156883059050000"); +_LIT (KDataComparison2_4, "http://208.184.103.62/servlet/fde.sync.SyncML"); +_LIT (KDataComparison2_5, "http://208.184.103.62/servlet/fde.sync.SyncML?f1sess=194.200.144.243sync43049786"); +_LIT (KDataComparison2_6, "12288"); +_LIT (KDataComparison2_7, "110"); +_LIT (KDataComparison2_8, "SyncHdrhttp://208.184.103.62/servlet/fde.sync.SyncML"); +_LIT (KDataComparison2_9, "63156883059050000200"); +_LIT (KDataComparison2_10, "211"); +_LIT (KDataComparison2_11, "Put./bookmarks"); +_LIT (KDataComparison2_12, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison2_13, "20010510T120024Z"); +_LIT (KDataComparison2_14, "31"); +_LIT (KDataComparison2_15, "2Get./bookmarks"); +_LIT (KDataComparison2_16, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison2_17, "20010510T120024Z"); +_LIT (KDataComparison2_18, "41"); +_LIT (KDataComparison2_19, "3Alert./bookmarks"); +_LIT (KDataComparison2_20, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison2_21, "20010501T172705Z"); +_LIT (KDataComparison2_22, "5200"); +_LIT (KDataComparison2_23, "C:\\System\\Data\\SyncML\\bookmarks1.dat"); +_LIT (KDataComparison2_24, "./bookmarks"); +_LIT (KDataComparison2_25, "020010501T172843"); +_LIT (KDataComparison2_26, "62"); +_LIT (KDataComparison2_27, "application/vnd.syncml-devinf+xml./devinf11"); +_LIT (KDataComparison2_28, "./devinf11"); +_LIT (KDataComparison2_29, "application/vnd.syncml-devinf+xml"); +_LIT (KDataComparison2_30, "2006A1D2D2F2F53594E434D4C2F2F44544420446576496E6620312E312F2F454E4A653312E3101513667573696F6E4F6E652C20496E632E0155353796E634D4C2046444"); +_LIT (KDataComparison2_31, "5015E3312E300149346312053796E634D4C205346444520312E30014B373657276657201475D32E2F43414C454E444152014C343616C656E646172015A463746578742F782D7663616C656E64617201643312E"); +_LIT (KDataComparison2_32, "3001162463746578742F782D7663616C656E64617201643312E300115F60331016033201603330111475D32E2F434F4E5441435453014C3436F6E7461637473015A463746578742F782D766361726401643322"); +_LIT (KDataComparison2_33, "E3101162463746578742F782D766361726401643322E310115F60331016033201603330111475D32E2F582D46312D424F4F4B4D41524B014C3426F6F6B6D61726B73015A463746578742F782D66312D626F6F6"); +_LIT (KDataComparison2_34, "B6D61726B01643312E3001162463746578742F782D66312D626F6F6B6D61726B01643312E300115F6033101603320160333011145463746578742F782D7663616C656E64617201583424547494E01633564341"); +_LIT (KDataComparison2_35, "4C454E4441520158356455253494F4E01633312E300158353554D4D41525901483636872015834445534352495054494F4E014836368720158343415445474F524945530148363687201583445453544152540"); +_LIT (KDataComparison2_36, "14836461746574696D65015834454454E44014836461746574696D650158341414C41524D014836461746574696D6501583434C41535301483636872015835252554C450148363687201583454E44016335643"); +_LIT (KDataComparison2_37, "414C454E44415201463746578742F782D766361726401583424547494E0163356434152440158356455253494F4E01633322E31015834E0148363687201583464E01483636872015835449544C450148363687"); +_LIT (KDataComparison2_38, "2015834F5247014836368720158354454C0148363687201573564F4943450148363687201573464158014836368720157343454C4C0148363687201573574F524B0148363687201573484F4D45014836368720"); +_LIT (KDataComparison2_39, "1583454D41494C014836368720158355524C01483636872015834E4F54450148363687201583434C4153530148363687201583454E4401633564341524401463746578742F782D66312D626F6F6B6D61726B01"); +_LIT (KDataComparison2_40, "583424547494E016334631424F4F4B4D41524B015834E414D45014836368720158355524C01483636872015834445534352495054494F4E01483636872015834C4153545649534954454444415445014836461"); +_LIT (KDataComparison2_41, "746574696D6501583454E44016334631424F4F4B4D41524B0111"); + + +_LIT (KDataComparison3_1, "1.1SyncML/1.1"); +_LIT (KDataComparison3_2, "334597021"); +_LIT (KDataComparison3_3, "63158186431599000"); +_LIT (KDataComparison3_4, "http://208.184.103.90/servlet/fde.sync.SyncML"); +_LIT (KDataComparison3_5, "http://208.184.103.90/servlet/fde.sync.SyncML?f1sess=194.200.144.243fuse10518377320"); +_LIT (KDataComparison3_6, "12288"); +_LIT (KDataComparison3_7, "110"); +_LIT (KDataComparison3_8, "SyncHdrhttp://208.184.103.90/servlet/fde.sync.SyncML"); +_LIT (KDataComparison3_9, "63158186431599000212"); +_LIT (KDataComparison3_10, "211Put"); +_LIT (KDataComparison3_11, "20031"); +_LIT (KDataComparison3_12, "2Get./devinf11"); +_LIT (KDataComparison3_13, "20041"); +_LIT (KDataComparison3_14, "3Alert./bookmarks"); +_LIT (KDataComparison3_15, "C:\\System\\Data\\SyncML\\bookmarks1.dat200"); +_LIT (KDataComparison3_16, "20010607T125033Z"); +_LIT (KDataComparison3_17, "5201"); +_LIT (KDataComparison3_18, "C:\\System\\Data\\SyncML\\bookmarks1.dat?from_server"); +_LIT (KDataComparison3_19, "./bookmarks"); +_LIT (KDataComparison3_20, "20010522T09081320010607T125258"); +_LIT (KDataComparison3_21, "62"); +_LIT (KDataComparison3_22, "application/vnd.syncml-devinf+xml./devinf11"); +_LIT (KDataComparison3_23, "./devinf11"); +_LIT (KDataComparison3_24, "application/vnd.syncml-devinf+xml2006A1D2D2F2F53594E434D4C2F2F44544420446576496E6620312E312"); +_LIT (KDataComparison3_25, "F2F454E4A653312E3101513667573696F6E4F6E652C20496E632E0155353796E634D4C20464445015E3312E300149346312053796E634D4C205346444520312E30014B373657276657201475D32E2F43616C"); +_LIT (KDataComparison3_26, "656E646172014C343616C656E646172015A463746578742F782D7663616C656E64617201643312E3001162463746578742F782D7663616C656E64617201643312E300115F6033101603320111475D32E2F43"); +_LIT (KDataComparison3_27, "6F6E7461637473014C3436F6E7461637473015A463746578742F782D766361726401643322E3101162463746578742F782D766361726401643322E310115F6033101603320111475D32E2F426F6F6B6D6172"); +_LIT (KDataComparison3_28, "6B73014C3426F6F6B6D61726B73015A463746578742F546573745479706501643312E3001162463746578742F546573745479706501643312E300115F603310160332011145463746578742F782D7663616C"); +_LIT (KDataComparison3_29, "656E64617201583424547494E016335643414C454E4441520158356455253494F4E01633312E300158353554D4D41525901483636872015834445534352495054494F4E014836368720158343415445474F5"); +_LIT (KDataComparison3_30, "2494553014836368720158344545354415254014836461746574696D65015834454454E44014836461746574696D650158341414C41524D014836461746574696D6501583434C41535301483636872015834"); +_LIT (KDataComparison3_31, "54E44016335643414C454E44415201463746578742F782D766361726401583424547494E0163356434152440158356455253494F4E01633322E31015834E0148363687201583464E01483636872015835449"); +_LIT (KDataComparison3_32, "544C4501483636872015834F5247014836368720158354454C0148363687201573564F4943450148363687201573464158014836368720157343454C4C0148363687201573574F524B014836368720157348"); +_LIT (KDataComparison3_33, "4F4D450148363687201583454D41494C014836368720158355524C01483636872015834E4F54450148363687201583434C4153530148363687201583454E4401633564341524401463746578742F782D6631"); +_LIT (KDataComparison3_34, "2D626F6F6B6D61726B01583424547494E016334631424F4F4B4D41524B015834E414D45014836368720158355524C01483636872015834445534352495054494F4E01483636872015834C415354564953495"); +_LIT (KDataComparison3_35, "4454444415445014836461746574696D6501583454E44016334631424F4F4B4D41524B0111"); +_LIT (KDataComparison3_36, "7C:\\System\\Data\\SyncML\\bookmarks1.dat"); +_LIT (KDataComparison3_37, "./bookmarks"); +_LIT (KDataComparison3_38, "508"); +_LIT (KDataComparison3_39, "text/x-f1-bookmark"); +_LIT (KDataComparison3_40, "fd279764-1dd1-11b2-80eb-ff2b70e4fe89"); +_LIT (KDataComparison3_41, "BEGIN:F1-BOOKMARK\r\nVERSION:1.0\r\nNAME:Server\'s Bookmark\r\nURL:www.servers-place.com\r\nEND:F1-BOOKMARK\r\n"); +_LIT (KDataComparison3_42, ""); + +_LIT (KDataComparison4_1, ""); +_LIT (KDataComparison4_2, ""); +_LIT (KDataComparison4_5, ""); +_LIT (KDataComparison4_6, ""); +_LIT (KDataComparison4_7, ""); +_LIT (KDataComparison4_8, "

"); +_LIT (KDataComparison4_9, "

#PCDATA ephasizedstrong"); +_LIT (KDataComparison4_10, " Biu
"); +_LIT (KDataComparison4_11, " big tiny

"); +_LIT (KDataComparison4_12, "\"alternative"); +_LIT (KDataComparison4_13, ""); +_LIT (KDataComparison4_14, "link"); +_LIT (KDataComparison4_15, ""); +_LIT (KDataComparison4_16, "
Stuff
"); +_LIT (KDataComparison4_17, "

"); +_LIT (KDataComparison4_20, "
"); + +_LIT (KDataComparison5_1, ""); +_LIT (KDataComparison5_2, ""); +_LIT (KDataComparison5_3, "   ­ $\">"); +_LIT (KDataComparison5_4, "

Quote: \"

Ampersand: &
"); +_LIT (KDataComparison5_5, "
Apos: \'

Lesser: <

Greater: >"); +_LIT (KDataComparison5_6, "

NBSP:  

S-hyp: ­
"); +_LIT (KDataComparison5_7, "
$


"); +_LIT (KDataComparison5_8, "
[[0x82 : Entities in attribute: var]]

"); + +_LIT (KDataComparison6_1, ""); +_LIT (KDataComparison6_2, "




"); +_LIT (KDataComparison6_3, "


Welcome"); +_LIT (KDataComparison6_4, "

to the

"); +_LIT (KDataComparison6_5, "Mib\'s World!

"); +_LIT (KDataComparison6_6, "

"); +_LIT (KDataComparison6_7, "

"); +_LIT (KDataComparison6_8, "

Well, that\'s pretty much it."); +_LIT (KDataComparison6_9, "



"); +_LIT (KDataComparison6_10, "Prev card"); +_LIT (KDataComparison6_11, "



"); +_LIT (KDataComparison6_12, "

"); +_LIT (KDataComparison6_13, "\"image\"

"); + +_LIT (KDataComparison7_1, ""); +_LIT (KDataComparison7_2, ""); +_LIT (KDataComparison7_3, "

"); +_LIT (KDataComparison7_4, "Sport Headlines

"); +_LIT (KDataComparison7_5, "at 14:45 on 31/5/2000

"); +_LIT (KDataComparison7_6, "TOP STORIES

"); +_LIT (KDataComparison7_7, "FOOTBALL

"); +_LIT (KDataComparison7_8, "GOLF

"); +_LIT (KDataComparison7_9, "CRICKET

"); +_LIT (KDataComparison7_10, "MOTORSPORT

"); +_LIT (KDataComparison7_11, "RUGBY UNION

"); +_LIT (KDataComparison7_12, "RUGBY LEAGUE

"); +_LIT (KDataComparison7_13, "TENNIS

"); +_LIT (KDataComparison7_14, "SNOOKER

"); +_LIT (KDataComparison7_15, "

BBC Sport programmes Alert

"); +_LIT (KDataComparison7_16, "

Sports Headlines

"); +_LIT (KDataComparison7_17, "

BBC Homepage

"); + +_LIT (KDataComparison8_1, "

"); +_LIT (KDataComparison8_4, "

1. Enter Stock Code"); +_LIT (KDataComparison8_5, "

2. Name Search

"); +_LIT (KDataComparison8_6, "

_____________

"); +_LIT (KDataComparison8_7, "Main Menu

"); +_LIT (KDataComparison8_8, "Help

"); +_LIT (KDataComparison8_9, "

Enter Stock Code

"); +_LIT (KDataComparison8_10, "[[0x80 : price.wml?s=s]]Get Quote"); +_LIT (KDataComparison8_11, "

[[0x80 : graph.wml?s=s]]Get 12 month"); +_LIT (KDataComparison8_12, "

[[0x80 : graph.wml?s=s]]Get Intraday

"); +_LIT (KDataComparison8_13, "

_____________

"); +_LIT (KDataComparison8_14, "Main Menu

"); +_LIT (KDataComparison8_15, "Help

"); +_LIT (KDataComparison8_16, "

Enter search term:"); +_LIT (KDataComparison8_17, "[[0x80 : name.wml?n=n]]Search

"); +_LIT (KDataComparison8_18, "

_____________

"); +_LIT (KDataComparison8_19, "Main Menu

"); +_LIT (KDataComparison8_20, "Help

"); + +_LIT (KDataComparison9_1, ""); +_LIT (KDataComparison9_2, ""); +_LIT (KDataComparison9_3, "

[[0x82 : Plain variable: var]]

[[0x82 : NoEsc: var]]
"); +_LIT (KDataComparison9_4, "
[[0x80 : Escape: var]]

[[0x81 : UnEsc: var]]

"); + +_LIT (KDataComparison10_1, ""); +_LIT (KDataComparison10_4, "

"); +_LIT (KDataComparison10_5, "\"Welcome

"); +_LIT (KDataComparison10_6, "

"); +_LIT (KDataComparison10_7, "» RouteWAP

"); +_LIT (KDataComparison10_8, "» Outlook Bridge

"); +_LIT (KDataComparison10_9, "» HKL Timetables

"); +_LIT (KDataComparison10_10, "» YTV Timetables

"); +_LIT (KDataComparison10_11, "» Wireless Investor

"); +_LIT (KDataComparison10_12, "» HangMan

"); +_LIT (KDataComparison10_13, "

Contact Us

"); +_LIT (KDataComparison10_14, "What\'s New

"); + +_LIT (KDataComparison11_1, ""); +_LIT (KDataComparison11_2, "







"); +_LIT (KDataComparison11_3, " Welcome

to the

"); +_LIT (KDataComparison11_4, "Mib\'s World!

"); +_LIT (KDataComparison11_5, "

"); +_LIT (KDataComparison11_6, "

Well, that\'s pretty much it.



"); +_LIT (KDataComparison11_7, "Prev card"); +_LIT (KDataComparison11_8, "



"); +_LIT (KDataComparison11_9, "

\"image\"

"); + + +static RTest test(_L("t_wbxmlparsertests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3726 +@SYMTestCaseDesc Parsing wml documents. +@SYMTestPriority Medium +@SYMTestActions Parse wml documents and compare the output with the expected output. +@SYMTestExpectedResults Parsed output and expected output should match. +@SYMREQ REQ0000 +*/ +static void ParserTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3726 ParserTestsL tests... ")); + + __UHEAP_MARK; + + TBuf16<8000> *expectedOutput = new(ELeave) TBuf16<8000>; + CleanupStack::PushL(expectedOutput); + + CStabilityTestClass* parserTest = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); + CleanupStack::PushL(parserTest); + + parserTest->iOutput->Zero(); + +// Test0 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison0_1); + expectedOutput->Append(KDataComparison0_2); + expectedOutput->Append(KDataComparison0_3); + expectedOutput->Append(KDataComparison0_4); + expectedOutput->Append(KDataComparison0_5); + expectedOutput->Append(KDataComparison0_6); + expectedOutput->Append(KDataComparison0_7); + expectedOutput->Append(KDataComparison0_8); + expectedOutput->Append(KDataComparison0_9); + expectedOutput->Append(KDataComparison0_10); + expectedOutput->Append(KDataComparison0_11); + expectedOutput->Append(KDataComparison0_12); + expectedOutput->Append(KDataComparison0_13); + expectedOutput->Append(KDataComparison0_14); + expectedOutput->Append(KDataComparison0_15); + expectedOutput->Append(KDataComparison0_16); + expectedOutput->Append(KDataComparison0_17); + expectedOutput->Append(KDataComparison0_18); + expectedOutput->Append(KDataComparison0_19); + expectedOutput->Append(KDataComparison0_20); + expectedOutput->Append(KDataComparison0_21); + expectedOutput->Append(KDataComparison0_22); + + parserTest->ParseEntryL(KTestDocument0(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument0(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test1 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison1_1); + expectedOutput->Append(KDataComparison1_2); + expectedOutput->Append(KDataComparison1_3); + expectedOutput->Append(KDataComparison1_4); + expectedOutput->Append(KDataComparison1_5); + expectedOutput->Append(KDataComparison1_6); + expectedOutput->Append(KDataComparison1_7); + expectedOutput->Append(KDataComparison1_8); + expectedOutput->Append(KDataComparison1_9); + expectedOutput->Append(KDataComparison1_10); + expectedOutput->Append(KDataComparison1_11); + expectedOutput->Append(KDataComparison1_12); + expectedOutput->Append(KDataComparison1_13); + expectedOutput->Append(KDataComparison1_14); + expectedOutput->Append(KDataComparison1_15); + expectedOutput->Append(KDataComparison1_16); + expectedOutput->Append(KDataComparison1_17); + expectedOutput->Append(KDataComparison1_18); + expectedOutput->Append(KDataComparison1_19); + expectedOutput->Append(KDataComparison1_20); + expectedOutput->Append(KDataComparison1_21); + expectedOutput->Append(KDataComparison1_22); + + parserTest->ParseEntryL(KTestDocument1(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument1(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test2 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison2_1); + expectedOutput->Append(KDataComparison2_2); + expectedOutput->Append(KDataComparison2_3); + expectedOutput->Append(KDataComparison2_4); + expectedOutput->Append(KDataComparison2_5); + expectedOutput->Append(KDataComparison2_6); + expectedOutput->Append(KDataComparison2_7); + expectedOutput->Append(KDataComparison2_8); + expectedOutput->Append(KDataComparison2_9); + expectedOutput->Append(KDataComparison2_10); + expectedOutput->Append(KDataComparison2_11); + expectedOutput->Append(KDataComparison2_12); + expectedOutput->Append(KDataComparison2_13); + expectedOutput->Append(KDataComparison2_14); + expectedOutput->Append(KDataComparison2_15); + expectedOutput->Append(KDataComparison2_16); + expectedOutput->Append(KDataComparison2_17); + expectedOutput->Append(KDataComparison2_18); + expectedOutput->Append(KDataComparison2_19); + expectedOutput->Append(KDataComparison2_20); + expectedOutput->Append(KDataComparison2_21); + expectedOutput->Append(KDataComparison2_22); + expectedOutput->Append(KDataComparison2_23); + expectedOutput->Append(KDataComparison2_24); + expectedOutput->Append(KDataComparison2_25); + expectedOutput->Append(KDataComparison2_26); + expectedOutput->Append(KDataComparison2_27); + expectedOutput->Append(KDataComparison2_28); + expectedOutput->Append(KDataComparison2_29); + expectedOutput->Append(KDataComparison2_30); + expectedOutput->Append(KDataComparison2_31); + expectedOutput->Append(KDataComparison2_32); + expectedOutput->Append(KDataComparison2_33); + expectedOutput->Append(KDataComparison2_34); + expectedOutput->Append(KDataComparison2_35); + expectedOutput->Append(KDataComparison2_36); + expectedOutput->Append(KDataComparison2_37); + expectedOutput->Append(KDataComparison2_38); + expectedOutput->Append(KDataComparison2_39); + expectedOutput->Append(KDataComparison2_40); + expectedOutput->Append(KDataComparison2_41); + + parserTest->ParseEntryL(KTestDocument2(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument2(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test3 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison3_1); + expectedOutput->Append(KDataComparison3_2); + expectedOutput->Append(KDataComparison3_3); + expectedOutput->Append(KDataComparison3_4); + expectedOutput->Append(KDataComparison3_5); + expectedOutput->Append(KDataComparison3_6); + expectedOutput->Append(KDataComparison3_7); + expectedOutput->Append(KDataComparison3_8); + expectedOutput->Append(KDataComparison3_9); + expectedOutput->Append(KDataComparison3_10); + expectedOutput->Append(KDataComparison3_11); + expectedOutput->Append(KDataComparison3_12); + expectedOutput->Append(KDataComparison3_13); + expectedOutput->Append(KDataComparison3_14); + expectedOutput->Append(KDataComparison3_15); + expectedOutput->Append(KDataComparison3_16); + expectedOutput->Append(KDataComparison3_17); + expectedOutput->Append(KDataComparison3_18); + expectedOutput->Append(KDataComparison3_19); + expectedOutput->Append(KDataComparison3_20); + expectedOutput->Append(KDataComparison3_21); + expectedOutput->Append(KDataComparison3_22); + expectedOutput->Append(KDataComparison3_23); + expectedOutput->Append(KDataComparison3_24); + expectedOutput->Append(KDataComparison3_25); + expectedOutput->Append(KDataComparison3_26); + expectedOutput->Append(KDataComparison3_27); + expectedOutput->Append(KDataComparison3_28); + expectedOutput->Append(KDataComparison3_29); + expectedOutput->Append(KDataComparison3_30); + expectedOutput->Append(KDataComparison3_31); + expectedOutput->Append(KDataComparison3_32); + expectedOutput->Append(KDataComparison3_33); + expectedOutput->Append(KDataComparison3_34); + expectedOutput->Append(KDataComparison3_35); + expectedOutput->Append(KDataComparison3_36); + expectedOutput->Append(KDataComparison3_37); + expectedOutput->Append(KDataComparison3_38); + expectedOutput->Append(KDataComparison3_39); + expectedOutput->Append(KDataComparison3_40); + expectedOutput->Append(KDataComparison3_41); + expectedOutput->Append(KDataComparison3_42); + + parserTest->ParseEntryL(KTestDocument3(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument3(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test4 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison4_1); + expectedOutput->Append(KDataComparison4_2); + expectedOutput->Append(KDataComparison4_3); + expectedOutput->Append(KDataComparison4_4); + expectedOutput->Append(KDataComparison4_5); + expectedOutput->Append(KDataComparison4_6); + expectedOutput->Append(KDataComparison4_7); + expectedOutput->Append(KDataComparison4_8); + expectedOutput->Append(KDataComparison4_9); + expectedOutput->Append(KDataComparison4_10); + expectedOutput->Append(KDataComparison4_11); + expectedOutput->Append(KDataComparison4_12); + expectedOutput->Append(KDataComparison4_13); + expectedOutput->Append(KDataComparison4_14); + expectedOutput->Append(KDataComparison4_15); + expectedOutput->Append(KDataComparison4_16); + expectedOutput->Append(KDataComparison4_17); + expectedOutput->Append(KDataComparison4_18); + expectedOutput->Append(KDataComparison4_19); + expectedOutput->Append(KDataComparison4_20); + + parserTest->ParseEntryL(KTestDocument4(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument4(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test5 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison5_1); + expectedOutput->Append(KDataComparison5_2); + expectedOutput->Append(KDataComparison5_3); + expectedOutput->Append(KDataComparison5_4); + expectedOutput->Append(KDataComparison5_5); + expectedOutput->Append(KDataComparison5_6); + expectedOutput->Append(KDataComparison5_7); + expectedOutput->Append(KDataComparison5_8); + + parserTest->ParseEntryL(KTestDocument5(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument5(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test6 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison6_1); + expectedOutput->Append(KDataComparison6_2); + expectedOutput->Append(KDataComparison6_3); + expectedOutput->Append(KDataComparison6_4); + expectedOutput->Append(KDataComparison6_5); + expectedOutput->Append(KDataComparison6_6); + expectedOutput->Append(KDataComparison6_7); + expectedOutput->Append(KDataComparison6_8); + expectedOutput->Append(KDataComparison6_9); + expectedOutput->Append(KDataComparison6_10); + expectedOutput->Append(KDataComparison6_11); + expectedOutput->Append(KDataComparison6_12); + expectedOutput->Append(KDataComparison6_13); + + parserTest->ParseEntryL(KTestDocument6(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument6(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test7 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison7_1); + expectedOutput->Append(KDataComparison7_2); + expectedOutput->Append(KDataComparison7_3); + expectedOutput->Append(KDataComparison7_4); + expectedOutput->Append(KDataComparison7_5); + expectedOutput->Append(KDataComparison7_6); + expectedOutput->Append(KDataComparison7_7); + expectedOutput->Append(KDataComparison7_8); + expectedOutput->Append(KDataComparison7_9); + expectedOutput->Append(KDataComparison7_10); + expectedOutput->Append(KDataComparison7_11); + expectedOutput->Append(KDataComparison7_12); + expectedOutput->Append(KDataComparison7_13); + expectedOutput->Append(KDataComparison7_14); + expectedOutput->Append(KDataComparison7_15); + expectedOutput->Append(KDataComparison7_16); + expectedOutput->Append(KDataComparison7_17); + + parserTest->ParseEntryL(KTestDocument7(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument7(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test8 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison8_1); + expectedOutput->Append(KDataComparison8_2); + expectedOutput->Append(KDataComparison8_3); + expectedOutput->Append(KDataComparison8_4); + expectedOutput->Append(KDataComparison8_5); + expectedOutput->Append(KDataComparison8_6); + expectedOutput->Append(KDataComparison8_7); + expectedOutput->Append(KDataComparison8_8); + expectedOutput->Append(KDataComparison8_9); + expectedOutput->Append(KDataComparison8_10); + expectedOutput->Append(KDataComparison8_11); + expectedOutput->Append(KDataComparison8_12); + expectedOutput->Append(KDataComparison8_13); + expectedOutput->Append(KDataComparison8_14); + expectedOutput->Append(KDataComparison8_15); + expectedOutput->Append(KDataComparison8_16); + expectedOutput->Append(KDataComparison8_17); + expectedOutput->Append(KDataComparison8_18); + expectedOutput->Append(KDataComparison8_19); + expectedOutput->Append(KDataComparison8_20); + + parserTest->ParseEntryL(KTestDocument8(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument8(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test9 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison9_1); + expectedOutput->Append(KDataComparison9_2); + expectedOutput->Append(KDataComparison9_3); + expectedOutput->Append(KDataComparison9_4); + + parserTest->ParseEntryL(KTestDocument9(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument9(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test10 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison10_1); + expectedOutput->Append(KDataComparison10_2); + expectedOutput->Append(KDataComparison10_3); + expectedOutput->Append(KDataComparison10_4); + expectedOutput->Append(KDataComparison10_5); + expectedOutput->Append(KDataComparison10_6); + expectedOutput->Append(KDataComparison10_7); + expectedOutput->Append(KDataComparison10_8); + expectedOutput->Append(KDataComparison10_9); + expectedOutput->Append(KDataComparison10_10); + expectedOutput->Append(KDataComparison10_11); + expectedOutput->Append(KDataComparison10_12); + expectedOutput->Append(KDataComparison10_13); + expectedOutput->Append(KDataComparison10_14); + + parserTest->ParseEntryL(KTestDocument10(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument10(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + // Test11 + + expectedOutput->Zero(); + expectedOutput->Append(KDataComparison11_1); + expectedOutput->Append(KDataComparison11_2); + expectedOutput->Append(KDataComparison11_3); + expectedOutput->Append(KDataComparison11_4); + expectedOutput->Append(KDataComparison11_5); + expectedOutput->Append(KDataComparison11_6); + expectedOutput->Append(KDataComparison11_7); + expectedOutput->Append(KDataComparison11_8); + expectedOutput->Append(KDataComparison11_9); + + parserTest->ParseEntryL(KTestDocument11(), &CStabilityTestClass::TestWholeL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + parserTest->ParseEntryL(KTestDocument11(), &CStabilityTestClass::TestChunkL); + test(*expectedOutput == *parserTest->iOutput); + + parserTest->iOutput->Zero(); + + + + CleanupStack::PopAndDestroy(parserTest); + CleanupStack::PopAndDestroy(expectedOutput); + + __UHEAP_MARKEND; + } + +static void MainL() + { + ParserTestsL(); + } + +TInt E32Main() + { + + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + + return KErrNone; + } + diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlparserucs4testspartone.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlparserucs4testspartone.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,116 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +using namespace Xml; + +static RTest test(_L("t_wbxmlparserucs4testspartone")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3725 +@SYMTestCaseDesc Parsing unicode characters. +@SYMTestPriority Medium +@SYMTestActions Parsing unicode characters and comparing the expected output. +@SYMTestExpectedResults Expected out matches actual output. +@SYMREQ REQ0000 +*/ +static void ParserTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3725 ParserTestsL tests... ")); + + __UHEAP_MARK; + + + TBuf16<256> ucs4_0041; + + // A + // 0x01, 0x04, 0x6A, 0x00, 0x7F, 0x02, 0x80, 0x41, 0x01 + + ucs4_0041.Append(0x01); + ucs4_0041.Append(0x04); + ucs4_0041.Append(0x6A); + ucs4_0041.Append(0x00); + ucs4_0041.Append(0x7F); + ucs4_0041.Append(0x02); + ucs4_0041.Append(0x80); + ucs4_0041.Append(0x41); + ucs4_0041.Append(0x01); + + _LIT (KDataComparison, "A"); + + TPassOrFailureSettings aPassOrFailureSettings; + + aPassOrFailureSettings.iStringDictionaryUri = &KBlankStringDictionaryUri; + aPassOrFailureSettings.iDoParseDocument = ETrue; + aPassOrFailureSettings.iFilenameProvided = EFalse; + aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| + ERawContent; + aPassOrFailureSettings.iExpectedCode = KErrNone; + + + CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); + CleanupStack::PushL(behaviourTest); + + + behaviourTest->TestBehaviour(ucs4_0041, aPassOrFailureSettings); + + test(KDataComparison() == *behaviourTest->iOutput); + behaviourTest->iOutput->Zero(); + + + CleanupStack::PopAndDestroy(behaviourTest); + + __UHEAP_MARKEND; + } + +static void MainL() + { + ParserTestsL(); + } + +TInt E32Main() + { + + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + + return KErrNone; + } + diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlsiparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlsiparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmlsiparserstabilitytests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3724 +@SYMTestCaseDesc Parsing service indication documents. +@SYMTestPriority Medium +@SYMTestActions Parsing the documents. +@SYMTestExpectedResults Parser should cope with parsing the documents. +@SYMREQ REQ0000 +*/ +static void SiTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3724 SiTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* siTest = CStabilityTestClass::NewL(test); + CleanupStack::PushL(siTest); + siTest->StabilityTestL(KSi1_0Directory(), KSiExt(), &CStabilityTestClass::TestWholeL); + CleanupStack::PopAndDestroy(siTest); + + CStabilityTestClass* siTestMin = CStabilityTestClass::NewL(test, EFalse, KMinChunkSize); + CleanupStack::PushL(siTestMin); + siTestMin->StabilityTestL(KSi1_0Directory(), KSiExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(siTestMin); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + SiTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlsyncmlparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlsyncmlparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,124 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmlsyncmlparserstabilitytests")); + + +static void DeleteTestDirL() + { + RFs fsSession; + TInt err = fsSession.Connect(); + if(err == KErrNone) + { + CleanupClosePushL(fsSession); + RDebug::Print(_L("Deleting \"%S\" directory.\n"), &KOpaqueDirectory); + CFileMan* fileMan = CFileMan::NewL(fsSession); + CleanupStack::PushL(fileMan); + TInt err = fileMan->RmDir(KOpaqueDirectory); + if(err == KErrPathNotFound) + { + err = KErrNone; + } + User::LeaveIfError(err); + CleanupStack::PopAndDestroy(fileMan); + CleanupStack::PopAndDestroy(&fsSession); + } + else + { + RDebug::Print(_L("Error %d connecting file session. Directory: %S.\n"), err, &KOpaqueDirectory); + } + } + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3723 +@SYMTestCaseDesc Parsing SyncML documents. +@SYMTestPriority Medium +@SYMTestActions Parsing syncml documents in the specified directory. +@SYMTestExpectedResults Parser should be able to cope with parsing the documents. +@SYMREQ REQ0000 +*/ +static void SyncmlTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3723 SyncmlTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* syncml1_1TestWithOpaque = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); + CleanupStack::PushL(syncml1_1TestWithOpaque); + syncml1_1TestWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncml1_1TestWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncml1_1TestWithOpaque); + + CStabilityTestClass* syncml1_1TestMax = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); + CleanupStack::PushL(syncml1_1TestMax); + syncml1_1TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncml1_1TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncml1_1TestMax); + + ::DeleteTestDirL(); + + CStabilityTestClass* syncml1_2TestWithOpaque = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); + CleanupStack::PushL(syncml1_2TestWithOpaque); + syncml1_2TestWithOpaque->StabilityTestL(KSyncML1_2Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncml1_2TestWithOpaque->StabilityTestL(KSyncML1_2Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncml1_2TestWithOpaque); + + CStabilityTestClass* syncml1_2TestMax = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); + CleanupStack::PushL(syncml1_2TestMax); + syncml1_2TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); + syncml1_2TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(syncml1_2TestMax); + + ::DeleteTestDirL(); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + SyncmlTestsL(); + + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlunknownparsertests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlunknownparsertests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,172 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +using namespace Xml; + +_LIT8 (KStringDictionaryUri, "4~0"); +_LIT8 (KStringDictionaryFD1, "FD1~0"); +_LIT8 (KStringDictionaryFD3, "FD3~0"); +_LIT8 (KStringDictionarySML10, "SYNCML:SYNCML1.0"); +_LIT8 (KStringDictionarySML11, "SYNCML:SYNCML1.1"); +_LIT8 (KStringDictionaryDTDSML10, "-//SYNCML//DTD SyncML 1.0//EN~0"); +_LIT8 (KStringDictionaryDTDSML11, "-//SYNCML//DTD SyncML 1.1//EN~0"); + +_LIT (KTestDocument, "z:\\system\\XmlTest\\Wml\\Unknown\\UnknownPubId_AllElements.wmlc"); +_LIT (KTestDocument1, "z:\\system\\XmlTest\\SyncML\\Unknown\\DEF078987_3.wbxml"); + +static RTest test(_L("t_wbxmlunknownparsertests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3721 +@SYMTestCaseDesc Testing wbxml parser +@SYMTestPriority Medium +@SYMTestActions Parses a doucment and behaviour should be as expected. +@SYMTestExpectedResults Test should not fail. +@SYMREQ REQ0000 +*/ +static void BehaviourTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3721 BehaviourTestsL tests... ")); + + __UHEAP_MARK; + + TPassOrFailureSettings aPassOrFailureSettings; + + aPassOrFailureSettings.iDoParseDocument = ETrue; + aPassOrFailureSettings.iFilenameProvided = ETrue; + aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| + ERawContent; + + + CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); + CleanupStack::PushL(behaviourTest); + + + + // Test 1 + + aPassOrFailureSettings.iStringDictionaryUri = &KBlankStringDictionaryUri; + aPassOrFailureSettings.iExpectedCode = KErrXmlMissingStringDictionary; + + behaviourTest->TestBehaviour(KTestDocument, aPassOrFailureSettings); + + + // Test 2 + + // Preload Dictionary + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryUri; + aPassOrFailureSettings.iExpectedCode = KErrNone; + + behaviourTest->TestBehaviour(KTestDocument, aPassOrFailureSettings); + + + + CleanupStack::PopAndDestroy(behaviourTest); + + __UHEAP_MARKEND; + } + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3722 +@SYMTestCaseDesc Testing : Convergence: KErrXmlStringDictionaryPluginNotFound when + syncing with DM server +@SYMTestPriority High +@SYMTestActions It parse the files DEF078987_3.wbxml a which contain the updated + unknown publicID +@SYMTestExpectedResults Test should not fail +@SYMDEF DEF083044 +*/ +void Defect_DEF083044_TestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3722 SyncML unknown publicID tests... ")); + + __UHEAP_MARK; + + TPassOrFailureSettings aPassOrFailureSettings; + aPassOrFailureSettings.iDoParseDocument = ETrue; + aPassOrFailureSettings.iFilenameProvided = ETrue; + + CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); + CleanupStack::PushL(behaviourTest); + + aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| + ERawContent; + aPassOrFailureSettings.iExpectedCode = KErrNone; + + // Preload Dictionary + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryFD1; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryFD3; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionarySML10; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionarySML11; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryDTDSML10; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryDTDSML11; + behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); + + CleanupStack::PopAndDestroy(behaviourTest); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + Defect_DEF083044_TestsL(); + BehaviourTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } + diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/t_wbxmlwmlparserstabilitytests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/t_wbxmlwmlparserstabilitytests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "stabilitytestclass.h" +#include "testdocuments.h" + +static RTest test(_L("t_wbxmlwmlparserstabilitytests")); + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3720 +@SYMTestCaseDesc Parsing wml test documents. +@SYMTestPriority Medium +@SYMTestActions Parsing files in the specified directory. +@SYMTestExpectedResults Test should pass. +@SYMREQ REQ0000 +*/ +static void WmlTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3720 WmlTestsL tests... ")); + + __UHEAP_MARK; + + CStabilityTestClass* wmlTest = CStabilityTestClass::NewL(test); + CleanupStack::PushL(wmlTest); + wmlTest->StabilityTestL(KWml1_1Directory(), KWmlcExt(), &CStabilityTestClass::TestWholeL); + CleanupStack::PopAndDestroy(wmlTest); + + CStabilityTestClass* wmlTestMid = CStabilityTestClass::NewL(test, EFalse, KMidChunkSize); + CleanupStack::PushL(wmlTestMid); + wmlTestMid->StabilityTestL(KWml1_1Directory(), KWmlcExt(), &CStabilityTestClass::TestChunkL); + CleanupStack::PopAndDestroy(wmlTestMid); + + __UHEAP_MARKEND; + } + + +static void MainL() + { + WmlTestsL(); + } + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/testdocuments.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/testdocuments.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __TESTDOCUMENTS_H__ +#define __TESTDOCUMENTS_H__ + +#include + + +// Encoding XML documents +_LIT(KXmlEngUtf, "z:\\system\\XmlTest\\Encodings\\doc_eng_utf.xml"); +_LIT(KXmlChBig5, "z:\\system\\XmlTest\\Encodings\\doc_ch_b5.xml"); +_LIT(KXmlChUtf, "z:\\system\\XmlTest\\Encodings\\doc_ch_utf.xml"); +_LIT(KXmlFrHtml, "z:\\system\\XmlTest\\Encodings\\doc_fr_html.xml"); +_LIT(KXmlFrLatin1, "z:\\system\\XmlTest\\Encodings\\doc_fr_latin1.xml"); +_LIT(KXmlFrUtf, "z:\\system\\XmlTest\\Encodings\\doc_fr_utf.xml"); +_LIT(KXmlJpEuc, "z:\\system\\XmlTest\\Encodings\\doc_jp_euc.xml"); +_LIT(KXmlJpSjis, "z:\\system\\XmlTest\\Encodings\\doc_jp_sjis.xml"); +_LIT(KXmlJpUtf, "z:\\system\\XmlTest\\Encodings\\doc_jp_utf.xml"); + + +// SyncML XML/WBXML documents directory. +// This contains a list of dirctories that contains the actual documents for test. +// NOTE there are NO trailing back slash. +_LIT(KSyncML1_1Directory, "z:\\system\\XmlTest\\SyncML\\1.1"); +_LIT(KSyncML1_2Directory, "z:\\system\\XmlTest\\SyncML\\1.2"); +_LIT(KWml1_1Directory, "z:\\system\\XmlTest\\Wml\\1.1"); +_LIT(KSi1_0Directory, "z:\\system\\XmlTest\\ServiceIndication\\1.0"); +_LIT(KOpaqueDirectory, "c:\\system\\XmlTest\\Opaque"); + +_LIT8(KWbxmlParserDataType, "text/wbxml"); + +_LIT8(KSyncmlStringDictionaryUri, "-//SYNCML//DTD SyncML 1.1//EN~0"); +_LIT8(KBlankStringDictionaryUri, ""); + +_LIT(KDirSeperator, "\\"); +_LIT(KUnderscore, "_"); + +_LIT(KXmlExt, ".xml"); +_LIT(KWbxmlExt, ".wbxml"); +_LIT(KWmlcExt, ".wmlc"); +_LIT(KSiExt, ".bdy"); + +// The size of chunks to parse. Allows for boundary testing. +const TInt KMinChunkSize = 1; +const TInt KMidChunkSize = 5; +const TInt KMaxChunkSize = 300; + + +#endif // __TESTDOCUMENTS_H__ diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/wml1_1codepage255attributetable.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/wml1_1codepage255attributetable.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,21 @@ +# wml1_1codepage255attributetable.st +# +# Copyright (c) Symbian Software Ltd 2003 - 2007. All rights reserved. +# +# NOTE: For WBXML - Direct correlation on ordering of tag entries to the tag values +# the parser defines +# No empty lines allowed either +# +# Short String table +# +stringtable Wml1_1CodePage255AttributeTable +# ////////////////////////////////////////////////////////////////////// +!// Attribute names +!// CodePage 255 +ETestAttr TestAttribute +# ////////////////////////////////////////////////////////////////////// +!// For XML +EUri -//WAPFORUM//DTD WML 1.1 ATTRIBUTE SWITCH TEST//EN +!// For WBXML +EPublicId 04~FF +EFormalPublicId -//WAPFORUM//DTD WML 1.1//EN~FF \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/wml1_1codepage255attributevaluetable.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/wml1_1codepage255attributevaluetable.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ +# wml1_1codepage255attributevaluetable.st +# +# Copyright (c) Symbian Software Ltd 2003 - 2007. All rights reserved. +# +# NOTE: For WBXML - Direct correlation on ordering of tag entries to the tag values +# the parser defines +# No empty lines allowed either +# +# Short String table +# +stringtable Wml1_1CodePage255AttributeValueTable +# ////////////////////////////////////////////////////////////////////// +!// Attribute value names +!// CodePage 255 +ETestAttr diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/wml1_1stringdictionary255.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/wml1_1stringdictionary255.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,217 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include + +#include "wml1_1stringdictionary255.h" +#include "wml1_1codepage255attributetable.h" +#include "wml1_1codepage255attributevaluetable.h" + + +using namespace Xml; + + +MStringDictionary* CWml1_1StringDictionary255::NewL(TAny* aStringPool) + { + CWml1_1StringDictionary255* self = new(ELeave) CWml1_1StringDictionary255(reinterpret_cast(aStringPool)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return (static_cast(self)); + } + + + +CWml1_1StringDictionary255::CWml1_1StringDictionary255(RStringPool* aStringPool) +: iStringPool(*aStringPool), + iCodePage(255) + { + // do nothing; + } + + + +void CWml1_1StringDictionary255::ConstructL() + { + // we don't own this stringpool + iStringPool.OpenL(Wml1_1CodePage255AttributeTable::Table); + iStringPool.OpenL(Wml1_1CodePage255AttributeValueTable::Table); + + iCodePage255Table = CDictionaryCodePage::NewL( + 0, + &Wml1_1CodePage255AttributeTable::Table, + &Wml1_1CodePage255AttributeValueTable::Table, + 0); // codepage + + // Construct the correlation mapping + iCodePage255Table->ConstructIndexMappingL(iAttributeCodePage255, CDictionaryCodePage::EStringTypeAttribute); + iCodePage255Table->ConstructIndexMappingL(iAttributeValueCodePage255, CDictionaryCodePage::EStringTypeAttributeValue); + } + + + + +void CWml1_1StringDictionary255::Release() + { + delete (this); + } + + + + +CWml1_1StringDictionary255::~CWml1_1StringDictionary255() + { + if (iCodePage255Table) + { + delete iCodePage255Table; + } + } + + + +void CWml1_1StringDictionary255::ElementL(TInt /*aToken*/, RString& /*aElement*/) const + { + User::Leave(KErrXmlUnsupportedElement); + } + + + +void CWml1_1StringDictionary255::AttributeL(TInt aToken, RString& aAttribute) const + { + TInt index = iCodePage255Table->StringPoolIndexFromToken( + aToken, CDictionaryCodePage::EStringTypeAttribute); + + if (index == KErrXmlStringPoolTableNotFound) + { + User::Leave(KErrXmlUnsupportedAttribute); + } + + // when we have multiple codepages per string dictionary we'd do something like iCodepageTable[n]->StringTable() + aAttribute = iStringPool.String( + index, + *(iCodePage255Table->StringTable(CDictionaryCodePage::EStringTypeAttribute))); + }; + + + +void CWml1_1StringDictionary255::AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const + { + AttributeL(aToken, aAttribute); + AttributeValueL(aToken, aValue); + }; + + + +void CWml1_1StringDictionary255::AttributeValueL(TInt aToken, RString& aValue) const + { + TInt index = iCodePage255Table->StringPoolIndexFromToken( + aToken, CDictionaryCodePage::EStringTypeAttributeValue); + + if (index == KErrXmlStringPoolTableNotFound) + { + User::Leave(KErrXmlUnsupportedAttributeValue); + } + + // when we have multiple codepages per string dictionary we'd do something like iCodepageTable[n]->StringTable() + aValue = iStringPool.String( + index, + *(iCodePage255Table->StringTable(CDictionaryCodePage::EStringTypeAttributeValue))); + }; + + + +TBool CWml1_1StringDictionary255::CompareThisDictionary(const RString& aDictionaryDescription) const + { + // If this string dictionary has many codepages then all these comparisons should go here. + // Remember, the string dictionary loads up all the RStringTables into its RStringPool + // on construction. So if the comparison fails we do not have it. + return ( + (aDictionaryDescription == iStringPool.String(Wml1_1CodePage255AttributeTable::EUri, Wml1_1CodePage255AttributeTable::Table)) || + (aDictionaryDescription == iStringPool.String(Wml1_1CodePage255AttributeTable::EPublicId, Wml1_1CodePage255AttributeTable::Table))|| + (aDictionaryDescription == iStringPool.String(Wml1_1CodePage255AttributeTable::EFormalPublicId, Wml1_1CodePage255AttributeTable::Table))); + } + + + +TInt CWml1_1StringDictionary255::SwitchCodePage(TInt aCodePage) + { + // We only have one codepage sp can't switch + if (aCodePage != iCodePage) + { + return KErrXmlMissingStringDictionary; + } + return iCodePage; + } + + + + + +/** +This method obtains the public identifier from the StringTable. +Either the formal or non formal public id will do. +The stringDictionary .rss files must list both these as wbxml +documents have one or the other. + +@param aPubId The public identifier for this string + dictionary. +*/ + +void CWml1_1StringDictionary255::PublicIdentifier(RString& aPubId) + { + // Better to use the element table as some documents don't have attributes. + aPubId = iStringPool.String( + Wml1_1CodePage255AttributeTable::EFormalPublicId, + *(iCodePage255Table->StringTable(CDictionaryCodePage::EStringTypeAttribute))); + } + + +/** +The element types in the Device Information DTD are defined within +a namespace associated with the Uri/Urn available from the StringTable. +The RString need not be closed, but closing is harmless. + +@param aUri The associated namespace for this string + dictionary. +*/ + +void CWml1_1StringDictionary255::NamespaceUri(RString& aUri) + { + // Better to use the element table as some documents don't have attributes. + aUri = iStringPool.String( + Wml1_1CodePage255AttributeTable::EUri, + *(iCodePage255Table->StringTable(CDictionaryCodePage::EStringTypeAttribute))); + } + + + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + {{{0x101FD309}, (TProxyNewLPtr)&CWml1_1StringDictionary255::NewL}}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/wbxmlparser/test/rtest/tsrc/wml1_1stringdictionary255.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/wbxmlparser/test/rtest/tsrc/wml1_1stringdictionary255.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,103 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + + +#ifndef __WML1_1STRINGDICTIONARY255_H__ +#define __WML1_1STRINGDICTIONARY255_H__ + +#include +#include + +#include + +class CWml1_1StringDictionary255 : public CBase, public Xml::MStringDictionary +/** +The CWml1_1StringDictionary255 class is a derived class defining the API of a single string dictionary. + +Derived classes must add all elements, attributes names, and attribute values that belong +to this string dictionary as static string tables to the StringPool. WBXML token mappings between +strings and WBXML tokens should also be maintained. + +@internalTechnology +*/ + { +public: + static Xml::MStringDictionary* NewL(TAny* aStringPool); + virtual ~CWml1_1StringDictionary255(); + void ConstructL(); + + void ElementL(TInt aToken, RString& aElement) const; + void AttributeL(TInt aToken, RString& aAttribute) const; + void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const; + void AttributeValueL(TInt aToken, RString& aValue) const; + + TBool CompareThisDictionary(const RString& aDictionaryDescription) const; + + TInt SwitchCodePage(TInt aCodePage); + void PublicIdentifier(RString& aPubId); + void NamespaceUri(RString& aUri); + + void Release(); + +public: + + // CodePage tokens. + // + // Note: There will be correlation between these token values and their + // strings via the CDictionaryCodePage using the RStringPool. + + enum TAttributeToken { + // CodePage 255 + // -//WAPFORUM//DTD WML 1.1//EN + // 0x05 not a global token + EAttributeTokenTestAttribute = 0x05, + }; + + enum TAttributeValueToken { + // CodePage 255 + // -//WAPFORUM//DTD WML 1.1//EN + EAttributeValueTokenTestAttribute = 0x05, + }; + +private: + + CWml1_1StringDictionary255(RStringPool* aStringPool); + +private: + +/** +The StringPool for this string dictionary. +We don't own this. +*/ + RStringPool iStringPool; + + Xml::CDictionaryCodePage* iCodePage255Table; + + TInt iCodePage; + + }; + + +const TInt iAttributeCodePage255[] = + {CWml1_1StringDictionary255::EAttributeTokenTestAttribute, + 0}; // ok to end with zero as this is used by a global token + +const TInt iAttributeValueCodePage255[] = + {CWml1_1StringDictionary255::EAttributeValueTokenTestAttribute, + 0}; // ok to end with zero as this is used by a global token + +#endif //__WML1_1STRINGDICTIONARY255_H__ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/bwins/xmlenginedom.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/bwins/xmlenginedom.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,247 @@ +EXPORTS + ??0RXmlEngDOMParser@@QAE@XZ @ 1 NONAME ; RXmlEngDOMParser::RXmlEngDOMParser(void) + ??0RXmlEngDocument@@QAE@XZ @ 2 NONAME ; RXmlEngDocument::RXmlEngDocument(void) + ??0RXmlEngNodeListImpl@@QAE@XZ @ 3 NONAME ; RXmlEngNodeListImpl::RXmlEngNodeListImpl(void) + ??0RXmlEngNodeSet@@QAE@XZ @ 4 NONAME ; RXmlEngNodeSet::RXmlEngNodeSet(void) + ??0TXmlEngXPathEvaluator@@QAE@XZ @ 5 NONAME ; TXmlEngXPathEvaluator::TXmlEngXPathEvaluator(void) + ??0RXmlEngXPathExpression@@QAE@XZ @ 6 NONAME ; RXmlEngXPathExpression::RXmlEngXPathExpression(void) + ??0RXmlEngXPathResult@@QAE@XZ @ 7 NONAME ; RXmlEngXPathResult::RXmlEngXPathResult(void) + ??0TXmlEngSerializationOptions@@QAE@IABVTDesC8@@@Z @ 8 NONAME ; TXmlEngSerializationOptions::TXmlEngSerializationOptions(unsigned int, class TDesC8 const &) + ??1CXmlEngXFormsInstanceMap@@UAE@XZ @ 9 NONAME ; CXmlEngXFormsInstanceMap::~CXmlEngXFormsInstanceMap(void) + ??ARXmlEngNodeSet@@QBE?AVTXmlEngNode@@H@Z @ 10 NONAME ; class TXmlEngNode RXmlEngNodeSet::operator[](int) const + ?AddEntryL@CXmlEngXFormsInstanceMap@@QAEXAAVRXmlEngDocument@@ABVTDesC8@@@Z @ 11 NONAME ; void CXmlEngXFormsInstanceMap::AddEntryL(class RXmlEngDocument &, class TDesC8 const &) + ?AddExtensionFunctionL@TXmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 12 NONAME ABSENT ; void TXmlEngXPathConfiguration::AddExtensionFunctionL(class TXmlEngExtensionFunctionDescriptor const &) + ?AddExtensionFunctionVectorL@TXmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 13 NONAME ABSENT ; void TXmlEngXPathConfiguration::AddExtensionFunctionVectorL(class RArray const &, unsigned int) + ?AddNamespaceDeclarationL@TXmlEngElement@@QAE?AVTXmlEngNamespace@@ABVTDesC8@@0@Z @ 14 NONAME ; class TXmlEngNamespace TXmlEngElement::AddNamespaceDeclarationL(class TDesC8 const &, class TDesC8 const &) + ?AddNativeExtensionFunctionL@TXmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 15 NONAME ABSENT ; void TXmlEngXPathConfiguration::AddNativeExtensionFunctionL(class TXmlEngExtensionFunctionDescriptor const &) + ?AddNativeExtensionFunctionVectorL@TXmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 16 NONAME ABSENT ; void TXmlEngXPathConfiguration::AddNativeExtensionFunctionVectorL(class RArray const &, unsigned int) + ?AddNewAttributeL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@000@Z @ 17 NONAME ; class TXmlEngAttr TXmlEngElement::AddNewAttributeL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?AddNewAttributeL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@0@Z @ 18 NONAME ; class TXmlEngAttr TXmlEngElement::AddNewAttributeL(class TDesC8 const &, class TDesC8 const &) + ?AddNewAttributeL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@0VTXmlEngNamespace@@@Z @ 19 NONAME ; class TXmlEngAttr TXmlEngElement::AddNewAttributeL(class TDesC8 const &, class TDesC8 const &, class TXmlEngNamespace) + ?AddNewAttributeUsePrefixL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@00@Z @ 20 NONAME ; class TXmlEngAttr TXmlEngElement::AddNewAttributeUsePrefixL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?AddNewAttributeWithNsL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@00@Z @ 21 NONAME ; class TXmlEngAttr TXmlEngElement::AddNewAttributeWithNsL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?AddNewElementAutoPrefixL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@0V1@@Z @ 22 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementAutoPrefixL(class TDesC8 const &, class TDesC8 const &, class TXmlEngElement) + ?AddNewElementL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@00@Z @ 23 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?AddNewElementL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@@Z @ 24 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementL(class TDesC8 const &) + ?AddNewElementL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@VTXmlEngNamespace@@@Z @ 25 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementL(class TDesC8 const &, class TXmlEngNamespace) + ?AddNewElementSameNsL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@@Z @ 26 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementSameNsL(class TDesC8 const &) + ?AddNewElementUsePrefixL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@0@Z @ 27 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementUsePrefixL(class TDesC8 const &, class TDesC8 const &) + ?AddNewElementWithNsL@TXmlEngElement@@QAE?AV1@ABVTDesC8@@0@Z @ 28 NONAME ; class TXmlEngElement TXmlEngElement::AddNewElementWithNsL(class TDesC8 const &, class TDesC8 const &) + ?AddTextL@TXmlEngElement@@QAEXABVTDesC8@@@Z @ 29 NONAME ; void TXmlEngElement::AddTextL(class TDesC8 const &) + ?AddUserData@TXmlEngNode@@QAEHPAVMXmlEngUserData@@@Z @ 30 NONAME ; int TXmlEngNode::AddUserData(class MXmlEngUserData *) + ?AddXmlIdL@TXmlEngElement@@QAE?AVTXmlEngAttr@@ABVTDesC8@@0VTXmlEngNamespace@@@Z @ 31 NONAME ; class TXmlEngAttr TXmlEngElement::AddXmlIdL(class TDesC8 const &, class TDesC8 const &, class TXmlEngNamespace) + ?AdoptNodeL@RXmlEngDocument@@QAE?AVTXmlEngNode@@V2@@Z @ 32 NONAME ; class TXmlEngNode RXmlEngDocument::AdoptNodeL(class TXmlEngNode) + ?AppendChildL@TXmlEngNode@@QAE?AV1@V1@@Z @ 33 NONAME ; class TXmlEngNode TXmlEngNode::AppendChildL(class TXmlEngNode) + ?AppendContentsL@TXmlEngBinaryContainer@@QAEXABVTDesC8@@@Z @ 34 NONAME ; void TXmlEngBinaryContainer::AppendContentsL(class TDesC8 const &) + ?AppendContentsL@TXmlEngCharacterData@@QAEXABVTDesC8@@@Z @ 35 NONAME ; void TXmlEngCharacterData::AppendContentsL(class TDesC8 const &) + ?AppendTextNoEncL@TXmlEngElement@@QAEXABVTDesC8@@@Z @ 36 NONAME ; void TXmlEngElement::AppendTextNoEncL(class TDesC8 const &) + ?AsBoolean@RXmlEngXPathResult@@QBEHXZ @ 37 NONAME ; int RXmlEngXPathResult::AsBoolean(void) const + ?AsNodeSet@RXmlEngXPathResult@@QBE?AVRXmlEngNodeSet@@XZ @ 38 NONAME ; class RXmlEngNodeSet RXmlEngXPathResult::AsNodeSet(void) const + ?AsNumber@RXmlEngXPathResult@@QBENXZ @ 39 NONAME ; double RXmlEngXPathResult::AsNumber(void) const + ?AsStringL@RXmlEngXPathResult@@QBEXAAVRBuf8@@@Z @ 40 NONAME ; void RXmlEngXPathResult::AsStringL(class RBuf8 &) const + ?AttributeNodeL@TXmlEngElement@@QBE?AVTXmlEngAttr@@ABVTDesC8@@0@Z @ 41 NONAME ; class TXmlEngAttr TXmlEngElement::AttributeNodeL(class TDesC8 const &, class TDesC8 const &) const + ?AttributeValueL@TXmlEngElement@@QBE?AVTPtrC8@@ABVTDesC8@@0@Z @ 42 NONAME ; class TPtrC8 TXmlEngElement::AttributeValueL(class TDesC8 const &, class TDesC8 const &) const + ?BaseUriL@TXmlEngNode@@QBEXAAVRBuf8@@@Z @ 43 NONAME ; void TXmlEngNode::BaseUriL(class RBuf8 &) const + ?Chunk@TXmlEngChunkContainer@@QBEAAVRChunk@@XZ @ 44 NONAME ; class RChunk & TXmlEngChunkContainer::Chunk(void) const + ?ChunkOffset@TXmlEngChunkContainer@@QBEIXZ @ 45 NONAME ; unsigned int TXmlEngChunkContainer::ChunkOffset(void) const + ?Cid@TXmlEngDataContainer@@QBE?AVTPtrC8@@XZ @ 46 NONAME ; class TPtrC8 TXmlEngDataContainer::Cid(void) const + ?CloneDocumentL@RXmlEngDocument@@QBE?AV1@XZ @ 47 NONAME ; class RXmlEngDocument RXmlEngDocument::CloneDocumentL(void) const + ?Close@RXmlEngDOMImplementation@@QAEXH@Z @ 48 NONAME ; void RXmlEngDOMImplementation::Close(int) + ?Close@RXmlEngDOMParser@@QAEXXZ @ 49 NONAME ; void RXmlEngDOMParser::Close(void) + ?Close@RXmlEngDocument@@QAEXXZ @ 50 NONAME ; void RXmlEngDocument::Close(void) + ?Close@RXmlEngNodeListImpl@@QAEXXZ @ 51 NONAME ; void RXmlEngNodeListImpl::Close(void) + ?Contains@RXmlEngNodeSet@@QBEHVTXmlEngNode@@@Z @ 52 NONAME ; int RXmlEngNodeSet::Contains(class TXmlEngNode) const + ?Contents@TXmlEngBinaryContainer@@QBE?AVTPtrC8@@XZ @ 53 NONAME ; class TPtrC8 TXmlEngBinaryContainer::Contents(void) const + ?Contents@TXmlEngCharacterData@@QBE?AVTPtrC8@@XZ @ 54 NONAME ; class TPtrC8 TXmlEngCharacterData::Contents(void) const + ?CopyAttributesL@TXmlEngElement@@QAEXV1@@Z @ 55 NONAME ; void TXmlEngElement::CopyAttributesL(class TXmlEngElement) + ?CopyChildrenL@TXmlEngElement@@QAEXV1@@Z @ 56 NONAME ; void TXmlEngElement::CopyChildrenL(class TXmlEngElement) + ?CopyL@TXmlEngAttr@@QBE?AV1@XZ @ 57 NONAME ; class TXmlEngAttr TXmlEngAttr::CopyL(void) const + ?CopyL@TXmlEngNode@@QBE?AV1@XZ @ 58 NONAME ; class TXmlEngNode TXmlEngNode::CopyL(void) const + ?CopyToL@TXmlEngNode@@QBE?AV1@V1@@Z @ 59 NONAME ; class TXmlEngNode TXmlEngNode::CopyToL(class TXmlEngNode) const + ?Count@RXmlEngNodeListImpl@@QBEHXZ @ 60 NONAME ; int RXmlEngNodeListImpl::Count(void) const + ?CreateAttributeL@RXmlEngDocument@@QAE?AVTXmlEngAttr@@ABVTDesC8@@0@Z @ 61 NONAME ; class TXmlEngAttr RXmlEngDocument::CreateAttributeL(class TDesC8 const &, class TDesC8 const &) + ?CreateBinaryContainerL@RXmlEngDocument@@QAE?AVTXmlEngBinaryContainer@@ABVTDesC8@@0@Z @ 62 NONAME ; class TXmlEngBinaryContainer RXmlEngDocument::CreateBinaryContainerL(class TDesC8 const &, class TDesC8 const &) + ?CreateCDATASectionL@RXmlEngDocument@@QAE?AVTXmlEngCDATASection@@ABVTDesC8@@@Z @ 63 NONAME ; class TXmlEngCDATASection RXmlEngDocument::CreateCDATASectionL(class TDesC8 const &) + ?CreateChunkContainerL@RXmlEngDocument@@QAE?AVTXmlEngChunkContainer@@ABVTDesC8@@ABVRChunk@@HH@Z @ 64 NONAME ; class TXmlEngChunkContainer RXmlEngDocument::CreateChunkContainerL(class TDesC8 const &, class RChunk const &, int, int) + ?CreateCommentL@RXmlEngDocument@@QAE?AVTXmlEngComment@@ABVTDesC8@@@Z @ 65 NONAME ; class TXmlEngComment RXmlEngDocument::CreateCommentL(class TDesC8 const &) + ?CreateDocumentElementL@RXmlEngDocument@@QAE?AVTXmlEngElement@@ABVTDesC8@@00@Z @ 66 NONAME ; class TXmlEngElement RXmlEngDocument::CreateDocumentElementL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?CreateElementL@RXmlEngDocument@@QAE?AVTXmlEngElement@@ABVTDesC8@@00@Z @ 67 NONAME ; class TXmlEngElement RXmlEngDocument::CreateElementL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?CreateEntityReferenceL@RXmlEngDocument@@QAE?AVTXmlEngEntityReference@@ABVTDesC8@@@Z @ 68 NONAME ; class TXmlEngEntityReference RXmlEngDocument::CreateEntityReferenceL(class TDesC8 const &) + ?CreateExpressionL@TXmlEngXPathEvaluator@@QAE?AVRXmlEngXPathExpression@@ABVTDesC8@@PBVMXmlEngNamespaceResolver@@@Z @ 69 NONAME ; class RXmlEngXPathExpression TXmlEngXPathEvaluator::CreateExpressionL(class TDesC8 const &, class MXmlEngNamespaceResolver const *) + ?CreateFileContainerL@RXmlEngDocument@@QAE?AVTXmlEngFileContainer@@ABVTDesC8@@ABVRFile@@@Z @ 70 NONAME ; class TXmlEngFileContainer RXmlEngDocument::CreateFileContainerL(class TDesC8 const &, class RFile const &) + ?CreateProcessingInstructionL@RXmlEngDocument@@QAE?AVTXmlEngProcessingInstruction@@ABVTDesC8@@0@Z @ 71 NONAME ; class TXmlEngProcessingInstruction RXmlEngDocument::CreateProcessingInstructionL(class TDesC8 const &, class TDesC8 const &) + ?CreateTextNodeL@RXmlEngDocument@@QAE?AVTXmlEngTextNode@@ABVTDesC8@@@Z @ 72 NONAME ; class TXmlEngTextNode RXmlEngDocument::CreateTextNodeL(class TDesC8 const &) + ?Data@TXmlEngProcessingInstruction@@QBE?AVTPtrC8@@XZ @ 73 NONAME ; class TPtrC8 TXmlEngProcessingInstruction::Data(void) const + ?Destroy@RXmlEngXPathExpression@@QAEXXZ @ 74 NONAME ; void RXmlEngXPathExpression::Destroy(void) + ?DocumentElement@RXmlEngDocument@@QBE?AVTXmlEngElement@@XZ @ 75 NONAME ; class TXmlEngElement RXmlEngDocument::DocumentElement(void) const + ?DocumentUri@RXmlEngDocument@@QBE?AVTPtrC8@@XZ @ 76 NONAME ; class TPtrC8 RXmlEngDocument::DocumentUri(void) const + ?ElementCopyNoChildrenL@TXmlEngElement@@QBE?AV1@H@Z @ 77 NONAME ; class TXmlEngElement TXmlEngElement::ElementCopyNoChildrenL(int) const + ?Unused_Func1@TXmlEngXPathConfiguration@@SAXH@Z @ 78 NONAME ABSENT ; void TXmlEngXPathConfiguration::Unused_Func1(int) + ?EvaluateL@TXmlEngXPathEvaluator@@QAE?AVRXmlEngXPathResult@@ABVTDesC8@@VTXmlEngNode@@PBVMXmlEngNamespaceResolver@@@Z @ 79 NONAME ; class RXmlEngXPathResult TXmlEngXPathEvaluator::EvaluateL(class TDesC8 const &, class TXmlEngNode, class MXmlEngNamespaceResolver const *) + ?EvaluateL@RXmlEngXPathExpression@@QBE?AVRXmlEngXPathResult@@VTXmlEngNode@@PBVMXmlEngNamespaceResolver@@@Z @ 80 NONAME ; class RXmlEngXPathResult RXmlEngXPathExpression::EvaluateL(class TXmlEngNode, class MXmlEngNamespaceResolver const *) const + ?EvaluateWithDependenciesL@TXmlEngXPathEvaluator@@QAE?AVRXmlEngXPathResult@@ABVTDesC8@@VTXmlEngNode@@PBVMXmlEngNamespaceResolver@@AAVRXmlEngNodeSet@@@Z @ 81 NONAME ; class RXmlEngXPathResult TXmlEngXPathEvaluator::EvaluateWithDependenciesL(class TDesC8 const &, class TXmlEngNode, class MXmlEngNamespaceResolver const *, class RXmlEngNodeSet &) + ?EvaluateWithDependenciesL@RXmlEngXPathExpression@@QBE?AVRXmlEngXPathResult@@VTXmlEngNode@@AAVRXmlEngNodeSet@@PBVMXmlEngNamespaceResolver@@@Z @ 82 NONAME ; class RXmlEngXPathResult RXmlEngXPathExpression::EvaluateWithDependenciesL(class TXmlEngNode, class RXmlEngNodeSet &, class MXmlEngNamespaceResolver const *) const + ?ExtendedContext@RXmlEngXPathExpression@@QBEPAXXZ @ 83 NONAME ; void * RXmlEngXPathExpression::ExtendedContext(void) const + ?File@TXmlEngFileContainer@@QBEAAVRFile@@XZ @ 84 NONAME ; class RFile & TXmlEngFileContainer::File(void) const + ?FindElementByXmlIdL@RXmlEngDocument@@QBE?AVTXmlEngElement@@ABVTDesC8@@@Z @ 85 NONAME ; class TXmlEngElement RXmlEngDocument::FindElementByXmlIdL(class TDesC8 const &) const + ?FindOrCreateNsDeclL@TXmlEngElement@@QAE?AVTXmlEngNamespace@@ABVTDesC8@@0@Z @ 86 NONAME ; class TXmlEngNamespace TXmlEngElement::FindOrCreateNsDeclL(class TDesC8 const &, class TDesC8 const &) + ?FindOrCreateNsDeclL@TXmlEngElement@@QAE?AVTXmlEngNamespace@@ABVTDesC8@@@Z @ 87 NONAME ; class TXmlEngNamespace TXmlEngElement::FindOrCreateNsDeclL(class TDesC8 const &) + ?FinishL@RXmlEngDOMParser@@QAE?AVRXmlEngDocument@@XZ @ 88 NONAME ; class RXmlEngDocument RXmlEngDOMParser::FinishL(void) + ?FirstChild@TXmlEngNode@@QBE?AV1@XZ @ 89 NONAME ; class TXmlEngNode TXmlEngNode::FirstChild(void) const + ?Free@RXmlEngNodeSet@@QAEXXZ @ 90 NONAME ; void RXmlEngNodeSet::Free(void) + ?Free@RXmlEngXPathResult@@QAEXXZ @ 91 NONAME ; void RXmlEngXPathResult::Free(void) + ?GetAttributes@TXmlEngElement@@QBEXAAV?$RXmlEngNodeList@VTXmlEngAttr@@@@@Z @ 92 NONAME ; void TXmlEngElement::GetAttributes(class RXmlEngNodeList &) const + ?GetChildElements@TXmlEngElement@@QBEXAAV?$RXmlEngNodeList@VTXmlEngElement@@@@@Z @ 93 NONAME ; void TXmlEngElement::GetChildElements(class RXmlEngNodeList &) const + ?GetChildNodes@TXmlEngNode@@QBEXAAV?$RXmlEngNodeList@VTXmlEngNode@@@@@Z @ 94 NONAME ; void TXmlEngNode::GetChildNodes(class RXmlEngNodeList &) const + ?GetDataContainerList@RXmlEngDocument@@QAEHAAV?$RArray@VTXmlEngDataContainer@@@@@Z @ 95 NONAME ; int RXmlEngDocument::GetDataContainerList(class RArray &) + ?GetElementsByTagNameL@TXmlEngElement@@QBEXAAV?$RXmlEngNodeList@VTXmlEngElement@@@@ABVTDesC8@@1@Z @ 96 NONAME ; void TXmlEngElement::GetElementsByTagNameL(class RXmlEngNodeList &, class TDesC8 const &, class TDesC8 const &) const + ?GetLastParsingError@RXmlEngDOMParser@@QAEHXZ @ 97 NONAME ; int RXmlEngDOMParser::GetLastParsingError(void) + ?HasAttributes@TXmlEngNode@@QBEHXZ @ 98 NONAME ; int TXmlEngNode::HasAttributes(void) const + ?HasChildNodes@TXmlEngNode@@QBEHXZ @ 99 NONAME ; int TXmlEngNode::HasChildNodes(void) const + ?HasNext@RXmlEngNodeListImpl@@QBEHXZ @ 100 NONAME ; int RXmlEngNodeListImpl::HasNext(void) const + ?HasNsDeclarationForPrefixL@TXmlEngElement@@QBEHABVTDesC8@@@Z @ 101 NONAME ; int TXmlEngElement::HasNsDeclarationForPrefixL(class TDesC8 const &) const + ?Implementation@RXmlEngDocument@@QBE?AVRXmlEngDOMImplementation@@XZ @ 102 NONAME ; class RXmlEngDOMImplementation RXmlEngDocument::Implementation(void) const + ?InitializeL@RXmlEngNodeSet@@QAEXXZ @ 103 NONAME ; void RXmlEngNodeSet::InitializeL(void) + ?InnerXmlL@TXmlEngNode@@QAEHAAVRBuf8@@@Z @ 104 NONAME ; int TXmlEngNode::InnerXmlL(class RBuf8 &) + ?InstanceMap@TXmlEngXPathEvaluator@@QAEPAVCXmlEngXFormsInstanceMap@@XZ @ 105 NONAME ; class CXmlEngXFormsInstanceMap * TXmlEngXPathEvaluator::InstanceMap(void) + ?IsDefault@TXmlEngNamespace@@QBEHXZ @ 106 NONAME ; int TXmlEngNamespace::IsDefault(void) const + ?IsDefaultNamespaceL@TXmlEngNode@@QBEHABVTDesC8@@@Z @ 107 NONAME ; int TXmlEngNode::IsDefaultNamespaceL(class TDesC8 const &) const + ?IsElementContentWhitespace@TXmlEngTextNode@@QBEHXZ @ 108 NONAME ; int TXmlEngTextNode::IsElementContentWhitespace(void) const + ?IsFunctionSupportedL@TXmlEngXPathConfiguration@@SAHABVTDesC8@@0@Z @ 109 NONAME ABSENT ; int TXmlEngXPathConfiguration::IsFunctionSupportedL(class TDesC8 const &, class TDesC8 const &) + ?IsSimpleTextContents@TXmlEngNode@@QBEHXZ @ 110 NONAME ; int TXmlEngNode::IsSimpleTextContents(void) const + ?IsStandalone@RXmlEngDocument@@QBEHXZ @ 111 NONAME ; int RXmlEngDocument::IsStandalone(void) const + ?IsUndefined@TXmlEngNamespace@@QBEHXZ @ 112 NONAME ; int TXmlEngNamespace::IsUndefined(void) const + ?LastChild@TXmlEngNode@@QBE?AV1@XZ @ 113 NONAME ; class TXmlEngNode TXmlEngNode::LastChild(void) const + ?Length@RXmlEngNodeSet@@QBEHXZ @ 114 NONAME ; int RXmlEngNodeSet::Length(void) const + ?Length@TXmlEngCharacterData@@QBEIXZ @ 115 NONAME ; unsigned int TXmlEngCharacterData::Length(void) const + ?LookupNamespaceByPrefixL@TXmlEngElement@@QBE?AVTXmlEngNamespace@@ABVTDesC8@@@Z @ 116 NONAME ; class TXmlEngNamespace TXmlEngElement::LookupNamespaceByPrefixL(class TDesC8 const &) const + ?LookupNamespaceByUriL@TXmlEngElement@@QBE?AVTXmlEngNamespace@@ABVTDesC8@@@Z @ 117 NONAME ; class TXmlEngNamespace TXmlEngElement::LookupNamespaceByUriL(class TDesC8 const &) const + ?LookupNamespaceUriL@TXmlEngNode@@QBE?AVTPtrC8@@ABVTDesC8@@@Z @ 118 NONAME ; class TPtrC8 TXmlEngNode::LookupNamespaceUriL(class TDesC8 const &) const + ?LookupPrefixL@TXmlEngNode@@QBE?AVTPtrC8@@ABVTDesC8@@@Z @ 119 NONAME ; class TPtrC8 TXmlEngNode::LookupPrefixL(class TDesC8 const &) const + ?MoveAfterSibling@TXmlEngNode@@QAEXV1@@Z @ 120 NONAME ; void TXmlEngNode::MoveAfterSibling(class TXmlEngNode) + ?MoveBeforeSibling@TXmlEngNode@@QAEXV1@@Z @ 121 NONAME ; void TXmlEngNode::MoveBeforeSibling(class TXmlEngNode) + ?Name@TXmlEngAttr@@QBE?AVTPtrC8@@XZ @ 122 NONAME ; class TPtrC8 TXmlEngAttr::Name(void) const + ?Name@TXmlEngNode@@QBE?AVTPtrC8@@XZ @ 123 NONAME ; class TPtrC8 TXmlEngNode::Name(void) const + ?NamespaceDeclaration@TXmlEngNode@@QBE?AVTXmlEngNamespace@@XZ @ 124 NONAME ; class TXmlEngNamespace TXmlEngNode::NamespaceDeclaration(void) const + ?NamespaceUri@TXmlEngNode@@QBE?AVTPtrC8@@XZ @ 125 NONAME ; class TPtrC8 TXmlEngNode::NamespaceUri(void) const + ?NewL@CXmlEngXFormsInstanceMap@@SAPAV1@XZ @ 126 NONAME ; class CXmlEngXFormsInstanceMap * CXmlEngXFormsInstanceMap::NewL(void) + ?NewLC@CXmlEngXFormsInstanceMap@@SAPAV1@XZ @ 127 NONAME ; class CXmlEngXFormsInstanceMap * CXmlEngXFormsInstanceMap::NewLC(void) + ?Next@RXmlEngNodeListImpl@@QAE?AVTXmlEngNode@@XZ @ 128 NONAME ; class TXmlEngNode RXmlEngNodeListImpl::Next(void) + ?NextSibling@TXmlEngNode@@QBE?AV1@XZ @ 129 NONAME ; class TXmlEngNode TXmlEngNode::NextSibling(void) const + ?NodeType@TXmlEngNode@@QBE?AW4TXmlEngDOMNodeType@1@XZ @ 130 NONAME ; enum TXmlEngNode::TXmlEngDOMNodeType TXmlEngNode::NodeType(void) const + ?Open@RXmlEngDOMParser@@QAEHAAVRXmlEngDOMImplementation@@@Z @ 131 NONAME ; int RXmlEngDOMParser::Open(class RXmlEngDOMImplementation &) + ?OpenL@RXmlEngDOMImplementation@@QAEXPAVRHeap@@@Z @ 132 NONAME ; void RXmlEngDOMImplementation::OpenL(class RHeap *) + ?OpenL@RXmlEngDocument@@QAEXAAVRXmlEngDOMImplementation@@@Z @ 133 NONAME ; void RXmlEngDocument::OpenL(class RXmlEngDOMImplementation &) + ?OpenL@RXmlEngDocument@@QAEXAAVRXmlEngDOMImplementation@@PAX@Z @ 134 NONAME ; void RXmlEngDocument::OpenL(class RXmlEngDOMImplementation &, void *) + ?OpenL@RXmlEngDocument@@QAEXAAVRXmlEngDOMImplementation@@VTXmlEngElement@@@Z @ 135 NONAME ; void RXmlEngDocument::OpenL(class RXmlEngDOMImplementation &, class TXmlEngElement) + ?OuterXmlL@TXmlEngNode@@QAEHAAVRBuf8@@@Z @ 136 NONAME ; int TXmlEngNode::OuterXmlL(class RBuf8 &) + ?OwnerDocument@TXmlEngNode@@QBE?AVRXmlEngDocument@@XZ @ 137 NONAME ; class RXmlEngDocument TXmlEngNode::OwnerDocument(void) const + ?OwnerElement@TXmlEngAttr@@QBE?BVTXmlEngElement@@XZ @ 138 NONAME ; class TXmlEngElement const TXmlEngAttr::OwnerElement(void) const + ?ParentNode@TXmlEngNode@@QBE?AV1@XZ @ 139 NONAME ; class TXmlEngNode TXmlEngNode::ParentNode(void) const + ?ParseChunkL@RXmlEngDOMParser@@QAEXABVTDesC8@@@Z @ 140 NONAME ; void RXmlEngDOMParser::ParseChunkL(class TDesC8 const &) + ?ParseFileL@RXmlEngDOMParser@@QAE?AVRXmlEngDocument@@AAVRFs@@ABVTDesC16@@I@Z @ 141 NONAME ; class RXmlEngDocument RXmlEngDOMParser::ParseFileL(class RFs &, class TDesC16 const &, unsigned int) + ?ParseFileL@RXmlEngDOMParser@@QAE?AVRXmlEngDocument@@ABVTDesC16@@I@Z @ 142 NONAME ; class RXmlEngDocument RXmlEngDOMParser::ParseFileL(class TDesC16 const &, unsigned int) + ?ParseL@RXmlEngDOMParser@@QAE?AVRXmlEngDocument@@ABVTDesC8@@@Z @ 143 NONAME ; class RXmlEngDocument RXmlEngDOMParser::ParseL(class TDesC8 const &) + ?Prefix@TXmlEngNamespace@@QBE?AVTPtrC8@@XZ @ 144 NONAME ; class TPtrC8 TXmlEngNamespace::Prefix(void) const + ?Prefix@TXmlEngNode@@QBE?AVTPtrC8@@XZ @ 145 NONAME ; class TPtrC8 TXmlEngNode::Prefix(void) const + ?PreviousSibling@TXmlEngNode@@QBE?AV1@XZ @ 146 NONAME ; class TXmlEngNode TXmlEngNode::PreviousSibling(void) const + ?ReconcileNamespacesL@TXmlEngNode@@QAEXXZ @ 147 NONAME ; void TXmlEngNode::ReconcileNamespacesL(void) + ?RegisterXmlIdL@RXmlEngDocument@@QAEXABVTDesC8@@0@Z @ 148 NONAME ; void RXmlEngDocument::RegisterXmlIdL(class TDesC8 const &, class TDesC8 const &) + ?RegisterXmlIdL@RXmlEngDocument@@QAEXVTXmlEngElement@@ABVTDesC8@@1@Z @ 149 NONAME ; void RXmlEngDocument::RegisterXmlIdL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &) + ?Remove@TXmlEngNode@@QAEXXZ @ 150 NONAME ; void TXmlEngNode::Remove(void) + ?RemoveAttributeL@TXmlEngElement@@QAEXABVTDesC8@@0@Z @ 151 NONAME ; void TXmlEngElement::RemoveAttributeL(class TDesC8 const &, class TDesC8 const &) + ?RemoveAttributes@TXmlEngElement@@QAEXXZ @ 152 NONAME ; void TXmlEngElement::RemoveAttributes(void) + ?RemoveChildElementsL@TXmlEngElement@@QAEXABVTDesC8@@0@Z @ 153 NONAME ; void TXmlEngElement::RemoveChildElementsL(class TDesC8 const &, class TDesC8 const &) + ?RemoveChildren@TXmlEngElement@@QAEXXZ @ 154 NONAME ; void TXmlEngElement::RemoveChildren(void) + ?RemoveEntryL@CXmlEngXFormsInstanceMap@@QAEXABVTDesC8@@@Z @ 155 NONAME ; void CXmlEngXFormsInstanceMap::RemoveEntryL(class TDesC8 const &) + ?RemoveExtensionFunction@TXmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 156 NONAME ABSENT ; void TXmlEngXPathConfiguration::RemoveExtensionFunction(class TXmlEngExtensionFunctionDescriptor const &) + ?RemoveExtensionFunctionVector@TXmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 157 NONAME ABSENT ; void TXmlEngXPathConfiguration::RemoveExtensionFunctionVector(class RArray const &, unsigned int) + ?RemoveNamespaceDeclarations@TXmlEngElement@@QAEXXZ @ 158 NONAME ; void TXmlEngElement::RemoveNamespaceDeclarations(void) + ?RemoveUserData@TXmlEngNode@@QAEPAVMXmlEngUserData@@XZ @ 159 NONAME ; class MXmlEngUserData * TXmlEngNode::RemoveUserData(void) + ?ReplaceWith@TXmlEngNode@@QAEXV1@@Z @ 160 NONAME ; void TXmlEngNode::ReplaceWith(class TXmlEngNode) + ?ResetExtensionFunctionsL@TXmlEngXPathConfiguration@@SAXXZ @ 161 NONAME ABSENT ; void TXmlEngXPathConfiguration::ResetExtensionFunctionsL(void) + ?SaveL@RXmlEngDocument@@QBEHAAVMXmlEngOutputStream@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 162 NONAME ; int RXmlEngDocument::SaveL(class MXmlEngOutputStream &, class TXmlEngNode, class TXmlEngSerializationOptions const &) const + ?SaveL@RXmlEngDocument@@QBEHAAVRBuf8@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 163 NONAME ; int RXmlEngDocument::SaveL(class RBuf8 &, class TXmlEngNode, class TXmlEngSerializationOptions const &) const + ?SaveL@RXmlEngDocument@@QBEHAAVRFs@@ABVTDesC16@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 164 NONAME ; int RXmlEngDocument::SaveL(class RFs &, class TDesC16 const &, class TXmlEngNode, class TXmlEngSerializationOptions const &) const + ?SaveL@RXmlEngDocument@@QBEHABVTDesC16@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 165 NONAME ; int RXmlEngDocument::SaveL(class TDesC16 const &, class TXmlEngNode, class TXmlEngSerializationOptions const &) const + ?SetAsFirstSibling@TXmlEngNode@@QAEXXZ @ 166 NONAME ; void TXmlEngNode::SetAsFirstSibling(void) + ?SetAsLastSibling@TXmlEngNode@@QAEXXZ @ 167 NONAME ; void TXmlEngNode::SetAsLastSibling(void) + ?SetAttributeL@TXmlEngElement@@QAEXABVTDesC8@@000@Z @ 168 NONAME ; void TXmlEngElement::SetAttributeL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?SetAttributeNodeL@TXmlEngElement@@QAEXVTXmlEngAttr@@@Z @ 169 NONAME ; void TXmlEngElement::SetAttributeNodeL(class TXmlEngAttr) + ?SetContentsL@TXmlEngBinaryContainer@@QAEXABVTDesC8@@@Z @ 170 NONAME ; void TXmlEngBinaryContainer::SetContentsL(class TDesC8 const &) + ?SetContentsL@TXmlEngCharacterData@@QAEXABVTDesC8@@@Z @ 171 NONAME ; void TXmlEngCharacterData::SetContentsL(class TDesC8 const &) + ?SetDataL@TXmlEngProcessingInstruction@@QAEXABVTDesC8@@@Z @ 172 NONAME ; void TXmlEngProcessingInstruction::SetDataL(class TDesC8 const &) + ?SetDefaultNamespaceL@TXmlEngElement@@QAE?AVTXmlEngNamespace@@ABVTDesC8@@@Z @ 173 NONAME ; class TXmlEngNamespace TXmlEngElement::SetDefaultNamespaceL(class TDesC8 const &) + ?SetDocumentElement@RXmlEngDocument@@QAEXVTXmlEngElement@@@Z @ 174 NONAME ; void RXmlEngDocument::SetDocumentElement(class TXmlEngElement) + ?SetDocumentUriL@RXmlEngDocument@@QAEXABVTDesC8@@@Z @ 175 NONAME ; void RXmlEngDocument::SetDocumentUriL(class TDesC8 const &) + ?SetEscapedTextL@TXmlEngElement@@QAEXABVTDesC8@@@Z @ 176 NONAME ; void TXmlEngElement::SetEscapedTextL(class TDesC8 const &) + ?SetEscapedValueL@TXmlEngAttr@@QAEXABVTDesC8@@@Z @ 177 NONAME ; void TXmlEngAttr::SetEscapedValueL(class TDesC8 const &) + ?SetExtendedContext@RXmlEngXPathExpression@@QAEXPAX@Z @ 178 NONAME ; void RXmlEngXPathExpression::SetExtendedContext(void *) + ?SetInstanceMap@TXmlEngXPathEvaluator@@QAEXPAVCXmlEngXFormsInstanceMap@@@Z @ 179 NONAME ; void TXmlEngXPathEvaluator::SetInstanceMap(class CXmlEngXFormsInstanceMap *) + ?SetNoDefaultNamespaceL@TXmlEngElement@@QAEXXZ @ 180 NONAME ; void TXmlEngElement::SetNoDefaultNamespaceL(void) + ?SetNodeFilter@TXmlEngSerializationOptions@@QAEXPAVMXmlEngNodeFilter@@@Z @ 181 NONAME ; void TXmlEngSerializationOptions::SetNodeFilter(class MXmlEngNodeFilter *) + ?SetStandalone@RXmlEngDocument@@QAEXH@Z @ 182 NONAME ; void RXmlEngDocument::SetStandalone(int) + ?SetTextL@TXmlEngElement@@QAEXABVTDesC8@@@Z @ 183 NONAME ; void TXmlEngElement::SetTextL(class TDesC8 const &) + ?SetTextNoEncL@TXmlEngElement@@QAEXABVTDesC8@@@Z @ 184 NONAME ; void TXmlEngElement::SetTextNoEncL(class TDesC8 const &) + ?SetValueL@TXmlEngAttr@@QAEXABVTDesC8@@@Z @ 185 NONAME ; void TXmlEngAttr::SetValueL(class TDesC8 const &) + ?SetValueL@TXmlEngNode@@QAEXABVTDesC8@@@Z @ 186 NONAME ; void TXmlEngNode::SetValueL(class TDesC8 const &) + ?SetValueNoEncL@TXmlEngAttr@@QAEXABVTDesC8@@@Z @ 187 NONAME ; void TXmlEngAttr::SetValueNoEncL(class TDesC8 const &) + ?SetXmlVersionL@RXmlEngDocument@@QAEXABVTDesC8@@@Z @ 188 NONAME ; void RXmlEngDocument::SetXmlVersionL(class TDesC8 const &) + ?Size@TXmlEngDataContainer@@QBEIXZ @ 189 NONAME ; unsigned int TXmlEngDataContainer::Size(void) const + ?SubstituteForL@TXmlEngNode@@QAE?AV1@V1@@Z @ 190 NONAME ; class TXmlEngNode TXmlEngNode::SubstituteForL(class TXmlEngNode) + ?Target@TXmlEngProcessingInstruction@@QBE?AVTPtrC8@@XZ @ 191 NONAME ; class TPtrC8 TXmlEngProcessingInstruction::Target(void) const + ?Text@TXmlEngElement@@QBE?AVTPtrC8@@XZ @ 192 NONAME ; class TPtrC8 TXmlEngElement::Text(void) const + ?TheXMLNamespaceL@TXmlEngElement@@QBE?AVTXmlEngNamespace@@XZ @ 193 NONAME ; class TXmlEngNamespace TXmlEngElement::TheXMLNamespaceL(void) const + ?ToBoolean@TXmlEngXPathObject@@SAHABVRXmlEngNodeSet@@@Z @ 194 NONAME ABSENT ; int TXmlEngXPathObject::ToBoolean(class RXmlEngNodeSet const &) + ?ToBoolean@TXmlEngXPathObject@@SAHABVTDesC8@@@Z @ 195 NONAME ABSENT ; int TXmlEngXPathObject::ToBoolean(class TDesC8 const &) + ?ToBoolean@TXmlEngXPathObject@@SAHABVTXmlEngNode@@@Z @ 196 NONAME ABSENT ; int TXmlEngXPathObject::ToBoolean(class TXmlEngNode const &) + ?ToBoolean@TXmlEngXPathObject@@SAHN@Z @ 197 NONAME ABSENT ; int TXmlEngXPathObject::ToBoolean(double) + ?ToBooleanL@TXmlEngXPathObject@@SAHABVTDesC8@@@Z @ 198 NONAME ABSENT ; int TXmlEngXPathObject::ToBooleanL(class TDesC8 const &) + ?ToNumberL@TXmlEngXPathObject@@SANABVRXmlEngNodeSet@@@Z @ 199 NONAME ABSENT ; double TXmlEngXPathObject::ToNumberL(class RXmlEngNodeSet const &) + ?ToNumberL@TXmlEngXPathObject@@SANABVTDesC8@@@Z @ 200 NONAME ABSENT ; double TXmlEngXPathObject::ToNumberL(class TDesC8 const &) + ?ToNumberL@TXmlEngXPathObject@@SANABVTXmlEngNode@@@Z @ 201 NONAME ABSENT ; double TXmlEngXPathObject::ToNumberL(class TXmlEngNode const &) + ?ToNumberL@TXmlEngXPathObject@@SANH@Z @ 202 NONAME ABSENT ; double TXmlEngXPathObject::ToNumberL(int) + ?ToStringL@TXmlEngXPathObject@@SAXABVRXmlEngNodeSet@@AAVRBuf8@@@Z @ 203 NONAME ABSENT ; void TXmlEngXPathObject::ToStringL(class RXmlEngNodeSet const &, class RBuf8 &) + ?ToStringL@TXmlEngXPathObject@@SAXABVTXmlEngNode@@AAVRBuf8@@@Z @ 204 NONAME ABSENT ; void TXmlEngXPathObject::ToStringL(class TXmlEngNode const &, class RBuf8 &) + ?ToStringL@TXmlEngXPathObject@@SAXHAAVRBuf8@@@Z @ 205 NONAME ABSENT ; void TXmlEngXPathObject::ToStringL(int, class RBuf8 &) + ?ToStringL@TXmlEngXPathObject@@SAXNAAVRBuf8@@@Z @ 206 NONAME ABSENT ; void TXmlEngXPathObject::ToStringL(double, class RBuf8 &) + ?Type@RXmlEngXPathResult@@QBE?AW4TXmlEngXPathResultType@1@XZ @ 207 NONAME ; enum RXmlEngXPathResult::TXmlEngXPathResultType RXmlEngXPathResult::Type(void) const + ?Unlink@TXmlEngNode@@QAE?AV1@XZ @ 208 NONAME ; class TXmlEngNode TXmlEngNode::Unlink(void) + ?Uri@TXmlEngNamespace@@QBE?AVTPtrC8@@XZ @ 209 NONAME ; class TPtrC8 TXmlEngNamespace::Uri(void) const + ?UserData@TXmlEngNode@@QBEPAVMXmlEngUserData@@XZ @ 210 NONAME ; class MXmlEngUserData * TXmlEngNode::UserData(void) const + ?Value@TXmlEngAttr@@QBE?AVTPtrC8@@XZ @ 211 NONAME ; class TPtrC8 TXmlEngAttr::Value(void) const + ?Value@TXmlEngNode@@QBE?AVTPtrC8@@XZ @ 212 NONAME ; class TPtrC8 TXmlEngNode::Value(void) const + ?WholeTextContentsCopyL@TXmlEngNode@@QBEXAAVRBuf8@@@Z @ 213 NONAME ; void TXmlEngNode::WholeTextContentsCopyL(class RBuf8 &) const + ?WholeValueCopyL@TXmlEngAttr@@QBEXAAVRBuf8@@@Z @ 214 NONAME ; void TXmlEngAttr::WholeValueCopyL(class RBuf8 &) const + ?XmlEncoding@RXmlEngDocument@@QBE?AVTPtrC8@@XZ @ 215 NONAME ; class TPtrC8 RXmlEngDocument::XmlEncoding(void) const + ?XmlEngRenameElementL@TDomUtils@@QAEXVTXmlEngElement@@ABVTDesC8@@11@Z @ 216 NONAME ; void TDomUtils::XmlEngRenameElementL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?XmlVersion@RXmlEngDocument@@QBE?AVTPtrC8@@XZ @ 217 NONAME ; class TPtrC8 RXmlEngDocument::XmlVersion(void) const + ?ReplaceWithL@TXmlEngNode@@QAEXV1@@Z @ 218 NONAME ; void TXmlEngNode::ReplaceWithL(class TXmlEngNode) + ?SetDataSerializer@TXmlEngSerializationOptions@@QAEXPAVMXmlEngDataSerializer@@@Z @ 219 NONAME ; void TXmlEngSerializationOptions::SetDataSerializer(class MXmlEngDataSerializer *) + ?CreateDocumentFragmentL@RXmlEngDocument@@QAE?AVTXmlEngDocumentFragment@@XZ @ 220 NONAME ; class TXmlEngDocumentFragment RXmlEngDocument::CreateDocumentFragmentL(void) + ?ToBoolean@XmlEngXPathUtils@@SAHABVRXmlEngNodeSet@@@Z @ 221 NONAME ; int XmlEngXPathUtils::ToBoolean(class RXmlEngNodeSet const &) + ?ToBoolean@XmlEngXPathUtils@@SAHABVTDesC8@@@Z @ 222 NONAME ; int XmlEngXPathUtils::ToBoolean(class TDesC8 const &) + ?ToBoolean@XmlEngXPathUtils@@SAHABVTXmlEngNode@@@Z @ 223 NONAME ; int XmlEngXPathUtils::ToBoolean(class TXmlEngNode const &) + ?ToBoolean@XmlEngXPathUtils@@SAHN@Z @ 224 NONAME ; int XmlEngXPathUtils::ToBoolean(double) + ?ToBooleanL@XmlEngXPathUtils@@SAHABVTDesC8@@@Z @ 225 NONAME ; int XmlEngXPathUtils::ToBooleanL(class TDesC8 const &) + ?ToNumberL@XmlEngXPathUtils@@SANABVRXmlEngNodeSet@@@Z @ 226 NONAME ; double XmlEngXPathUtils::ToNumberL(class RXmlEngNodeSet const &) + ?ToNumberL@XmlEngXPathUtils@@SANABVTDesC8@@@Z @ 227 NONAME ; double XmlEngXPathUtils::ToNumberL(class TDesC8 const &) + ?ToNumberL@XmlEngXPathUtils@@SANABVTXmlEngNode@@@Z @ 228 NONAME ; double XmlEngXPathUtils::ToNumberL(class TXmlEngNode const &) + ?ToNumberL@XmlEngXPathUtils@@SANH@Z @ 229 NONAME ; double XmlEngXPathUtils::ToNumberL(int) + ?ToStringL@XmlEngXPathUtils@@SAXABVRXmlEngNodeSet@@AAVRBuf8@@@Z @ 230 NONAME ; void XmlEngXPathUtils::ToStringL(class RXmlEngNodeSet const &, class RBuf8 &) + ?ToStringL@XmlEngXPathUtils@@SAXABVTXmlEngNode@@AAVRBuf8@@@Z @ 231 NONAME ; void XmlEngXPathUtils::ToStringL(class TXmlEngNode const &, class RBuf8 &) + ?ToStringL@XmlEngXPathUtils@@SAXHAAVRBuf8@@@Z @ 232 NONAME ; void XmlEngXPathUtils::ToStringL(int, class RBuf8 &) + ?ToStringL@XmlEngXPathUtils@@SAXNAAVRBuf8@@@Z @ 233 NONAME ; void XmlEngXPathUtils::ToStringL(double, class RBuf8 &) + ??0TXmlEngExtensionFunctionDescriptor@@QAE@XZ @ 234 NONAME ; TXmlEngExtensionFunctionDescriptor::TXmlEngExtensionFunctionDescriptor(void) + ?AddExtensionFunctionL@XmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 235 NONAME ; void XmlEngXPathConfiguration::AddExtensionFunctionL(class TXmlEngExtensionFunctionDescriptor const &) + ?AddExtensionFunctionVectorL@XmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 236 NONAME ; void XmlEngXPathConfiguration::AddExtensionFunctionVectorL(class RArray const &, unsigned int) + ?AddNativeExtensionFunctionL@XmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 237 NONAME ; void XmlEngXPathConfiguration::AddNativeExtensionFunctionL(class TXmlEngExtensionFunctionDescriptor const &) + ?AddNativeExtensionFunctionVectorL@XmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 238 NONAME ; void XmlEngXPathConfiguration::AddNativeExtensionFunctionVectorL(class RArray const &, unsigned int) + ?IsFunctionSupportedL@XmlEngXPathConfiguration@@SAHABVTDesC8@@0@Z @ 239 NONAME ; int XmlEngXPathConfiguration::IsFunctionSupportedL(class TDesC8 const &, class TDesC8 const &) + ?RemoveExtensionFunction@XmlEngXPathConfiguration@@SAXABVTXmlEngExtensionFunctionDescriptor@@@Z @ 240 NONAME ; void XmlEngXPathConfiguration::RemoveExtensionFunction(class TXmlEngExtensionFunctionDescriptor const &) + ?RemoveExtensionFunctionVector@XmlEngXPathConfiguration@@SAXABV?$RArray@VTXmlEngExtensionFunctionDescriptor@@@@I@Z @ 241 NONAME ; void XmlEngXPathConfiguration::RemoveExtensionFunctionVector(class RArray const &, unsigned int) + ?ResetExtensionFunctionsL@XmlEngXPathConfiguration@@SAXXZ @ 242 NONAME ; void XmlEngXPathConfiguration::ResetExtensionFunctionsL(void) + ?Unused_Func1@XmlEngXPathConfiguration@@SAXH@Z @ 243 NONAME ; void XmlEngXPathConfiguration::Unused_Func1(int) + ?RenameElementL@TXmlEngElement@@QAEXABVTDesC8@@00@Z @ 244 NONAME ; void TXmlEngElement::RenameElementL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + ?Close@RXmlEngDOMImplementation@@QAEXXZ @ 245 NONAME ; void RXmlEngDOMImplementation::Close(void) + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/bwins/xmlengineserializer.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/bwins/xmlengineserializer.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +EXPORTS + ??0TXmlEngParsingOptions@@QAE@I@Z @ 1 NONAME ; TXmlEngParsingOptions::TXmlEngParsingOptions(unsigned int) + ?DeserializeL@CXmlEngDeserializer@@UAEXAAVRFs@@ABVTDesC16@@ABVTXmlEngParsingOptions@@@Z @ 2 NONAME ; void CXmlEngDeserializer::DeserializeL(class RFs &, class TDesC16 const &, class TXmlEngParsingOptions const &) + ?DeserializeL@CXmlEngDeserializer@@UAEXABVTDesC16@@ABVTXmlEngParsingOptions@@@Z @ 3 NONAME ; void CXmlEngDeserializer::DeserializeL(class TDesC16 const &, class TXmlEngParsingOptions const &) + ?DeserializeL@CXmlEngDeserializer@@UAEXABVTDesC8@@ABVTXmlEngParsingOptions@@@Z @ 4 NONAME ; void CXmlEngDeserializer::DeserializeL(class TDesC8 const &, class TXmlEngParsingOptions const &) + ?DeserializeL@CXmlEngDeserializer@@UAEXXZ @ 5 NONAME ; void CXmlEngDeserializer::DeserializeL(void) + ?DeserializeL@CXmlEngDeserializerDOM@@QAE?AVRXmlEngDocument@@AAVRFs@@ABVTDesC16@@W4TXmlEngDeserializerType@@@Z @ 6 NONAME ; class RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(class RFs &, class TDesC16 const &, enum TXmlEngDeserializerType) + ?DeserializeL@CXmlEngDeserializerDOM@@QAE?AVRXmlEngDocument@@ABVTDesC16@@W4TXmlEngDeserializerType@@@Z @ 7 NONAME ; class RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(class TDesC16 const &, enum TXmlEngDeserializerType) + ?DeserializeL@CXmlEngDeserializerDOM@@QAE?AVRXmlEngDocument@@ABVTDesC8@@W4TXmlEngDeserializerType@@@Z @ 8 NONAME ; class RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(class TDesC8 const &, enum TXmlEngDeserializerType) + ?DeserializeL@CXmlEngDeserializerDOM@@QAE?AVRXmlEngDocument@@XZ @ 9 NONAME ; class RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(void) + ?NewL@CXmlEngDeserializer@@SAPAV1@AAVMContentHandler@Xml@@W4TXmlEngDeserializerType@@@Z @ 10 NONAME ; class CXmlEngDeserializer * CXmlEngDeserializer::NewL(class Xml::MContentHandler &, enum TXmlEngDeserializerType) + ?DisableFeature@CXmlEngDeserializer@@UAEHH@Z @ 11 NONAME ; int CXmlEngDeserializer::DisableFeature(int) + ?DisableFeature@CXmlEngDeserializerXOP@@UAEHH@Z @ 12 NONAME ; int CXmlEngDeserializerXOP::DisableFeature(int) + ?EnableFeature@CXmlEngDeserializer@@UAEHH@Z @ 13 NONAME ; int CXmlEngDeserializer::EnableFeature(int) + ?EnableFeature@CXmlEngDeserializerXOP@@UAEHH@Z @ 14 NONAME ; int CXmlEngDeserializerXOP::EnableFeature(int) + ?ExternalData@CXmlEngDeserializer@@QAEPAV?$RArray@VTXmlEngDataContainer@@@@XZ @ 15 NONAME ; class RArray * CXmlEngDeserializer::ExternalData(void) + ?ExternalData@CXmlEngDeserializerDOM@@QAEPAV?$RArray@VTXmlEngDataContainer@@@@XZ @ 16 NONAME ; class RArray * CXmlEngDeserializerDOM::ExternalData(void) + ?IsFeatureEnabled@CXmlEngDeserializer@@UBEHH@Z @ 17 NONAME ; int CXmlEngDeserializer::IsFeatureEnabled(int) const + ?IsFeatureEnabled@CXmlEngDeserializerXOP@@UBEHH@Z @ 18 NONAME ; int CXmlEngDeserializerXOP::IsFeatureEnabled(int) const + ?NewL@CXmlEngDeserializerDOM@@SAPAV1@XZ @ 19 NONAME ; class CXmlEngDeserializerDOM * CXmlEngDeserializerDOM::NewL(void) + ?NewL@CXmlEngSerializerXOP@@SAPAV1@H@Z @ 20 NONAME ; class CXmlEngSerializerXOP * CXmlEngSerializerXOP::NewL(int) + ?ParsingOptions@CXmlEngDeserializer@@UAEABVTXmlEngParsingOptions@@XZ @ 21 NONAME ; class TXmlEngParsingOptions const & CXmlEngDeserializer::ParsingOptions(void) + ?SerializeL@CXmlEngSerializer@@UAEHAAVRBuf8@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 22 NONAME ; int CXmlEngSerializer::SerializeL(class RBuf8 &, class TXmlEngNode, class TXmlEngSerializationOptions const &) + ?SerializeL@CXmlEngSerializer@@UAEHAAVRFs@@ABVTDesC16@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 23 NONAME ; int CXmlEngSerializer::SerializeL(class RFs &, class TDesC16 const &, class TXmlEngNode, class TXmlEngSerializationOptions const &) + ?SerializeL@CXmlEngSerializer@@UAEHABVTDesC16@@VTXmlEngNode@@ABVTXmlEngSerializationOptions@@@Z @ 24 NONAME ; int CXmlEngSerializer::SerializeL(class TDesC16 const &, class TXmlEngNode, class TXmlEngSerializationOptions const &) + ?SerializeL@CXmlEngSerializer@@UAEHVTXmlEngNode@@@Z @ 25 NONAME ; int CXmlEngSerializer::SerializeL(class TXmlEngNode) + ?NewL@CXmlEngSerializer@@SAPAV1@W4TXmlEngSerializerType@@@Z @ 26 NONAME ; class CXmlEngSerializer * CXmlEngSerializer::NewL(enum TXmlEngSerializerType) + ?SetContentHandlerL@CXmlEngDeserializer@@UAEXAAVMContentHandler@Xml@@@Z @ 27 NONAME ; void CXmlEngDeserializer::SetContentHandlerL(class Xml::MContentHandler &) + ?SetInputBuffer@CXmlEngDeserializer@@QAEXABVTDesC8@@@Z @ 28 NONAME ; void CXmlEngDeserializer::SetInputBuffer(class TDesC8 const &) + ?SetInputBuffer@CXmlEngDeserializerDOM@@QAEXABVTDesC8@@W4TXmlEngDeserializerType@@@Z @ 29 NONAME ; void CXmlEngDeserializerDOM::SetInputBuffer(class TDesC8 const &, enum TXmlEngDeserializerType) + ?SetInputFileL@CXmlEngDeserializer@@QAEXABVTDesC16@@@Z @ 30 NONAME ; void CXmlEngDeserializer::SetInputFileL(class TDesC16 const &) + ?SetInputFileL@CXmlEngDeserializerDOM@@QAEXABVTDesC16@@W4TXmlEngDeserializerType@@@Z @ 31 NONAME ; void CXmlEngDeserializerDOM::SetInputFileL(class TDesC16 const &, enum TXmlEngDeserializerType) + ?SetOutput@CXmlEngSerializer@@QAEXAAVMXmlEngOutputStream@@@Z @ 32 NONAME ; void CXmlEngSerializer::SetOutput(class MXmlEngOutputStream &) + ?SetOutput@CXmlEngSerializer@@QAEXAAVRBuf8@@@Z @ 33 NONAME ; void CXmlEngSerializer::SetOutput(class RBuf8 &) + ?SetOutputL@CXmlEngSerializer@@QAEXABVTDesC16@@@Z @ 34 NONAME ; void CXmlEngSerializer::SetOutputL(class TDesC16 const &) + ?SetParsingOptions@CXmlEngDeserializer@@UAEXAAVTXmlEngParsingOptions@@@Z @ 35 NONAME ; void CXmlEngDeserializer::SetParsingOptions(class TXmlEngParsingOptions &) + ?SetSerializationOptions@CXmlEngSerializer@@QAEXAAVTXmlEngSerializationOptions@@@Z @ 36 NONAME ; void CXmlEngSerializer::SetSerializationOptions(class TXmlEngSerializationOptions &) + ?UseDOMImplementationL@CXmlEngDeserializerDOM@@QAEXAAVRXmlEngDOMImplementation@@@Z @ 37 NONAME ; void CXmlEngDeserializerDOM::UseDOMImplementationL(class RXmlEngDOMImplementation &) + ?UseExternalDataL@CXmlEngDeserializer@@QAEXAAV?$RArray@VTXmlEngDataContainer@@@@@Z @ 38 NONAME ; void CXmlEngDeserializer::UseExternalDataL(class RArray &) + ?UseExternalDataL@CXmlEngDeserializerDOM@@QAEXAAV?$RArray@VTXmlEngDataContainer@@@@@Z @ 39 NONAME ; void CXmlEngDeserializerDOM::UseExternalDataL(class RArray &) + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/eabi/xmlenginedom.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/eabi/xmlenginedom.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,266 @@ +EXPORTS + _ZN11TXmlEngAttr14SetValueNoEncLERK6TDesC8 @ 1 NONAME + _ZN11TXmlEngAttr16SetEscapedValueLERK6TDesC8 @ 2 NONAME + _ZN11TXmlEngAttr9SetValueLERK6TDesC8 @ 3 NONAME + _ZN11TXmlEngNode11AddUserDataEP15MXmlEngUserData @ 4 NONAME + _ZN11TXmlEngNode11ReplaceWithES_ @ 5 NONAME + _ZN11TXmlEngNode12AppendChildLES_ @ 6 NONAME + _ZN11TXmlEngNode14RemoveUserDataEv @ 7 NONAME + _ZN11TXmlEngNode14SubstituteForLES_ @ 8 NONAME + _ZN11TXmlEngNode16MoveAfterSiblingES_ @ 9 NONAME + _ZN11TXmlEngNode16SetAsLastSiblingEv @ 10 NONAME + _ZN11TXmlEngNode17MoveBeforeSiblingES_ @ 11 NONAME + _ZN11TXmlEngNode17SetAsFirstSiblingEv @ 12 NONAME + _ZN11TXmlEngNode20ReconcileNamespacesLEv @ 13 NONAME + _ZN11TXmlEngNode6RemoveEv @ 14 NONAME + _ZN11TXmlEngNode6UnlinkEv @ 15 NONAME + _ZN11TXmlEngNode9InnerXmlLER5RBuf8 @ 16 NONAME + _ZN11TXmlEngNode9OuterXmlLER5RBuf8 @ 17 NONAME + _ZN11TXmlEngNode9SetValueLERK6TDesC8 @ 18 NONAME + _ZN14RXmlEngNodeSet11InitializeLEv @ 19 NONAME + _ZN14RXmlEngNodeSet4FreeEv @ 20 NONAME + _ZN14RXmlEngNodeSetC1Ev @ 21 NONAME + _ZN14RXmlEngNodeSetC2Ev @ 22 NONAME + _ZN14TXmlEngElement13CopyChildrenLES_ @ 23 NONAME + _ZN14TXmlEngElement13SetAttributeLERK6TDesC8S2_S2_S2_ @ 24 NONAME + _ZN14TXmlEngElement13SetTextNoEncLERK6TDesC8 @ 25 NONAME + _ZN14TXmlEngElement14AddNewElementLERK6TDesC8 @ 26 NONAME + _ZN14TXmlEngElement14AddNewElementLERK6TDesC816TXmlEngNamespace @ 27 NONAME + _ZN14TXmlEngElement14AddNewElementLERK6TDesC8S2_S2_ @ 28 NONAME + _ZN14TXmlEngElement14RemoveChildrenEv @ 29 NONAME + _ZN14TXmlEngElement15CopyAttributesLES_ @ 30 NONAME + _ZN14TXmlEngElement15SetEscapedTextLERK6TDesC8 @ 31 NONAME + _ZN14TXmlEngElement16AddNewAttributeLERK6TDesC8S2_ @ 32 NONAME + _ZN14TXmlEngElement16AddNewAttributeLERK6TDesC8S2_16TXmlEngNamespace @ 33 NONAME + _ZN14TXmlEngElement16AddNewAttributeLERK6TDesC8S2_S2_S2_ @ 34 NONAME + _ZN14TXmlEngElement16AppendTextNoEncLERK6TDesC8 @ 35 NONAME + _ZN14TXmlEngElement16RemoveAttributeLERK6TDesC8S2_ @ 36 NONAME + _ZN14TXmlEngElement16RemoveAttributesEv @ 37 NONAME + _ZN14TXmlEngElement17SetAttributeNodeLE11TXmlEngAttr @ 38 NONAME + _ZN14TXmlEngElement19FindOrCreateNsDeclLERK6TDesC8 @ 39 NONAME + _ZN14TXmlEngElement19FindOrCreateNsDeclLERK6TDesC8S2_ @ 40 NONAME + _ZN14TXmlEngElement20AddNewElementSameNsLERK6TDesC8 @ 41 NONAME + _ZN14TXmlEngElement20AddNewElementWithNsLERK6TDesC8S2_ @ 42 NONAME + _ZN14TXmlEngElement20RemoveChildElementsLERK6TDesC8S2_ @ 43 NONAME + _ZN14TXmlEngElement20SetDefaultNamespaceLERK6TDesC8 @ 44 NONAME + _ZN14TXmlEngElement22AddNewAttributeWithNsLERK6TDesC8S2_S2_ @ 45 NONAME + _ZN14TXmlEngElement22SetNoDefaultNamespaceLEv @ 46 NONAME + _ZN14TXmlEngElement23AddNewElementUsePrefixLERK6TDesC8S2_ @ 47 NONAME + _ZN14TXmlEngElement24AddNamespaceDeclarationLERK6TDesC8S2_ @ 48 NONAME + _ZN14TXmlEngElement24AddNewElementAutoPrefixLERK6TDesC8S2_S_ @ 49 NONAME + _ZN14TXmlEngElement25AddNewAttributeUsePrefixLERK6TDesC8S2_S2_ @ 50 NONAME + _ZN14TXmlEngElement27RemoveNamespaceDeclarationsEv @ 51 NONAME + _ZN14TXmlEngElement8AddTextLERK6TDesC8 @ 52 NONAME + _ZN14TXmlEngElement8SetTextLERK6TDesC8 @ 53 NONAME + _ZN14TXmlEngElement9AddXmlIdLERK6TDesC8S2_16TXmlEngNamespace @ 54 NONAME + _ZN15RXmlEngDocument10AdoptNodeLE11TXmlEngNode @ 55 NONAME + _ZN15RXmlEngDocument13SetStandaloneEi @ 56 NONAME + _ZN15RXmlEngDocument14CreateCommentLERK6TDesC8 @ 57 NONAME + _ZN15RXmlEngDocument14CreateElementLERK6TDesC8S2_S2_ @ 58 NONAME + _ZN15RXmlEngDocument14RegisterXmlIdLE14TXmlEngElementRK6TDesC8S3_ @ 59 NONAME + _ZN15RXmlEngDocument14RegisterXmlIdLERK6TDesC8S2_ @ 60 NONAME + _ZN15RXmlEngDocument14SetXmlVersionLERK6TDesC8 @ 61 NONAME + _ZN15RXmlEngDocument15CreateTextNodeLERK6TDesC8 @ 62 NONAME + _ZN15RXmlEngDocument15SetDocumentUriLERK6TDesC8 @ 63 NONAME + _ZN15RXmlEngDocument16CreateAttributeLERK6TDesC8S2_ @ 64 NONAME + _ZN15RXmlEngDocument18SetDocumentElementE14TXmlEngElement @ 65 NONAME + _ZN15RXmlEngDocument19CreateCDATASectionLERK6TDesC8 @ 66 NONAME + _ZN15RXmlEngDocument20CreateFileContainerLERK6TDesC8RK5RFile @ 67 NONAME + _ZN15RXmlEngDocument20GetDataContainerListER6RArrayI20TXmlEngDataContainerE @ 68 NONAME + _ZN15RXmlEngDocument21CreateChunkContainerLERK6TDesC8RK6RChunkii @ 69 NONAME + _ZN15RXmlEngDocument22CreateBinaryContainerLERK6TDesC8S2_ @ 70 NONAME + _ZN15RXmlEngDocument22CreateDocumentElementLERK6TDesC8S2_S2_ @ 71 NONAME + _ZN15RXmlEngDocument22CreateEntityReferenceLERK6TDesC8 @ 72 NONAME + _ZN15RXmlEngDocument28CreateProcessingInstructionLERK6TDesC8S2_ @ 73 NONAME + _ZN15RXmlEngDocument5CloseEv @ 74 NONAME + _ZN15RXmlEngDocument5OpenLER24RXmlEngDOMImplementation @ 75 NONAME + _ZN15RXmlEngDocument5OpenLER24RXmlEngDOMImplementation14TXmlEngElement @ 76 NONAME + _ZN15RXmlEngDocument5OpenLER24RXmlEngDOMImplementationPv @ 77 NONAME + _ZN15RXmlEngDocumentC1Ev @ 78 NONAME + _ZN15RXmlEngDocumentC2Ev @ 79 NONAME + _ZN16RXmlEngDOMParser10ParseFileLER3RFsRK7TDesC16j @ 80 NONAME + _ZN16RXmlEngDOMParser10ParseFileLERK7TDesC16j @ 81 NONAME + _ZN16RXmlEngDOMParser11ParseChunkLERK6TDesC8 @ 82 NONAME + _ZN16RXmlEngDOMParser19GetLastParsingErrorEv @ 83 NONAME + _ZN16RXmlEngDOMParser4OpenER24RXmlEngDOMImplementation @ 84 NONAME + _ZN16RXmlEngDOMParser5CloseEv @ 85 NONAME + _ZN16RXmlEngDOMParser6ParseLERK6TDesC8 @ 86 NONAME + _ZN16RXmlEngDOMParser7FinishLEv @ 87 NONAME + _ZN16RXmlEngDOMParserC1Ev @ 88 NONAME + _ZN16RXmlEngDOMParserC2Ev @ 89 NONAME + _ZN18RXmlEngXPathResult4FreeEv @ 90 NONAME + _ZN18RXmlEngXPathResultC1Ev @ 91 NONAME + _ZN18RXmlEngXPathResultC2Ev @ 92 NONAME + _ZN18TXmlEngXPathObject10ToBooleanLERK6TDesC8 @ 93 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToBooleanERK11TXmlEngNode @ 94 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToBooleanERK14RXmlEngNodeSet @ 95 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToBooleanERK6TDesC8 @ 96 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToBooleanEd @ 97 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToNumberLERK11TXmlEngNode @ 98 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToNumberLERK14RXmlEngNodeSet @ 99 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToNumberLERK6TDesC8 @ 100 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToNumberLEi @ 101 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToStringLERK11TXmlEngNodeR5RBuf8 @ 102 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToStringLERK14RXmlEngNodeSetR5RBuf8 @ 103 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToStringLEdR5RBuf8 @ 104 NONAME ABSENT + _ZN18TXmlEngXPathObject9ToStringLEiR5RBuf8 @ 105 NONAME ABSENT + _ZN19RXmlEngNodeListImpl4NextEv @ 106 NONAME + _ZN19RXmlEngNodeListImpl5CloseEv @ 107 NONAME + _ZN19RXmlEngNodeListImplC1Ev @ 108 NONAME + _ZN19RXmlEngNodeListImplC2Ev @ 109 NONAME + _ZN20TXmlEngCharacterData12SetContentsLERK6TDesC8 @ 110 NONAME + _ZN20TXmlEngCharacterData15AppendContentsLERK6TDesC8 @ 111 NONAME + _ZN21TXmlEngXPathEvaluator11InstanceMapEv @ 112 NONAME + _ZN21TXmlEngXPathEvaluator14SetInstanceMapEP24CXmlEngXFormsInstanceMap @ 113 NONAME + _ZN21TXmlEngXPathEvaluator17CreateExpressionLERK6TDesC8PK24MXmlEngNamespaceResolver @ 114 NONAME + _ZN21TXmlEngXPathEvaluator25EvaluateWithDependenciesLERK6TDesC811TXmlEngNodePK24MXmlEngNamespaceResolverR14RXmlEngNodeSet @ 115 NONAME + _ZN21TXmlEngXPathEvaluator9EvaluateLERK6TDesC811TXmlEngNodePK24MXmlEngNamespaceResolver @ 116 NONAME + _ZN21TXmlEngXPathEvaluatorC1Ev @ 117 NONAME + _ZN21TXmlEngXPathEvaluatorC2Ev @ 118 NONAME + _ZN22RXmlEngXPathExpression18SetExtendedContextEPv @ 119 NONAME + _ZN22RXmlEngXPathExpression7DestroyEv @ 120 NONAME + _ZN22RXmlEngXPathExpressionC1Ev @ 121 NONAME + _ZN22RXmlEngXPathExpressionC2Ev @ 122 NONAME + _ZN22TXmlEngBinaryContainer12SetContentsLERK6TDesC8 @ 123 NONAME + _ZN22TXmlEngBinaryContainer15AppendContentsLERK6TDesC8 @ 124 NONAME + _ZN24CXmlEngXFormsInstanceMap12RemoveEntryLERK6TDesC8 @ 125 NONAME + _ZN24CXmlEngXFormsInstanceMap4NewLEv @ 126 NONAME + _ZN24CXmlEngXFormsInstanceMap5NewLCEv @ 127 NONAME + _ZN24CXmlEngXFormsInstanceMap9AddEntryLER15RXmlEngDocumentRK6TDesC8 @ 128 NONAME + _ZN24CXmlEngXFormsInstanceMapD0Ev @ 129 NONAME + _ZN24CXmlEngXFormsInstanceMapD1Ev @ 130 NONAME + _ZN24CXmlEngXFormsInstanceMapD2Ev @ 131 NONAME + _ZN24RXmlEngDOMImplementation5CloseEi @ 132 NONAME + _ZN24RXmlEngDOMImplementation5OpenLEP5RHeap @ 133 NONAME + _ZN25TXmlEngXPathConfiguration20IsFunctionSupportedLERK6TDesC8S2_ @ 134 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration21AddExtensionFunctionLERK34TXmlEngExtensionFunctionDescriptor @ 135 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration12Unused_Func1Ei @ 136 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration23RemoveExtensionFunctionERK34TXmlEngExtensionFunctionDescriptor @ 137 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration24ResetExtensionFunctionsLEv @ 138 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration27AddExtensionFunctionVectorLERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 139 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration27AddNativeExtensionFunctionLERK34TXmlEngExtensionFunctionDescriptor @ 140 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration29RemoveExtensionFunctionVectorERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 141 NONAME ABSENT + _ZN25TXmlEngXPathConfiguration33AddNativeExtensionFunctionVectorLERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 142 NONAME ABSENT + _ZN27TXmlEngSerializationOptions13SetNodeFilterEP17MXmlEngNodeFilter @ 143 NONAME + _ZN27TXmlEngSerializationOptionsC1EjRK6TDesC8 @ 144 NONAME + _ZN27TXmlEngSerializationOptionsC2EjRK6TDesC8 @ 145 NONAME + _ZN28TXmlEngProcessingInstruction8SetDataLERK6TDesC8 @ 146 NONAME + _ZN9TDomUtils20XmlEngRenameElementLE14TXmlEngElementRK6TDesC8S3_S3_ @ 147 NONAME + _ZNK11TXmlEngAttr12OwnerElementEv @ 148 NONAME + _ZNK11TXmlEngAttr15WholeValueCopyLER5RBuf8 @ 149 NONAME + _ZNK11TXmlEngAttr4NameEv @ 150 NONAME + _ZNK11TXmlEngAttr5CopyLEv @ 151 NONAME + _ZNK11TXmlEngAttr5ValueEv @ 152 NONAME + _ZNK11TXmlEngNode10FirstChildEv @ 153 NONAME + _ZNK11TXmlEngNode10ParentNodeEv @ 154 NONAME + _ZNK11TXmlEngNode11NextSiblingEv @ 155 NONAME + _ZNK11TXmlEngNode12NamespaceUriEv @ 156 NONAME + _ZNK11TXmlEngNode13GetChildNodesER15RXmlEngNodeListIS_E @ 157 NONAME + _ZNK11TXmlEngNode13HasAttributesEv @ 158 NONAME + _ZNK11TXmlEngNode13HasChildNodesEv @ 159 NONAME + _ZNK11TXmlEngNode13LookupPrefixLERK6TDesC8 @ 160 NONAME + _ZNK11TXmlEngNode13OwnerDocumentEv @ 161 NONAME + _ZNK11TXmlEngNode15PreviousSiblingEv @ 162 NONAME + _ZNK11TXmlEngNode19IsDefaultNamespaceLERK6TDesC8 @ 163 NONAME + _ZNK11TXmlEngNode19LookupNamespaceUriLERK6TDesC8 @ 164 NONAME + _ZNK11TXmlEngNode20IsSimpleTextContentsEv @ 165 NONAME + _ZNK11TXmlEngNode20NamespaceDeclarationEv @ 166 NONAME + _ZNK11TXmlEngNode22WholeTextContentsCopyLER5RBuf8 @ 167 NONAME + _ZNK11TXmlEngNode4NameEv @ 168 NONAME + _ZNK11TXmlEngNode5CopyLEv @ 169 NONAME + _ZNK11TXmlEngNode5ValueEv @ 170 NONAME + _ZNK11TXmlEngNode6PrefixEv @ 171 NONAME + _ZNK11TXmlEngNode7CopyToLES_ @ 172 NONAME + _ZNK11TXmlEngNode8BaseUriLER5RBuf8 @ 173 NONAME + _ZNK11TXmlEngNode8NodeTypeEv @ 174 NONAME + _ZNK11TXmlEngNode8UserDataEv @ 175 NONAME + _ZNK11TXmlEngNode9LastChildEv @ 176 NONAME + _ZNK14RXmlEngNodeSet6LengthEv @ 177 NONAME + _ZNK14RXmlEngNodeSet8ContainsE11TXmlEngNode @ 178 NONAME + _ZNK14RXmlEngNodeSetixEi @ 179 NONAME + _ZNK14TXmlEngElement13GetAttributesER15RXmlEngNodeListI11TXmlEngAttrE @ 180 NONAME + _ZNK14TXmlEngElement14AttributeNodeLERK6TDesC8S2_ @ 181 NONAME + _ZNK14TXmlEngElement15AttributeValueLERK6TDesC8S2_ @ 182 NONAME + _ZNK14TXmlEngElement16GetChildElementsER15RXmlEngNodeListIS_E @ 183 NONAME + _ZNK14TXmlEngElement16TheXMLNamespaceLEv @ 184 NONAME + _ZNK14TXmlEngElement21GetElementsByTagNameLER15RXmlEngNodeListIS_ERK6TDesC8S5_ @ 185 NONAME + _ZNK14TXmlEngElement21LookupNamespaceByUriLERK6TDesC8 @ 186 NONAME + _ZNK14TXmlEngElement22ElementCopyNoChildrenLEi @ 187 NONAME + _ZNK14TXmlEngElement24LookupNamespaceByPrefixLERK6TDesC8 @ 188 NONAME + _ZNK14TXmlEngElement26HasNsDeclarationForPrefixLERK6TDesC8 @ 189 NONAME + _ZNK14TXmlEngElement4TextEv @ 190 NONAME + _ZNK15RXmlEngDocument10XmlVersionEv @ 191 NONAME + _ZNK15RXmlEngDocument11DocumentUriEv @ 192 NONAME + _ZNK15RXmlEngDocument11XmlEncodingEv @ 193 NONAME + _ZNK15RXmlEngDocument12IsStandaloneEv @ 194 NONAME + _ZNK15RXmlEngDocument14CloneDocumentLEv @ 195 NONAME + _ZNK15RXmlEngDocument14ImplementationEv @ 196 NONAME + _ZNK15RXmlEngDocument15DocumentElementEv @ 197 NONAME + _ZNK15RXmlEngDocument19FindElementByXmlIdLERK6TDesC8 @ 198 NONAME + _ZNK15RXmlEngDocument5SaveLER19MXmlEngOutputStream11TXmlEngNodeRK27TXmlEngSerializationOptions @ 199 NONAME + _ZNK15RXmlEngDocument5SaveLER3RFsRK7TDesC1611TXmlEngNodeRK27TXmlEngSerializationOptions @ 200 NONAME + _ZNK15RXmlEngDocument5SaveLER5RBuf811TXmlEngNodeRK27TXmlEngSerializationOptions @ 201 NONAME + _ZNK15RXmlEngDocument5SaveLERK7TDesC1611TXmlEngNodeRK27TXmlEngSerializationOptions @ 202 NONAME + _ZNK15TXmlEngTextNode26IsElementContentWhitespaceEv @ 203 NONAME + _ZNK16TXmlEngNamespace11IsUndefinedEv @ 204 NONAME + _ZNK16TXmlEngNamespace3UriEv @ 205 NONAME + _ZNK16TXmlEngNamespace6PrefixEv @ 206 NONAME + _ZNK16TXmlEngNamespace9IsDefaultEv @ 207 NONAME + _ZNK18RXmlEngXPathResult4TypeEv @ 208 NONAME + _ZNK18RXmlEngXPathResult8AsNumberEv @ 209 NONAME + _ZNK18RXmlEngXPathResult9AsBooleanEv @ 210 NONAME + _ZNK18RXmlEngXPathResult9AsNodeSetEv @ 211 NONAME + _ZNK18RXmlEngXPathResult9AsStringLER5RBuf8 @ 212 NONAME + _ZNK19RXmlEngNodeListImpl5CountEv @ 213 NONAME + _ZNK19RXmlEngNodeListImpl7HasNextEv @ 214 NONAME + _ZNK20TXmlEngCharacterData6LengthEv @ 215 NONAME + _ZNK20TXmlEngCharacterData8ContentsEv @ 216 NONAME + _ZNK20TXmlEngDataContainer3CidEv @ 217 NONAME + _ZNK20TXmlEngDataContainer4SizeEv @ 218 NONAME + _ZNK20TXmlEngFileContainer4FileEv @ 219 NONAME + _ZNK21TXmlEngChunkContainer11ChunkOffsetEv @ 220 NONAME + _ZNK21TXmlEngChunkContainer5ChunkEv @ 221 NONAME + _ZNK22RXmlEngXPathExpression15ExtendedContextEv @ 222 NONAME + _ZNK22RXmlEngXPathExpression25EvaluateWithDependenciesLE11TXmlEngNodeR14RXmlEngNodeSetPK24MXmlEngNamespaceResolver @ 223 NONAME + _ZNK22RXmlEngXPathExpression9EvaluateLE11TXmlEngNodePK24MXmlEngNamespaceResolver @ 224 NONAME + _ZNK22TXmlEngBinaryContainer8ContentsEv @ 225 NONAME + _ZNK28TXmlEngProcessingInstruction4DataEv @ 226 NONAME + _ZNK28TXmlEngProcessingInstruction6TargetEv @ 227 NONAME + _ZTI23TXmlEngFileOutputStream @ 228 NONAME ; ## + _ZTI24CXmlEngXFormsInstanceMap @ 229 NONAME ; ## + _ZTI26CXmlEngOwnedNodesContainer @ 230 NONAME ; ## + _ZTI33TXmlEngXPathEvaluationContextImpl @ 231 NONAME ; ## + _ZTV23TXmlEngFileOutputStream @ 232 NONAME ; ## + _ZTV24CXmlEngXFormsInstanceMap @ 233 NONAME ; ## + _ZTV26CXmlEngOwnedNodesContainer @ 234 NONAME ; ## + _ZTV33TXmlEngXPathEvaluationContextImpl @ 235 NONAME ; ## + _ZN11TXmlEngNode12ReplaceWithLES_ @ 236 NONAME + _ZN27TXmlEngSerializationOptions17SetDataSerializerEP21MXmlEngDataSerializer @ 237 NONAME + _ZN15RXmlEngDocument23CreateDocumentFragmentLEv @ 238 NONAME + _ZN16XmlEngXPathUtils10ToBooleanLERK6TDesC8 @ 239 NONAME + _ZN16XmlEngXPathUtils9ToBooleanERK11TXmlEngNode @ 240 NONAME + _ZN16XmlEngXPathUtils9ToBooleanERK14RXmlEngNodeSet @ 241 NONAME + _ZN16XmlEngXPathUtils9ToBooleanERK6TDesC8 @ 242 NONAME + _ZN16XmlEngXPathUtils9ToBooleanEd @ 243 NONAME + _ZN16XmlEngXPathUtils9ToNumberLERK11TXmlEngNode @ 244 NONAME + _ZN16XmlEngXPathUtils9ToNumberLERK14RXmlEngNodeSet @ 245 NONAME + _ZN16XmlEngXPathUtils9ToNumberLERK6TDesC8 @ 246 NONAME + _ZN16XmlEngXPathUtils9ToNumberLEi @ 247 NONAME + _ZN16XmlEngXPathUtils9ToStringLERK11TXmlEngNodeR5RBuf8 @ 248 NONAME + _ZN16XmlEngXPathUtils9ToStringLERK14RXmlEngNodeSetR5RBuf8 @ 249 NONAME + _ZN16XmlEngXPathUtils9ToStringLEdR5RBuf8 @ 250 NONAME + _ZN16XmlEngXPathUtils9ToStringLEiR5RBuf8 @ 251 NONAME + _ZN34TXmlEngExtensionFunctionDescriptorC1Ev @ 252 NONAME + _ZN34TXmlEngExtensionFunctionDescriptorC2Ev @ 253 NONAME + _ZN24XmlEngXPathConfiguration12Unused_Func1Ei @ 254 NONAME + _ZN24XmlEngXPathConfiguration20IsFunctionSupportedLERK6TDesC8S2_ @ 255 NONAME + _ZN24XmlEngXPathConfiguration21AddExtensionFunctionLERK34TXmlEngExtensionFunctionDescriptor @ 256 NONAME + _ZN24XmlEngXPathConfiguration23RemoveExtensionFunctionERK34TXmlEngExtensionFunctionDescriptor @ 257 NONAME + _ZN24XmlEngXPathConfiguration24ResetExtensionFunctionsLEv @ 258 NONAME + _ZN24XmlEngXPathConfiguration27AddExtensionFunctionVectorLERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 259 NONAME + _ZN24XmlEngXPathConfiguration27AddNativeExtensionFunctionLERK34TXmlEngExtensionFunctionDescriptor @ 260 NONAME + _ZN24XmlEngXPathConfiguration29RemoveExtensionFunctionVectorERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 261 NONAME + _ZN24XmlEngXPathConfiguration33AddNativeExtensionFunctionVectorLERK6RArrayI34TXmlEngExtensionFunctionDescriptorEj @ 262 NONAME + _ZN14TXmlEngElement14RenameElementLERK6TDesC8S2_S2_ @ 263 NONAME + _ZN24RXmlEngDOMImplementation5CloseEv @ 264 NONAME + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/eabi/xmlengineserializer.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/eabi/xmlengineserializer.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,74 @@ +EXPORTS + _ZN17CXmlEngSerializer10SerializeLE11TXmlEngNode @ 1 NONAME + _ZN17CXmlEngSerializer10SerializeLER3RFsRK7TDesC1611TXmlEngNodeRK27TXmlEngSerializationOptions @ 2 NONAME + _ZN17CXmlEngSerializer10SerializeLER5RBuf811TXmlEngNodeRK27TXmlEngSerializationOptions @ 3 NONAME + _ZN17CXmlEngSerializer10SerializeLERK7TDesC1611TXmlEngNodeRK27TXmlEngSerializationOptions @ 4 NONAME + _ZN17CXmlEngSerializer10SetOutputLERK7TDesC16 @ 5 NONAME + _ZN17CXmlEngSerializer4NewLE21TXmlEngSerializerType @ 6 NONAME + _ZN17CXmlEngSerializer23SetSerializationOptionsER27TXmlEngSerializationOptions @ 7 NONAME + _ZN17CXmlEngSerializer9SetOutputER19MXmlEngOutputStream @ 8 NONAME + _ZN17CXmlEngSerializer9SetOutputER5RBuf8 @ 9 NONAME + _ZN19CXmlEngDeserializer12DeserializeLER3RFsRK7TDesC16RK21TXmlEngParsingOptions @ 10 NONAME + _ZN19CXmlEngDeserializer12DeserializeLERK6TDesC8RK21TXmlEngParsingOptions @ 11 NONAME + _ZN19CXmlEngDeserializer12DeserializeLERK7TDesC16RK21TXmlEngParsingOptions @ 12 NONAME + _ZN19CXmlEngDeserializer12DeserializeLEv @ 13 NONAME + _ZN19CXmlEngDeserializer12ExternalDataEv @ 14 NONAME + _ZN19CXmlEngDeserializer4NewLERN3Xml15MContentHandlerE23TXmlEngDeserializerType @ 15 NONAME + _ZN19CXmlEngDeserializer13EnableFeatureEi @ 16 NONAME + _ZN19CXmlEngDeserializer13SetInputFileLERK7TDesC16 @ 17 NONAME + _ZN19CXmlEngDeserializer14DisableFeatureEi @ 18 NONAME + _ZN19CXmlEngDeserializer14ParsingOptionsEv @ 19 NONAME + _ZN19CXmlEngDeserializer14SetInputBufferERK6TDesC8 @ 20 NONAME + _ZN19CXmlEngDeserializer16UseExternalDataLER6RArrayI20TXmlEngDataContainerE @ 21 NONAME + _ZN19CXmlEngDeserializer17SetParsingOptionsER21TXmlEngParsingOptions @ 22 NONAME + _ZN19CXmlEngDeserializer18SetContentHandlerLERN3Xml15MContentHandlerE @ 23 NONAME + _ZN20CXmlEngSerializerXOP4NewLEi @ 24 NONAME + _ZN21TXmlEngParsingOptionsC1Ej @ 25 NONAME + _ZN21TXmlEngParsingOptionsC2Ej @ 26 NONAME + _ZN22CXmlEngDeserializerDOM12DeserializeLER3RFsRK7TDesC1623TXmlEngDeserializerType @ 27 NONAME + _ZN22CXmlEngDeserializerDOM12DeserializeLERK6TDesC823TXmlEngDeserializerType @ 28 NONAME + _ZN22CXmlEngDeserializerDOM12DeserializeLERK7TDesC1623TXmlEngDeserializerType @ 29 NONAME + _ZN22CXmlEngDeserializerDOM12DeserializeLEv @ 30 NONAME + _ZN22CXmlEngDeserializerDOM12ExternalDataEv @ 31 NONAME + _ZN22CXmlEngDeserializerDOM13SetInputFileLERK7TDesC1623TXmlEngDeserializerType @ 32 NONAME + _ZN22CXmlEngDeserializerDOM14SetInputBufferERK6TDesC823TXmlEngDeserializerType @ 33 NONAME + _ZN22CXmlEngDeserializerDOM16UseExternalDataLER6RArrayI20TXmlEngDataContainerE @ 34 NONAME + _ZN22CXmlEngDeserializerDOM21UseDOMImplementationLER24RXmlEngDOMImplementation @ 35 NONAME + _ZN22CXmlEngDeserializerDOM4NewLEv @ 36 NONAME + _ZN22CXmlEngDeserializerXOP13EnableFeatureEi @ 37 NONAME + _ZN22CXmlEngDeserializerXOP14DisableFeatureEi @ 38 NONAME + _ZNK19CXmlEngDeserializer16IsFeatureEnabledEi @ 39 NONAME + _ZNK22CXmlEngDeserializerXOP16IsFeatureEnabledEi @ 40 NONAME + _ZTI17CXmlEngSerializer @ 41 NONAME ; ## + _ZTI19CXmlEngDeserializer @ 42 NONAME ; ## + _ZTI20CXmlEngSerializerXOP @ 43 NONAME ; ## + _ZTI21CXmlEngContentHandler @ 44 NONAME ; ## + _ZTI21CXmlEngSerializerGZIP @ 45 NONAME ; ## + _ZTI22CXmlEngDeserializerDOM @ 46 NONAME ; ## + _ZTI22CXmlEngDeserializerXOP @ 47 NONAME ; ## + _ZTI23CXmlEngDeserializerGZIP @ 48 NONAME ; ## + _ZTI23CXmlEngGZIPOutputStream @ 49 NONAME ; ## + _ZTI24CXmlEngDOMContentHandler @ 50 NONAME ; ## + _ZTI27CXmlEngGZIPFileOutputStream @ 51 NONAME ; ## + _ZTI27CXmlEngGZipFileDeserializer @ 52 NONAME ; ## + _ZTI27TXmlEngSXOPFileOutputStream @ 53 NONAME ; ## + _ZTI28TXmlEngSXOPProxyOutputStream @ 54 NONAME ; ## + _ZTI29CXmlEngGZIPBufferOutputStream @ 55 NONAME ; ## + _ZTI30CXmlEngGZipBufferDeserializeBM @ 56 NONAME ; ## + _ZTV17CXmlEngSerializer @ 57 NONAME ; ## + _ZTV19CXmlEngDeserializer @ 58 NONAME ; ## + _ZTV20CXmlEngSerializerXOP @ 59 NONAME ; ## + _ZTV21CXmlEngContentHandler @ 60 NONAME ; ## + _ZTV21CXmlEngSerializerGZIP @ 61 NONAME ; ## + _ZTV22CXmlEngDeserializerDOM @ 62 NONAME ; ## + _ZTV22CXmlEngDeserializerXOP @ 63 NONAME ; ## + _ZTV23CXmlEngDeserializerGZIP @ 64 NONAME ; ## + _ZTV23CXmlEngGZIPOutputStream @ 65 NONAME ; ## + _ZTV24CXmlEngDOMContentHandler @ 66 NONAME ; ## + _ZTV27CXmlEngGZIPFileOutputStream @ 67 NONAME ; ## + _ZTV27CXmlEngGZipFileDeserializer @ 68 NONAME ; ## + _ZTV27TXmlEngSXOPFileOutputStream @ 69 NONAME ; ## + _ZTV28TXmlEngSXOPProxyOutputStream @ 70 NONAME ; ## + _ZTV29CXmlEngGZIPBufferOutputStream @ 71 NONAME ; ## + _ZTV30CXmlEngGZipBufferDeserializeBM @ 72 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file provides the information required for building the DOM XPath C++ Wrapper. +// + +PRJ_EXPORTS +../inc/xmlenginedom/xmlengdom.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdom.h) +../inc/xmlenginedom/xmlengattr.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengattr.h) +../inc/xmlenginedom/xmlengnodelist_impl.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodelist_impl.h) +../inc/xmlenginedom/xmlengnode.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnode.h) +../inc/xmlenginedom/xmlengelement.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengelement.inl) +../inc/xmlenginedom/xmlengnodelist.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodelist.inl) +../inc/xmlenginedom/xmlengbinarycontainer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengbinarycontainer.h) +../inc/xmlenginedom/xmlenguserdata.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlenguserdata.h) +../inc/xmlenginedom/xmlengdomimplementation.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdomimplementation.h) +../inc/xmlenginedom/xmlengprocessinginstruction.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengprocessinginstruction.inl) +../inc/xmlenginedom/xmlengdatacontainer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdatacontainer.h) +../inc/xmlenginedom/xmlengdataserializer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdataserializer.h) +../inc/xmlenginedom/xmlengdocumentfragment.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdocumentfragment.inl) +../inc/xmlenginedom/xmlengtext.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengtext.inl) +../inc/xmlenginedom/xmlengfilecontainer.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengfilecontainer.inl) +../inc/xmlenginedom/xmlengnodelist.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodelist.h) +../inc/xmlenginedom/xmlengnamespace.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnamespace.h) +../inc/xmlenginedom/xmlengdomutils.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdomutils.h) +../inc/xmlenginedom/xmlengcharacterdata.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcharacterdata.h) +../inc/xmlenginedom/xmlengdatacontainer.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdatacontainer.inl) +../inc/xmlenginedom/xmlengserializationoptions.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengserializationoptions.h) +../inc/xmlenginedom/xmlengcomment.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcomment.inl) +../inc/xmlenginedom/xmlengchunkcontainer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengchunkcontainer.h) +../inc/xmlenginedom/xmlengerrors.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengerrors.h) +../inc/xmlenginedom/xmlengdocument.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdocument.inl) +../inc/xmlenginedom/xmlengentityreference.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengentityreference.inl) +../inc/xmlenginedom/xmlengbinarycontainer.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengbinarycontainer.inl) +../inc/xmlenginedom/xmlengdocument.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdocument.h) +../inc/xmlenginedom/xmlengcomment.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcomment.h) +../inc/xmlenginedom/xmlengnamespace.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnamespace.inl) +../inc/xmlenginedom/xmlengnode.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnode.inl) +../inc/xmlenginedom/xmlengentityreference.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengentityreference.h) +../inc/xmlenginedom/xmlengdocumentfragment.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdocumentfragment.h) +../inc/xmlenginedom/xmlengcdatasection.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcdatasection.inl) +../inc/xmlenginedom/xmlengcdatasection.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcdatasection.h) +../inc/xmlenginedom/xmlengdomparser.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdomparser.h) +../inc/xmlenginedom/xmlengnodefilter.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodefilter.h) +../inc/xmlenginedom/xmlengprocessinginstruction.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengprocessinginstruction.h) +../inc/xmlenginedom/xmlengchunkcontainer.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengchunkcontainer.inl) +../inc/xmlenginedom/xmlengtext.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengtext.h) +../inc/xmlenginedom/xmlengoutputstream.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengoutputstream.h) +../inc/xmlenginedom/xmlengfilecontainer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengfilecontainer.h) +../inc/xmlenginedom/xmlengelement.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengelement.h) +../inc/xmlenginedom/xmlengcharacterdata.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengcharacterdata.inl) +../inc/xmlenginedom/xmlengattr.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengattr.inl) + +../inc/xpath/xmlengxpath.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpath.h) +../inc/xpath/xmlengxformsinstancemap.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxformsinstancemap.h) +../inc/xpath/xmlengxpathevaluator.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathevaluator.h) +../inc/xpath/xmlengxpathevaluator.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathevaluator.inl) +../inc/xpath/xmlengxpathevaluationcontext.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathevaluationcontext.h) +../inc/xpath/xmlengxpathexpression.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathexpression.inl) +../inc/xpath/xmlengxpathextensionfunction.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathextensionfunction.h) +../inc/xpath/xmlengnodeset.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodeset.h) +../inc/xpath/xmlengxpathresult.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathresult.inl) +../inc/xpath/xmlengxpathutils.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathutils.inl) +../inc/xpath/xmlengxpathexpression.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathexpression.h) +../inc/xpath/xmlengnodeset.inl SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnodeset.inl) +../inc/xpath/xmlengxpathconfiguration.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathconfiguration.h) +../inc/xpath/xmlengnamespaceresolver.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengnamespaceresolver.h) +../inc/xpath/xmlengxpathresult.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathresult.h) +../inc/xpath/xmlengxpathutils.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpathutils.h) +../inc/xpath/xmlengxpatherrors.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengxpatherrors.h) + +../inc/xmlengineserializer/xmlengserializer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengserializer.h) +../inc/xmlengineserializer/xmlengdeserializer.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdeserializer.h) +../inc/xmlengineserializer/xmlengextendedcontenthandler.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengextendedcontenthandler.h) +../inc/xmlengineserializer/xmlengdeserializerdom.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengdeserializerdom.h) +../inc/xmlengineserializer/xmlengparsingoptions.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengparsingoptions.h) +../inc/xmlengineserializer/xmlengserializeerrors.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/dom/xmlengserializeerrors.h) + +xmlenginedom.iby /epoc32/rom/include/xmlenginedom.iby +xmlengineserializer.iby /epoc32/rom/include/xmlengineserializer.iby + + +#ifndef GCCXML +PRJ_MMPFILES +xmlenginedom.mmp +xmlengineserializer.mmp +#endif //GCCXML +//Added to include new tef cases +#include "../test/tef/group/bld.inf" diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/syslibs_xmldom.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/syslibs_xmldom.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ + + + + This component contains the XML Document Object Model and XPath API library and the serialisation library. + + + + The listed files are now being exported to proper locations. + + + + Increased the scope of 'aFilterData' and renamed it to 'filterData' in SaveNodeL function. + + + + Xmldom : Renamed the variable name as j instead of i. + + + + + + + The Symbian OS XML services subsystem shall be extended with a new DOM API, the open source libxml2 library and a new libxml2-based SAX plug-in for the existing XML Parser Framework. + + + + + + + Relocating Header files for XML API + + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/syslibs_xmldom.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/syslibs_xmldom.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,12 @@ +component syslibs_xmldom + +source \sf\os\xmlsrv\xml\xmldomandxpath + +exports \sf\os\xmlsrv\xml\xmldomandxpath\group +binary \sf\os\xmlsrv\xml\xmldomandxpath\group all + +notes_source \component_defs\release.src + +ipr E +ipr T \sf\os\xmlsrv\xml\xmldomandxpath\test + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/xmlenginedom.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/xmlenginedom.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// IBY file for DOM XPath C++ Wrapper +// + +#ifndef XMLENGINEDOM_IBY +#define XMLENGINEDOM_IBY + +#include +#include + +file=ABI_DIR\BUILD_DIR\xmlenginedom.dll sys\bin\xmlenginedom.dll + + +#endif // XMLENGINEDOM_IBY diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/xmlenginedom.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/xmlenginedom.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Project specification file for XML DOM XPath C++ Wrapper +// +// + +TARGET xmlenginedom.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9781 + +SOURCEPATH ../src/xmlenginedom +SOURCE xmlengattr.cpp +SOURCE xmlengdatacontainer.cpp +SOURCE xmlengbinarycontainer.cpp +SOURCE xmlengchunkcontainer.cpp +SOURCE xmlengfilecontainer.cpp +SOURCE xmlengcharacterdata.cpp +SOURCE xmlengdocument.cpp +SOURCE xmlengdombase.cpp +SOURCE xmlengdomimplementation.cpp +SOURCE xmlengdomparser.cpp +SOURCE xmlengelement.cpp +SOURCE xmlengnamespace.cpp +SOURCE xmlengnode.cpp +SOURCE xmlengnodelist_impl.cpp +SOURCE xmlengnodeset.cpp +SOURCE xmlengownednodescontainer.cpp +SOURCE xmlengprocessinginstruction.cpp +SOURCE xmlengserializationoptions.cpp +SOURCE xmlengtext.cpp +SOURCE xmlengxpathconfiguration.cpp +SOURCE xmlengxpathevaluationcontext_impl.cpp +SOURCE xmlengxpathevaluator.cpp +SOURCE xmlengxpathexpression.cpp +SOURCE xmlengxpathutils.cpp +SOURCE xmlengxpathresult.cpp +SOURCE xmlengxformsinstancemap.cpp +SOURCE xmlengfileoutputstream.cpp +SOURCE xmlengdomutils.cpp + +USERINCLUDE ../../libxml2libs/inc/libxml2_nonexport + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 + +LIBRARY libc.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY sysutil.lib +LIBRARY bafl.lib + +LIBRARY xmlengine.lib +LIBRARY xmlengineutils.lib + +nostrictdef + +CAPABILITY ALL -TCB +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/xmlengineserializer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/xmlengineserializer.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Image description file for project XmlEngineSerializer +// + +#ifndef XMLENGINESERIALIZER_IBY +#define XMLENGINESERIALIZER_IBY + +#include +#include +#include + +file=ABI_DIR\BUILD_DIR\xmlengineserializer.dll sys\bin\xmlengineserializer.dll + +#endif // XMLENGINESERIALIZER_IBY diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/group/xmlengineserializer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/group/xmlengineserializer.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Project specification file for XML Serializer +// +// + +TARGET xmlengineserializer.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9794 + +SOURCEPATH ../src/xmlengineserializer +SOURCE xmlengserializer.cpp +SOURCE xmlengserializerxop.cpp +SOURCE xmlengxopproxyoutputstream.cpp +SOURCE xmlengxopfileoutputstream.cpp +SOURCE xmlengserializergzip.cpp +SOURCE xmlenggzipfileoutputstream.cpp +SOURCE xmlenggzipbufferoutputstream.cpp +SOURCE xmlenggzipoutputstream.cpp +SOURCE xmlengdeserializer.cpp +SOURCE xmlengdeserializerxop.cpp +SOURCE xmlengdeserializergzip.cpp +SOURCE xmlengcontenthandler.cpp +SOURCE xmlenggzipbufferdeserializebm.cpp +SOURCE xmlenggzipfiledeserializer.cpp +SOURCE xmlengdomcontenthandler.cpp +SOURCE xmlengdeserializerdom.cpp +SOURCE xmlengparsingoptions.cpp + +USERINCLUDE ../src/xmlenginedom + + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 + +LIBRARY libc.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY xmlengine.lib +LIBRARY xmlengineutils.lib +LIBRARY xmlenginedom.lib +LIBRARY multipartparser.lib +LIBRARY ezlib.lib +LIBRARY xmlframework.lib +LIBRARY bsul.lib //TImCodec +LIBRARY sysutil.lib + +nostrictdef + +CAPABILITY ALL -TCB +VENDORID 0x70000001 + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengattr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengattr.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,166 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Attribute node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGATTR_H +#define XMLENGATTR_H + +#include + +/** +This class represents a XML attribute in the DOM tree. +*/ +class TXmlEngAttr : public TXmlEngNode +{ + public: + /** Default constructor */ + inline TXmlEngAttr(); + + /** + Clones attribute node. + + Note: Resets the namespace of the attribute. To avoid this, use + TXmlEngNode::CopyToL(), which finds an appropriate or creates + a new namespace declaration on the new parent node (argument should be + an TXmlEngElement handle) + + @see TXmlEngNode::CopyToL() + + @return A copy of this attribute + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr CopyL() const; + + /** + Get the owner element. + + Same as TXmlEngNode::ParentNode() but returns TXmlEngElement + instead of TXmlEngNode. + + Note: Copies of attributes [TXmlEngAttr::CopyL()] and newly created + attribute nodes [RXmlEngDocument::CreateAttributeL()] do not have + parent element until they are attached to some element. + + If there is no owning element, a NULL element is returned. + + @return TXmlEngElement that contains the attribute + */ + IMPORT_C const TXmlEngElement OwnerElement() const; + + /** + Get the attribute name. Equal to TXmlEngNode::Name(), but works faster. + + @return Local name of the attribute + @pre Node must not be NULL + @see TXmlEngNode::Name() + */ + IMPORT_C TPtrC8 Name() const; + + /** + Get the attribute's value. If the value consists of more than one TXmlEngTextNode, + as children of the attribute, only the beginning of the value is returned. This + happens when the value is represented by list of TXmlEngTextNode and + TXmlEngEntityReference nodes. + + @return The attribute's value + @see IsSimpleContents(), WholeValueCopyL() + */ + IMPORT_C TPtrC8 Value() const; + + /** + Get a copy of attribute content. Since the value may be composed from a set of + TXmlEngTextNode and TXmlEngEntityReference nodes, the returned result is a newly allocated + RBuf, which should be closed by the caller. + + Example usage of the API: + @code + RBuf8 value; + attr.WholeValueCopyL(value); + ... + value.Close(); + @endcode + + In most cases using Value() is enough (and it needs no memory allocation). + Use IsSimpleTextContents() if there are doubts whether Value() can be used safely. + + @return Complex value of the attribute, probably consisting of text nodes and entity references + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + @see TXmlEngAttr::Value() + @see TXmlEngNode::Value() + @see TXmlEngNode::IsSimpleTextContents() + @see TXmlEngNode::WholeTextContentsCopyL() + */ + IMPORT_C void WholeValueCopyL(RBuf8& aBuffer) const; + + /** + Sets the value of the attribute. The new value should not contain entity + references. Entity references are not expanded, but used as text, thus + the string "abc & def" is copied directly as "abc & def" without + expansion. + + @param aNewValue A string value for the attribute + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + @see SetEscapedValueL(const TDesC8&) + */ + IMPORT_C void SetValueL(const TDesC8& aNewValue); + + /** + Sets the value of the attribute from escaped XML character data that may contain + entity references. + + If the value contains entity references, then the resulting + content of the attribute is a list of TXmlEngTextNode + and TXmlEngEntityReference nodes. + Predefined entities are converted into characters they represent. + + @param aNewValue is a new attribute value + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + @see TXmlEngAttr::SetValueL(const TDesC8&) + */ + IMPORT_C void SetEscapedValueL(const TDesC8& aNewValue); + + /** + Sets new attribute value exactly as presented in the string. + Predefined entities are not converted into characters they represent. + + @param aNewValue is the new attribute value + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + @see TXmlEngAttr::SetValueL(const TDesC8&) + */ + IMPORT_C void SetValueNoEncL(const TDesC8& aNewValue ); + +protected: + /** + Constructor + @param aInternal attribute pointer + */ + inline TXmlEngAttr(void* aInternal); +}; + +#include + +#endif /* XMLENGATTR_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengattr.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengattr.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Attribute node functions +// Default constructor +// + +inline TXmlEngAttr::TXmlEngAttr() + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngAttr::TXmlEngAttr(void* aInternal):TXmlEngNode(aInternal) + { + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengbinarycontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengbinarycontainer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,89 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// All binary data functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGBINARYCONTAINER_H +#define XMLENGBINARYCONTAINER_H + +#include + +/** +This class represents binary data in a DOM tree. + +Binary data is treated in general as text nodes in DOM tree. +Data is stored in process's heap memory. + +Sample code for creating binary container: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDocument iDoc; + // create document element + TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc")); + // create binary container from buffer (str1) and CID equals cid + TXmlEngBinaryContainer binData=iDoc.CreateBinaryContainerL(cid,*str1); + elem.AppendChildL(binData); // append container to the dom tree + iDoc.Close(); // closing all opened objects + domImpl.Close(); +@endcode +*/ +class TXmlEngBinaryContainer : public TXmlEngDataContainer +{ +public: + + /** Get content of the container. + @return The contents of the container + */ + IMPORT_C TPtrC8 Contents() const; + + /** + Copies the given string and sets the contents of the binary container + @param aNewContents The actual value to store + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetContentsL( const TDesC8& aNewContents ); + + /** + Appends contents to binary container + @param aData Content to be appended + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + */ + EXPORT_C void AppendContentsL( const TDesC8& aData ); + + /** Default constructor */ + inline TXmlEngBinaryContainer(); + +protected: + + /** + Constructor + @param aInternal node pointer + */ + inline TXmlEngBinaryContainer(void* aInternal); +}; + +#include + +#endif /* XMLENGBINARYCONTAINER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengbinarycontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengbinarycontainer.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Binary data node functions +// Default constructor +// + +inline TXmlEngBinaryContainer::TXmlEngBinaryContainer():TXmlEngDataContainer(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// + +inline TXmlEngBinaryContainer::TXmlEngBinaryContainer(void* aInternal):TXmlEngDataContainer(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcdatasection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcdatasection.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// CDATASection node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGCDATASECTION_H +#define XMLENGCDATASECTION_H + +#include + +/** +This class represents a XML CDATASection in the DOM tree. +*/ +class TXmlEngCDATASection : public TXmlEngTextNode +{ +public: + /** Default constructor */ + inline TXmlEngCDATASection(); + +protected: + /** + Constructor + @param aInternal CDATASection pointer + */ + inline TXmlEngCDATASection(void* aInternal); +}; + + + +#include + +#endif /* XMLENGCDATASECTION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcdatasection.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcdatasection.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Data section node functions +// Default constructor +// + +inline TXmlEngCDATASection::TXmlEngCDATASection():TXmlEngTextNode(NULL) + { + } + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngCDATASection::TXmlEngCDATASection(void* aInternal):TXmlEngTextNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcharacterdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcharacterdata.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,83 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// All text nodes functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGCHARACTERDATA_H +#define XMLENGCHARACTERDATA_H + +#include + +/** +This class represents XML text nodes in the DOM tree. Inherited classes +further specialize (e.g. TXmlEngTextNode, TXmlEngComment). + +The CharacterData Interface is described by the DOM Spec here: +http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-FF21A306 +*/ +class TXmlEngCharacterData : public TXmlEngNode +{ +public: + + /** Get contents of the node. + @return The content of the node + */ + IMPORT_C TPtrC8 Contents() const; + + /** + Sets contents of the node. + + The input is taken as non-escaped: for example, + aNewContents = "123 > 34 && P" will be serialized as "123 > 34 && P" + + @param aNewContents The actual value to store + @leave - One of the system-wide error codes + */ + IMPORT_C void SetContentsL(const TDesC8& aNewContents); + + /** Append to the contents of the node + @param aString Content to be appended + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void AppendContentsL(const TDesC8& aString); + + /** Get length of the content. + @return Number of characters in the contents + */ + IMPORT_C TUint Length() const; + +protected: + /** Default constructor */ + inline TXmlEngCharacterData(); + + /** + Constructor + @param aInternal node pointer + */ + inline TXmlEngCharacterData(void* aInternal); +}; + + +#include + +#endif /* XMLENGCHARACTERDATA_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcharacterdata.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcharacterdata.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Character data node functions +// Default constructor +// + +inline TXmlEngCharacterData::TXmlEngCharacterData() + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngCharacterData::TXmlEngCharacterData(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengchunkcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengchunkcontainer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,91 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// All memory chunk data functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGCHUNKCONTAINER_H +#define XMLENGCHUNKCONTAINER_H + +#include + + +/** +This class stores a reference to a RChunk handle within the DOM tree. No +ownership is tranferred and the client is expected to close the RChunk when it +is no longer required. Multiple chunk containers can refer to the same RChunk, +regardless of whether the offsets overlap. + +This class is most often instantiated by calling +RXmlEngDocument::CreateChunkContainerL(). + +Sample code for creating chunk container: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDocument iDoc; + // create document element + TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc")); + // create RChunk object with chunkName name and size + RChunk chunk; + chunk.CreateGlobal(chunkName, size, maxSize); + CleanupClosePushL(chunk); + // create chunk container from Rchunk object with offset to the + // binary data in chunk and binary data size in chunk (binarySize) + TXmlEngChunkContainer binData = iDoc.CreateChunkContainerL( + cid,chunk,offset,binarySize); + // append chunkcontainer to the dom tree + TXmlEngNode ref = iDoc.DocumentElement().AppendChildL(binData); + // closing all opened objects + CleanupStack::PopAndDestroy(); //chunk + iDoc.Close(); + domImpl.Close(); +@endcode +*/ +class TXmlEngChunkContainer : public TXmlEngDataContainer +{ +public: + /** Get memory chunk reference + @return Memory chunk reference + */ + IMPORT_C RChunk& Chunk() const; + + /** Get offset of binary data in memory chunk + @return Offset of binary data in memory chunk + */ + IMPORT_C TUint ChunkOffset() const; + +protected: + /** Default constructor */ + inline TXmlEngChunkContainer(); + + /** + Constructor + @param aInternal node pointer + */ + inline TXmlEngChunkContainer(void* aInternal); +}; + + + +#include + +#endif /* XMLENGCHUNKCONTAINER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengchunkcontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengchunkcontainer.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RChunk container functions +// Default constructor +// + +inline TXmlEngChunkContainer::TXmlEngChunkContainer():TXmlEngDataContainer(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngChunkContainer::TXmlEngChunkContainer(void* aInternal):TXmlEngDataContainer(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcomment.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcomment.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Comment node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGCOMMENT_H +#define XMLENGCOMMENT_H + +#include + +/** +This class represents XML comments in the DOM tree. + +DOM spec: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-FF21A306 +*/ +class TXmlEngComment : public TXmlEngCharacterData +{ +public: + /** Default constructor */ + inline TXmlEngComment(); + +protected: + /** + Constructor + @param aInternal Comment pointer + */ + inline TXmlEngComment(void* aInternal); +}; + +#include + +#endif /* XMLENGCOMMENT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengcomment.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengcomment.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Comment node functions +// Default constructor +// + +inline TXmlEngComment::TXmlEngComment():TXmlEngCharacterData(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngComment::TXmlEngComment(void* aInternal):TXmlEngCharacterData(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdatacontainer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// All binary data functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDATACONTAINER_H +#define XMLENGDATACONTAINER_H + +#include + +/** +This class represents different types of binary data in DOM tree. + +It can be custom-serialized using the MXmlEngDataSerializer interface which can +be set in the TXmlEngSerializationOptions used for saving the tree. +*/ +class TXmlEngDataContainer : public TXmlEngNode +{ +public: + + /** Get CID of data container. + @return Cid of data container + */ + IMPORT_C TPtrC8 Cid() const; + + /** Get data size in bytes + @return Number of bytes occupied by data + */ + IMPORT_C TUint Size() const; + +protected: + /** Default constructor */ + inline TXmlEngDataContainer(); + + /** + Constructor + @param aInternal node pointer + */ + inline TXmlEngDataContainer(void* aInternal); +}; + +#include + +#endif /* XMLENGDATACONTAINER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdatacontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdatacontainer.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Binary data node functions +// Default constructor +// + +inline TXmlEngDataContainer::TXmlEngDataContainer() + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// + +inline TXmlEngDataContainer::TXmlEngDataContainer(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdataserializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdataserializer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// serializer for binary data +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGMDATASERIALIZER_H +#define XMLENGMDATASERIALIZER_H + +#include + +/** +This interface is used to serialize binary data stored in a node, external +memory chunk (RChunk) or file. This interface may be implemented by client +applications. +@see TXmlEngSerializationOptions +*/ +class MXmlEngDataSerializer + { +public: + /** + Serializes the node. The implementor of this class must allocate and own + the memory returned by this method until serialization is complete. + @param aNode A node to serialize + @return The serialized node + @leave - One of the system-wide error codes + */ + virtual TPtrC8 SerializeDataL(TXmlEngNode aNode) = 0; + }; + + +#endif /* XMLENGMDATASERIALIZER_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdocument.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,570 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDOCUMENT_H +#define XMLENGDOCUMENT_H + +#include + +#include +#include + +class RXmlEngDOMImplementation; + +/** +This class represents an XML document in the DOM tree. It stores all nodes +and associated information about the XML document. + +This class implements the interface. Another class, RXmlEngDOMImplementation, +provides the implementation. An instance of RXmlEngDOMImplementation must be +constructed and opened first and passed to RXmlEngDocument::OpenL(). +*/ +class RXmlEngDocument : public TXmlEngNode +{ +public: + /** + Default constructor. An instance of RXmlEngDocument must be "opened" with + one of OpenL() overloads before methods are invoked on the object. + */ + IMPORT_C RXmlEngDocument(); + + /** + Opens the document. + @param aDOMImpl An opened DOM implementation object + @leave - One of the system-wide error codes + */ + IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl); + + /** + Opens the document, initializing it with the internal state pointer from + another RXmlEngDocument. This document becomes an alias for the document + whose state is represented by aInternal and a change in either document + will be reflected in the other. Close() need only be called once, however, + it is not an error to call Close() on each RXmlEngDocument. + + @param aDOMImpl An opened DOM implementation object + @param aInternal The internal document state to initialize this object with + @leave - One of the system-wide error codes + */ + IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl, void* aInternal); + + /** + Opens the document and adds aRoot as the root of the DOM tree. If aRoot is + currently part of another document, it will be unlinked. Ownership is + transferred to this document. + + @param aDOMImpl An opened DOM implementation object + @param aRoot The element that will be the root of the DOM tree + @leave - One of the system-wide error codes + */ + IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl, TXmlEngElement aRoot); + + /** + Closes document: All owned nodes, child nodes, and namespaces are freed. All + data containers on the data container list are freed. + */ + IMPORT_C void Close(); + + /** + Serializes document tree into a file. For nodes containing binary data in + the form of BinaryDataContainer, FileContainer or ChunkContainer, the + client can implement custom serialization by implementing the + MXmlEngDataSerializer interface and saving a pointer to the customer + serializer in the iDataSerializer member of the aSaveOptions parameter. If + no custom serialization is specified, the binary data container nodes are + serialized like text nodes. + + If no aRoot is provided, the entire DOM tree is serialized. aRoot does not + need to be owned by this document. + + @param aFileName A file name (with path) + @param aRoot Root node to be serialized + @param aSaveOptions Options that control how serialization is performed + @return Number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseOfAPI Document is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C TInt SaveL( const TDesC& aFileName, + TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const; + + /** + Serializes document tree into a file. For nodes containing binary data in + the form of BinaryDataContainer, FileContainer or ChunkContainer, the + client can implement custom serialization by implementing the + MXmlEngDataSerializer interface and saving a pointer to the customer + serializer in the iDataSerializer member of the aSaveOptions parameter. If + no custom serialization is specified, the binary data container nodes are + serialized like text nodes. + + If no aRoot is provided, the entire DOM tree is serialized. aRoot does not + need to be owned by this document. + + @param aRFs An open file Server session + @param aFileName A file name (with path) + @param aRoot Root node to be serialized + @param aSaveOptions Options that control how serialization is performed + @return Number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseOfAPI Document is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C TInt SaveL( RFs& aRFs, + const TDesC& aFileName, + TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const; + + /** + Serializes document tree into provided output stream, which supports + progressive writing of data. For nodes containing binary data in the form + of BinaryDataContainer, FileContainer or ChunkContainer, the client can + implement custom serialization by implementing the MXmlEngDataSerializer + interface and saving a pointer to the customer serializer in the + iDataSerializer member of the aSaveOptions parameter. If no custom + serialization is specified, the binary data container nodes are serialized + like text nodes. + + If no aRoot is provided, the entire DOM tree is serialized. aRoot does not + need to be owned by this document. + + @param aStream An output stream to write the serialized DOM tree + @param aRoot Root node to be serialized + @param aSaveOptions Options that control how serialization is performed + @return Number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseOfAPI Document is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C TInt SaveL( MXmlEngOutputStream& aStream, + TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const; + + /** + Saves document tree into memory buffer. + + Any existing contents in aBuffer will be deleted. The memory required for + aBuffer will be allocated by this method. The method caller must Close() + aBuffer. + + If no aRoot is provided, the entire DOM tree is serialized. aRoot does not + need to be owned by this document. + + @param aBuffer Resulting buffer + @param aRoot The root of the subtree to serialize + @param aSaveOptions Options that control how serialization is performed + @return Size of buffer + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseOfAPI Document is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C TInt SaveL(RBuf8& aBuffer, + TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions()) const; + + /** + Creates a complete copy of the document and transfers ownership to the + caller. The caller is required to call Close() on the new document. The + new document is independant from this document and this document may be + changed or closed without affecting the new document. + + @return Complete copy of the document + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument CloneDocumentL() const; + + /** + Creates a new element from a specific namespace to be the root of the + document tree. Any existing document element of the document is destroyed. + + @param aName Element name + @param aNamespaceUri Element namespace URI + @param aPrefix Element namemespace prefix + @return The new root element + @leave KXmlEngErrWrongUseOfAPI No name has been specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement CreateDocumentElementL(const TDesC8& aName, + const TDesC8& aNamespaceUri = KNullDesC8, + const TDesC8& aPrefix = KNullDesC8); + + /** + Replaces (and destroys) the document element. + + Note: Use TXmlEngElement::ReconcileNamespacesL() on the new document + element if it or its descendants can contain references to namespace + declarations outside of the element. + + @param aNewDocElement New document element + @see TXmlEngElement::ReconcileNamespacesL() + */ + IMPORT_C void SetDocumentElement(TXmlEngElement aNewDocElement); + + /** + Get document encoding. + @return Encoding of the source XML data or TPtrC8("") if none. + */ + IMPORT_C TPtrC8 XmlEncoding() const; + + /** + Get xml version + @return Version number reported by the XML declaration or TPtrC8("") if none. + */ + IMPORT_C TPtrC8 XmlVersion() const; + + /** + Retrieves base URI (if defined) of the document + @return Document URI or TPtrC8("") if none. + */ + IMPORT_C TPtrC8 DocumentUri() const; + + /** + Check if document is standalone + @return ETrue if standalone="true" was specified in the XML declaration in + the source XML file. + */ + IMPORT_C TBool IsStandalone() const; + + /** + Sets XML version number to be shown in XML declaration when document is serialized. + @param aVersion Version string + @leave - One of the system-wide error codes + */ + IMPORT_C void SetXmlVersionL(const TDesC8& aVersion); + + /** + Sets the location of the document. The document's URI is used as the + top-level base URI definition. + @param aUri Document URI + @leave - One of the system-wide error codes + */ + IMPORT_C void SetDocumentUriL(const TDesC8& aUri); + + /** + Sets "standalone" attribute of XML declaration for the document + @param aStandalone Is the document standalone + */ + IMPORT_C void SetStandalone(TBool aStandalone); + + /** + Get the DOM implementation. Ownership is not transferred. Any operation + on the returned object will affect this document directly, in particular, + a call to RXmlEngDOMImplementation::Close() will cause further operations + on this document to fail. + + @return Object that represents current DOM implementation + */ + IMPORT_C RXmlEngDOMImplementation Implementation() const; + + /** + Get the document element + @return The document element -- the top-most element in the document tree + */ + IMPORT_C TXmlEngElement DocumentElement() const; + + /** + Sets the "document" property on the node and all its descendants to be this + RXmlEngDocument node + @param aSource Node that should be added. + @return Adopted node + @leave KXmlEngErrWrongUseOfAPI The node has a parent node, the node is + already owned by this document, or the node is a document. + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNode AdoptNodeL(TXmlEngNode aSource); + + /** + Creates a new attribute. + + aValue should represent the correct value of an attribute if it is put + as-is into an XML file (with all characters correctly escaped with entity + references when XML spec requires) + + The TXmlEngElement class provides a rich set of attribute creation methods, + which not only create attributes but also link them into elements. + + @see TXmlEngElement + + There is no way to create attributes with namespaces (despite the DOM spec); + you have to use one of the TXmlEngElement::AddNewAttributeL(..) methods instead + + The returned attribute is the only reference to the allocated memory until + you have attached the attribute to some element node. + + @param aName Name of the atribute; no prefix allowed + @param aValue Value of the attribute (optional) + @return The newly created attribute + @leave KXmlEngErrWrongUseOfAPI No name specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr CreateAttributeL(const TDesC8& aName, + const TDesC8& aValue = KNullDesC8); + + /** + Creates a new text node and copies the content string into it. + @param aCharacters Text node content + @return The created node + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngTextNode CreateTextNodeL(const TDesC8& aCharacters = KNullDesC8); + + /** + Creates a new binary container and copies the specified cid and data into + it. A pointer to the container is stored in the document's data container + list that can be fetched using GetDataContainerList(). + + @see GetDataContainerList( RArray& aList ) + @param aCid Content identifier + @param aData Binary octets + @return The new binary container + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngBinaryContainer CreateBinaryContainerL( const TDesC8& aCid, + const TDesC8& aData ); + + /** + Creates a new chunk container and copies the specified cid into it. A + reference to a memory chunk is stored in the container. The memory chunk + must stay in scope for the lifetime of the container. A pointer to the + container is stored in the document's data container list that can be + fetched using GetDataContainerList(). + + @see GetDataContainerList( RArray& aList ) + @param aCid Content identifier + @param aChunk RChunk reference + @param aChunkOffset Offset to the binary data in aChunk + @param aDataSize Size of binary data in aChunk + @return The new chunk container + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngChunkContainer CreateChunkContainerL( const TDesC8& aCid, + const RChunk& aChunk, + const TInt aChunkOffset, + const TInt aDataSize ); + + /** + Creates a new file container and copies the specified cid into it. A + reference to a file is stored in the container. aFile must stay in scope + of the lifetime of the container. A pointer to the container is stored in + the document's data container list that can be fetched using + GetDataContainerList(). + + @see GetDataContainerList( RArray& aList ) + @param aCid Content identifier + @param aFile The file to reference + @return The new file container + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngFileContainer CreateFileContainerL( const TDesC8& aCid, + const RFile& aFile ); + + /** + Creates a new element node that belongs to the specific namespace. A + namespace declaration node is created on the element. + + If the provided namespace uri is NULL, the element will be created without + namespace. + + @param aNamespaceUri Namespace of new element + @param aPrefix Prefix to use for the namespace binding and the QName of the element + @param aLocalName Local name of the element + @return The created element + @leave KXmlEngErrWrongUseOfAPI No name specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement CreateElementL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8, + const TDesC8& aPrefix = KNullDesC8); + + /** + Creates a new comment node and copies the specified string into it. + @param aText New comment + @return The created node + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngComment CreateCommentL(const TDesC8& aText = KNullDesC8); + + /** + Creates a new CDATA section node and copies the specified string into it. + @param aContents CDATASection content + @return The created node + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngCDATASection CreateCDATASectionL(const TDesC8& aContents = KNullDesC8); + + /** + Creates a new entity reference node and copies the specified string into + it. + + Note: < , > , ' , " and other predefined entity references + should not be created with this method. These entity references are rather + "character references" and are encoded/decoded automatically. + + @param aEntityRef is a string in one of these forms: + - name + - &name + - &name; + where name is the name of the entity + @return The new entity reference + @leave KXmlEngErrWrongUseOfAPI No entity specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngEntityReference CreateEntityReferenceL(const TDesC8& aEntityRef); + + /** + Creates a new empty Document Fragment node. The document fragment is owned by + this document. + @return The created document fragment + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngDocumentFragment CreateDocumentFragmentL(); + + /** + Creates a new processing instruction node and copies "target" and "data" + into it. + + @param aTarget Target + @param aData Data + @return The created processing instruction + @leave KXmlEngErrWrongUseOfAPI No target specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngProcessingInstruction CreateProcessingInstructionL(const TDesC8& aTarget, + const TDesC8& aData = KNullDesC8); + + /** + Sets the specified attribute as a xml:id attribute, starting at + aStartElement and recursing through the subtree. To set the specified + attribute as a xml:id attribute for the entire DOM tree, see + RegisterXmlId(const TDesC8&,const TDesC8&). + + @param aStartElement Root of the subtree to recurse + @param aLocalName Name of the attribute + @param aNamespaceUri Namespace of the new element (default empty) + @leave KXmlEngErrWrongUseOfAPI The starting element is NULL, the attribute + name is not specified, the starting element is the document, or the + starting element does not belong to a document. + @leave KErrAlreadyExists The attribute is already set to be xml:id + @leave - One of the system-wide error codes + */ + IMPORT_C void RegisterXmlIdL(TXmlEngElement aStartElement, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8); + + /** + Sets the specified attribute as a xml:id attribute, recursing through the + entire DOM tree. In order to specify a subtree only, see + RegisterXmlId(TXmlEngElement,const TDesC8,const TDesC8). + + @param aLocalName Name of attribute + @param aNamespaceUri Namespace of new element (default empty) + @leave KXmlEngErrWrongUseOfAPI The document is NULL + @leave KErrAlreadyExists The attribute is already set to be xml:id + @leave - One of the system-wide error codes + */ + IMPORT_C void RegisterXmlIdL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8); + + /** + Looks for an element with the specified xml:id attribute + @param aValue Name of attribute + @return The found element or a NULL element if not found + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement FindElementByXmlIdL(const TDesC8& aValue ) const; + + /** + Retrieves an array of data containers owned by this document. + + Note: The document ceases to be the owner of a data container when the data + container (or one of its predecessors) is removed from the document or + becomes part of another document. Unlinking a data container (or one of its + predecessors) doesn't remove ownership of the data container from this + document so the list might contain containers that are not linked to this + document anymore. + + @param aList Array of data containers + @return KErrNone if successful or one of the system wide error codes otherwise + */ + IMPORT_C TInt GetDataContainerList( RArray& aList ); + +protected: + friend class RXmlEngDOMParser; + friend class TXmlEngNode; + friend class TXmlEngAttr; + friend class TXmlEngElement; + friend class RXmlEngDOMImplementation; + +protected: + /** + Constructor + @param aInternal Document pointer + */ + inline RXmlEngDocument(void* aInternal); + + /** + DISABLED for document; CloneDocumentL() must be used + */ + inline TXmlEngNode CopyL() const; + + /** + DISABLED for document; Close() must be used + */ + inline void Remove(); + + /** + DISABLED for document; Close() must be used + */ + inline void ReplaceWith(TXmlEngNode aNode); + inline void ReplaceWithL(TXmlEngNode aNode); + + /** + DISABLED for document; Close() must be used + */ + inline TXmlEngNode SubstituteForL(TXmlEngNode aNode); + +private: + TInt SaveNodeL( TXmlEngNode aNode, + RBuf8& aBuffer, + MXmlEngOutputStream* aOutputStream = NULL, + TXmlEngSerializationOptions aOpt = TXmlEngSerializationOptions()) const; + + void InitOwnedNodeListL(); + void TakeOwnership(TXmlEngNode aNode); + void RemoveOwnership(TXmlEngNode aNode); + +protected: + /** Pointer to DOM implementation object */ + RXmlEngDOMImplementation* iImpl; + +};// class RXmlEngDocument + + + +#include + +#endif /* XMLENGDOCUMENT_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdocument.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdocument.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,21 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document node functions +// Constructor +// + +inline RXmlEngDocument::RXmlEngDocument(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdocumentfragment.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdocumentfragment.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,50 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document fragment node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDOCUMENTFRAGMENT_H +#define XMLENGDOCUMENTFRAGMENT_H + +#include + + +/** +This class represents a document fragment of the DOM tree. +*/ +class TXmlEngDocumentFragment : public TXmlEngNode +{ +public: + /** Default constructor */ + inline TXmlEngDocumentFragment(); + +protected: + /** + Constructor + @param aInternal Document fragment pointer + */ + inline TXmlEngDocumentFragment(void* aInternal); +}; + +#include + +#endif /* XMLENGDOCUMENTFRAGMENT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdocumentfragment.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdocumentfragment.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document fragment node functions +// Default constructor +// + +inline TXmlEngDocumentFragment::TXmlEngDocumentFragment():TXmlEngNode(NULL) + { + } + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngDocumentFragment::TXmlEngDocumentFragment(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdom.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file is to be included by DOM API clients +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDOM_H +#define XMLENGDOM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // XMLENGDOM_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdomimplementation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdomimplementation.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** @file +@publishedAll +@released +*/ +#ifndef XMLENGDOMIMPLEMENTATION_H +#define XMLENGDOMIMPLEMENTATION_H + +#include + +/** +The RXmlEngDOMImplementation interface provides a number of methods for performing +operations that are independent of any particular instance of the document object model. + +http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-102161490 +*/ +class RXmlEngDOMImplementation +{ + public: + + + /** + Open method needed to initialize the DOM library and should be called + before using any class/function from this library. The initialization is + required in every client thread in which it used. Calling this method + multiple times in a thread is allowed. There should be a call to Close() + for every call to Open, per thread. + + @param aHeap This argument not used at present and is ignored in the + implementation. + @leave - One of the system-wide error codes + */ + IMPORT_C void OpenL( RHeap* aHeap = NULL ); + + /** + Close method. It cleans up resources used by the DOM library. Clients + should call this method at the end of library usage. The library should not + be used after this call. If needed, clients can initialize the library + again by calling the Open() method. + + @param aReserved This parameter is not used + */ + IMPORT_C void Close(TBool aReserved); + + /** + Close method. It cleans up resources used by the DOM library. Clients + should call this method at the end of library usage. The library should not + be used after this call. If needed, clients can initialize the library + again by calling the Open() method. + */ + IMPORT_C void Close(); +}; + +#endif /* XMLENGDOMIMPLEMENTATION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdomparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdomparser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** @file +@publishedAll +@released +*/ +#ifndef XMLENGDOMPARSER_H +#define XMLENGDOMPARSER_H + +#include + +class RXmlEngDOMImplementation; +class RXmlEngDocument; + +/** +This class implements methods for parsing XML data. XML data may be parsed +from a chunk, file, or memory buffer. + +Sample code for parsing from buffer: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDOMParser parser; + parser.Open( domImpl ); // opening parser object + RXmlEngDocument iDoc; + iDoc =parser.ParseL( *aInput ); // parsing aInput - buffer + iDoc.Close(); // closing all opened objects + parser.Close(); + domImpl.Close(); +@endcode + +Sample code for parsing from file: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDOMParser parser; + parser.Open( domImpl ); // opening parser object + RXmlEngDocument iDoc; + iDoc =parser.ParseFileL( aFileName ); // parsing from file + iDoc.Close(); // closing all openend objects + parser.Close(); + domImpl.Close(); +@endcode +*/ +class RXmlEngDOMParser +{ +public: + /** Default constructor */ + IMPORT_C RXmlEngDOMParser(); + + /** + Opens the parser. The RXmlEngDOMImplementation object passed as an + argument may be used by multiple RXmlEngDOMParser objects. + + @param aDOMImpl DOM implementation object previously opened without error. + @return KErrNone if successful, system wide error code otherwise + */ + IMPORT_C TInt Open(RXmlEngDOMImplementation& aDOMImpl); + + /** Closes the parser. */ + IMPORT_C void Close(); + + /** + Parses a chunk of XML data from a memory buffer and builds an internal DOM + tree. The DOM tree can be accessed by calling FinishL() to obtain a + RXmlEngDocument. + + @see FinishL() + @param aBuffer XML data buffer + @see GetLastParsingError() + @leave KXmlEngErrParsing Parsing error + @leave KXmlEngErrWrongUseOfAPI OpenL() not previously called + @leave - One of the system-wide error codes + */ + IMPORT_C void ParseChunkL(const TDesC8& aBuffer); + + /** + Creates a document from chunks of data previously parsed by ParseChunkL(). + Should be called after parsing all chunks. Ownership of the returned + RXmlEngDocument object is transferred to the caller of the method. + RXmlEngDocument::Close() must be called when the document is no longer + required. + + @see ParseChunkL() + @return The created document + @see GetLastParsingError() + @leave KXmlEngErrParsing Parsing error + @leave KXmlEngErrWrongUseOfAPI OpenL() or ParseChunkL() not previously + called + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument FinishL(); + + /** + Parses XML file and builds a DOM RXmlEngDocument. Ownership of the + returned RXmlEngDocument object is transferred to the caller of the method. + RXmlEngDocument::Close() must be called when the document is no longer + required. + + @param aRFs Open file server session + @param aFileName File name + @param aChunkSize The number of bytes to parse from the file at a time, or 0 + if the whole file should be parsed at once. + @return The created document + @see GetLastParsingError() + @leave KXmlEngErrParsing Parsing error + @leave KXmlEngErrWrongUseOfAPI OpenL() not previously called + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument ParseFileL(RFs &aRFs, const TDesC& aFileName, TUint aChunkSize = 0); + + /** + Parses XML file and builds a DOM RXmlEngDocument. Ownership of the + returned RXmlEngDocument object is transferred to the caller of the method. + RXmlEngDocument::Close() must be called when the document is no longer + required. + + @param aFileName File name + @param aChunkSize The number of bytes to parse from the file at a time, or 0 + if the whole file should be parsed at once. + @return The created document + @see GetLastParsingError() + @leave KXmlEngErrParsing Parsing error + @leave KXmlEngErrWrongUseOfAPI OpenL() not previously called + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument ParseFileL(const TDesC& aFileName, TUint aChunkSize = 0); + + /** + Parses XML data from a memory buffer that holds the entire XML structure + and builds a DOM RXmlEngDocument. Ownership of the returned + RXmlEngDocument object is transferred to the caller of the method. + RXmlEngDocument::Close() must be called when the document is no longer + required. + + @see ParseChunkL() + @param aBuffer XML data buffer + @return The created document + @see GetLastParsingError() + @leave KXmlEngErrParsing Parsing error + @leave KXmlEngErrWrongUseOfAPI OpenL() not previously called + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument ParseL(const TDesC8& aBuffer); + + /** + Return last parsing error code. Error codes are positive numbers. + @see xmlengerrors.h + @return The last error returned by the parser or KErrNone if none + */ + IMPORT_C TInt GetLastParsingError(); + +private: + RXmlEngDocument ParseFileWithoutChunksL(RFs& aRFs, const TDesC& aFileName); + void Cleanup(); + +private: + void* iInternal; + TInt iError; + RXmlEngDOMImplementation* iImpl; +}; + +#endif /* XMLENGDOMPARSER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengdomutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengdomutils.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** @file +@publishedAll +@deprecated +*/ +#ifndef XMLENGDOMUTILS_H +#define XMLENGDOMUTILS_H + +#include + +/** +@deprecated This class will be removed in future releases. See +TXmlEngElement::RenameL() for a replacement. +*/ +class TDomUtils +{ + public: + + /** + Renames a TXmlEngElement node. + @param aElement Element node + @param aLocalName New name + @param aNamespaceUri New namespace uri + @param aPrefix New namespace prefix + @leave - One of the system-wide error codes + */ + IMPORT_C void XmlEngRenameElementL(TXmlEngElement aElement, const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix); + + +}; + + +#endif /* XMLENGDOMUTILS_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengelement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengelement.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1057 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** @file +@publishedAll +@released +*/ +#ifndef XMLENGELEMENT_H +#define XMLENGELEMENT_H + +#include +#include + +template class RXmlEngNodeList; + + +/** +This class represents an XML element in the DOM tree. + +Namespace handling: + +The namespace of a XML element is an URI that in pair with the local part of +the element's name consistute the @c expanded-name of the element. It is said +that "the element is of NNN namespace". + +XML elements are shown as belonging to a specific namespace by using prefixes +that previously were bound to some namespace URIs. The scope of a prefix is the +element, where it was declared and all its child (sub-)elements. + +Namespace declaration is created by using a special @c xmlns:{prefix-name} +attribute (which is not really considered as an attribute in DOM): +@code + ... +OR + ... + ... +@endcode + +The latter two examples are equivalent and show the use of @c default namespace. + +Implementation notes: +- Elements having no namespace are either presented with a NULL + TXmlEngNamespace node or a TXmlEngNamespace node that has NULL (KNullDesC8) + prefix and namespace URI set to "" (an empty descriptor). The former is + used by default on all nodes, whereas the latter is for cases when some node + contains undeclaration of the default namespace: + @code + .. + @endcode + +- The prefix of the default attribute is NULL (KNullDesC8), not an "" (empty + descriptor). An empty descriptor which corresponds to + @code + ... + @endcode + (it does not contradict XML spec, but you are strongly advised against using + this) + +- Prefix "xml" is reserved by XML Namespace spec for special purposes; it is + implicitly bound to XML's namespace "http://www.w3.org/XML/1998/namespace" + and no one is allowed to use this prefix except as with spec-defined + elements and attributes or to rebind this prefix to other namespaces + +- Namespace URI may be "" (an empty descriptor) only for default namespace. In + other words, "" namespace URI may not be bound to non-NULL prefix. + + Declaration of "" (an empty descriptor) namespace with NULL (KNullDesC8) + prefix results in: + @code + ... + @endcode + which undeclares any existing (in some parent element) default namespace + for the scope of element 'a': element, its attributes and all child nodes + of DOM tree. Note, that such "undeclaration" will be added only if neccessary. + +- Unneccessary namespace declaration are ignored. Attemps to add namespace binding + using same namespace URI and prefix if such binding already exists in the scope + will have no effect. + +- IMPORTANT! Attributes DO NOT HAVE default namespaces. If an attribute has no + prefix, its namespace is undeclared even if there is some default namespaces for + the scope of the element, which contains the attribute. + +So, it is wrong to write something like this: +@code + ... +@endcode +and assume that the attr belongs to namespace pointed to with @c ns_uri. + +HINTS: +- Use namespace declaration nodes as much as possible (but watch out for prefix collisions). +- Add most referred to namespace declarations (AddNamespaceDeclarationL(uri,pref)) after + any other namespace declarations in a element -- they will be found faster in + namespace lookups. + +For more informarion on NULL and NULL nodes: +@see TXmlEngNode +@see KNullDesC8 +*/ +class TXmlEngElement : public TXmlEngNode +{ + public: + /** Default constructor */ + inline TXmlEngElement(); + + /** + Constructor + @param aInternal element pointer + */ + inline TXmlEngElement(void* aInternal); + + /* + Extensions to the DOM Level 3 Core methods + */ + + /** + Retrieves a list of the attribute nodes of an element + + Upon return, aList is initialized and is ready for use with HasNext() and + Next() methods: + + @code + ... + TXmlEngElement root = doc.DocumentElement(); + RXmlEngNodeList attlist; + root.GetAttributes(attlist); + while (attlist.HasNext()) + processAttribute(attlist.Next()); + ... + attlist.Close(); + @endcode + + If there are no attributes the list will be empty. + + @param aList An attribute list to initialize + */ + IMPORT_C void GetAttributes(RXmlEngNodeList& aList) const; + + /** + Retrieves a list of child elements of an element. + + Upon return, aList is initialized and is ready for use with HasNext() and + Next() methods. + + Note: This returns a list of the child element nodes only. + + There is no affect if the element attributes are empty. + + @param aList A child list to initialize + */ + IMPORT_C void GetChildElements(RXmlEngNodeList& aList) const; + + /** + Creates a new attribute node outside of any namespace (i.e. it has no + prefix), sets the attribute's value and links it as the last attribute of + the current element. + + Note: + - No checks are made that an attribute with the same name exists. + Use this method only on newly created elements! + Otherwise, use TXmlEngElement::SetAttributeL() + - Attributes do not inherit default namespace of its element + (http://w3.org/TR/REC-xml-names/#defaulting) + - The attribute's value is the second argument in all AddNewAttributeL() methods + + When adding the first attribute, use TXmlEngNode::SetAsFirstSibling() on the attribute: + @code + TXmlEngElement el = ... ; // get some element + el.AddNewAttributeL("version","0.1").SetAsFirstSibling(); + @endcode + + Copies are taken of descripters passed in. + + @see SetAsLastSibling() + @see MoveBeforeSibling(TXmlEngNode) + @see MoveAfterSibling(TXmlEngNode) + * + @param aName A local name of the attribute + @param aValue Value to set for new attribute or KNullDesC8 + @return The created attribute + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aName is empty + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, const TDesC8& aValue); + + /** + Creates a new attribute node and adds it to the element. + + The provided namespace declaration is used to set the attribute's namespace. + + Note: If aNsDef is not defined in some of the attribute's ascendants + (including this element), then the ReconcileNamespacesL() method must be + called on this element later. + + Copies are taken of descripters passed in. + + @param aName The local name of attribute + @param aValue Value to set for new attribute or KNullDesC8 + @param aNsDef Namespace to add to the attribute + @return The created attribute + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aName is empty + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, + const TDesC8& aValue, + const TXmlEngNamespace aNsDef); + + /** + Creates a new attribute for the element. A namespace declaration for the + attribute namespace is also created. + + Note: Namespace declarations are reused if possible (no redundant ones are + created) + + Copies are taken of descripters passed in. + + @param aName The local name of attribute + @param aValue Value to set for the new attribute or an empty string + @param aNsUri Namespace URI + @param aPrefix Namespace prefix + @return The created attribute + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aName is empty + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddNewAttributeL(const TDesC8& aName, + const TDesC8& aValue, + const TDesC8& aNsUri, + const TDesC8& aPrefix); + + /** + Creates a new attribute node using the namespace of its parent element + (this element), sets the attribute's value and links it as the last + attribute of the element + + For more hints how to use it @see AddNewAttributeL(const TDesC8&,const TDesC8&) + + Note: + - No checks are made that an attribute with the same name exists + - if the namespace of the parent element is default (i.e. bound prefix is KNullDesC8), + then a temporary prefix will be used and bound to the same namespace URI as the element + (It is due to the fact that default namespaces do not spread on unprefixed attributes, + see http://w3.org/TR/REC-xml-names/#defaulting) + + Copies are taken of descripters passed in. + @see KNullDesC8 + + @param aName Local name of attribute + @param aValue Value to set for the new attribute or empty. + @return The created attribute + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aName is empty + @leave - One of the system-wide error codes + */ + inline TXmlEngAttr AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue); + + /** + Creates a new attribute using the namespace which is bound to the specified prefix + + Use this mothod only for construction of new parts of DOM tree where + you know for sure that the prefix is bound in the given scope. + @code + TXmlEngElement el = parent.AddNewAttributeUsePrefixL("property","ObjName","rdf"); + el.AddNewAttributeUsePrefixL("type", "xs:integer", "rdf"); + @endcode + + Otherwise, you should check that the prefix is bound like this example shows: + @code + TXmlEngNamespace boundNS = TXmlEngNamespace::LookupByPrefix(thisElement, prefix); + if (boundNS.NotNull()){ + thisElement.AddNewAttributeUsePrefixL("name", value, prefix); + } + @endcode + + Note: Use AddNewAttributeNsL(name,value,nsDefNode) as much as you can, + because it is the most efficient way to create namespaced DOM elements (no + additional lookups for namespace declarations are required). + + @code + // If namespace with given URI is not in the scope, then it will be declared + // and bound to "data" prefix. + TXmlEngNamespace nsDef = elem.FindOrCreateNsDefL("http://../Data", "data"); + elem.AddNewAttributeL("location", "...", nsDef); + elem.AddNewElementL("child", nsDef).AddNewAttributeL("attr","...value..."); + // the result is + ... + + + + ... + // + @endcode + + Copies are taken of descripters passed in. + + @param aLocalName The local name of the attribute + @param aValue Value to set for the new attribute or empty string. + @param aPrefix Namespace prefix for the new attribute + @return The created attribute + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aLocalName is empty + @leave KErrNoMemory The namespace is not found and the URI is not + http://www.w3.org/XML/1998/namespace; or there is a memory allocation error + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddNewAttributeUsePrefixL(const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aPrefix); + + /** + Creates new attributes using the namespace in scope, which has the specified URI + + Almost the same as AddNewAttributeUsePrefixL() but does lookup by namespace URI + + @see AddNewAttributeUsePrefixL(const TDesC8&,const TDesC8&,const TDesC8&) + + Copies are taken of descripters passed in. + @see KNullDesC8 + + @param aLocalName The local name of the attribute + @param aValue Value to set for new attribute or empty string. + @param aNsUri Namespace URI for new attribute + @return NULL attribute if namespace declaration is not found OR newly added + to the end of attribute list attribute of this element. + @leave KXmlEngErrNullNode The node is NULL + @leave KXmlEngErrWrongUseOfAPI aLocalName is empty + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddNewAttributeWithNsL(const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aNsUri); + + /** + Adds attribute to element that will be used as Xml:Id. Does not check if + an attribute with the same name exists. + + Note: Call RXmlEngDocument.RegisterXmlIdL(aName,aNsUri) first to register + existed id's in the document. If the ids are not registered the ID will + not be added to the element. + + Copies are taken of descripters passed in. + + @param aLocalName Name of the attribute + @param aValue Value of the attribute + @param aNs Namespace of the attribute + @return Attribute if created. Null attribute if Xml:Id exists + @leave KXmlEngErrWrongUseOfAPI Element is NULL or attribute doesn't exist + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AddXmlIdL(const TDesC8& aLocalName, + const TDesC8& aValue, + TXmlEngNamespace aNs = TXmlEngNamespace()); + + /** + Adds a child element with no namespace. This results in adding an element + with aName and no prefix. + + This method is the best for creation of non-namespace based documents + or document fragments, where no default namespace declared. + + It may be used also as a method for adding elements from the default + namespace, BUT namespace will be assigned ONLY after serialization of the + current document and parsing it back into a DOM tree!! If you need the new + element to inherit the default namespace use: + + @code + ... + TXmlEngNamespace defns = element.DefaultNamespace(); + TXmlEngElement newEl = element.AddNewElementL("Name",defns); + ... + @endcode + + It is not recommended that you use an undefined namespace with libxml. + If an undefined namespace for the element is truly required, then DO NOT + USE this method if there is a default namespace in the scope! + @see AddNamespaceDeclarationL + + Copies are taken of descripters passed in. + + @param aName The name of the element + @return The created element + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aName); + + /** + Creates a new child element with the provided name and namespace + declaration and adds it as the last child of its parent. + + Copies are taken of descripters passed in. + + @param aLocalName The name of the element + @param aNsDecl The namespace declaration that must be retrieved from + one of the ascendant nodes of the new elements (and its prefix + should not be remapped to another namespace URI for the scope + of the new element) + @return Created element node + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, TXmlEngNamespace aNsDecl); + + /** + Creates a new child element with provided the name, prefix and namespace + URI and adds it as the last child of its parent. + + The new namespace declaration will be attached to the parent (this) element + and used as the namespace for newly created child element. If such a + binding already exists (same prefix is bound to same URI), it will be + reused. If the prefix is already bound to some other namespace URI, it will + be rebound by the new namespace declaration node. + + Copies are taken of descripters passed in. + + @param aLocalName Name of the element + @param aNsUri URI of the element's namespace + @param aPrefix Prefix of the element + @return The created element node + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name or URI or prefix is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementL(const TDesC8& aLocalName, + const TDesC8& aNsUri, + const TDesC8& aPrefix); + + /** + Creates a child element with the same namespace (and prefix if present) as + the parent element and adds it as the last child of its parent. + + Copies are taken of descripters passed in. + + @param aLocalName The element's name + @return The created element + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementSameNsL(const TDesC8& aLocalName); + + /** + Performs a lookup for the namespace declaration for the specified prefix + and adds a new child element with the found namespace as the last child of + its parent. + + @pre The prefix is bound + + Copies are taken of descripters passed in. + + @param aLocalName The element's name + @param aPrefix The prefix to use for the search + @return The created element + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name is not specified + @leave KErrNoMemory The namespace is not found and the prefix is not "xml" + (i.e http://www.w3.org/XML/1998/namespace); or there is a memory allocation + error. + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementUsePrefixL(const TDesC8& aLocalName, const TDesC8& aPrefix); + + /** + Performs a lookup for the namespace declaration for the specified namespace + URI and adds a new child element with the found namespace. The new element + is added as the last child of this element. + + Copies are taken of descripters passed in. + + @pre A namespace with the given URI has been declared + + @param aLocalName The element's name + @param aNsUri The namespace of the element + @return The created element + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name is not specified + @leave KErrNoMemory The namespace is not found and the URI is not http://www.w3.org/XML/1998/namespace + or there is a memory allocation error + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementWithNsL(const TDesC8& aLocalName, const TDesC8& aNsUri); + + /** + Creates a new child element. If there is no a prefix binding for the new + element's namespace, a namespace decaration is created with a generated + prefix at the specified element. + + The location of the namespace declaration may be controlled with + aNsDeclTarget: + + @code + el.AddNewElementAutoPrefixL(tagName,uri,KNullDesC8); // declare on the new element + el.AddNewElementAutoPrefixL(tagName,uri,el); // declare on the parent element + el.AddNewElementAutoPrefixL(tagName,uri,doc.DocumentElement()); // declare on the root element + ... + @endcode + + Note: The farther namespace declaration up in the document tree, the + longer the namespace declaration lookups take. + + Copies are taken of descripters passed in. + + @param aLocalName Name of the element to create + @param aNsUri Namespace URI of the new element + @param aNsDeclTarget The element where the namespace declaraton should be placed. + @return The created element + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI Name or URI is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement AddNewElementAutoPrefixL(const TDesC8& aLocalName, + const TDesC8& aNsUri, + TXmlEngElement aNsDeclTarget); + + /** + Gets element content. This method may be used in most cases when the element + has only simple text content (without entity references embedded). If the + element's contents is mixed (other types of nodes present), only the contents + of the first child node is returned (if it is a TXmlEngTextNode node). + + For getting the contents of an element that has contents containing entity + references, WholeTextValueCopyL() should be used. + + @see TXmlEngNode::WholeTextContentsCopyL() + + @return The simple text contents of the element or NULL if there is no text. + */ + IMPORT_C TPtrC8 Text() const; + + /** + Adds text as a child of the element to the end of the list of children. + + Note: There may be several TXmlEngTextNode and TXmlEngEntityReference + nodes added, depending on the aString value. For example, if the curernt + node has text and attributes, a text node and attribute nodes will + be added. + + Copies are taken of descripters passed in. + + @param aString Text to be added as the element's content. + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void AddTextL(const TDesC8& aString); + + /** + Sets text contents for the element. Any child nodes are removed. + This function is the same as TXmlEngNode::SetValueL(TDesC8&) + + @see TXmlEngNode::SetValueL(TDesC8&) + + @param aString Text to be set as element's content. + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetTextL(const TDesC8& aString); + + /** + Sets the text content of the element from an escaped string. + @see TXmlEngAttr::SetEscapedValueL(TDesC8&) + + @param aEscapedString New value + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetEscapedTextL(const TDesC8& aEscapedString); + + /** + Sets the new element value exactly as presented in the string. Predefined + entities are not converted into the characters they represent. Any child + nodes are removed. + + @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); + + @param aNotEncString New string value + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetTextNoEncL(const TDesC8& aNotEncString); + + /** + Appends a new text node with the value exactly as presented in the string. + Predefined entities are not converted into the characters they represent. + Existing child nodes are not removed. + + @see TXmlEngAttr::SetValueNoEncL(const TDesC8& aNewValue); + + Copies are taken of descripters passed in. + + @param aNotEncString Appended string value + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void AppendTextNoEncL(const TDesC8& aNotEncString); + + /** + Adds a namespace declaration to the current element: a binding of prefix to namespace URI. + + If the same namespace declaration exists (same prefix and URI), a redundant + namespace declaration will not be created. + + Both KNullDesC8 or an empty descriptor may be used for "UNDEFINED URI" + and "NO PREFIX" values of arguments. Please refer to the class + documentation for more specific information. + @see TXmlEngElement + @see KNullDesC8 + + Note: Undeclaring of default namespace (xmlns="") is supported by + the SetNoDefaultNamespace() method. + @see SetNoDefaulNamespace() + + Note: Adding a namespace declaration that rebinds the prefix mapping (or + default namespace) used by nodes lower in the tree may damage the document + tree because references to namespace declarations are not updated. + However, after serialization, the document will have the desired structure. + Use this method with care! + + Copies are taken of descripters passed in. + + @param aNsUri Namespace URI, KNullDesC8 or an empty descriptor. + @param aPrefix Namespace prefix, KNullDesC8 or an empty descriptor. + @return The namespace that was created or found or a NULL namespace if the + namespace is being undeclared. + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI URI or prefix is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace AddNamespaceDeclarationL(const TDesC8& aNsUri, const TDesC8& aPrefix); + + /** + Adds a default namespace declaration. + +1 + This achieves the same result as with AddNamespaceDeclarationL(aNsUri, + KNullDesC8), but additionally the element's namespace is modified (if it has no + prefix and there were no default namespace declaration in the scope) to the + new default one. + + Copies are taken of descripters passed in. + @see KNullDesC8 + + @param aNsUri Namespace URI; KNullDesC8 and empty descriptor are allowed to represent UNDEFINED NAMSPACE + @return The created namespace declaration (NULL for UNDEFINED NAMESPACE) + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI URI is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace SetDefaultNamespaceL(const TDesC8& aNsUri); + + /** + Undeclares any default namespace for this element and its descendants. + + If there is already a default namespace, a @c xmlns="" namespace + declaration is added. Otherwise, nothing happens, since elements with no + prefix in such scope are automaticaly considered outside of any namespace. + + The side effect of this method is that the namespace of the current element + may change from the previous default namespace to a NULL TXmlEngNamespace, + which is considered an absence of namespace. + + If the element has a prefix (i.e. not having default namespace), then the + only effect for the element is undeclaration of existing default namespace. + + If the element is in the scope of another @c xmlns="" undeclaration, no + action is taken. + + Note: Use AddNamespaceDeclarationL(KNullDesC8,KNullDesC8) to force the creation of a @c + xmlns="" declaration within the scope of another such declaration + (otherwise unneccessary/duplicate declarations are not created). + + Note: This method should be called on elements before adding children, + because default namespace undeclaration is not spread into its subtree and + descendants' default namespaces are not reset to NULL. This should be taken + into account if later some processing on the subtree occurs. However, + after serialization and deserialization, undeclared default namespace will + affect whole element's subtree correctly. + + @see KNullDesC8 + + @leave KXmlEngErrNullNode Element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetNoDefaultNamespaceL(); + + /** + Finds the namespace declaration that has a specific prefix in the list of parents for + this element. + + If no prefix is specified (an empty descriptor or KNullDesC8) then it is + considered to be a "NO PREFIX" search. Therefore, if the namespace + declaration for "no prefix" is searched, then the default namespace is + returned. + + Copies are taken of descripters passed in. + @see KNullDesC8 + + @param aPrefix Namespace prefix. + @return The namespace, which may be NULL if prefix is not found; NULL result for "no prefix" means that default namespace is undefined. + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace LookupNamespaceByPrefixL(const TDesC8& aPrefix) const; + + /** + Finds a namespace declaration that has a specific namespace URI in the + scope for the given node. + + KNullDesC8 value of aUri is equivalent to an empty descriptor and means + "UNDEFINED NAMESPACE". + For such URI's a NULL namespace handle is always returned even if there is + a namespace undeclaration, which has an empty descriptor URI (and KNullDesC8 + prefix). + + Hint: Use the returned instance of TXmlEngNamespace as the aNsDef argument + to an element's methods that create new child elements and attributes. The + same TXmlEngNamespace may be used on deeper descentants of the reference + element (and doing this way will generally increase performance of DOM tree + construction). However, if namespace bindings are not controlled for the + element's children and the prefix (which is bound to the search namespace) + is rebound to some other namespace URI, then reusing the namespace may lead + to unwanted result. + + Note: At the moment it is possible to retrieve namespace declaration nodes + whose prefixes were rebound. Be careful when using returned + TXmlEngNamespace objects for creation of new elements. + + Copies are taken of descripters passed in. + + @param aUri Namespace URI, for which the namespace declaration is searched + @return The namespace declaration that binds the given namespace URI to a + prefix or sets it as a default namespace + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace LookupNamespaceByUriL(const TDesC8& aUri) const; + + /** + Retrieves the implicitly declared XML infoset binding of the 'xml' prefix + to XML's namespace URI: "http://www.w3.org/XML/1998/namespace" + + The result should be used for creating attributes beloging to the XML namespace + (xml:lang, xml:space, xml:id , etc.) + + DO NOT USE the methods LookupNamespaceByUriL(const TDesC8&) and + LookupNamespaceByPrefixL(const TDesC8&) (with the arguments + "http://www.w3.org/XML/1998/namespace" and "xml" respectively) for + retrieving the namespace node, since in the case of a memory allocation + fault, a NULL result is returned (and breaks your program silently) + + Note: Normally the 'xml' prefix is bound to the XML namespace URI in the + document node, BUT if this element is not a part of the document tree yet, + the requested namespace declaration WILL BE ADDED to the current node. + This is the reason why the method may fail in OOM conditions. + + @return The namespace matching the prefix binding + {xml,"http://www.w3.org/XML/1998/namespace"} in the current document + @leave KErrNoMemory The element is NULL or there was a memory allocation error + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace TheXMLNamespaceL() const; + + /** + Get the default namespace for the element. + + A NULL TXmlEngNamespace means that an element with no prefix + has no namespace associated with it because no default namespace was declared or + the default namespace was undeclared with @c xmlns="" + + This function is equivalent to LookupNamespaceByPrefixL(KNullDesC8). + @see KNullDesC8 + + @return The default namespace in the scope of the element + @leave - One of the system-wide error codes + */ + inline TXmlEngNamespace DefaultNamespaceL() const; + + /** + Performs a search for the namespace in the scope of the element. This + method will create new namespace declaration on the element if such + namespace is not found. + + Note: Be sure not to use the result of this method for non-descendants of + the element or in situations when prefix overlapping might occur. + @see TXmlEngAttr + @see TXmlEngNamespace + Please read the documentation for this class: + @see TXmlEngElement + + Copies are taken of descripters passed in. + + @param aNsUri Namespace to search for + @param aPrefix Prefix to use for the new namespace declaration (if it is to be created) + @return The namespace found or created + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI URI is not specified + @leave - One of the system-wide error codes + + @see LookupNamespacebyUriL + */ + IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri, const TDesC8& aPrefix); + + /** + Performs a search on the element and its ascendants for any namespace + declaration with a given URI. Creates a new namespace declaration with a + (unique) prefix if the search was not successful. + @see AddNamespaceDeclarationL + + Copies are taken of descripters passed in. + + @param aNsUri Namespace to search for + @return The namespace found or created + @leave KXmlEngErrNullNode Element is NULL + @leave KXmlEngErrWrongUseOfAPI URI is not specified + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNamespace FindOrCreateNsDeclL(const TDesC8& aNsUri); + + /** + Checks whether a prefix has been bound in this element (not in one of its ascendants) + + Use this method for preventing prefix-name collision in a element node + + Copies are taken of descripters passed in. + + @param aPrefix Namespace prefix + @return ETrue if there is already a namespace declaration that uses aPrefix on this element + @leave - One of the system-wide error codes + */ + IMPORT_C TBool HasNsDeclarationForPrefixL(const TDesC8& aPrefix) const; + + /** + Copies the element with its attributes, but not child nodes + + If the context is preserved (preserveNsContent), then all namespace + declarations that are in the element are writen to the tag. + + @param preserveNsContext Whether the namespace context should be preserved + @return The copied element + @leave KXmlEngErrNullNode The element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngElement ElementCopyNoChildrenL(TBool preserveNsContext) const; + + /** + Specialized version of TXmlEngNode::CopyL() + @return Deep copy of the element. + @leave KXmlEngErrNullNode The element is NULL + @leave - One of the system-wide error codes + */ + inline TXmlEngElement CopyL() const; + + /** Resets element's content: all child nodes are removed */ + IMPORT_C void RemoveChildren(); + + /** Resets element's attributes */ + IMPORT_C void RemoveAttributes(); + + /** + Resets all namespace declarations made in the element + + Note: There can be references to these namespace declarations elsewhere! + Use ReconcileNamespacesL() to fix that. + */ + IMPORT_C void RemoveNamespaceDeclarations(); + + /** + Removes all element contents: child nodes, attributes and namespace declarations + + @see RemoveChildren() + @see RemoveAttributes() + @see RemoveNamespaceDeclarations(); + */ + inline void ClearElement(); + + /** + Copies attributes from another element. It may be a very convenient method + for initializing element with a set of predefined attributes. + + Note: Namespaces of the this element may need to be reconciled if the + copied attributes belong to any namespace that is not declared on some + ascendant of this node. @see ReconcileNamespacesL() + + @param aSrc Source element + @leave KXmlEngErrNullNode The element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void CopyAttributesL(TXmlEngElement aSrc); + + /** + Recursively copies the children (and all of it's associated information) + from another element. Elements are appended to the current element's + children list. + + Note: Namespaces of this element may need to be reconciled after copy + operation + @see ReconcileNamespacesL() + + @param aSrc Source element + @leave KXmlEngErrNullNode The element is NULL + @leave KXmlEngWrongUseOfAPI The source element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void CopyChildrenL(TXmlEngElement aSrc); + + /** + Removes the child element with the given name and namespace URI (if it exists). + Memory allocated for the element is freed. + + @param aLocalName Child element name + @param aNamespaceUri Child element namespace + @leave KXmlEngErrNullNode The element is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void RemoveChildElementsL(const TDesC8& aLocalName,const TDesC8& aNamespaceUri); + + /** + Renames the element with the given name, namespace URI, and namespace prefix. + + @param aLocalName The new element name + @param aNamespaceUri The new namespace URI + @param aPrefix The new namespace prefix + @leave - One of the system-wide error codes + */ + IMPORT_C void RenameElementL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri, const TDesC8& aPrefix); + + /* + DOM Level 3 Core methods + + Most methods of DOM spec operate with fully-qualified names (QNames) + of elements and attributes. It is different in this API - all methods + instead accept prefix and localName parts of QName. + */ + + /** + Returns the value of the attribute with the given name and namespace URI. + + @param aLocalName Local name of the attribute + @param aNamespaceUri Namespace URI of the attribute, or the default namespace if not specified. + @return The attribute value (for as long as the attribute exists) or + NULL if not found. + @leave - One of the system-wide error codes + */ + IMPORT_C TPtrC8 AttributeValueL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8) const; + + /** + Initializes list of child elements with matching names and namespace URIs. + + Note: This method does not list all descendants of the element, only child elements + @see KNullDesC8 + + @param aList Node list to be created + @param aLocalName Element name + @param aNamespaceUri if specified it sets the Namespace URI, default is KNullDesC8 (no namespace set). + @leave - One of the system-wide error codes + */ + IMPORT_C void GetElementsByTagNameL(RXmlEngNodeList& aList, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8) const; + + /** + Sets the value of the given attribute. The attribute is created if there + is no such attribute yet. + + Note: If prefix is not KNullDesC8 (or an empty descriptor), + then the namespace URI may not be empty see + http://www.w3.org/TR/REC-xml-names/#ns-decl (Definition #3) + + Copies are taken of descripters passed in. + @see KNullDesC8 + + @param aLocalName Attribute name + @param aValue Attribute value + @param aNamespaceUri Namespace URI - default is KNullDesC8 + @param aPrefix Namespace prefix - default is KNullDesC8 + @leave KXmlEngErrNullNode The element is NULL + @leave KXmlEngErrWrongUseOfAPI Attribute name not specified + @leave - One of the system-wide error codes + */ + IMPORT_C void SetAttributeL(const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aNamespaceUri = KNullDesC8, + const TDesC8& aPrefix = KNullDesC8); + + /** + Removes the attribute with the given name and namespace URI (if it exists). + Memory allocated for the attribute is freed. + + @see KNullDesC8 + + @param aLocalName Name of the attribute + @param aNamespaceUri Attribute namespace URI, default is KNullDesC8 + @leave - One of the system-wide error codes + */ + IMPORT_C void RemoveAttributeL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8); + + /** + Retrieves an attribute node with a specific namespace by its name. + + @see KNullDesC8 + + @param aLocalName Name of the attribute + @param aNamespaceUri Attribute namespace URI, default is KNullDesC8 + @return Attribute node with matching namespace URI and name, NULL if not found. + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngAttr AttributeNodeL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8) const; + + /** + Check if the element has an attribute with given parameters. + + This function is the same as AttributeNodeL(uri,name).NotNull(). + + @see KNullDesC8 + + @param aLocalName Name of attribute + @param aNamespaceUri Namespace uri, default is KNullDesC8. + @return ETrue if the element holds an attribute with such namespace URI and name. + @leave - One of the system-wide error codes + */ + inline TBool HasAttributeL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri = KNullDesC8) const; + + /** + Adds an attribute to this element. If an attribute of the same name + exists, it will be destroyed. + + @param aNewAttr The new attribute + @leave KXmlEngErrNullNode The element or attribute is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetAttributeNodeL(TXmlEngAttr aNewAttr); +}; + + +#include + +#endif /* XMLENGELEMENT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengelement.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengelement.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Inline functions specyfic for element node +// Default constructor +// + +inline TXmlEngElement::TXmlEngElement():TXmlEngNode(NULL) {} + +// ------------------------------------------------------------------------------------- +// Constructor +// ------------------------------------------------------------------------------------- +// +inline TXmlEngElement::TXmlEngElement(void* aInternal): TXmlEngNode(aInternal) {} + + +// ------------------------------------------------------------------------------------- +// Creates new attribute node using namespace of its parent element (this element), +// sets attribute's value and links it as the last attribute of the element +// +// @param aName - Local name of attribute +// @param aValue - Value to set for new attribute or NULL (sets value to "") +// @return A handler to the newly created attribute node; +// +// For more hints how to use it refer to AddNewAttributeL(const TDesC8&,const TDesC8&) +// +// @note +// - No checks are made that attribute with such name exists +// - if namespace of the parent element is default (i.e. bound prefix is NULL), +// then temporary prefix will be used and bound to the same namespace URI as elements +// (It is due to the fact that default namespaces do not spread on unprefixed attributes, +// see http://w3.org/TR/REC-xml-names/#defaulting) +// ------------------------------------------------------------------------------------- +// +inline TXmlEngAttr TXmlEngElement::AddNewAttributeSameNsL(const TDesC8& aName, const TDesC8& aValue) + { + return AddNewAttributeL(aName, aValue, NamespaceDeclaration()); + } + +// ------------------------------------------------------------------------------------- +// @return Default namespace in the scope of the element +// +// NULL TXmlEngNamespace means that element with no prefix have no namespace associated +// because no default namespace was declared or default namespace was undeclared with xmlns="" +// +// Equivalent to LookupNamespaceByPrefixL() with NULL (or "") prefix provided +// ------------------------------------------------------------------------------------- +// +inline TXmlEngNamespace TXmlEngElement::DefaultNamespaceL() const + { + return LookupNamespaceByPrefixL(KNullDesC8); + } + +// ------------------------------------------------------------------------------------- +// Specialized version of TXmlEngNode::CopyL() +// +// @return Deep copy of the element. +// ------------------------------------------------------------------------------------- +// +inline TXmlEngElement TXmlEngElement::CopyL() const + {return TXmlEngNode::CopyL().AsElement();} + +// ------------------------------------------------------------------------------------- +// Removes all element contents: child nodes, attributes and namespace declarations +// +// @see RemoveChildren(), RemoveAttributes(), RemoveNamespaceDeclarations(); +// ------------------------------------------------------------------------------------- +// +inline void TXmlEngElement::ClearElement() + { + RemoveChildren(); + RemoveAttributes(); + RemoveNamespaceDeclarations(); + } + +// ------------------------------------------------------------------------------------- +// ------------------------------------------------------------------------------------- +// + + +// ------------------------------------------------------------------------------------- +// Returns TRUE if the element holds an attribute with such namespace URI and name. +// +// Same result gives AttributeNodeL(uri,name).NotNull() +// ------------------------------------------------------------------------------------- +// +inline TBool TXmlEngElement::HasAttributeL(const TDesC8& aLocalName, const TDesC8& aNamespaceUri) const + {return AttributeNodeL(aLocalName, aNamespaceUri).NotNull();} + + + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengentityreference.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengentityreference.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,49 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Entity reference node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGENTITYREFERENCE_H +#define XMLENGENTITYREFERENCE_H + +#include + +/** +This class represents an XML entity reference in the DOM tree. +*/ +class TXmlEngEntityReference : public TXmlEngNode +{ +public: + /** Default constructor */ + inline TXmlEngEntityReference(); + +protected: + /** + Constructor + @param aInternal Entity reference pointer + */ + inline TXmlEngEntityReference(void* aInternal); +}; + +#include + +#endif /* XMLENGENTITYREFERENCE_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengentityreference.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengentityreference.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Entity reference node functions +// Default constructor +// + +inline TXmlEngEntityReference::TXmlEngEntityReference():TXmlEngNode(NULL) + { + } + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngEntityReference::TXmlEngEntityReference(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengerrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** @file +@publishedAll +@released +*/ + +#ifndef XMLENGDOMERRORS_H +#define XMLENGDOMERRORS_H + +#include + +/** +DOM parsing error. + +All errors returned by the DOM parser (positive values) are propagated from the +open-source library. They can be found in the documentation for Libxml2 +(version 2.6.10). See http://xmlsoft.org. + +@see xmlParserErrors +@see libxml2_xmlerror.h + +These errors are generated by DOM APIs and may occur as a Leave or as a return +code. +*/ +const TInt KXmlEngErrParsing = -32397; + +/** DOM save error */ +const TInt KXmlEngErrNegativeOutputSize = -32383; + +/** Encoding not understood*/ +const TInt KXmlEngErrWrongEncoding = -32382; + +/** KXmlEngErrNullNode error */ +const TInt KXmlEngErrNullNode = -32380; + +/** KXmlEngErrWrongUseOfAPI error */ +const TInt KXmlEngErrWrongUseOfAPI = -32381; + +#endif // XMLENGDOMERRORS_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengfilecontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengfilecontainer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// All file container data functions +// @file +// @publishedAll +// @released +// + + + +#ifndef XMLENGFILECONTAINER_H +#define XMLENGFILECONTAINER_H + +#include + +class RFile; + +/** +This class represents data stored as a RFile in the DOM tree. + +The RFile container is treated in general as a text node in the DOM tree. Data +is stored in the file system referenced by the RFile handle. + +Sample code for creating a file container: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDocument iDoc; + // create document element + TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc")); + // create file container from file (file1 is an RFile object) and CID equals cid + TXmlEngFileContainer binData = iDoc.CreateFileContainerL(cid, file1); + elem.AppendChildL(binData); // append container to the dom tree + iDoc.Close(); // closing all opened objects + domImpl.Close(); +@endcode +*/ +class TXmlEngFileContainer : public TXmlEngDataContainer +{ +public: + /** + Gets the RFile reference + @return RFile reference + */ + IMPORT_C RFile& File() const; + +protected: + /** Default constructor */ + inline TXmlEngFileContainer(); + + /** + Constructor + @param aInternal Node pointer + */ + inline TXmlEngFileContainer(void* aInternal); +}; + +#include + +#endif // XMLENGFILECONTAINER_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengfilecontainer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengfilecontainer.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// File container functions +// Default constructor +// + +inline TXmlEngFileContainer::TXmlEngFileContainer():TXmlEngDataContainer(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngFileContainer::TXmlEngFileContainer(void* aInternal):TXmlEngDataContainer(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnamespace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnamespace.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,138 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNAMESPACE_H +#define XMLENGNAMESPACE_H + +#include + +/** +This class represents an existing namespace declaration in the DOM tree or a +namespace node returned in RXmlEngNodeSet as a result of some XPath expression. + +All elements and attributes may have a namespace instance associated with them. +Once added to an element, a namespace declaration (instance of +TXmlEngNamespace) may be referred to by all attributes and descendants of the +element (unless the prefix that this namespace-to-prefix binding uses is +overriden somewhere below in the document tree). + +General rules for namespace handling: + +- A NULL prefix in the namespace node means NO PREFIX. An empty string "" can +be used to specify the absence of a prefix when setting it, however, NULL will +be stored and returned. + +- A NULL value for a namespace URI is legal only with a NULL prefix and is only +used in the undeclaration of a namespace (@c xmlns="" ). An empty string "" +can be used too, however, it will be returned as NULL. + +- A NULL or empty string namespace URI with a non-NULL prefix is illegal +acording to the XML specification. + +- The namespace of an element is a default namespace if it has a NULL prefix. + +- Elements with namespace undeclarations (@c xmlns="" ), have no namespace and +are treated as local names. + +- Attributes do not have a default namespace. Even if a namespace is applied at +element scope, the default namespace declaration is not applied to the +element's attributes (according to the XML specification). + +- The namespace of a node (element or attribute) is undefined if no namespace +declaration is associated with it. + +- A node with an undefined namespace is serialized as having no prefix. In +general, the DOM API handles the complexity of namespace declaration handling, +creating neccessary namespace declarations and undeclaring default namespaces. +However, some node-creation methods (e.g. TXmlEngElement::AddNewElementL()) do +not ensure that a node created with an undefined namespace (i.e. without a +prefix) will be treated after serialization as having the default namespace. + +Note: +Namespace nodes that are the result of XPath expressions have following restrictions: + +- They cannot be used as namespace definitions, because they are not part of +the DOM tree, but rather copies of existing namespace definitions. + +- The namespace prefix is not available because it is not mandated by the DOM +Level 3 XPath API. So, in returned copies of the DOM tree, namespace prefix +strings are not preserved and Prefix() returns NULL. +*/ +class TXmlEngNamespace: public TXmlEngNode +{ + friend class TXmlEngElement; + friend class TXmlEngNode; + + public: + /** Default constructor */ + inline TXmlEngNamespace(); + + /** + Gets the namespace URI + @return Namespace URI string or an empty string if the namespace is either + NULL or undeclared (@c xmlns="" ) + */ + IMPORT_C TPtrC8 Uri() const; + + /** + Gets the namespace prefix. + @return The prefix bound in the namespace declaration or an empty string + when there is a default namespace or if no binding exists + */ + IMPORT_C TPtrC8 Prefix() const; + + /** + Check if the namespace is default. + @return ETrue if the namespace is default (no prefix), EFalse if the + namespace is not default (bound to prefix) or the namespace is NULL + */ + IMPORT_C TBool IsDefault() const; + + /** + Check if the namespace is undefined. A node's namespace is undefined if no + namespace declaration is associated with it. This is the same as + TXmlEngNode::IsNull(). + @return ETrue if the namespace is undefined, EFalse otherwise + */ + IMPORT_C TBool IsUndefined() const; + +protected: + /** + This method is inherited from TXmlEngNode. To prevent its use, no function body + has been supplied. The method Uri() should be used instead. + + @see Uri(). + */ + inline TPtrC8 NamespaceUri(); + +protected: + /** + Constructor + @param aPtr Namespace pointer + */ + inline TXmlEngNamespace(void* aPtr); +}; + +#include + +#endif /* XMLENGNAMESPACE_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnamespace.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnamespace.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,28 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Default constructor +// + +inline TXmlEngNamespace::TXmlEngNamespace():TXmlEngNode(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngNamespace::TXmlEngNamespace(void* aPtr):TXmlEngNode(aPtr) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnode.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,784 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node class declaration +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNODE_H +#define XMLENGNODE_H + +#include + +class TXmlEngNode; +template class RXmlEngNodeList; +class RXmlEngDocument; +class TXmlEngElement; +class TXmlEngAttr; +class TXmlEngTextNode; +class TXmlEngNamespace; +class TXmlEngComment; +class TXmlEngCDATASection; +class TXmlEngDocumentFragment; +class TXmlEngEntityReference; +class TXmlEngProcessingInstruction; +class MXmlEngUserData; +class TXmlEngBinaryContainer; +class TXmlEngChunkContainer; +class TXmlEngDataContainer; +class TXmlEngFileContainer; + +/** +This class represents an XML node in the DOM tree. + +As the base class for other node types (element, attribute, etc.) this class +implements common methods that are similar for all XML node types. + +Sample code for tree manipulations: +@code + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); // opening DOM implementation object + RXmlEngDocument iDoc; // iDoc with created nodes tree + TXmlEngNode tmp = iDoc.DocumentElement(); + // copying first child of iDoc to tmp2 node and appending it + TXmlEngNode tmp2 = tmp.FirstChild().CopyL(); + tmp.AppendChildL(tmp2); + // copying the second child of iDoc to the last child + tmp.FirstChild().NextSibling().CopyToL(tmp.LastChild()); + // replacing the second to last child with the second child + tmp.LastChild().PreviousSibling().ReplaceWith(tmp.FirstChild().NextSibling()); + // moving first child of iDoc to second child's children + tmp.FirstChild().MoveTo(tmp.FirstChild().NextSibling()); + iDoc.Close(); // closing all opened objects + domImpl.Close(); +@endcode + +A node is NULL when the internal data pointer is NULL. This is the default +state of a newly created node. Many DOM APIs that return TXmlEngNode objects +use this NULL state to indicate a failure of some kind. The methods IsNull() +and NotNull() can be used to determine whether a node is NULL. +*/ +class TXmlEngNode +{ +public: + /** + The different node types in a XML tree. + */ + enum TXmlEngDOMNodeType { + EElement = 1, + EAttribute = 2, + EText = 3, + ECDATASection = 4, + EEntityReference = 5, + /** Not supported */ + EEntity = 6, + EProcessingInstruction = 7, + EComment = 8, + EDocument = 9, + /** Not supported */ + EDocumentType = 10, + EDocumentFragment = 11, + /** Not supported */ + ENotation = 12, + /** Extension to the DOM spec */ + ENamespaceDeclaration = 18, + /** Extension to the DOM spec */ + EBinaryContainer = 30, + /** Extension to the DOM spec */ + EChunkContainer = 31, + /** Extension to the DOM spec */ + EFileContainer = 32 + }; + +public: + /** Default constructor */ + inline TXmlEngNode(); + + /** + Constructor + @param aInternal node pointer + */ + inline TXmlEngNode(void* aInternal); + + /** + Check if the node is NULL + @return ETrue if node is NULL, otherwise EFalse + */ + inline TBool IsNull() const; + + /** + Check if node is not NULL + @return ETrue if node is not NULL, otherwise EFalse + */ + inline TBool NotNull() const; + + /** + Cast to an attribute node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as an attribute node + */ + inline TXmlEngAttr& AsAttr() const; + + /** + Cast to a text node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a text node + */ + inline TXmlEngTextNode& AsText() const; + + /** + Cast to a binary data container + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a binary container + */ + inline TXmlEngBinaryContainer& AsBinaryContainer() const; + + /** + Cast to a memory chunk container + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a chunk container + */ + inline TXmlEngChunkContainer& AsChunkContainer() const; + + /** + Cast to a file container + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a file container + */ + inline TXmlEngFileContainer& AsFileContainer() const; + + /** + Cast to a memory chunk container + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a chunk container + */ + inline TXmlEngDataContainer& AsDataContainer() const; + + /** + Cast to an element node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as an element node + */ + inline TXmlEngElement& AsElement() const; + + /** + Cast to a comment node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a comment node + */ + inline TXmlEngComment& AsComment() const; + + /** + Cast to a namespace node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a namespace node + */ + inline TXmlEngNamespace& AsNamespace() const; + + /** + Cast to a CDATA section node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a CDATA section node + */ + inline TXmlEngCDATASection& AsCDATASection() const; + + /** + Cast to an entity reference node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as an entity reference node + */ + inline TXmlEngEntityReference& AsEntityReference() const; + + /** + Cast to a Document Fragment. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a Document Fragment + */ + inline TXmlEngDocumentFragment& AsDocumentFragment() const; + + /** + Cast to a processing instruction node. + Note: + - Never cast nodes to the wrong node type! + - Casting removes the const'ness of the node + @return This node as a Processing instruction node + */ + inline TXmlEngProcessingInstruction& AsProcessingInstruction() const; + + /** + Get the inner XML string. This method returns all content of the node, + exluding node markup. Child nodes will be included. Any existing contents + in aBuffer will be destroyed. This method allocates memory for the buffer. + + @param aBuffer A buffer owned by the caller that contains the result + @return Length of the output buffer + @leave KXmlEngErrWrongUseOfAPI Node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C TInt InnerXmlL(RBuf8& aBuffer); + + /** + Get the outer XML string. This method returns all content of the node, + including node markup. Child nodes will be included. Any existing + contents in aBuffer will be destroyed. This method allocates memory for + the buffer. + + @param aBuffer A buffer owned by the caller that contains the result + @return Length of the output buffer + @leave KXmlEngErrWrongUseOfAPI Node is NULL + @leave KXmlEngErrNegativeOutputSize Output has a negative length + @leave - One of the system-wide error codes + */ + IMPORT_C TInt OuterXmlL(RBuf8& aBuffer); + + /** + Moves the node to become the first in the list of its siblings + @pre The node has a parent + */ + IMPORT_C void SetAsFirstSibling(); + + /** + Moves the node to become the last in the list of its siblings + @pre The node has a parent. + */ + IMPORT_C void SetAsLastSibling(); + + /** + Moves the node to come before the specified node in the list of sibling + nodes. This method does nothing if aSiblingNode is not one of the node's + siblings. + @pre The node has a parent. + @param aSiblingNode The node is moved to fall before this sibling + */ + IMPORT_C void MoveBeforeSibling(TXmlEngNode aSiblingNode); + + /** + Moves the node to come after the specified node in the list of sibling + nodes. This method does nothing if aSiblingNode is not one of the node's + siblings. + @pre The node has a parent + @param aSiblingNode The node is moved to fall after this sibling + */ + IMPORT_C void MoveAfterSibling(TXmlEngNode aSiblingNode); + + /** + Moves the node to another part of the tree or to another document. The + node is unlinked from its current postion (if any) and appended to its new + parent. + + Note: In many cases this method call should be followed by a call to + ReconcileNamespacesL(). + + @param aParent This node will be moved to be a child of this node + @return This node + @leave KXmlEngErrNullNode The node is NULL + @leave - One of the system-wide error codes + */ + inline TXmlEngNode MoveToL(TXmlEngNode aParent); + + /** + Moves the node to another part of the tree or to another document. The + node is unlinked from its current postion (if any) and appended to its new + parent. + + Note: In many cases this method call should be followed by a call to + ReconcileNamespacesL(). + + @see ReconcileNamespacesL() + @param aParent This node will be moved to be a child of this node + @return This node + @leave KXmlEngErrNullNode The node is NULL + @leave - One of the system-wide error codes + + @deprecated This method has been deprecated and will be removed in a future + release. + */ + inline TXmlEngNode MoveTo(TXmlEngNode aParent); + + /** + Detaches the node from the document tree. The document maintains ownership + of the node until it is linked elsewhere. + + Note: Remember to use ReconcileNamespacesL() later, if the extracted node + (or subtree) contains references to namespace declarations outside of the + subtree. + + @see ReconcileNamespacesL() + @return This node + */ + IMPORT_C TXmlEngNode Unlink(); + + /** + Ensures that namespaces referred to in the node and its descendants are + within the scope of the node. + + This method checks that all the namespaces declared within the subtree + parented by this node are properly declared. This is needed for example + after a Copy or an Unlink followed by an Append operation. The subtree may + still hold pointers to namespace declarations outside the subtree or they + may be invalid/masked. The function tries to reuse the existing namespaces + found in the new environment as much as possible. If not possible, the new + namespaces are redeclared at the top of the subtree. + + This method should be used after unlinking nodes and inserting them into + another document tree or into another part of the original tree, if some + nodes of the subtree are removed from the scope of the namespace + declaration they refer to. + + When a node is unlinked, it may still refer to namespace declarations from + the previous location. It is important to reconcile the subtree's + namespaces if the previous parent tree is to be destroyed. On the other + hand, if the parent tree is not changed before pasting its unlinked part + into another tree, then reconciliation is needed only after the paste + operation. + @leave - One of the system-wide error codes + */ + IMPORT_C void ReconcileNamespacesL(); + + /** + Unlinks this node and destroys it; all child nodes are also destroyed and + all memory is freed. + + Note: Document nodes cannot be removed with this method. Use + RXmlEngDocument::Close() instead. + */ + IMPORT_C void Remove(); + + /** + This node is replaced with another node (or subtree). The replacement node + is linked into the document tree instead of this node. The replaced node + is destroyed. Replacement of a node with a NULL TXmlEngNode is legal and + equivalent to removing the node. + + aNode is unlinked from its previous location, which can be none (i.e. not + linked), within the same document tree, or within another document tree. + + Note: Not applicable to document nodes. + + @see SubstituteForL(TXmlEngNode) + @param aNode Node that replaces this node + @leave KXmlEngErrNullNode Node is NULL + @leave KXmlEngErrWrongUseOfAPI Node is a document node + @leave - One of the system-wide error codes + */ + IMPORT_C void ReplaceWithL(TXmlEngNode aNode); + + /** + This node is replaced with another node (or subtree). The replacement node + is linked into the document tree instead of this node. The replaced node + is destroyed. Replacement of a node with a NULL TXmlEngNode is legal and + equivalent to removing the node. + + aNode is unlinked from its previous location, which can be none (i.e. not + linked), within the same document tree, or within another document tree. + + Note: Not applicable to document nodes. + + @see SubstituteForL(TXmlEngNode) + @param aNode Node that replaces this node + @deprecated This method has been deprecated and will be removed in a future + release. + */ + IMPORT_C void ReplaceWith(TXmlEngNode aNode); + + /** + Unlinks this node and puts another in its place. This function is the same + as ReplaceWithL(), but this node is not freed. + + aNode is unlinked from its previous location, which can be none (i.e. not + linked), within the same document tree, or within another document tree. + + It is possible to use a NULL TXmlEngNode object as an argument. In this + case, this node will simply be removed from the tree, but not freed. + + Note: Not applicable to document nodes. + + @see ReplaceWithL() + @param aNode Node that replaces current node + @return The current node after unlinking it from document tree + @leave KXmlEngErrNullNode Node is NULL + @leave KXmlEngErrWrongUseOfAPI Node is a document node + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNode SubstituteForL(TXmlEngNode aNode); + + /** + Retrieves the namespace declaration that applies to the node's namespace + + Note: The DOM spec does not consider namespace declarations as a kind of + node. This API adds TXmlEngNamespace, which is derived from TXmlEngNode. + + @return The namespace declaration and prefix binding that act on the node; + returns a NULL object if no namespace associated + */ + IMPORT_C TXmlEngNamespace NamespaceDeclaration() const; + + /** + Attaches a user data object to this node. The ownership of the object is + transferred. When the node is deleted, the Destroy method of the + MXmlEngUserData class will be called. If there is a user data object + already associated with this node, it will be deleted before attaching the + new object. + + Only TXmlEngElement and TXmlEngAttr nodes currently support this feature. + + User data is not copied when the node is copied. + + @param aData Pointer to the data object. + @return ETrue if successful or EFalse if the node type does not support this operation + */ + IMPORT_C TBool AddUserData(MXmlEngUserData* aData); + + /** + Gets the user data object attached to this node. Ownership is not transferred. + @return Pointer to data object or NULL if it doesn't exist. + */ + IMPORT_C MXmlEngUserData* UserData() const; + + /** + Removes the user data object attached to this node and transfers ownership + to the caller. The user data object is not deleted. + @return Pointer to the user data object or NULL if it doesn't exist. + */ + IMPORT_C MXmlEngUserData* RemoveUserData(); + + /** + Creates a deep copy of the node. All values and children nodes are copied. + Attributes and namespace declarations are also copied for TXmlEngElement + nodes. Document nodes cannot be copied with this method. Use + RXmlEngDocument::CloneDocumentL() instead. + + User data stored with AddUserData() is not copied. + + @return A complete copy of the node or NULL if the node is a document node + @leave KXmlEngErrNullNode Node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNode CopyL() const; + + /** + Creates a deep copy of the node and appends the subtree as a new child to + the provided parent node. Document nodes cannot be copied with this + method. Use RXmlEngDocument::CloneDocumentL() instead. + + User data stored with AddUserData() is not copied. + + @return Created copy of the node after linking it into the target document tree. + @leave KXmlEngErrNullNode Node is NULL + @leave KXmlEngErrWrongUseOfAPI Node is document node + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNode CopyToL(TXmlEngNode aParent) const; + + /** + Append a child node. This is a universal operation for any type of node. + Note that some types of nodes cannot have children and some types of nodes + are not allowed to be children of some other types. These relationships + are not enforced by this function. + + @param aNewChild The node that should be added as a child + @return The appended node, which could be changed as a result of adding it to + list of child nodes (e.g. text nodes can coalesce together) + @leave KXmlEngErrNullNode Node or aNewChild is NULL + @leave KErrNoMemory Memory allocation failure + @leave - One of the system-wide error codes + */ + IMPORT_C TXmlEngNode AppendChildL(TXmlEngNode aNewChild); + + /** + Gets the list of children. + @param aList The list of children returned + */ + IMPORT_C void GetChildNodes(RXmlEngNodeList& aList) const; + + /** + Gets the parent node + @return The parent node or NULL if no parent exists + */ + IMPORT_C TXmlEngNode ParentNode() const; + + /** + Gets the first child + @return The first child node or NULL if no children + */ + IMPORT_C TXmlEngNode FirstChild() const; + + /** + Gets the last child + @return The last child node or NULL if no children + */ + IMPORT_C TXmlEngNode LastChild() const; + + /** + Gets the previous sibling + @return The previous sibling or NULL if there is no sibling before + */ + IMPORT_C TXmlEngNode PreviousSibling() const; + + /** + Gets the next sibling + @return The next sibling or NULL if there is no sibling after + */ + IMPORT_C TXmlEngNode NextSibling() const; + + /** + Gets the owning document + + Note: An instance of the RXmlEngDocument class returns itself + + @pre Node must not be NULL. + @return The document node of the DOM tree that this node belongs to or a + NULL document if no owning document. + */ + IMPORT_C RXmlEngDocument OwnerDocument() const; + + /** + Gets the value of this node. + + Note: Since this is not a virtual function, it is better to always cast + nodes to a specific type and then use the specific method for getting the + "node value". + + @return The node value + */ + IMPORT_C TPtrC8 Value() const; + + /** + Gets a copy of the node's text content. What is returned depends on the + node type. Any existing content in the specified buffer is destroyed. + This method allocates memory for the buffer. + + @param aOutput A buffer owned by the caller which holds the returned string + @leave - One of the system-wide error codes + */ + IMPORT_C void WholeTextContentsCopyL(RBuf8& aOutput) const; + + /** + Copies the specified string and sets the value of this node. + @param aValue The value to set + @leave KXmlEngErrNullNode The node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C void SetValueL(const TDesC8& aValue); + + /** + Check if the node content is "simple text" for element and attribute nodes. + + If the node content is "simple text" then it is represented by a single + TXmlEngTextNode (or derived type). The contents can be obtained through a + call to Value(). A node that has multiple child text nodes does not have + node content that is "simple text" and the contents must be obtained + through a call to WholeTextContentsCopyL(). + + The contents of TXmlEngComment, TXmlEngCDATASection, TXmlEngTextNode, and + Processing Instuction data are always "simple". + + @see TXmlEngNode::Value() + @see TXmlEngAttr::Value() + @see TXmlEngElement::Text() + @see TXmlEngNode::WholeTextContentsCopyL() + + @return ETrue if the node is an element or attribute node and content is + represented by one TXmlEngTextNode or EFalse otherwise + */ + IMPORT_C TBool IsSimpleTextContents() const; + + /** + Gets the node type. Used to find out the type of the node prior to casting + the node to one of TXmlEngNode class to one of its derived subclasses + (TXmlEngElement, TXmlEngAttr, TXmlEngTextNode, etc.). + + @see TXmlEngDOMNodeType + @pre Node must not be NULL + @return The type of the node + */ + IMPORT_C TXmlEngDOMNodeType NodeType() const; + + /** + Gets the node name. + + This method generally follows the DOM spec: + ------------------------------------------------------------------------------- + The values of nodeName, nodeValue, and attributes vary according to the node + type as follows: + + interface nodeName nodeValue attributes + ------------------------------------------------------------------------------- + Attr = Attr.name = Attr.value = null + CDATASection = "#cdata-section" = CharacterData.data = null + Comment = "#comment" = CharacterData.data = null + Document = "#document" = null = null + DocumentFragment = "#document-fragment" = null = null + DocumentType = DocumentType.name = null = null + Element = Element.tagName = null = NamedNodeMap + Entity = entity name = null = null + EntityReference = name of entity referenced = null = null + Notation = notation name = null = null + ProcessingInstruction = target = data = null + Text = "#text" = CharacterData.data = null + ------------------------------------------------------------------------------- + + @return The name of the node + */ + IMPORT_C TPtrC8 Name() const; + + + /** + Check if the node has child nodes. + @return ETrue if the node has child nodes, EFalse otherwise + */ + IMPORT_C TBool HasChildNodes() const; + + /** + Check if the node has attributes. Namespace-to-prefix bindings are not + considered attributes. + @return ETrue if the node is an Element node and has at least one + attribute, EFalse otherwise + */ + IMPORT_C TBool HasAttributes() const; + + /** + Evaluates the active base URI for the node by processing the xml:base + attributes of the parents of the node. If no xml:base attributes exist, + an empty string is returned. Any existing content in the specified buffer + is destroyed. This function allocates memory for the buffer. + + @param aBaseUri A buffer owned by the caller that holds the result. + @leave - One of the system-wide error codes + */ + IMPORT_C void BaseUriL(RBuf8& aBaseUri) const; + + /** + Checks if a node is the same as this node. Nodes are considered the same + if they refer to the same in-memory data structure. + + @param aOther Node to compare + @return ETrue if the nodes are the same, EFalse otherwise + */ + inline TBool IsSameNode(TXmlEngNode aOther) const; + + /** + Gets the namespace URI. + + @return The namespace URI of a TXmlEngNamespace, TXmlEngAttr or + TXmlEngElement node if bound, NULL in all other cases. + */ + IMPORT_C TPtrC8 NamespaceUri() const; + + /** + Gets the namespace prefix. + + @return The prefix of an element or attribute node if bound, NULL in all + other cases. + */ + IMPORT_C TPtrC8 Prefix() const; + + /** + Check if the given namespace is the same as the default namespace for this + node. + + Note: "" or NULL can be used to denote undefined namespace + + @param aNamespaceUri Namespace URI + @return ETrue if the node is an element node and its default namespace URI is the same as the given namespace URI, EFalse otherwise + @leave - One of the system-wide error codes + */ + IMPORT_C TBool IsDefaultNamespaceL(const TDesC8& aNamespaceUri) const; + + /** + Searches for the prefix bound to the given aNamespaceUri and applicable + within the scope of this node. + + @see TXmlEngElement::LookupNamespaceByUriL() + + @param aNamespaceUri The Namespace URI to search for + + @return The sought prefix or NULL if not found or if aNamespaceUri is the default namespace + @leave KXmlEngErrNullNode The node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C TPtrC8 LookupPrefixL(const TDesC8& aNamespaceUri) const; + + /** + Searches for the namespace URI that is bound to the given prefix. + + @see TXmlEngElement::LookupNamespaceByPrefixL(const TDesC8&) + + @param aPrefix The namespace prefix to search for + @return The sought URI or NULL if the prefix is not bound + @leave KXmlEngErrNullNode The node is NULL + @leave - One of the system-wide error codes + */ + IMPORT_C TPtrC8 LookupNamespaceUriL(const TDesC8& aPrefix) const; + +protected: + /** + Unlinks the node from the double-linked list and relinks any neighbour + nodes. Despite being removed from the list, the node retains links to its + old neighbours! Use with care!! + + No checks are made. Neither the parent's, nor the node's properties are + updated. + */ + void DoUnlinkNode(); + + /** + Inserts this node before the specified node in the double-linked list. + + No checks are made. Neither the parent's, nor the node's properties are + updated. + + @param aNode After insertion, this node will come before aNode in the list + */ + void LinkBefore(TXmlEngNode aNode); + +protected: + /** Node pointer */ + void* iInternal; + +}; + +#include + +#endif /* XMLENGNODE_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnode.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnode.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node functions implementation +// + +inline TXmlEngNode::TXmlEngNode() + : iInternal(NULL) {} + +inline TXmlEngNode::TXmlEngNode(void* aInternal) + : iInternal(aInternal) {} + +inline TBool TXmlEngNode::IsNull() const + {return iInternal == NULL;} + +inline TBool TXmlEngNode::NotNull() const + {return iInternal != NULL;} + +// ------------------------------------------------------------------------ +// Compares nodes. +// +// The nodes are the same if they are referring to the same in-memory +// data structure. +// ------------------------------------------------------------------------ +// +inline TBool TXmlEngNode::IsSameNode(TXmlEngNode aOther) const + {return iInternal == aOther.iInternal;} + +inline TXmlEngNode TXmlEngNode::MoveToL(TXmlEngNode aParent) + {return aParent.AppendChildL(Unlink());} + +inline TXmlEngNode TXmlEngNode::MoveTo(TXmlEngNode aParent) + {return aParent.AppendChildL(Unlink());} + +inline TXmlEngAttr& TXmlEngNode::AsAttr() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngElement& TXmlEngNode::AsElement() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngTextNode& TXmlEngNode::AsText() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngBinaryContainer& TXmlEngNode::AsBinaryContainer() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngChunkContainer& TXmlEngNode::AsChunkContainer() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngFileContainer& TXmlEngNode::AsFileContainer() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngDataContainer& TXmlEngNode::AsDataContainer() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngNamespace& TXmlEngNode::AsNamespace() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngComment& TXmlEngNode::AsComment() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngCDATASection& TXmlEngNode::AsCDATASection() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngEntityReference& TXmlEngNode::AsEntityReference() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngProcessingInstruction& TXmlEngNode::AsProcessingInstruction() const + {return *reinterpret_cast(const_cast(this));} + +inline TXmlEngDocumentFragment& TXmlEngNode::AsDocumentFragment() const + {return *reinterpret_cast(const_cast(this));} diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnodefilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnodefilter.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node filter interface +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNODEFILTER_H +#define XMLENGNODEFILTER_H + +#include + +class TXmlEngNode; + +/** +Results that can be returned by the node filter +*/ +enum TXmlEngNodeFilterResult + { + /** Accept the node */ + EAccept = 1, + /** Skip the node, including the start and end tags and its children */ + EReject = 2, + /** Skip the node, including the start and end tags, but consider its children */ + ESkip = 3, + /** Accept the node as an empty node, but skip the end tag and the nodes + children (Extension to DOM Spec). */ + ESkipContents = 4 + }; + +/** +Provides an interface to filter nodes when traversing a tree. +@see http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/traversal.html#Traversal-NodeFilter +@see TXmlEngSerializationOptions +*/ +class MXmlEngNodeFilter + { +public: + /** + Examines the node and determines what action should be taken. + @see TXmlEngNodeFilterResult + + @param aNode The node to examine + @return The filter result + */ + virtual TXmlEngNodeFilterResult AcceptNode(TXmlEngNode aNode) = 0; + }; + +#endif /* XMLENGNODEFILTER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node list class +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNODELIST_H +#define XMLENGNODELIST_H + +#include +#include + +/** +Implements an iterator or filtered iterator for a tree. + +This classes behaves in two very different ways, depending on the +template parameter. + +1) RXmlEngNodeList + +Through template specialization, this becomes an alias for RXmlEngNodeListImpl. +The RXmlEngNodeListImpl::OpenL() methods control which nodes are included in +the iterator. It is possible to iterate across all node types or only a single +type. It is possible to iterate only over nodes within a specific namespace. +It is also possible to iterate over nodes with the same name. + +RXmlEngNodeListImpl should not be used directly. + +@see RXmlEngNodeListImpl + +2) RXmlEngNodeList where X is not TXmlEngNode + +As the OpenL() methods of this class are private, this class cannot be opened +except by friend classes TXmlEngNode and TXmlEngElement. As such, this form +should not be used. +*/ +template +class RXmlEngNodeList +{ + friend class TXmlEngNode; + friend class TXmlEngElement; + +public: + /** + Gets the list length. + @return The number of nodes in the list + */ + inline TInt Count() const; + + /** + Checks whether a next node exists in the list + @return ETrue of a next node exists, EFalse otherwise + */ + inline TBool HasNext() const; + + /** + Gets the next node in the list + @return The next node casted to the templated type or NULL if it does not + exist + */ + inline T Next(); + + /** + Closes a node list. This does not affect any of the nodes. Only + internally used memory is freed. + */ + inline void Close(); + +private: + + inline void OpenL( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType, + const TDesC8& aName = KNullDesC8, + const TDesC8& aNs = KNullDesC8); + + inline void Open( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType); + +private: + RXmlEngNodeListImpl iList; +}; + +/** +This template specialization makes RXmlEngNodeList an alias for +RXmlEngNodeListImpl. No part of the class specified above is used, rather the +interface (and implementation) of RXmlEngNodeListImpl is used instead. +*/ +template<> +class RXmlEngNodeList: public RXmlEngNodeListImpl {}; + + +#include + +#endif /* XMLENGNODELIST_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,74 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node list inline functions +// Retrieves number of items in node list +// + +template inline TInt RXmlEngNodeList::Count() const + { + return iList.Count(); + } + +// ----------------------------------------------------------------------------- +// Returns true if this node has next sibling, false otherwise. +// ----------------------------------------------------------------------------- +// +template inline TBool RXmlEngNodeList::HasNext() const + { + return iList.HasNext(); + } + +// ----------------------------------------------------------------------------- +// Retrieves next node +// ----------------------------------------------------------------------------- +// +template inline T RXmlEngNodeList::Next() + { + TXmlEngNode t = iList.Next(); + return *(static_cast(&t)); + } + +// ----------------------------------------------------------------------------- +// Closes node list +// ----------------------------------------------------------------------------- +// +template inline void RXmlEngNodeList::Close() + { + iList.Close(); + } + +// ----------------------------------------------------------------------------- +// Opens node list +// ----------------------------------------------------------------------------- +// +template inline void RXmlEngNodeList::OpenL( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType, + const TDesC8& aName, + const TDesC8& aNs) + { + iList.OpenL(aHead, aType, aName, aNs); + } + +// ----------------------------------------------------------------------------- +// Opens node list +// ----------------------------------------------------------------------------- +// +template inline void RXmlEngNodeList::Open( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType) + { + iList.Open(aHead, aType); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengnodelist_impl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,127 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node list implementation functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNODELIST_IMPL_H +#define XMLENGNODELIST_IMPL_H + +#include +#include + +/** +This class should not be used directly. However, it defines the interface for +RXmlEngNodeList through template specialization. + +@see RXmlEngNodeList + +This class implements an iterator or filtered iterator for a tree. The OpenL() +methods control which nodes are included in the iterator. It is possible to +iterate across all node types or only a single type. It is possible to iterate +only over nodes within a specific namespace. It is also possible to iterate +over nodes with the same name. +*/ +class RXmlEngNodeListImpl +{ +public: + + /** Default constructor */ + IMPORT_C RXmlEngNodeListImpl(); + + /** + Closes a node list. This does not affect any of the nodes. Only + internally used memory is freed. + */ + IMPORT_C void Close(); + + /** + Gets the list length. + @return Number of nodes in the list + */ + IMPORT_C TInt Count() const; + + /** + Checks whether the next node exists in the list + @return ETrue if the next node exists, EFalse otherwise + */ + IMPORT_C TBool HasNext() const; + + /** + Gets the next node in the list + @return The next node or NULL if it does not exist + */ + IMPORT_C TXmlEngNode Next(); + + /** + Initializes the list. The parameters to this method control what nodes are + included in the list. If aType is NULL, all nodes are included in the + list. Both aName and aNs, if specified, are copied internally. + + @param aHead The first node in the list + @param aType Only include nodes of this type + @param aName Only include nodes that match this name + @param aNs Only include nodes that match this namespace + @leave - One of the system-wide error codes + */ + void OpenL( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType, + const TDesC8& aName = KNullDesC8, + const TDesC8& aNs = KNullDesC8); + + /** + Initializes the list. The parameters to this method control what nodes are + included in the list. If aType is NULL, all nodes are included in the + list. + + @param aHead The first node in the list + @param aType Only include nodes of this type + */ + void Open( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType); + +private: + + /** + Finds the next node in the list according to the criteria specified in OpenL(). + @param aCurrentNode The current node pointer + @return The next node or NULL if no next node + */ + void* FindNextNode(void* aCurrentNode) const; + + void* iCurrentNode; + TInt iType; // NodeType:4 bits (0-3) & MatchName flag (bit 4) + unsigned char* iName; + unsigned char* iNsUri; +}; + +/** +Compares two strings. +@param aStr1 String 1 to compare +@param aStr2 String 2 to compare +@return ETrue of aStr1 and aStr2 are equal or if they are both NULL. EFalse otherwise. +*/ +TBool StrEqualOrNull(const void* aStr1, const void* aStr2); + + +#endif /* XMLENGNODELIST_IMPL_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,60 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// output stream for dom tree +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGMOUTPUTSTREAM_H +#define XMLENGMOUTPUTSTREAM_H + +#include + + + +/** +Provides an interface for writing serialized XML data to a stream. This +interface should be implemented by client applications when the +RXmlEngDocument::SaveL() method is used to serialize XML data to a stream. + +No ownership is transferred by RXmlEngDocument::SaveL(), thus an object +of the implementing class should be freed after use. + +@see RXmlEngDocument::SaveL() +*/ +class MXmlEngOutputStream + { +public: + /** + Writes the specified buffer to the output stream. + @param aBuffer The data to write + @return The number of bytes written or -1 in the case of an error + */ + virtual TInt Write(const TDesC8& aBuffer) = 0; + + /** + Closes the output stream. + @return 0 if successful or -1 in the case of an error + */ + virtual TInt Close() = 0; + }; + +#endif /* XMLENGMOUTPUTSTREAM_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengprocessinginstruction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengprocessinginstruction.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Processing instruction node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGPROCESSINGINSTRUCTION_H +#define XMLENGPROCESSINGINSTRUCTION_H + +#include + + + +/** +This class represents an XML processing instruction in the DOM tree. This class +is usually instantiated through RXmlEngDocument::CreateProcessingInstruction(). +*/ +class TXmlEngProcessingInstruction : public TXmlEngNode +{ + public: + /** Default constructor */ + inline TXmlEngProcessingInstruction(); + + /** + Gets a reference to the the target part of the processing instruction. + + @code + + @endcode + + @see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-pi + @return A reference to the target part + */ + IMPORT_C TPtrC8 Target() const; + + /** + Gets a reference to the data part of the processing instruction. + + @code + + @endcode + + @see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-pi + @return A reference to the data part + */ + IMPORT_C TPtrC8 Data() const; + + /** + Copies the parameter and sets the data part of the processing instruction. + Note: The processing instruction contents should not contain the "?>" + sequence + @param aData The data part to set + @leave - One of the system-wide error codes + */ + IMPORT_C void SetDataL(const TDesC8& aData); + +protected: + /** + Constructor + @param aInternal Processing instruction pointer + */ + inline TXmlEngProcessingInstruction(void* aInternal); +}; + + +#include +#endif /* XMLENGPROCESSINGINSTRUCTION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengprocessinginstruction.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengprocessinginstruction.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Processing instruction inline functions +// Default constructor +// + +inline TXmlEngProcessingInstruction::TXmlEngProcessingInstruction():TXmlEngNode(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngProcessingInstruction::TXmlEngProcessingInstruction(void* aInternal):TXmlEngNode(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengserializationoptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengserializationoptions.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Serialization options functions +// + + + +/** + @file + @publishedAll + @released +*/ + +#ifndef XMLENGSERIALIZATIONOPTIONS_H +#define XMLENGSERIALIZATIONOPTIONS_H + +#include + +class MXmlEngOutputStream; +class MXmlEngDataSerializer; +class MXmlEngNodeFilter; + +/** +This class stores serialization options to be used when a document is +serialized. +@see RXmlEngDocument::SaveL() +*/ +class TXmlEngSerializationOptions + { +public: + /** Use indent in output */ + static const TUint KOptionIndent = 0x01; + /** Skip xml declaration */ + static const TUint KOptionOmitXMLDeclaration = 0x02; + /** Add standalone in xml declaration. KOptionOmitXMLDeclaration must not be set */ + static const TUint KOptionStandalone = 0x04; + /** Add encoding in xml declaration. KOptionOmitXMLDeclaration must not be set */ + static const TUint KOptionEncoding = 0x08; + /** Not supported */ + static const TUint KOptionIncludeNsPrefixes = 0x10; + /** Not supported */ + static const TUint KOptionCDATASectionElements = 0x20; + /** Decode base64 encoded binary containers content upon XOP serialization */ + static const TUint KOptionDecodeBinaryContainers = 0x40; + + /** + Constructor + @param aOptionFlags Serialization options + @param aEncoding Serialization encoding. If KNullDesC8, the document + encoding is used. + */ + IMPORT_C TXmlEngSerializationOptions( TUint aOptionFlags = + (TXmlEngSerializationOptions::KOptionIndent | + TXmlEngSerializationOptions::KOptionStandalone | + TXmlEngSerializationOptions::KOptionEncoding), + const TDesC8& aEncoding = KNullDesC8); + + /** + Sets a node filter. The node filter is used to choose which nodes from the + tree are serialized. Ownership of the node filter is not transferred and + the caller is responsible for freeing aFilter. + + @param aFilter The node filter to set + */ + IMPORT_C void SetNodeFilter(MXmlEngNodeFilter* aFilter); + + /** + Sets a data serializer. Ownership of the data serializer is not + transferred and the caller is responsbile for freeing aSerializer. + + @param aSerializer The data serializer to set + */ + IMPORT_C void SetDataSerializer(MXmlEngDataSerializer* aSerializer); + +public: + /** Options flag */ + TUint iOptions; + /** Encoding */ + TPtrC8 iEncoding; + /** Node filter */ + MXmlEngNodeFilter* iNodeFilter; + /** Data serializer */ + MXmlEngDataSerializer* iDataSerializer; + }; + + +#endif /* XMLENGSERIALIZATIONOPTIONS_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengtext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengtext.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,80 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Text node functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGTEXT_H +#define XMLENGTEXT_H + +#include + + +/** +The TXmlEngTextNode class inherits from TXmlEngCharacterData and represents the +textual content (termed "character data" in XML) of an Element or TXmlEngAttr. + +If there is no markup inside an element's content, the text is contained in a +single TXmlEngTextNode that is the only child of the element. If there is +markup, it is parsed into the information items (elements, comments, etc.) and +the TXmlEngTextNode nodes that form the list of children of the element. + +When a document is first made available via the DOM, there is only one +TXmlEngTextNode node for each block of text. Users may create adjacent +TXmlEngTextNode nodes that represent the contents of a given element without +any intervening markup, but should be aware that there is no way to represent +the separations between these nodes in XML or HTML, so they will not (in +general) persist between DOM editing sessions. + +No lexical check is done on the content of a TXmlEngTextNode node and depending +on its position in the document, some characters must be escaped during +serialization using character references. For example, the characters "<&" if +the textual content is part of an element or an attribute, the character +sequence "]]>" when part of an element, the quotation mark character " or the +apostrophe character ' when part of an attribute. + +@see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1312295772 +*/ +class TXmlEngTextNode : public TXmlEngCharacterData +{ +public: + /** Default constructor */ + inline TXmlEngTextNode(); + + /** + Check if the element content is whitespace. Whitespace may be an empty element, + or the characters space, tab, LF, or CR. + @return ETrue if the element content only contains whitespace, EFalse otherwise + */ + IMPORT_C TBool IsElementContentWhitespace() const; + +protected: + /** + Constructor + @param aInternal Text node pointer + */ + inline TXmlEngTextNode(void* aInternal); +}; + + +#include + +#endif /* XMLENGTEXT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlengtext.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlengtext.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Text node inline functions +// Default constructor +// + +inline TXmlEngTextNode::TXmlEngTextNode():TXmlEngCharacterData(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline TXmlEngTextNode::TXmlEngTextNode(void* aInternal):TXmlEngCharacterData(aInternal) + { + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlenginedom/xmlenguserdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlenginedom/xmlenguserdata.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may contains user +// data added to node +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGUSERDATA_H +#define XMLENGUSERDATA_H + +#include + +/** +Defines an interface so that user data can be stored in the DOM tree. +Applications that wish to store user data in the DOM tree must wrap the user +data in a class that implements this interface. + +There are two common patterns for implementors of this interface: + +1) Instance-based implementation +The implementing class stores the user data. The object can be duplicated with +CloneL() to form a new object that duplicates the user data. When Destroy() is +called, the user data attached to the object is destroyed, but other duplicates +may continue to hold the data. + +2) Reference-counted implementation +The implementing class points to the user data. The object can be duplicated, +but the user data is not duplicated. When Destroy() is called, the object is +destroyed, but the user data is not destroyed unless this is the last object +referring to this data. +*/ +class MXmlEngUserData { +public: + /** + Free memory that is allocated and do other case specific cleanup. Whether + this frees the user data depends on the implementation. In a + reference-counted implementation, the user data may only be destroyed + when Destroy() is called on the last object referring to that data. + */ + virtual void Destroy() = 0; + + /** + Make a copy of the the object. Whether this duplicates the data or + creates a new object that points to the data is determined by the + implementor of this class. + + @return Pointer to a copy of this object. + @leave - One of the system-wide error codes + */ + virtual MXmlEngUserData* CloneL() = 0; + + /** + Gets the id of the object. It is up to the user data provider determine + what the result is. Such a "user data identification" may be useful if + several types of MXmlEngUserData objects are used. + + @return Pointer that somehow identifies the type of MXmlEngUserData (NULL by default) + */ + virtual void* ID() {return NULL;} +}; + + +#endif /* XMLENGUSERDATA_H*/ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengdeserializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengdeserializer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,296 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML Deserializer +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDESERIALIZER_H +#define XMLENGDESERIALIZER_H + +#include +#include + +#include +#include +#include + +class RFs; +class TXmlEngDataContainer; + +/** Controls the format of deserialization */ +enum TXmlEngDeserializerType + { + /** Default deserialization (XML) */ + EDeserializerDefault, + /** Deserialization from MIME Multipart containing XOP */ + EDeserializerXOP, + /** Deserialization from XOP Infoset */ + EDeserializerXOPInfoset, + /** Deserialization from GZip */ + EDeserializerGZip + }; + +/** Controls the source of the deserialization */ +enum TXmlEngDeserializationSource + { + EDeserializeFromFile, + EDeserializeFromBuffer, + EDeserializeFromStream + }; + +/** +Provides deserialization and parsing for XML content using a SAX callback +interface. Derived classes provide deserialization for specific formats, +whereas this class defines the interface and provides default (plain XML) +deserialization. + +@see TXmlEngDeserializerType + +Deserialization generates SAX events that are passed to a MContentHandler. + +@see Xml::MContentHandler + +For deserialization to a DOM tree, see CXmlEngDeserializerDOM. +@see CXmlEngDeserializerDOM + +Support for data stored outside the DOM tree, such as data linked by +xop:include references, is provided. The external data must be set with +UseExternalDataL() prior to deserialization. The data is then returned through +the MContentHandler interface. +*/ +class CXmlEngDeserializer: public CBase +{ + friend class CXmlEngDeserializerXOP; + friend class CXmlEngDeserializerGZIP; + + public: + /** + Creates a deserializer of the given type. Returns an instance of this + class or a derived class. + + @param aHandler Content handler for SAX events triggered by deserialization + @param aType Deserializer type + @return The deserializer + @leave - One of the system-wide error codes + */ + IMPORT_C static CXmlEngDeserializer* NewL( Xml::MContentHandler& aContentHandler, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** + Sets the input type to file and saves the file name for later + deserialization. + @param aFileName The file name of the file to deserialize + @leave - One of the system-wide error codes + */ + IMPORT_C void SetInputFileL(const TDesC& aFileName); + + /** + Sets the input type to buffer and saves the buffer for later deserialization. + @param aBuffer The buffer to deserialize + */ + IMPORT_C void SetInputBuffer(const TDesC8& aBuffer); + + /** + Sets the content handler which handles SAX events raised during + deserialization. Clients must derive from Xml::MContentHandler in order to + receive SAX callbacks. + + @param aContentHandler The content handler + @leave - One of the system-wide error codes + */ + IMPORT_C virtual void SetContentHandlerL(Xml::MContentHandler& aContentHandler); + + /** + Sets parsing options used for deserialization. + @param aOptions Parsing options to set. A copy of the options is stored. + */ + IMPORT_C virtual void SetParsingOptions(TXmlEngParsingOptions& aOptions); + + /** + Gets the parsing options + @return The parsing options + */ + IMPORT_C virtual const TXmlEngParsingOptions& ParsingOptions(); + + /** + Sets a list of data containers and indicates that the XML to be + deserialized contains references (such as xop:include) to data stored + outside the DOM tree. + + Upon deserialization, the references are substituted with the matching data + containers and returned via the content handler. + + This often occurs when a multipart MIME message is received. The text XML + content may be in one part, while the binary content is in another part. + Each part containing binary content must be placed into a data container using + RXmlEngDocument::CreateBinaryContainerL() or similar. When deserialization + of the XML occurs, the data containers are retrieved by content-id. + + Ownership is not transferred and the list must stay in scope for the + lifetime of the deserializer. + + @param aList The list of data containers + @leave - Any system-wide error code + */ + IMPORT_C void UseExternalDataL(RArray& aList); + + /** + Gets the list of external data containers. + @return The list of data containers or NULL if no external data is registered + */ + IMPORT_C RArray* ExternalData(); + + /** + Enables parser features. + + @see Xml::CParser::EnableFeature() + @see Xml::CParser::TParserFeature + @param aParserFeature The parser feature to enable + @return KErrNone if successful, otherwise one of the system-wide error codes + */ + IMPORT_C virtual TInt EnableFeature(TInt aParserFeature); + + /** + Disables parser features. + + @see Xml::CParser::DisableFeature() + @see Xml::CParser::TParserFeature + @param aParserFeature The parser feature to disable + @return KErrNone if successful, otherwise one of the system-wide error codes + */ + IMPORT_C virtual TInt DisableFeature(TInt aParserFeature); + + /** + Checks if a parser feature is enabled. + + @see Xml::CParser::IsFeatureEnabled() + @see Xml::CParser::TParserFeature + @param aParserFeature The parser feature to check + @return ETrue if feature is enabled, otherwise EFalse + */ + IMPORT_C virtual TBool IsFeatureEnabled(TInt aParserFeature) const; + + /** + Deserializes the file or buffer previously set by SetInputFileL() or + SetInputBuffer(). + + The result of deserialization is passed to the content handler as SAX + events. + + @leave KXmlEngErrNoParameters No file or buffer has been previously set + @leave - One of the system wide error codes or one of the Xml specific + ones defined in XmlFrameworkErrors.h + */ + IMPORT_C virtual void DeserializeL(); + + /** + Deserializes the given file. Any filename previously set with + SetInputFileL() is ignored. + + The result of deserialization is passed to the content handler as SAX + events. + + @param aFileName The file to be parsed + @param aOptions Parsing options + @leave - One of the system wide error codes or one of the Xml specific + ones defined in XmlFrameworkErrors.h + */ + IMPORT_C virtual void DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions()); + + /** + Deserializes the given file. Any filename previously set with + SetInputFileL() is ignored. + + The result of deserialization is passed to the content handler as SAX + events. + + @param aRFs File Server session + @param aFileName The file to be parsed + @param aOptions Parsing options + @leave - One of the system wide error codes or one of the Xml specific + ones defined in XmlFrameworkErrors.h + */ + IMPORT_C virtual void DeserializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions()); + + /** + Deserializes the given buffer. Any buffer previously set with + SetInputBuffer() is ignored. + + The result of deserialization is passed to the content handler as SAX + events. + + @param aBuffer The buffer to be parsed + @param aOptions Parsing options + @leave - One of the system wide error codes or one of the Xml specific + ones defined in XmlFrameworkErrors.h + */ + IMPORT_C virtual void DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions()); + + /** Destructor */ + virtual ~CXmlEngDeserializer(); + + /** + Retrieves a pointer to the data container referenced by CID. + @param aCid The aCid corresponding to the data container required + @return The data container or NULL if no matching container is found + */ + TXmlEngDataContainer* GetDataContainer(const TDesC8& aCid); + +private: + /** Default constructor */ + CXmlEngDeserializer( ); + + /** 2nd phase constructor */ + virtual void ConstructL( Xml::MContentHandler& aContentHandler ); + +private: + /** SAX Parser */ + Xml::CParser* iParser; + + /** File to be parsed */ + HBufC* iInputFileName; + + /** Buffer to be parsed */ + TPtrC8 iBuffer; + + /** Deserialization format */ + TXmlEngDeserializationSource iSerializationOutput; + + /** Array of external data */ + RArray* iDataList; + + /** Features */ + TUint iFeatures; + + /** Parsing options */ + TXmlEngParsingOptions iParsingOptions; + +}; //class CXmlEngDeserializer + + + +#endif /* XMLENGDESERIALIZER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengdeserializerdom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengdeserializerdom.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,185 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML Deserializer to DOM tree +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGDESERIALIZERDOM_H +#define XMLENGDESERIALIZERDOM_H + +#include + +#include +#include + + +class RFs; +class RXmlEngDOMImplementation; +class RXmlEngDocument; + +/** +Deserializes a XML file to a DOM tree. + +Sample code for deserialization to a DOM tree: +@code + // create deserializer + CXmlEngDeserializerDOM* deserializer = CXmlEngDeserializerDOM::NewL(); + CleanupStack::PushL(deserializer); + // configure deserializer + deserializer->SetInputFileL(KInputFile, EDeserializerGZip); + // Set the DOM Implementation + deserializer->UseDOMImplementationL(iDomImpl); + // deserialize + RXmlEngDocument doc = deserializer->DeserializeL(); + CleanupStack::PopAndDestroy();// deserializer +@endcode +*/ +class CXmlEngDeserializerDOM: public CBase +{ + public: + /** + Creates an instance of CXmlEngDeserializerDOM. + @return The DOM deserializer instance + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static CXmlEngDeserializerDOM* NewL(); + + /** + Sets the input type to file and saves the file name for later + deserialization. + @param aFileName The file name of the file to deserialize + @param aType The deserialization format + @leave - One of the system-wide error codes + */ + IMPORT_C void SetInputFileL(const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** + Sets the input to to buffer and saves the buffer for later deserialization. + @param aBuffer The buffer to deserialize + @param aType The deserialization format + */ + IMPORT_C void SetInputBuffer(const TDesC8& aBuffer, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** + Sets a list of data containers and indicates that the XML to be + deserialized contains references (such as xop:include) to data stored + outside the DOM tree. + + Upon deserialization, the references are substituted with the matching data + containers and returned via the content handler. + + This often occurs when a multipart MIME message is received. The text XML + content may be in one part, while the binary content is in another part. + Each part containing binary content must be placed into a data container using + RXmlEngDocument::CreateBinaryContainerL() or similar. When deserialization + of the XML occurs, the data containers are retrieved by content-id. + + Ownership is not transferred and the list must stay in scope for the + lifetime of the deserializer. + + @param aList The list of data containers + @leave - Any system-wide error code + */ + IMPORT_C void UseExternalDataL(RArray& aList); + + /** + Gets the list of external data containers. + @return The list of data containers or NULL if no external data is registered + */ + IMPORT_C RArray* ExternalData(); + + /** + Sets the DOM implementation that will be used to create the DOM tree + @param aImpl The DOM implementation + @leave - Does not leave + */ + IMPORT_C void UseDOMImplementationL(RXmlEngDOMImplementation& aImpl); + + /** + Deserializes the file or buffer previously set by SetInputFileL() or + SetInputBuffer() and creates a new document that holds the DOM tree. + + @return The document that holds the DOM tree + @leave KXmlEngErrNoParameters No file or buffer has been previously set + @leave KXmlEngErrWrongUseOfAPI DOM Implementation not set + @leave - One of the system-wide error codes + */ + IMPORT_C RXmlEngDocument DeserializeL(); + + /** + Deserializes the given file and creates a new document that holds the DOM + tree. Any filename previously set with SetInputFileL() is ignored. + + @param aFileName The file to be deserialized + @param aType The deserialization format + @return The document that holds the DOM tree + @leave KXmlEngErrWrongUseOfAPI DOM Implementation not set + @leave - One of the system wide error codes + */ + IMPORT_C RXmlEngDocument DeserializeL( const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** + Deserializes the given file and creates a new document that holds the DOM + tree. Any filename previously set with SetInputFileL() is ignored. + + @param aRFs File Server session + @param aFileName The file to be deserialized + @param aType The deserialization format + @return The document that holds the DOM tree + @leave KXmlEngErrWrongUseOfAPI DOM Implementation not set + @leave - One of the system wide error codes + */ + IMPORT_C RXmlEngDocument DeserializeL( RFs& aRFs, const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** + Deserializes the given buffer and creates a new document that holds the DOM + tree. Any buffer previously set with SetInputBuffer() is ignored. + + @param aBuffer Buffer to be parsed + @param aType Input type + @return The document that holds the DOM tree + @leave KXmlEngErrWrongUseOfAPI DOM Implementation not set + @leave - One of the system wide error codes + */ + IMPORT_C RXmlEngDocument DeserializeL( const TDesC8& aBuffer, TXmlEngDeserializerType aType = EDeserializerDefault); + + /** Destructor. */ + ~CXmlEngDeserializerDOM(); + +protected: + /** Default constructor. */ + CXmlEngDeserializerDOM(); + +protected: + /** File to be parsed */ + HBufC* iInputFileName; + /** Buffer to be parsed */ + TPtrC8 iBuffer; + /** Array of external data */ + RArray* iDataList; + /** Deserializer type */ + TXmlEngDeserializerType iType; + /** DOM implementation */ + RXmlEngDOMImplementation* iImpl; + +}; //class CXmlEngDeserializerDOM + +#endif /* XMLENGDESERIALIZERDOM_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengextendedcontenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengextendedcontenthandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Content handler for binary data +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGEXTENDEDCONTENTHANDLER_H +#define XMLENGEXTENDEDCONTENTHANDLER_H + +#include + +/** +This class extends MContentHandler with functions for binary data handling. +Used by clients during XOP deserialization. + +@see Xml::MContentHandler +*/ +class MXmlEngExtendedHandler + { +public: + /** The uid identifying this extension interface. */ + enum TExtInterfaceUid {EExtInterfaceUid = 0x101F9794}; + + /** + Called when binary content has been parsed. + + @param aBytes The raw binary data of the element + @param aCid The CID of the binary data + @param aErrorcode The parsing error code. If this is not KErrNone, special + action may be required. + @leave - One of the system-wide error codes + */ + virtual void OnBinaryContentL(const TDesC8& aBytes, + const TDesC8& aCid, + TInt aErrorCode) = 0; + + /** + Called when a reference to external data has been parsed. + @see CXmlEngDeserializer::ExternalData() + + Any class derived from TXmlEngDataContainer may be passed to this function. + @see TXmlEngBinaryContainer + @see TXmlEngChunkContainer + @see TXmlEngFileContainer + + @param aContainer The container that holds the external binary data. + @param aErrorcode The parsing error code. If this is not KErrNone, special + action may be required. + @leave - One of the system-wide error codes + */ + virtual void OnDataContainerL( const TXmlEngDataContainer& aContainer, + TInt aErrorCode) = 0; + }; + +#endif //XMLENGINE_EXTENDEDCONTENTHANDLER_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengparsingoptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengparsingoptions.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Serialization options functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGPARSINGOPTIONS_H +#define XMLENGPARSINGOPTIONS_H + +#include + +/** +Container for parsing options used for deserialization. +*/ +class TXmlEngParsingOptions + { +public: + /** Encode data containers to base 64 */ + static const TUint KOptionEncodeToBase64 = 0x01; + + /** Provide raw binary octets */ + static const TUint KOptionRawData = 0x02; + + /** + Constructor + @param aOptionFlags Parsing options + */ + IMPORT_C TXmlEngParsingOptions( TUint aOptionFlags = + TXmlEngParsingOptions::KOptionRawData); + +public: + /** Options flag */ + TUint iOptions; + }; + +#endif /* XMLENGPARSINGOPTIONS_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengserializeerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengserializeerrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Errors code for serialization and deserialization +// + + + +/** + @file + @publishedAll + @released +*/ +#include + +#ifndef XMLENGSERIALIZERERRORS_H +#define XMLENGSERIALIZERERRORS_H + +/** Serializer or deserializer was not configured correctly */ +const TInt KXmlEngErrNoParameters = -32384; + +/** No binary data was found for XOP data Id */ +const TInt KXmlEngErrBinDataNotFound = -32385; + +/** Base 64 decoding failed */ +const TInt KXmlEngErrDecodingFailed = -32386; + +/** DOM tree does not contain XOP Infoset */ +const TInt KXmlEngErrBadInfoset = -32387; + +/** The multipart document could not be parsed */ +const TInt KXmlEngErrBadMultipart = -32388; + +#endif // XMLENGSERIALIZERERRORS_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xmlengineserializer/xmlengserializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xmlengineserializer/xmlengserializer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,196 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of serializer +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGSERIALIZER_H +#define XMLENGSERIALIZER_H + +#include +#include +#include + +class MXmlEngOutputStream; +class RFs; + +/** Controls the format of serialization */ +enum TXmlEngSerializerType + { + /** Default serialization (XML) */ + ESerializerDefault, + /** Serialization to MIME Multipart containing XOP */ + ESerializerXOP, + /** Serialization to XOP Infoset */ + ESerializerXOPInfoset, + /** Serialization to GZip */ + ESerializerGZip + }; + +/** Controls the serialization format */ +enum TXmlEngSerializationOutput + { + ESerializeToFile, + ESerializeToBuffer, + ESerializeToStream + }; + +/** +Provides the serializer interface and provides common functionality to all +serializers. Implements default serialization (plain XML). Derived classes +implement serialization to other formats. + +@see TXmlEngSerializerType +*/ +class CXmlEngSerializer: public CBase + { + friend class CXmlEngSerializerXOP; + friend class CXmlEngSerializerGZIP; + +public: + /** + Creates a serializer of the given type. Returns an instance of this + class or a derived class. + + @param aType Serializer type + @return The serializer + @leave - One of the system-wide error codes + */ + IMPORT_C static CXmlEngSerializer* NewL(TXmlEngSerializerType aType = ESerializerDefault); + + /** + Sets the output type to file and saves the file name for later + serialization. + @param aFileName The file name of the file to serialize + @leave - One of the system-wide error codes + */ + IMPORT_C void SetOutputL(const TDesC& aFileName); + + /** + Sets the output type to buffer and saves the buffer for later serialization. + @param aBuffer The buffer to serialize + */ + IMPORT_C void SetOutput(RBuf8& aBuffer); + + /** + Sets the output type to stream and saves the stream for later serialization. + @param aBuffer The stream to serialize + */ + IMPORT_C void SetOutput(MXmlEngOutputStream& aStream); + + /** + Sets the serialization options + @param aOptions The serialization options to set. Ownership is not + transferred and aOptions must stay in scope for the lifetime of the + serializer. + */ + IMPORT_C void SetSerializationOptions(TXmlEngSerializationOptions& aOptions); + + /** + Serializes a DOM tree to the buffer, file or stream set previously with + SetOutputL() or SetOutput(). + + @param aRoot The root node of the DOM tree to be serialized + @return The number of bytes written + @leave KXmlEngErrNoParameters No previous call to SetOutputL() or SetOutput(). + @leave KErrNotSupported Unsupported serialization type + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseofAPI Document of root node is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C virtual TInt SerializeL(const TXmlEngNode aRoot = TXmlEngNode()); + + /** + Serializes a DOM tree to file. Any filename previously set with + SetOutputL(const TDesC&) is ignored. + + @param aFileName The file name to serialize to + @param aRoot The root node of the DOM tree to be serialized + @param aOptions The serialization options + @return The number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseofAPI Document of root node is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C virtual TInt SerializeL(const TDesC& aFileName, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aOptions = TXmlEngSerializationOptions()); + + /** + Serializes a DOM tree to file. Any filename previously set with + SetOutputL(const TDesC&) is ignored. + + @param aRFs File Server session + @param aFileName The file name to serialize to + @param aRoot The root node of the DOM tree to be serialized + @param aOptions The serialization options + @return The number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseofAPI Document of root node is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C virtual TInt SerializeL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aOptions = TXmlEngSerializationOptions()); + + /** + Serializes a DOM tree to buffer. Any buffer previously set with + SetOutputL(RBuf8&) is ignored. Any existing data in aBuffer is destroyed. + This function allocates memory for the buffer and the caller must close the + buffer when finished. + + @param aBuffer The buffer to serialize to + @param aRoot The root node of DOM tree + @param aOptions The serialization options + @return The number of bytes written + @leave KXmlEngErrWrongEncoding Encoding not understood + @leave KXmlEngErrWrongUseofAPI Document of root node is NULL + @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size + @leave - One of the system-wide error codes + */ + IMPORT_C virtual TInt SerializeL(RBuf8& aBuffer, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& + aOptions = TXmlEngSerializationOptions()); + + /** Destructor */ + virtual ~CXmlEngSerializer(); + +private: + /** Default constructor */ + CXmlEngSerializer(); + + /** Second phase constructor. */ + void ConstructL(); + +private: + HBufC* iOutFileName; + RBuf8* iBuffer; + MXmlEngOutputStream* iOutputStream; + TXmlEngSerializationOptions* iSerializationOptions; + TXmlEngSerializationOutput iSerializationOutput; + }; + +#endif /* XMLENGSERIALIZER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengnamespaceresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengnamespaceresolver.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNAMESPACERESOLVER_H +#define XMLENGNAMESPACERESOLVER_H + +/** +Provides an interface to query the namespace context of a DOM object. +@see TXmlEngXPathEvaluator +@see RXmlEngXPathExpression +*/ +class MXmlEngNamespaceResolver +{ +public: + /** + Searches for the prefix that is bound to the given aNamespaceUri and + applicable in the scope of this object. + + @param aNamespaceUri Namespace URI to search for + @return The sought prefix or an empty string if not found or if aNamespaceUri is the + default namespace + @leave - Any system wide error code + */ + virtual TPtrC8 LookupPrefixL(const TDesC8& aNamespaceUri) const = 0; + + /** + Searches for the namespace URI that is bound to the given prefix. + + @param aPrefix The namespace prefix to search for + @return The sought URI or an empty string if the prefix is not bound + @leave - Any system wide error code + */ + virtual TPtrC8 LookupNamespaceUriL(const TDesC8& aPrefix) const = 0; +}; + +#endif /* XMLENGNAMESPACERESOLVER_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengnodeset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengnodeset.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,110 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node set functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGNODESET_H +#define XMLENGNODESET_H + +#include + +/** +This class implements the node set container, which is one of the result type +in XPath. +*/ +class RXmlEngNodeSet +{ + friend class TXmlEngXPathEvaluator; + friend class RXmlEngXPathResult; + friend class RXmlEngXPathExpression; + +public: + /** Default constructor */ + IMPORT_C RXmlEngNodeSet(); + + /** + Frees any allocated resources. + + As a node set only refers to existing nodes in the DOM tree, no nodes are + freed. However, namespace declarations are copied into the node set and + these copies are indeed freed. + */ + IMPORT_C void Free(); + + /** Closes the node set. This simply calls Free(). */ + inline void Close(); + + /** + Initializes the node set to an empty state. + + @see Free() + + This method is used when preparing node sets that will be used with + RXmlEngXPathExpression::EvaluateWithDependenciesL(TXmlEngNode,RXmlEngNodeSet&) + and + TXmlEngXPathEvaluator::EvaluateWithDependenciesL(aExpression,aContextNode,aResolver,aDependents). + + @leave KErrNoMemory Memory allocation failure + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C void InitializeL(); + + /** + Gets the size of the node set + @return The number of nodes + */ + IMPORT_C TInt Length() const; + + /** + Checks whether a node is in the node set. + + @param aNode The node to check + @return ETrue if the node is in the node set, EFalse otherwise + */ + IMPORT_C TBool Contains(TXmlEngNode aNode) const; + + /** + Retrieves a node from the node set by index + + @param aIndex Node index ( 0 <= aIndex < Length() ) + @return The node + @leave KXmlEngErrWrongUseOfAPI aIndex is less than 0 or greater than + Length(), in debug builds only. + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C TXmlEngNode operator[](TInt aIndex) const; + +private: + /** + Constructor + @param aData Internal data pointer + */ + RXmlEngNodeSet(void* aData); + +private: + void* iInternal; + +}; + +#include + +#endif /* XMLENGNODESET_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengnodeset.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengnodeset.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node set inline functions +// Closes node set +// + +inline void RXmlEngNodeSet::Close() + { + Free(); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxformsinstancemap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxformsinstancemap.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XForms instance map declaration +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGCXFORMSINSTANCEMAP_H +#define XMLENGCXFORMSINSTANCEMAP_H + +#include + +class RXmlEngDocument; + +/** +This class associates DOM Documents with a string name. +Entries can be added and removed. +*/ +class CXmlEngXFormsInstanceMap : public CBase +{ + friend class RXmlEngXPathExpression; + +public: + /** + Allocates and constructs a new CXmlENgXFormsInstanceMap object. + @return A new CXmlEngXFormsInstanceMap object. + @leave KErrNoMemory Memory allocation failure + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C static CXmlEngXFormsInstanceMap* NewL(); + + /** + Allocates and constructs a new CXmlENgXFormsInstanceMap object, and leaves + it on the cleanup stack. + @return A new CXmlEngXFormsInstanceMap object. + @leave KErrNoMemory Memory allocation failure + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C static CXmlEngXFormsInstanceMap* NewLC(); + +public: + /** + Destructor. Frees internal storage, but does not free the Document + instances that were added. These are owned by the caller. + */ + IMPORT_C ~CXmlEngXFormsInstanceMap(); + + /** + Adds an entry to the map. The document is associated with a name. If an + entry with the same name already exists this method does nothing. + + Ownership of the document is not transferred. + + @param aInstance The DOM document to be stored. + @param aName The name that to be associated with the document. + @leave KErrNoMemory Memory allocation failure + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C void AddEntryL(RXmlEngDocument& aInstance, const TDesC8& aName); + + /** + Removes an entry from the map. If the entry does not exist, the + method does nothing. Note that the document is not freed. + + @param aName Name of entry to remove. + @leave KErrNoMemory Memory allocation failure + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C void RemoveEntryL(const TDesC8& aName); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** Default constructor */ + CXmlEngXFormsInstanceMap() {} + +private: + void *iInternal; +}; + +#endif // XMLENGCXFORMSINSTANCEMAP_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpath.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file is to be included by API clients +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATH_H +#define XMLENGXPATH_H + +class RXmlEngNodeSet; +class RXmlEngXPathResult; +class RXmlEngXPathExpression; +class TXmlEngXPathEvaluator; +class CXmlEngXFormsInstanceMap; + +#include +#include +#include +#include + +#endif /* XMLENGXPATH_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathconfiguration.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathconfiguration.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,159 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath configuraion functions +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHCONFIGURATION_H +#define XMLENGXPATHCONFIGURATION_H + +#include + +/** +This class holds a name, a namespace URI and a pointer to a XPath extension +function (either native or defined via MXmlEngXPathExtensionFunction interface). + +@see XmlEngXPathConfiguration +@see MXmlEngXPathExtensionFunction +*/ +class TXmlEngExtensionFunctionDescriptor + { +public: + /** Default constructor */ + IMPORT_C TXmlEngExtensionFunctionDescriptor(); + +public: + /** Extension function (Pointer to MXmlEngXPathExtensionFunction) */ + void* iFunc; + /** Function name */ + const char* iName; + /** Second name */ + const char* iNamespaceUri; + /** Reserved */ + TInt iReserved; + }; + +/** +This object is used to support extension functions used within the XPath library. +Extension functions may be added or removed. This object can also determine whether +an extension function is supported. + +Extension functions are stored in a TXmlEngExtensionFunctionDescriptor object which +holds the extension function (a MXmlEngXPathExtensionFunction instance), the +function name and the function namespace. An extension function can be added +to the library using XmlEngXPathConfiguration::AddExtensionFunctionL(). + +When an extension function is to be evaluated, +MXmlEngXPathExtensionFunction::Evaluate() is called with a +MXmlEngXPathEvaluationContext instance which holds the function arguments and +evaluation result. + +@see MXmlEngXPathExtensionFunction +@see MXmlEngXPathEvaluationContext +@see TXmlEngExtensionFunctionDescriptor +*/ +class XmlEngXPathConfiguration + { +public: + /** + Unused + @internalComponent + */ + IMPORT_C static void Unused_Func1(TBool aEnable); + + /** + Disables support of any previously registered extension functions + and switches to support only the XPath Function Library. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static void ResetExtensionFunctionsL(); + + /** + Check if XPath extension function is supported. + + @param aFunc Function name + @param aNsUri Function namespace URI + @return ETrue if supported, EFalse otherwise + @leave - One of the system-wide error codes + */ + IMPORT_C static TBool IsFunctionSupportedL(const TDesC8& aFunc, const TDesC8& aNsUri); + + /** + Registers an extension function at the global scope. + + @param aFuncDes Function descriptor. + @leave KXmlEngErrWrongUseOfAPI Error initializing XPath context + @leave KXmlEngErrXPathResult Error adding function + @leave - One of the system-wide error codes + */ + IMPORT_C static void AddExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aFuncDes); + + /** + Registers a set of extension functions at the global scope. + + @param aFuncVector Vector with function descriptors. Ownership is not transferred. + @param aSize The size of the vector + @leave KXmlEngErrWrongUseOfAPI Error initializing XPath context + @leave KXmlEngErrXPathResult Error adding function + @leave - One of the system-wide error codes + */ + IMPORT_C static void AddExtensionFunctionVectorL (const RArray& aFuncVector, TUint aSize); + + /** + Registers a native extension function at the global scope. + + @param aNativeFuncDes Function descriptor. + @leave KXmlEngErrWrongUseOfAPI Error initializing XPath context + @leave KXmlEngErrXPathResult Error adding function + @leave - One of the system-wide error codes + */ + IMPORT_C static void AddNativeExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aNativeFuncDes); + + /** + Registers a set of native extension functions at the global scope. + + @param aNativeFuncVector Function descriptor. + @param aSize The size of the vector + @leave KXmlEngErrWrongUseOfAPI Error initializing XPath context + @leave KXmlEngErrXPathResult Error adding function + @leave - One of the system-wide error codes + */ + IMPORT_C static void AddNativeExtensionFunctionVectorL(const RArray& aNativeFuncVector, TUint aSize); + + /** + Deregisters an extension function. No error is generated if the extension + function is not found. + + @param aFuncDes Function descriptor. + */ + IMPORT_C static void RemoveExtensionFunction(const TXmlEngExtensionFunctionDescriptor& aFuncDes); + + /** + Deregisters a set of extension functions. No error is generated if an + extension function in the vector is not found. + + @param aFuncVector Vector with function descriptors. + @param aSize The size of the vector + */ + IMPORT_C static void RemoveExtensionFunctionVector(const RArray& aFuncVector, TUint aSize); + }; + +#endif /* XMLENGXPATHCONFIGURATION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpatherrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpatherrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPATH error codes +// + + + +/** + @file + @publishedAll + @released +*/ + +#ifndef XMLENGDOMXPATHERRORS_H +#define XMLENGDOMXPATHERRORS_H + +/** + * Syntax error compiling XPath expression. + * @see TXmlEngXPathEvaluator::CreateExpressionL + */ +const TInt KXmlEngErrXPathSyntax = -32399; +/** + * General error evaluating XPath expression. + */ +const TInt KXmlEngErrXPathResult = -32398; + +#endif // XMLENGDOMXPATHERRORS_H + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathevaluationcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathevaluationcontext.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,154 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluation context interface +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHEVALCTXT_H +#define XMLENGXPATHEVALCTXT_H + +#include +#include + +/** +Provides the XPath evaluation context interface. An object of this type +provides the argument values to an extension function to be evalutated +and stores the result of evalutation. + +@see MXmlEngXPathExtensionFunction +@see MXmlEngXPathExtensionFunction::Evaluate() + +Objects of this type are not registered with the XPath library and must +be destroyed by their owner. + +Any memory allocated by this object must be freed when the object is +destroyed. +*/ +class MXmlEngXPathEvaluationContext + { +public: + /** + Gets the number of arguments provided. + @return The number of arguments provided + */ + virtual TUint ArgCount() = 0; + + /** + Gets an argument by index. Does not transfer ownership. Index starts at 0. + @pre 0 <= aIndex < ArgCount(). Function panics if precondition not met. + @return The n-th argument of the function + */ + virtual const RXmlEngXPathResult Argument(TUint aIndex) = 0; + + /** + Gets the result written so far. The result is undefined before SetResult(), + InitializeNodeSetResult() or AppendToResult() have been called. + + @pre SetResult() or InitializeNodeSetResult() and AppendToResult() have + been previously called. + @return The result evaluated by the function so far. + */ + virtual const RXmlEngXPathResult Result() = 0; + + /** + Sets the type of result to node set and initializes a new node set. Any + existing result node set is replaced. + + @see AppendToResult(const TXmlEngNode) + @see AppendToResult(const RXmlEngNodeSet) + @see AppendToResult(const TXmlEngNamespace, const TXmlEngElement) + */ + virtual void InitializeNodeSetResult() = 0; + + /** + Appends a node to the node set result. InitializeNodeSetResult() should be + called prior to the first call to an AppendToResult() method. + + This method will return and do nothing if a previous OOM condition in the + underlying libxml2 library has not been cleared. See libxml2_modules.h. + + @pre OOM_FLAG==0, otherwise method returns and does nothing. + @param aNode Node to be added + */ + virtual void AppendToResult(const TXmlEngNode aNode) = 0; + + /** + Appends a namespace node to the node set result. InitializeNodeSetResult() + should be called prior to the first call to an AppendToResult() method. + + A namespace node is the representation of an existing namespace declaration + within an element node. This function cannot be used to add a new namespace + declaration, rather it adds an existing namespace declaration attached to + aNsParentNode. + + @see TXmlEngNamespace + + This method will return and do nothing if a previous OOM condition in the + underlying libxml2 library has not been cleared. See libxml2_modules.h. + + @pre OOM_FLAG==0, otherwise method returns and does nothing. + @param aAppendedNsNode A namspace node to add to the node set result. + @param aNsParentNode An element node that holds the namespace declaration + represented by aAppendedNsNode. + */ + virtual void AppendToResult(const TXmlEngNamespace aAppendedNsNode, + const TXmlEngElement aNsParentNode) = 0; + + /** + Appends a node set to the node set result. Nodes are merged into a + resulting node set. InitializeNodeSetResult() should be called prior to + the first call to an AppendToResult() method. + + This method will return and do nothing if a previous OOM condition in the + underlying libxml2 library has not been cleared. See libxml2_modules.h. + + @pre OOM_FLAG==0, otherwise method returns and does nothing. + @param aNodeSet The node set to be appended + */ + virtual void AppendToResult(const RXmlEngNodeSet aNodeSet) = 0; + + /** + Sets the type of result to floating point number and stores the number as + the result. + @param aNumber The number to store as the result + */ + virtual void SetResult(TReal aNumber) = 0; + + /** + Sets the type of result to boolean and stores the value as the result. + @param aBoolean The value to store as the result + */ + virtual void SetResult(TBool aBoolean) = 0; + + /** + Sets the type of result to string and stores the string as the result. + @param aString The string to store as the result + */ + virtual void SetResultL(const TDesC8& aString) = 0; + + /** + Gets the data specified in RXmlEngXPathExpression::SetExtendedContext() + for the expression currently being evaluated. + */ + virtual void* ExtendedContext() = 0; + }; + +#endif /* XMLENGXPATHEVALCTXT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathevaluator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathevaluator.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,126 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluator declaration +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHEVALUATOR_H +#define XMLENGXPATHEVALUATOR_H + +#include +#include +#include + +class MXmlEngXPathExtensionFunction; + +class MXmlEngNamespaceResolver; +/** +Evaluates XPath expressions on a DOM tree. + +See the XPath specfication here: +http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html +*/ +class TXmlEngXPathEvaluator +{ +public: + /** Default constructor */ + IMPORT_C TXmlEngXPathEvaluator(); + + // XPath 1.0 methods + + /** + Precompiles and stores an XPath expression, which is returned to caller. + + Information on how to write XPath expressions can be found here: + @see http://en.wikipedia.org/wiki/XPath + + @param aExpression The expression to create + @param aResolver Not supported in current API. Reserved for future use. + @return The compiled XPath expression. + @leave KXmlEngErrXPathSyntax Error compiling expression + @leave KErrNoMemory Memory allocation error + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C RXmlEngXPathExpression CreateExpressionL(const TDesC8& aExpression, + const MXmlEngNamespaceResolver* aResolver = NULL); + + /** + Evaluates the XPath expression given as a parameter and returns the result. + + @param aExpression The expression to evaluate + @param aContextNode The node relative to which the expression is evaluated. + @param aResolver Not supported in current API. Reserved for future use. + @return The result of the evaluation. + @leave KXmlEngErrXPathResult Error evaluating expression + @leave KXmlEngErrXPathSyntax Error compiling expression + @leave KErrNoMemory Memory allocation error + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C RXmlEngXPathResult EvaluateL(const TDesC8& aExpression, + const TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* aResolver = NULL); + + + // Extensions to XPath 1.0 + + /** + Does the same thing as EvaluateL(), but also calculates the dependency list + of the expression. + + @param aExpression The expression to evaluate + @param aContextNode The node relative to which the expression is evaluated. + @param aResolver Not supported in current API. Reserved for future use. + @param aDependents After the method has returned, contains set of nodes that + the expression is dependent on. + @return The result of evaluation + + @leave KXmlEngErrXPathResult Error evaluating expression + @leave KXmlEngErrXPathSyntax Error compiling expression + @leave KErrNoMemory Memory allocation error + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(const TDesC8& aExpression, + const TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* aResolver, + RXmlEngNodeSet& aDependents); + + /** + Registers the instance map to be used when evaluating form expressions. The map + contains DOM Documents and their names. For example, when evaluating the expression + "instance('a')" the evaluator looks up a document that has the name "a" from the map. + + @param aInstanceTrees The instance map, ownership is not transferred. + */ + IMPORT_C void SetInstanceMap(CXmlEngXFormsInstanceMap* aInstanceTrees); + + /** + Returns the registered instance map. Ownership is not transferred. + @return A pointer to the instance map or NULL if not registered. + */ + IMPORT_C CXmlEngXFormsInstanceMap* InstanceMap(); + +private: + CXmlEngXFormsInstanceMap* iInstanceTrees; +}; + + + +#endif /* XMLENGXPATHEVALUATOR_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathevaluator.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathevaluator.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluator inline functions +// Closes XPath evaluator +// + +inline void RXmlEngXPathEvaluator::Close() + { + Destroy(); + } + +// ----------------------------------------------------------------------------- +// Frees any allocated resources +// ----------------------------------------------------------------------------- +// +inline void RXmlEngXPathEvaluator::Destroy() + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathexpression.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathexpression.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,136 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath expression declaration +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHEXPRESSION_H +#define XMLENGXPATHEXPRESSION_H + +#include +#include + +class TXmlEngNode; + +/** +A compiled XPath expression is a textual expression transformed after +syntactical analysis into some internal representation of the expression. The +only missing element for evaluation of the expression is evaluation context: +the context node (where to start) and an optional set of prefix-to-namespace bindings. + +XPath Expressions are created and instantiated by the Evaluator: +@see TXmlEngXPathEvaluator + +See the XPath spec here: +http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html +*/ +class RXmlEngXPathExpression +{ + friend class TXmlEngXPathEvaluator; + +public: + /** XPath expression parts */ + enum TXmlEngXPathExpressionPartType + { + EFunction, + EPrefix + }; + +public: + /** Default constructor */ + IMPORT_C RXmlEngXPathExpression(); + + /** Resets the compiled expression and frees the allocated memory */ + IMPORT_C void Destroy(); + + /** Resets the compiled expression and frees the allocated memory */ + inline void Close(); + + // XPath 1.0 methods + + /** + Evaluates this expression. + + @param aContextNode The node relative to which the expression is evaluated. + @param aResolver Not supported in current API. Reserved for future use. + @return Result of evaluation + @leave KXmlEngErrXPathResult Error evaluating expression + @leave KXmlEngErrXPathSyntax Error compiling expression + @leave KErrNoMemory Memory allocation error + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C RXmlEngXPathResult EvaluateL(TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* aResolver = NULL) const; + + + // Extensions to XPath 1.0 + + /** + Does the same thing as EvaluateL(), but also calculates the dependency list + of the expression. + + @param aContextNode The node relative to which the expression is evaluated. + @param aDependents After the method has returned, contains set of nodes that + the expression is dependent on. + @param aResolver Not supported in current API. Reserved for future use. + @return Result of evaluation + @leave KXmlEngErrXPathResult Error evaluating expression + @leave KXmlEngErrXPathSyntax Error compiling expression + @leave KErrNoMemory Memory allocation error + @leave - Otherwise, any of the system wide errors. + */ + IMPORT_C RXmlEngXPathResult EvaluateWithDependenciesL(TXmlEngNode aContextNode, + RXmlEngNodeSet& aDependents, + const MXmlEngNamespaceResolver* aResolver = NULL) const; + + /** + Set context data for the expression currently being evaluated. + + Extended Context is data set by API users and available for XPath extension + functions. For more information: + @see RXmlEngXPathExpression + + @param aContext Extended context pointer + */ + IMPORT_C void SetExtendedContext(void* aContext); + + /** + Gets extended context data for the expression currently being evaluated. + + @return Extended context pointer or NULL if not sete + + @see SetExtendedContext + */ + IMPORT_C void* ExtendedContext() const; + +private: + RXmlEngXPathExpression(void* aData, void* aData2); + +private: + void* iInternal; + void* iInternal2; + TInt32 reserved1; + TAny* reserved2; +}; + +#include + +#endif /* XMLENGXPATHEXPRESSION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathexpression.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathexpression.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath expression inline functions +// Resets the compiled expression and frees the allocated memory. +// + +inline void RXmlEngXPathExpression::Close() + { + Destroy(); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathextensionfunction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathextensionfunction.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,93 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Extension function interface +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHFUNCTION_H +#define XMLENGXPATHFUNCTION_H + +#include + +class MXmlEngXPathEvaluationContext; + +/** +Provides an interface for an object to participate in the evaluation of XPath +expression via a XPath function call. + +Objects that implement the MXmlEngXPathExtensionFunction interface can be +registered in a XmlEngXPathConfiguration object for global action (across +all evaluations globally). + +@see XmlEngXPathConfiguration::AddExtensionFunctionL() + +When the extension function is no longer required, it must be deregistered +by calling XmlEngXPathConfiguration::RemoveExtensionFunction(). +*/ +class MXmlEngXPathExtensionFunction + { +public: + /** Evaluation status */ + enum TXmlEngEvaluationStatus + { + /** Evaluation was accomplished successfully */ + ESucceeded, + /** An exceptional condition occurs */ + EError, + /** Type of argument does not match function specification */ + EInvalidArgumentType, + /** Number of arguments do not match function specification */ + EInvalidArgumentNumber + }; + +public: + /** + Gets the minimum number of arguments the function can take. + @return Minimum number of arguments + */ + virtual TInt MinArity() {return 0;} + + /** + Gets the maximum number of arguments the function can take. + + @return The maximum number of arguments or -1 if unbounded + */ + virtual TInt MaxArity() {return MinArity();} + + /** + Called to evaluate the extension function. + + This function is called only if simple arity constraints (min/max number of + arguments) are satisfied. The implementation of this function may need to + check further that the types of arguments and their positions in the + function call match function-specific requirements. + + @param aEvalCtxt Evaluation context, which contains data about arguments + and provides a number of methods for setting the result of the extension + function. + + @return ESucceeded if evaluation success, otherwise one of the errors + defined in TXmlEngEvaluationStatus. + */ + virtual TXmlEngEvaluationStatus Evaluate(MXmlEngXPathEvaluationContext* aEvalCtxt) = 0; + }; + +#endif /* XMLENGXPATHFUNCTION_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathresult.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathresult.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,136 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Result of XPath expression +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHRESULT_H +#define XMLENGXPATHRESULT_H + +#include + +/** +Represents the result of a XPath expression. + +The result may be one of the standard types: string, boolean, number (float), +node set or be undefined in the case of error. + +The returned result should be freed after use. +*/ +class RXmlEngXPathResult +{ + friend class RXmlEngXPathExpression; + friend class TXmlEngXPathEvaluationContextImpl; + +public: + /** + Result types of a XPath expression. + See http://w3.org/TR/xpath#section-Introduction + */ + enum TXmlEngXPathResultType + { + EUndefined = 0, + ENodeset = 1, + EBoolean = 2, + ENumber = 3, + EString = 4 + //Other node types defined in XPath are not supported. + } ; + +public: + /** Default constructor */ + IMPORT_C RXmlEngXPathResult(); + + /** Frees any allocated memory */ + IMPORT_C void Free(); + + /** Frees any allocated memory */ + inline void Close(); + + /** + Retrieves the type of the result (e.g. boolean, number, string, etc.). + The type of a result should always be checked before using the result. + + If there was an error and no value was set, undefined is returned. + Otherwise nodeset is returned. + + @return Type of result. + + @see TXmlEngXPathResultType + */ + IMPORT_C TXmlEngXPathResultType Type() const; + + /** + Retrieves a node-set result. A Non-RXmlEngNodeSet result will return NULL. + No conversion is done from other types. + + For more information no NULL nodes: + @see TXmlEngNode + + @return Node-set result + */ + IMPORT_C RXmlEngNodeSet AsNodeSet() const; + + /** + Retrieves a string copy of result. + @param A buffer allocated by the caller that holds the result string + @leave KErrNoMemory if out of memory situation occurs. + @leave - Otherwise any of the system wide errors. + */ + IMPORT_C void AsStringL(RBuf8& aOutput) const; + + /** + Retrieves a numeric value result. Conversion can occur from other types. + + Node sets, strings, and booleans will be cast to numbers. Anything else + will return NAN (i.e. not a number). + + @return Numeric value of the result. + + @see Math + */ + IMPORT_C TReal AsNumber() const; + + /** + Retrieves a boolean result. Conversion can occur from other types. + + Numbers will be returned as true unless it is not a number or 0.0. + A string of 0 length will return false, otherwise true. + If the node exists it will be returned as true, otherwise false. + + @return Boolean value of the result + */ + IMPORT_C TBool AsBoolean() const; + +private: + /** + Constructor + @param aData Internal representation of XPath result + */ + RXmlEngXPathResult(void* aData); + +private: + void* iInternal; + }; + +#include + +#endif /* XMLENGXPATHRESULT_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathresult.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathresult.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath result inline functions +// Closes the result of XPath expression +// + +inline void RXmlEngXPathResult::Close() + { + Free(); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathutils.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,163 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath Utils +// + + + +/** + @file + @publishedAll + @released +*/ +#ifndef XMLENGXPATHUTILS_H +#define XMLENGXPATHUTILS_H + +#include + +/** +Implements utility functions such as conversion methods for XPath objects. + +The XPath specification considers a node result as a set of only one node, +however, in this API it is possible to perform conversion routines +directly on nodes. +*/ +class XmlEngXPathUtils + { +public: + /** + Converts node to number + @param aNode Node to be converted + @return The number represented by the node or NaN if cannot convert. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static TReal ToNumberL(const TXmlEngNode& aNode); + + /** + Converts a node-set to a number by taking the node in the node set that + appears first in the document and converting that to a number. + + @param aNodeSet Node-set to be converted + @return The number represented by the node set or NaN if cannot convert. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static TReal ToNumberL(const RXmlEngNodeSet& aNodeSet); + + /** + Converts TBool value to TReal + @param aValue TBool value to be converted + @return 1.0 if ETrue and 0.0 otherwise + @leave - Does not leave + */ + IMPORT_C static TReal ToNumberL(TBool aValue); + + /** + Converts a string to a number + @param aString String to be converted + @return The number respresented by the string or NaN if cannot convert. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static TReal ToNumberL(const TDesC8& aString); + + /** + Converts a node to a string. Any existing text in aOutput is destroyed. + This method allocates memory for the buffer. + + @param aNode The node to be converted + @param aOutput A buffer owned by the caller that holds the returned string + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static void ToStringL(const TXmlEngNode& aNode, RBuf8& aOutput ); + + /** + Converts a node-set to a string by taking the node in the node set that + appears first in the document and converting that to a string. Any + existing text in aOutput is destroyed. This method allocates memory for + the buffer. + + @param aNodeSet The node-set to be converted + @param aOutput A buffer owned by the caller that holds the returned string + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static void ToStringL(const RXmlEngNodeSet& aNodeSet, RBuf8& + aOutput ); + + /** + Converts a TBool value to a string. Any existing text in aOutput is + destroyed. This method allocates memory for the buffer. + + @param aValue The TBool value to be converted + @param aOutput A buffer owned by the caller that holds the returned string. + "true" if ETrue and "false" otherwise. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static void ToStringL(TBool aValue, RBuf8& aOutput ); + + /** + Converts a TReal value to a string. Any existing text in aOutput is + destroyed. This method allocates memory for the buffer. + + @param aValue The TReal value to be converted + @param aOutput A buffer owned by the caller that holds the returned string. + @leave KErrNoMemory Memory allocation failure + */ + IMPORT_C static void ToStringL(TReal aValue, RBuf8& aOutput ); + + /** + Converts a node to a TBool + @param aNode Node to be converted + @return ETrue if the node is not NULL, EFalse otherwise + */ + IMPORT_C static TBool ToBoolean(const TXmlEngNode& aNode); + + /** + Converts a node-set to a TBool + @param aNodeSet Node-set to be converted + @return ETrue if the nodeset is not NULL, EFalse otherwise + */ + IMPORT_C static TBool ToBoolean(const RXmlEngNodeSet& aNodeSet); + + /** + Converts a string to a TBool + @param aValue String that should be converted + @return ETrue if the string is not an empty string, EFalse otherwise + */ + IMPORT_C static TBool ToBoolean(const TDesC8& aValue); + + /** + Converts a string to a TBool + @deprecated This function is deprecated and will be removed in future + releases. ToBoolean() should be used instead. + @param aValue String that should be converted + @return ETrue if the string is not an empty string, EFalse otherwise + @leave - Does not leave + */ + IMPORT_C static TBool ToBooleanL(const TDesC8& aValue); + + /** + Converts a TReal value to a TBool + @param aValue TReal value to be converted + @return EFalse if aValue is NaN or 0.0, ETrue otherwise + */ + IMPORT_C static TBool ToBoolean(TReal aValue); + +private: + /** Default constructor */ + inline XmlEngXPathUtils(); + }; + +#include + +#endif /* XMLENGXPATHUTILS_H */ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/inc/xpath/xmlengxpathutils.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/inc/xpath/xmlengxpathutils.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,20 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath utils inline functions +// Default constructor +// + +inline XmlEngXPathUtils::XmlEngXPathUtils() + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengattr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengattr.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,277 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for attribute node +// + + +#include +#include +#include +#include "xmlengdomdefs.h" +#include +#include +#include +#include + +#define LIBXML_ATTRIBUTE (static_cast(iInternal)) + +// --------------------------------------------------------------------------------------------- +// Clones attribute node +// +// @return A copy of the attribute with its value +// @note +// Namespace of the attribute is reset; use TXmlEngNode::CopyToL(TXmlEngNode), which +// finds appropriate or creates new namespace declaration on the new +// parent node (argument should be an TXmlEngElement handle) +// @see CopyToL(TXmlEngNode) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngAttr::CopyL() const + { + if (iInternal) + { + xmlAttrPtr attr = xmlCopyProp(NULL, LIBXML_ATTRIBUTE); + OOM_IF_NULL(attr); + TXmlEngAttr ncopy(attr); + attr->doc = NULL; + OwnerDocument().TakeOwnership(ncopy); + return attr; + } + return NULL; + } + +// --------------------------------------------------------------------------------------------- +// @return Attribute's contents +// +// @note For values consisting of more then one TXmlEngTextNode node (as attribute's child) +// returns only the begining of the value; this happens when the value is +// represented by list of TXmlEngTextNode and TXmlEngEntityReference nodes. +// @see IsSimpleContents(), WholeValueCopyL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngAttr::Value() const + { + if(LIBXML_ATTRIBUTE && LIBXML_ATTRIBUTE->children && + LIBXML_ATTRIBUTE->children->type == XML_TEXT_NODE) + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_ATTRIBUTE->children->content)).PtrC8(); + } + return KNullDesC8(); // the value starts with entity reference or is NULL + } + +// --------------------------------------------------------------------------------------------- +// @return Local name of the attribute +// +// @note Equal to TXmlEngNode::NodeName(), but works faster. +// +// Never call this on NULL object! +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngAttr::Name() const + { + if(LIBXML_ATTRIBUTE) + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_ATTRIBUTE->name)).PtrC8(); + } + return KNullDesC8(); + } + +// --------------------------------------------------------------------------------------------- +// @return Compex value of the attribute, +// probably consisting of text nodes and entity references +// +// Since the value may be composed from a set of TXmlEngTextNode and EntityRefernce nodes, +// the returned result is newly allocated string, which should be freed by caller. +// +// BE SURE TO FREE THE RESULT STRING!!! +// +// On Symbian: +// @code +// // Note the use of AllocAndFreeLC(), which converts value to +// // UTF-16 descriptor, pushes it to the cleanup stack and +// // DEALLOCATES string in the returned TDOMString object +// HBufC* value = attr.WholeValueCopyL().AllocAndFreeLC(); +// ... +// CleanupStack::PopAndDestroy(); // value; +// @endcode +// +// @see TXmlEngAttr::Value(), TXmlEngNode::Value(), +// TXmlEngNode::IsSimpleTextContents(), TXmlEngNode::WholeTextContentsCopyL() +// +// @note In most cases using Value() is enough (and it needs no memory allocation). +// Use IsSimpleTextContents() if there doubts can Value() be used or not safely. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngAttr::WholeValueCopyL(RBuf8& aBuffer) const + { + if (!LIBXML_ATTRIBUTE) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlChar* value = xmlNodeListGetString( + LIBXML_ATTRIBUTE->doc, + LIBXML_ATTRIBUTE->children, + 1); + TEST_OOM_FLAG; + xmlCharAssignToRbuf8L(aBuffer,value); + } + +// ------------------------------------------------------------------------------------- +// Sets new value of the attribute. Provided new value will be escaped as needed. +// +// @param aNewValue A string value for the attribute +// +// The new value should not contain entity references. Entity references are not expanded, +// but used as text, because the ampersand (&) character of reference is escaped. +// +// @see SetRawValueL(TDOMString) +// ------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngAttr::SetValueL( + const TDesC8& aNewValue) + { + if (!LIBXML_ATTRIBUTE) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlAttrPtr prop = LIBXML_ATTRIBUTE; + xmlNodePtr new_ch; + if (!aNewValue.Length()) + { + new_ch = NULL; + } + else + { + xmlChar* value = xmlCharFromDesC8L(aNewValue); + new_ch = xmlNewText(NULL); + if(!new_ch) + { + delete value; + OOM_HAPPENED; + }; + new_ch->content = value; + new_ch->parent = reinterpret_cast(prop); + new_ch->doc = prop->doc; + } + xmlFreeNodeList(prop->children); + prop->children = new_ch; + prop->last = new_ch; + } + +// ------------------------------------------------------------------------------------- +// Sets new value from escaped XML character data that may contain entity references. +// +// The value as if it is an escaped contents from XML file. +// If the value contains entity references, then the resulting +// content of the attribute is a list of TXmlEngTextNode and EntityRefeerence nodes. +// Predefined entities are converted into characters they represent. +// +// @see TXmlEngAttr::SetValueL(TStringArg) +// ------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngAttr::SetEscapedValueL( + const TDesC8& aNewValue) + { + if (!LIBXML_ATTRIBUTE) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlAttrPtr prop = LIBXML_ATTRIBUTE; + xmlNodePtr new_ch; + if (!aNewValue.Length()) + { + prop->last = NULL; + new_ch = NULL; + } + else + { + xmlChar* value = xmlCharFromDesC8L(aNewValue); + new_ch = xmlStringGetNodeList(LIBXML_ATTRIBUTE->doc, value); + delete value; + TEST_OOM_FLAG; + + // Set parent property on all child nodes and find pointer to the last node + xmlNodePtr tmp = new_ch; + while (tmp) + { + tmp->parent = (xmlNodePtr) prop; + if (!(tmp->next)) + prop->last = tmp; + tmp = tmp->next; + } + } + xmlFreeNodeList(prop->children); + prop->children = new_ch; + } + +// ------------------------------------------------------------------------------------- +// Sets new attribute value exactly as presented in the string. +// +// Predefined entities are not converted into characters they represent. +// +// @see TXmlEngAttr::SetValueL() +// ------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngAttr::SetValueNoEncL( const TDesC8& aNewValue ) + { + if (!LIBXML_ATTRIBUTE) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlAttrPtr prop = LIBXML_ATTRIBUTE; + xmlNodePtr new_ch; + if (!aNewValue.Length()) + { + prop->last = NULL; + new_ch = NULL; + } + else + { + xmlChar* value = xmlCharFromDesC8L(aNewValue); + new_ch = xmlNewText(NULL); + if(!new_ch) + { + delete value; + OOM_HAPPENED; + }; + + new_ch->name = xmlStringTextNoenc; + new_ch->content = value; + new_ch->parent = (xmlNodePtr) prop; + prop->last = new_ch; + } + xmlFreeNodeList(prop->children); + prop->children = new_ch; + } + +// --------------------------------------------------------------------------------------------- +// @return TXmlEngElement that contains the attribute +// +// Same as TXmlEngNode::ParentNode() but returns TXmlEngElement instead of TXmlEngNode +// +// @note Copies of attributes [TXmlEngAttr::CopyL()] and newly created attribute nodes +// [RXmlEngDocument::CreateAttributeL(..)] do not have parent element until they are attached +// to some element. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C const TXmlEngElement TXmlEngAttr::OwnerElement() const + { + XE_ASSERT_DEBUG(LIBXML_ATTRIBUTE); + return TXmlEngElement(LIBXML_ATTRIBUTE->parent); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengbinarycontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengbinarycontainer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,98 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for all kind of text nodes +// + +#include +#include +#include "xmlengdomdefs.h" +#include + +// ------------------------------------------------------------------------------- +// @return Binary contents of the container +// +// ------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngBinaryContainer::Contents() const + { + return TPtrC8((const TUint8*)LIBXML_NODE->content, (TInt)LIBXML_NODE->properties); + } + +// ------------------------------------------------------------------------------- +// Sets contents of binary container +// +// @param aNewContents The actual value to store +// ------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngBinaryContainer::SetContentsL( const TDesC8& aNewContents ) + { + if (!LIBXML_NODE) + { + User::Leave(KXmlEngErrNullNode); + } + // Note: TXmlEngBinaryContainer is treated internally by Libxml2 as text nodes. + // Hence, appending 0 at the end to ensure that text is not parsed beyond actual data in any case. + + TUint len = aNewContents.Size(); + unsigned char* str = new(ELeave) unsigned char[len + 1]; + memcpy(str, aNewContents.Ptr(), len); + str[len] = 0; + + if (LIBXML_NODE->content + && + !(LIBXML_NODE->doc && + LIBXML_NODE->doc->dict && + xmlDictOwns(LIBXML_NODE->doc->dict, LIBXML_NODE->content))) + { + xmlFree(LIBXML_NODE->content); + } + LIBXML_NODE->properties = (xmlAttr*) len; + LIBXML_NODE->content = str; + } + +// ------------------------------------------------------------------------------- +// Extends the contents of binary container by appending aContents +// +// @param aContents Content to be appended to current content +// ------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngBinaryContainer::AppendContentsL( const TDesC8& aData ) + { + if (!LIBXML_NODE) + { + User::Leave(KXmlEngErrNullNode); + } + + // Note: TXmlEngBinaryContainer is treated internally by Libxml2 as text nodes. + // Hence, appending 0 at the end to ensure that text is not parsed beyond actual data in any case. + + TPtrC8 prevContent = Contents(); + TInt len = prevContent.Length() + aData.Length(); + unsigned char* newContent = new(ELeave) unsigned char[len + 1]; + + TAny* last = Mem::Copy((TAny*)newContent, prevContent.Ptr(), prevContent.Length()); + memcpy(last, aData.Ptr(), aData.Length()); + newContent[len] = 0; + + if (LIBXML_NODE->content + && + !(LIBXML_NODE->doc && + LIBXML_NODE->doc->dict && + xmlDictOwns(LIBXML_NODE->doc->dict, LIBXML_NODE->content))) + { + xmlFree(LIBXML_NODE->content); + } + LIBXML_NODE->properties = (xmlAttr*) len; + LIBXML_NODE->content = (unsigned char *)newContent; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengcharacterdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengcharacterdata.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,104 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for all kind of text nodes +// + +#include +#include +#include "xmlengdomdefs.h" +#include +#include //pjj18 new + +#define CHARACTER_DATA (static_cast(iInternal)) + +// ------------------------------------------------------------------------------- +// @return Character contents of the node +// +// This method applies to TXmlEngCDATASection, TXmlEngComment and TXmlEngTextNode nodes. +// ------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngCharacterData::Contents() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_NODE ? LIBXML_NODE->content : NULL)).PtrC8(); + } + +// ------------------------------------------------------------------------------- +// Sets contents of basic character nodes: TXmlEngTextNode, TXmlEngComment, TXmlEngCDATASection +// +// @param aNewContents The actual value to store +// +// The input is taken as non-escaped: for example, +// aNewContents = "123 > 34 && P" will be serialized as "123 > 34 && P" +// +// Escaped contents may be set only for TXmlEngElement and TXmlEngAttr nodes. +// @see TXmlEngAttr::SetRawValueL(), TXmlEngElement::SetRawTextL() +// ------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngCharacterData::SetContentsL( + const TDesC8& aNewContents ) + { + char* newContent = (char*)new(ELeave) TUint8[aNewContents.Length() + 1]; + *(Mem::Copy((TAny*)newContent, aNewContents.Ptr(), aNewContents.Length())) = 0; + if (LIBXML_NODE->content + && + !(LIBXML_NODE->doc && + LIBXML_NODE->doc->dict && + xmlDictOwns(LIBXML_NODE->doc->dict, LIBXML_NODE->content))) + { + xmlFree(LIBXML_NODE->content); + } + + LIBXML_NODE->content = (unsigned char *)newContent; + } + +// ----------------------------------------------------------------------------- +// Extends the contents of the node by appending aString +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngCharacterData::AppendContentsL( + const TDesC8& aString) + { + if (!LIBXML_NODE) + { + User::Leave(KXmlEngErrNullNode); + } + + TPtrC8 prevContent = Contents(); + TInt len = prevContent.Length() + aString.Length() + 1; + char* newContent = (char*)new(ELeave) TUint8[len]; + + TAny* last = Mem::Copy((TAny*)newContent, prevContent.Ptr(), prevContent.Length()); + *(Mem::Copy(last, aString.Ptr(), aString.Length())) = 0; + + if (LIBXML_NODE->content + && + !(LIBXML_NODE->doc && + LIBXML_NODE->doc->dict && + xmlDictOwns(LIBXML_NODE->doc->dict, LIBXML_NODE->content))) + { + xmlFree(LIBXML_NODE->content); + } + + LIBXML_NODE->content = (unsigned char *)newContent; + } + +// ------------------------------------------------------------------------------- +// @return Number of characters in the contents +// ------------------------------------------------------------------------------- +// +EXPORT_C TUint TXmlEngCharacterData::Length() const + { + return CHARACTER_DATA && CHARACTER_DATA->content ? + xmlUTF8Strlen(CHARACTER_DATA->content) : 0; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengchunkcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengchunkcontainer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for memory chunk container +// + +#include +#include "xmlengdomdefs.h" +#include + +// ------------------------------------------------------------------------------- +// @return Memory chunk reference +// +// ------------------------------------------------------------------------------- +// +EXPORT_C RChunk& TXmlEngChunkContainer::Chunk() const + { + return (RChunk&) *LIBXML_NODE->content; + } + +// ------------------------------------------------------------------------------- +// @return Offset of binary data in memory chunk +// +// ------------------------------------------------------------------------------- +// +EXPORT_C TUint TXmlEngChunkContainer::ChunkOffset() const + { + return (TUint)LIBXML_NODE->nsDef; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdatacontainer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for all kind of text nodes +// + +#include +#include "xmlengdomdefs.h" +#include + +// ------------------------------------------------------------------------------- +// @return Cid of the container +// +// ------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngDataContainer::Cid() const + { + return TPtrC8( (const unsigned char *)LIBXML_NODE->ns); + } + +// ------------------------------------------------------------------------------- +// @return Data size in bytes +// ------------------------------------------------------------------------------- +// +EXPORT_C TUint TXmlEngDataContainer::Size() const + { + return (TUint)LIBXML_NODE->properties; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdocument.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1139 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document node functions +// + +#include +#include + +#include +#include +#include "xmlengfileoutputstream.h" +#include +#include "xmlengownednodescontainer.h" +#include "xmlengdomdefs.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "libxml2_xmlsave_private.h" +#include "libxml2_tree_private.h" +#include "libxml2_globals_private.h" +#include +#include "libxml2_valid_private.h" + +int XMLCALL NodeFilterCallback(void* aFilter, xmlNodePtr aNode); +void LibxmlDocumentCleanup(TAny* aAttrPtr); +void LibxmlNodeCleanup(TAny* aNodePtr); + +// ----------------------------------------------------------------------------------------------- +// "Write" callback registered in libxml2 for using with custom output stream +// during serializing XML. +// +// This callback is invoked repeatedly during serialization; +// when whole data is serialized the "Close" callback is called for a output stream. +// +// @param aContext User data that was used during callback registration +// XML Engine uses here a pointer to MXmlEngOutputStream provided by client app +// @param aBuffer Buffer where the next part of serialized XML has just been written +// @param aLen Number of bytes written to the buffer +// +// The callback is prototyped by libxml2's type declaration: +// @code +// typedef int (*xmlOutputWriteCallback) (void* context, const char* buffer, int len); +// @endcode +// ----------------------------------------------------------------------------------------------- +// +int XmlEngineIOWriteCallback(void* aContext, const char* aBuffer, int aLen) + { + MXmlEngOutputStream* stream = reinterpret_cast(aContext); + return stream->Write(TPtrC8(reinterpret_cast(const_cast(aBuffer)), aLen)); + } + +// ----------------------------------------------------------------------------------------------- +// "Close" callback registered in libxml2 for using with custom output stream +// during serializing XML. +// +// This callback is invoked after the last "Write" callback. +// +// @param aContext User data that was used during callback registration +// XML Engine uses here a pointer to MXmlEngOutputStream provided by client app +// +// The callback is prototyped by libxml2's type declaration: +// @code +// typedef int (*xmlOutputCloseCallback) (void* context); +// @endcode +// ----------------------------------------------------------------------------------------------- +// +int XmlEngineIOCloseCallback(void* aContext) + { + MXmlEngOutputStream* stream = reinterpret_cast(aContext); + return stream->Close(); + } + +// ----------------------------------------------------------------------------------------------- +// Data serialization callback registered in libxml2 for custom node data serialization. +// +// This callback is invoked whenever EText node contains data of given length, for example +// binary data or data stored in a memory chunk. +// +// @param aContext Data serializer provided by client app +// @param aNode Node that contains data to be serialized +// ----------------------------------------------------------------------------------------------- +// +unsigned char* DataSerializationCallback(void* aContext, xmlNodePtr aNode, int* aWritten) + { + TPtrC8 ptr(KNullDesC8()); + MXmlEngDataSerializer* dataSerializer = reinterpret_cast(aContext); + TRAPD(err, ptr.Set(dataSerializer->SerializeDataL(TXmlEngNode(aNode)))); + if(err) + { + *aWritten = err; + return NULL; + } + + *aWritten = ptr.Size(); + return (unsigned char*)ptr.Ptr(); + } + +#define LIBXML_DOC (static_cast(iInternal)) + +// ------------------------------------------------------------------------------------------------------- +// Closes the RXmlEngDocument object: the whole document tree is destroyed and all memory is released. +// +// All owned by the document nodes (created by it or unlinked from the document and not linked elsewhere) +// are destroyed too. +// ------------------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::Close() + { + if(LIBXML_DOC) + { + LibxmlDocumentCleanup(LIBXML_DOC); + iInternal = NULL; + } + } + +EXPORT_C void RXmlEngDocument::OpenL(RXmlEngDOMImplementation& aDOMImpl) + { + iImpl = &aDOMImpl; + xmlDocPtr doc = xmlNewDoc(NULL); + OOM_IF_NULL(doc); + iInternal = doc; + CleanupClosePushL(*this); + InitOwnedNodeListL(); + CleanupStack::Pop(); + }; + +EXPORT_C void RXmlEngDocument::OpenL(RXmlEngDOMImplementation& aDOMImpl, void* aInternal) + { + iImpl = &aDOMImpl; + iInternal = aInternal; + CleanupStack::PushL(TCleanupItem(LibxmlDocumentCleanup,(TAny*)LIBXML_DOC)); + InitOwnedNodeListL(); + CleanupStack::Pop(); + }; + +EXPORT_C void RXmlEngDocument::OpenL(RXmlEngDOMImplementation& aDOMImpl, TXmlEngElement aRoot) + { + OpenL(aDOMImpl); + xmlUnlinkNode(INTERNAL_NODEPTR(aRoot)); + xmlNodePtr node = xmlAddChild(LIBXML_NODE, INTERNAL_NODEPTR(aRoot)); + if(!node) + { + Close(); + OOM_HAPPENED; + } + }; + +EXPORT_C TXmlEngDocumentFragment RXmlEngDocument::CreateDocumentFragmentL() + { + xmlNodePtr dfNode = xmlNewDocFragment(LIBXML_DOC); + OOM_IF_NULL(dfNode); + TXmlEngNode df(dfNode); + TakeOwnership(df); + return df.AsDocumentFragment(); + } + +// ----------------------------------------------------------------------------------------------- +// Serializes document tree into a file +// +// @param aFileName A file name (with path) +// @return Number of byte written +// @note +// Method may leave with KErrNoMemory or KErrGeneral codes. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDocument::SaveL( const TDesC& aFileName, + TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aSaveOptions ) const + { + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + if (!aFileName.Length()) + { + WRONG_USE_OF_API; + } + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + TInt size = SaveL(fs, aFileName, aRoot, aSaveOptions); + CleanupStack::PopAndDestroy(&fs); + return size; + } + +// ----------------------------------------------------------------------------------------------- +// Serializes node to a file +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDocument::SaveL( RFs& aRFs, + const TDesC& aFileName, + TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aSaveOptions ) const + { + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + if (!aFileName.Length()) + { + WRONG_USE_OF_API; + } + TInt size = -1; + RFile outputFile; + + User::LeaveIfError(outputFile.Replace(aRFs,aFileName,EFileShareAny|EFileWrite)); + CleanupClosePushL(outputFile); + + TXmlEngFileOutputStream outputStream(outputFile,aRFs); + RBuf8 buffer; + // TString is null so it does not need to be closed + size = SaveNodeL( INTERNAL_NODEPTR(aRoot), buffer, &outputStream, aSaveOptions); + User::LeaveIfError(outputStream.CheckError()); + CleanupStack::PopAndDestroy(&outputFile); + + return size; + } + +// ----------------------------------------------------------------------------------------------- +// Serializes a document tree into provided output stream, which supports +// progressive writing of data. +// +// @param aStream An output stream to write serialized DOM tree +// @param aRoot Root node to be serialized +// @param aSaveOptions Options that control how serialization is performed +// @see MXmlEngOutputStream +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDocument::SaveL( MXmlEngOutputStream& aStream, + TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aSaveOptions ) const + { + RBuf8 placeHolder; + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + if(!&aStream) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + return SaveNodeL( aRoot, placeHolder, &aStream, aSaveOptions ); + } + + +// ----------------------------------------------------------------------------------------------- +// Serializes DOM subtree into memory buffer +// +// @param aBuffer A buffer to write output data. +// @param aRoot Root note to serialize. +// @param aSaveOptions Various options that control how serialization is performed +// +// @return Number of bytes in updated buffer +// +// Buffer contents is freed prior serialization +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDocument::SaveL( RBuf8& aBuffer, + TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aSaveOptions ) const + { + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + return SaveNodeL(aRoot, aBuffer, NULL, aSaveOptions); + } + +// ----------------------------------------------------------------------------------------------- +// Creates complete copy of the document +// +// @return Complete copy of the document tree +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument RXmlEngDocument::CloneDocumentL() const + { + xmlDocPtr doc = NULL; + if (iInternal) + { + doc = xmlCopyDoc(LIBXML_DOC, 1); + OOM_IF_NULL(doc); + } + RXmlEngDocument retDoc(doc); + CleanupStack::PushL(TCleanupItem(LibxmlDocumentCleanup,(TAny*)doc)); + retDoc.InitOwnedNodeListL(); + CleanupStack::Pop(); + return retDoc; + } + +// ----------------------------------------------------------------------------------------------- +// Creates new element from specific namespace to be a root of the document tree. +// +// Any existing document element of the document is destroyed +//@return A new root element +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement RXmlEngDocument::CreateDocumentElementL( const TDesC8& aName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix ) + { + TXmlEngElement newE = CreateElementL(aName, aNamespaceUri, aPrefix); + SetDocumentElement(newE); + return newE; + } + +// ----------------------------------------------------------------------------------------------- +// Replaces (and closes) document element with another one +// +// New document element is added as the last child to the document node +// @param aNewDocElement New document tree +// @note Use TXmlEngElement::ReconcileNamespacesL() on the new document element +// if it or its descendants can contain references to namespace declarations +// out of the element +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::SetDocumentElement( TXmlEngElement aNewDocElement ) + { + TXmlEngElement oldE = DocumentElement(); + if (oldE.NotNull()) + { + oldE.Remove(); + } + if(aNewDocElement.ParentNode().IsNull()) + aNewDocElement.OwnerDocument().RemoveOwnership(aNewDocElement); + // + xmlNodePtr child = xmlAddChild(LIBXML_NODE, INTERNAL_NODEPTR(aNewDocElement)); + } + + +// ----------------------------------------------------------------------------------------------- +// @return A document element - the top-most element in the document tree +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement RXmlEngDocument::DocumentElement() const + { + return TXmlEngElement(xmlDocGetRootElement(LIBXML_DOC)); + } + +// ----------------------------------------------------------------------------------------------- +// @return Encoding of the source XML data. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 RXmlEngDocument::XmlEncoding() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_DOC->encoding)).PtrC8(); + } + +// ----------------------------------------------------------------------------------------------- +// @return Whether standalone="true" was specified in XML declaration in the source XML file. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TBool RXmlEngDocument::IsStandalone() const + { + return LIBXML_DOC->standalone != 0; + } + +// ----------------------------------------------------------------------------------------------- +// Sets 'standalone' attribute of XML declaration for a document +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::SetStandalone( TBool aStandalone ) + { + LIBXML_DOC->standalone = aStandalone; + } + +// ----------------------------------------------------------------------------------------------- +// @return Version number of XML taken from XML declaration +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 RXmlEngDocument::XmlVersion() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_DOC->version)).PtrC8(); + } + +// ----------------------------------------------------------------------------------------------- +// Sets XML version number to be shown in XML declaration when document is serialized. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::SetXmlVersionL( const TDesC8& aVersion ) + { + if(aVersion.Length()) + { + xmlChar* ver = xmlCharFromDesC8L(aVersion); + xmlFree((void*)LIBXML_DOC->version); + LIBXML_DOC->version = ver; + } + } + +// ----------------------------------------------------------------------------------------------- +// Retrieves base URI (if defined) of the document or NULL +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 RXmlEngDocument::DocumentUri() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_DOC->URL)).PtrC8(); + } + +// ----------------------------------------------------------------------------------------------- +// Sets location of the document. +// +// Document's URI is used as top-level base URI definition. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::SetDocumentUriL( const TDesC8& aUri ) + { + xmlChar* uri = xmlCharFromDesC8L(aUri); + if(LIBXML_DOC->URL) + xmlFree((void*)LIBXML_DOC->URL); + LIBXML_DOC->URL = uri; + } + +// ----------------------------------------------------------------------------------------------- +// @return Object that represents current DOM implementation +// @note There is no practical use of implementation object in this version +// of API other than for creating new RXmlEngDocument instances, but +// it will change in the future, when an implementation object +// is used for changing configuration settings at run-time. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDOMImplementation RXmlEngDocument::Implementation() const + { + return *iImpl; + } + +// ----------------------------------------------------------------------------------------------- +// Creates new text node and copies the content string into it. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngTextNode RXmlEngDocument::CreateTextNodeL( const TDesC8& aCharacters ) + { + xmlChar* con = xmlCharFromDesC8L(aCharacters); + xmlNodePtr textNode = xmlNewText(NULL); + if(!textNode) + { + delete con; + OOM_HAPPENED; + } + textNode->doc = LIBXML_DOC; + textNode->content = con; + TXmlEngNode text(textNode); + TakeOwnership(text); + return text.AsText(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new binary container and copies the content string into it. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngBinaryContainer RXmlEngDocument::CreateBinaryContainerL( const TDesC8& aCid, + const TDesC8& aData ) + { + // Note: TXmlEngBinaryContainer is treated internally by Libxml2 as text node. + + TUint len = aCid.Size(); + unsigned char* cid = new(ELeave) unsigned char[len + 1]; + memcpy(cid, aCid.Ptr(), len); + cid[len] = 0; + len = aData.Size(); + + CleanupStack::PushL(cid); + unsigned char* str = new(ELeave) unsigned char[len + 1]; + CleanupStack::Pop(cid); + + memcpy(str, aData.Ptr(), len); + str[len] = 0; + + xmlNodePtr contNode = xmlNewText(NULL); + if(!contNode) + { + delete cid; + delete str; + OOM_HAPPENED; + } + + contNode->ns = (xmlNs*) cid; + contNode->content = (xmlChar*) str; + contNode->properties = (xmlAttr*) len; + contNode->psvi = (void*) EBinaryContainer; + contNode->doc = LIBXML_DOC; + contNode->name = xmlStringTextNoenc; + xmlAppendDataList(contNode, LIBXML_DOC); + if(OOM_FLAG) + { + xmlFreeNode(contNode); + OOM_HAPPENED; + } + TXmlEngNode container(contNode); + TakeOwnership(container); + return container.AsBinaryContainer(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new binary container that stores reference to memory chunk mapped with descriptor +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngChunkContainer RXmlEngDocument::CreateChunkContainerL( const TDesC8& aCid, + const RChunk& aChunk, + const TInt aChunkOffset, + const TInt aDataSize ) + { + // Note: TXmlEngChunkContainer is treated internally by Libxml2 as text node. + TUint len = aCid.Size(); + unsigned char* cid = new(ELeave) unsigned char[len + 1]; + memcpy(cid, aCid.Ptr(), len); + cid[len] = 0; + + xmlNodePtr contNode = xmlNewText(NULL); + if(!contNode) + { + delete cid; + OOM_HAPPENED; + } + contNode->ns = (xmlNs*) cid; + contNode->content = (xmlChar*) &aChunk; + contNode->properties = (xmlAttr*) aDataSize; + contNode->nsDef = (xmlNs*) aChunkOffset; + contNode->psvi = (void*) EChunkContainer; + contNode->doc = LIBXML_DOC; + contNode->name = xmlStringTextNoenc; + xmlAppendDataList(contNode, LIBXML_DOC); + if(OOM_FLAG) + { + xmlFreeNode(contNode); + OOM_HAPPENED; + } + TXmlEngNode container(contNode); + TakeOwnership(container); + return container.AsChunkContainer(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new binary container that stores reference to memory chunk mapped with descriptor +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngFileContainer RXmlEngDocument::CreateFileContainerL( const TDesC8& aCid, + const RFile& aFile ) + + { + // Note: TXmlEngChunkContainer is treated internally by Libxml2 as text node. + TUint len = aCid.Size(); + unsigned char* cid = new(ELeave) unsigned char[len + 1]; + memcpy(cid, aCid.Ptr(), len); + cid[len] = 0; + + xmlNodePtr contNode = xmlNewText(NULL); + if(!contNode) + { + delete cid; + OOM_HAPPENED; + } + contNode->ns = (xmlNs*) cid; + contNode->content = (xmlChar*) &aFile; + TInt fileSize; + aFile.Size(fileSize); + contNode->properties = (xmlAttr*) fileSize; + contNode->psvi = (void*) EFileContainer; + contNode->doc = LIBXML_DOC; + contNode->name = xmlStringTextNoenc; + xmlAppendDataList(contNode, LIBXML_DOC); + if(OOM_FLAG) + { + xmlFreeNode(contNode); + OOM_HAPPENED; + } + TXmlEngNode container(contNode); + TakeOwnership(container); + return container.AsFileContainer(); + } +// ----------------------------------------------------------------------------------------------- +// Creates new comment node and copies the content string into it. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngComment RXmlEngDocument::CreateCommentL( const TDesC8& aText ) + { + xmlChar* con = xmlCharFromDesC8L(aText); + xmlNodePtr commentNode = xmlNewComment(NULL); + if(!commentNode) + { + delete con; + OOM_HAPPENED; + } + commentNode->doc = LIBXML_DOC; + commentNode->content = con; + TXmlEngNode comment(commentNode); + TakeOwnership(comment); + return comment.AsComment(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new processing instruction node and set its "target" and "data" values +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngProcessingInstruction RXmlEngDocument::CreateProcessingInstructionL( const TDesC8& aTarget, + const TDesC8& aData ) + { + if ( aTarget.Length( ) <= 0 ) + { + User::Leave( KXmlEngErrWrongUseOfAPI ); + } + + xmlChar* target = xmlCharFromDesC8L(aTarget); + CleanupStack::PushL(target); + xmlChar* data = xmlCharFromDesC8L(aData); + + xmlNodePtr piNode = xmlNewPI( target, + NULL ); + OOM_IF_NULL(piNode); + CleanupStack::PopAndDestroy(target); + piNode->content = data; + TXmlEngNode pi(piNode); + TakeOwnership(pi); + return pi.AsProcessingInstruction(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new CDATA section node and copies the content into it. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngCDATASection RXmlEngDocument::CreateCDATASectionL( const TDesC8& aContents ) + { + xmlChar* con = xmlCharFromDesC8L(aContents); + xmlNodePtr cdNode = xmlNewCDataBlock( LIBXML_DOC, + NULL, + 0); + if(!cdNode) + { + delete con; + OOM_HAPPENED; + } + cdNode->content = con; + TXmlEngNode cd(cdNode); + TakeOwnership(cd); + return cd.AsCDATASection(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new entity reference node for aEntityName entity +// +// aEntityName is a string in one of the forms: +// - name +// - &name +// - &name; +// +// where name is the name of the entity +// +// @note < , > , ' , " and other predefined entity references +// should not be created with this method. These entity refs are rather +// "character references" and encoded/decoded automatically. +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngEntityReference RXmlEngDocument::CreateEntityReferenceL( const TDesC8& aEntityRef ) + { + if ( aEntityRef.Length( ) <= 0 ) + { + User::Leave( KXmlEngErrWrongUseOfAPI ); + } + + xmlChar* er = xmlCharFromDesC8L(aEntityRef); + xmlNodePtr erNode = xmlNewReference( LIBXML_DOC, + er); + delete er; + OOM_IF_NULL(erNode); + TXmlEngNode eref(erNode); + TakeOwnership(eref); + return eref.AsEntityReference(); + } + +// ----------------------------------------------------------------------------------------------- +// Creates new element node that belongs to specific namespace. +// A namespace declaration node is created on the element. +// +// @param aNamespaceUri Namespace of new element +// @param aPrefix Prefix to use for namespace binding and QName of the element +// @param aLocalName Local name of the element +// +// @note If null namespace uri is provided element will be created without namespace. +// ----------------------------------------------------------------------------------------------- + +EXPORT_C TXmlEngElement RXmlEngDocument::CreateElementL( const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix ) + { + if ( aLocalName.Length( ) <= 0 ) + { + User::Leave( KXmlEngErrWrongUseOfAPI ); + } + // + xmlChar* name = xmlCharFromDesC8L(aLocalName); + xmlNodePtr nodeEl = xmlNewNode( NULL, + name); + delete name; + OOM_IF_NULL(nodeEl); + // +// if(aNamespaceUri.Length() || aPrefix.Length()) + if(aNamespaceUri.Length()) + { + CleanupStack::PushL(TCleanupItem(LibxmlNodeCleanup,(TAny*)nodeEl)); + xmlChar* nsU = xmlCharFromDesC8L(aNamespaceUri); + CleanupStack::PushL(nsU); + xmlChar* nsP = NULL; + if(aPrefix.Length()) + { + nsP = xmlCharFromDesC8L(aPrefix); + } + CleanupStack::Pop(nsU); + xmlNsPtr ns = xmlNewNs( NULL, + NULL, + NULL); + + if (!ns) + { + delete nsP; + delete nsU; + OOM_HAPPENED; + } + ns->href = nsU; + ns->prefix = nsP; + nodeEl->nsDef = ns; + nodeEl->ns = ns; + CleanupStack::Pop(); // nodeEl + } + nodeEl->doc = LIBXML_DOC; + + TXmlEngElement el(nodeEl); + TakeOwnership(el); + return el; + } + +// ----------------------------------------------------------------------------------------------- +// Creates new attribute, +// +// @param aName Name of the atribute; no prefix allowed +// @param aValue Value of the attribute (optional) +// @return Handler to the newly created attribute +// +// @note +// aValue should represent a correct value of an attribute if it is put as is into XML file +// (with all characters correctly escaped with entity references when XML spec requires) +// +// TXmlEngElement class provides a rich set of attribute creation methods, which not +// just create attribute nut also link it into element. +// +// There is no way to create attributes with namespace (despite the DOM spec); +// you have to use one of the TXmlEngElement::AddNewAttributeL(..) methods instead +// +// Returned handler is the only reference to the allocated memory +// until you have attached the attribute to some element node +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr RXmlEngDocument::CreateAttributeL( const TDesC8& aName, + const TDesC8& aValue ) + { + if ( aName.Length( ) <= 0 ) + { + User::Leave( KXmlEngErrWrongUseOfAPI ); + } + xmlChar* name = xmlCharFromDesC8L(aName); + CleanupStack::PushL(name); + xmlChar* value = xmlCharFromDesC8L(aValue); + + xmlAttrPtr attrNode = xmlNewDocProp( LIBXML_DOC, + name, + value ); + delete value; + CleanupStack::PopAndDestroy(name); + OOM_IF_NULL(attrNode); + TXmlEngNode attr(attrNode); + TakeOwnership(attr); + return attr.AsAttr(); + } + +// ----------------------------------------------------------------------------------------------- +// Sets "document" property on the node and all its descendants to be this RXmlEngDocument node +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode RXmlEngDocument::AdoptNodeL(TXmlEngNode aSource) + { + if ( aSource.ParentNode().NotNull() || aSource.OwnerDocument().IsSameNode( *this ) + || aSource.NodeType() == TXmlEngNode::EDocument ) + { + User::Leave( KXmlEngErrWrongUseOfAPI ); + } + + aSource.OwnerDocument().RemoveOwnership(aSource); + xmlSetTreeDoc(INTERNAL_NODEPTR(aSource), LIBXML_DOC); + TakeOwnership(aSource); + return aSource; + } + +// ----------------------------------------------------------------------------------------------- +// Main implementation of SaveL() functions that puts together all common code +// and serializes to buffer or output stream. +// @param aNode Root node to be serialized +// @param aBuffer buffer with serialized data. +// @param aOutputStream stream that should be used during serialization +// @param aOpt Options that control how serialization is performed +// @return Number of bytes written +// @leave KXmlEngErrWrongEncoding The encoding is not understood +// @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size +// @leave - One of the system-wide error codes +// ----------------------------------------------------------------------------------------------- +// +TInt RXmlEngDocument::SaveNodeL( TXmlEngNode aRoot, + RBuf8& aBuffer, + MXmlEngOutputStream* aOutputStream, + TXmlEngSerializationOptions aOpt) const + { + TInt size = -1; + const unsigned char* encoding; + xmlCharEncodingHandlerPtr encoder = NULL; + xmlSaveCtxt ctxt; + xmlOutputBufferPtr buf = NULL; + if (aBuffer.Length()) + { + aBuffer.Close(); + } + xmlNodePtr node = INTERNAL_NODEPTR(aRoot); + if(!node) + { + node = LIBXML_NODE; + } + xmlChar* enc =NULL; + if(aOpt.iEncoding.Length()) + enc = xmlCharFromDesC8L(aOpt.iEncoding); + CleanupStack::PushL(enc); + + encoding = enc; + if (!encoding) + { + encoding = node->doc->encoding; + } + if (encoding) + { + encoder = xmlFindCharEncodingHandler((char*)encoding); + if (encoder == NULL) + { + TEST_OOM_FLAG; + XmlEngLeaveL(KXmlEngErrWrongEncoding); + } + } + + if(aOutputStream) + { + buf = xmlOutputBufferCreateIO( XmlEngineIOWriteCallback, + XmlEngineIOCloseCallback, + aOutputStream, // a "context" know by the library + encoder ); + } + else + { + buf = xmlAllocOutputBuffer(encoder); + } + OOM_IF_NULL(buf); + + memset(&ctxt, 0, sizeof(ctxt)); + ctxt.doc = node->doc; + ctxt.encoding = encoding; + ctxt.buf = buf; + ctxt.level = 0; + ctxt.format = (aOpt.iOptions & TXmlEngSerializationOptions::KOptionIndent) ? 1 : 0; + if(aOpt.iDataSerializer) + { + ctxt.textNodeCallback = (xmlSaveTextNodeCallback) DataSerializationCallback; + ctxt.context = aOpt.iDataSerializer; + } + xmlSaveCtxtInit(&ctxt); + + xmlNodeFilterData filterData = {0,0}; // Fix to DEF133066. + // The scope of 'afilterData' (now 'filterData') has been increased so that it is valid when + // passed to 'xmlNodeDumpOutputInternal(&ctxt, node)' as a member of 'ctxt' + if (aOpt.iNodeFilter) + { + filterData.fn = aOpt.iNodeFilter; + filterData.proxyFn = NodeFilterCallback; + ctxt.nodeFilter = &filterData; + } + + if(!(aOpt.iOptions & TXmlEngSerializationOptions::KOptionOmitXMLDeclaration)) + { + const TInt KXmlOpenTagLength = 14; + const TInt KXmlOpenTagEncLength = 10; + const TInt KXmlOpenTagStdLength1 = 16; + const TInt KXmlOpenTagStdLength2 = 17; + const TInt KXmlCloseTagEncLength = 1; + const TInt KXmlCloseTagLength = 2; + + xmlOutputBufferWrite(buf,KXmlOpenTagLength,"doc->version != NULL) + xmlBufferWriteQuotedString(buf->buffer, node->doc->version); + else + xmlOutputBufferWrite(buf, 5, "\"1.0\""); + + if (encoding && (aOpt.iOptions & TXmlEngSerializationOptions::KOptionEncoding)) + { + xmlOutputBufferWrite(buf,KXmlOpenTagEncLength," encoding="); + xmlBufferWriteQuotedString(buf->buffer,encoding); + } + + if (aOpt.iOptions & TXmlEngSerializationOptions::KOptionStandalone) + { + switch (node->doc->standalone) + { + case 0: + xmlOutputBufferWrite(buf, KXmlOpenTagStdLength1, " standalone=\"no\""); + break; + case 1: + xmlOutputBufferWrite(buf, KXmlOpenTagStdLength2, " standalone=\"yes\""); + break; + } + } + xmlOutputBufferWrite(buf,KXmlCloseTagLength,"?>"); + if(ctxt.format) + { + xmlOutputBufferWrite(buf,KXmlCloseTagEncLength,"\n"); + } + } + xmlNodeDumpOutputInternal(&ctxt, node); + + if(xmlOOMFlag()) + { + xmlOutputBufferClose(buf); + OOM_HAPPENED; + } + + if(!aOutputStream) + { + if(buf->encoder) + { + xmlCharEncOutFunc(buf->encoder, buf->conv, buf->buffer); + size = buf->conv->use; + aBuffer.Assign(buf->conv->content,size,size); // frees any previous contents of aBuffer argument + buf->conv->content = NULL; // To prevent it from freeing + } + else + { + size = buf->buffer->use; + aBuffer.Assign(buf->buffer->content,size,size); // frees any previous contents of aBuffer argument + buf->buffer->content = NULL; // To prevent it from freeing + } + } + else + { + size = buf->buffer->use; + } + TInt res = xmlOutputBufferClose(buf); + + if ((size < 0) || (res == -1)) + { + XmlEngLeaveL(KXmlEngErrNegativeOutputSize); + } + CleanupStack::PopAndDestroy(enc); + if(!aOutputStream) + { + return size; + } + else + { + return res; + } + } + +// ----------------------------------------------------------------------------------------------- +// "Secondary" constructor that should be called on every newly created document node. +// Initializes container for nodes owned by the document. +// +// The need for such secondary constructor is in the fact that underlying libxml2 +// library knows nothing about ownership of unlinked nodes -- this feature is +// implemented in C++ DOM wrapper. +// ----------------------------------------------------------------------------------------------- +// +void RXmlEngDocument::InitOwnedNodeListL() + { + if(!LIBXML_DOC->ownedNodes) + LIBXML_DOC->ownedNodes = CXmlEngOwnedNodesContainer::NewL(); + } + +// ----------------------------------------------------------------------------------------------- +// Adds aNode to the list of owned nodes - the nodes that are not linked yet into a +// document tree, but still destroyed with the document that owns them. +// +// In case of OOM (during growing node list container) the argument node is freed with +// xmlFreeNode() +// ----------------------------------------------------------------------------------------------- +// +void RXmlEngDocument::TakeOwnership(TXmlEngNode aNode) + { + CXmlEngOwnedNodesContainer* nc = (CXmlEngOwnedNodesContainer*) LIBXML_DOC->ownedNodes; + if(aNode.ParentNode().NotNull()) + return; + RXmlEngDocument owner = aNode.OwnerDocument(); + if(owner.NotNull() && !owner.IsSameNode(*this)) + { + owner.RemoveOwnership(aNode); + } + + nc->Add(INTERNAL_NODEPTR(aNode)); + INTERNAL_NODEPTR(aNode)->doc = LIBXML_DOC; + } + +void RXmlEngDocument::RemoveOwnership(TXmlEngNode aNode) + { + if(LIBXML_DOC) + ((CXmlEngOwnedNodesContainer*)(LIBXML_DOC->ownedNodes))->Remove(INTERNAL_NODEPTR(aNode)); + } + +// ----------------------------------------------------------------------------------------------- +// Registers specified attribute as xml:id. +// First parametr allows user, to specify sub-tree, not to search whole document. +// To search whole tree see @see RegisterXmlId(const TDesC8&,const TDesC8&) +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::RegisterXmlIdL(TXmlEngElement aStartElement, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri) + { + if ( !aLocalName.Compare(KNullDesC8) || aStartElement.IsNull() + || !aStartElement.OwnerDocument().IsSameNode(*this) || aStartElement.OwnerDocument().IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + xmlChar* name = xmlCharFromDesC8L(aLocalName); + CleanupStack::PushL(name); + xmlChar* nsU = NULL; + if(aNamespaceUri.Length()) + nsU=xmlCharFromDesC8L(aNamespaceUri); + + const xmlChar* ids[3]; + ids[0] = name; + ids[1] = nsU; + ids[2] = NULL; + + TInt error = xmlAddIDs(INTERNAL_NODEPTR(aStartElement), ids); + + delete nsU; + CleanupStack::PopAndDestroy(name); + + switch (error) + { + case 0: + break; + case -1: + User::Leave(KErrAlreadyExists); + break; + case -2: + User::Leave(KErrNoMemory); + break; + case -3: + User::Leave(KErrArgument); + break; + default: + //User::Panic(); ? + break; + } + + } + +// ----------------------------------------------------------------------------------------------- +// Registers specified attribute as xml:id. +// Not to search whole tree see @see RegisterXmlId(TXmlEngElement,const TDesC8&,const TDesC8&) +// ----------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDocument::RegisterXmlIdL(const TDesC8& aLocalName, + const TDesC8& aNamespaceUri) + { + if (IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + RegisterXmlIdL(DocumentElement(),aLocalName, aNamespaceUri); + } + +// --------------------------------------------------------------------------------------------- +// Looks for element with specified value of xmlId +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement RXmlEngDocument::FindElementByXmlIdL( const TDesC8& aValue ) const + { + xmlChar* value = xmlCharFromDesC8L(aValue); + xmlAttrPtr attr = xmlGetID( LIBXML_DOC, value ); + delete value; + if (attr==NULL) + { + return TXmlEngElement(NULL); + } + return TXmlEngElement(attr->parent); + } + +// --------------------------------------------------------------------------------------------- +// Retrieves an array of chunk containers +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDocument::GetDataContainerList( RArray& aList ) + { + TInt i = 0; + TInt error = 0; + while( LIBXML_DOC->dataNodeList[i] ) + { + TXmlEngNode node(LIBXML_DOC->dataNodeList[i]); + error = aList.Append( node.AsDataContainer() ); + if (error) break; + ++i; + } + return error; + } + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument::RXmlEngDocument():TXmlEngNode(NULL), iImpl(NULL) + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdombase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdombase.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,119 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Document & node callbacks +// + +#include +#include +#include +#include +#include "xmlengdomdefs.h" +#include "xmlengownednodescontainer.h" +#include +#include +#include +#include "libxml2_globals_private.h" +#include + + +void NodeConstructCallback( + xmlNodePtr aNode) + { + // NOTE for further evaluation of component _private is not copied by libxml + if (aNode && aNode->_private) + { + if (aNode->type == XML_ELEMENT_NODE || aNode->type == XML_ATTRIBUTE_NODE) + { + MXmlEngUserData* data = static_cast(aNode->_private); + TInt err; + TRAP(err,aNode->_private = data->CloneL()); + if(err == KErrNoMemory) + xmlSetOOM(); + } + } + } + +void NodeDestructCallback( + xmlNodePtr aNode ) + { + if (aNode && aNode->_private) + { + if (aNode->type == XML_ELEMENT_NODE || aNode->type == XML_ATTRIBUTE_NODE) + { + MXmlEngUserData* data = static_cast(aNode->_private); + aNode->_private = NULL; + data->Destroy(); + } + } + } + +int XMLCALL NodeFilterCallback(void* aFilter, xmlNodePtr aNode) + { + MXmlEngNodeFilter* filter = reinterpret_cast(aFilter); + return (int)filter->AcceptNode(*reinterpret_cast(&aNode)); + } + +void SetUserDataCallbacks() + { + xmlRegisterNodeDefault(NodeConstructCallback); + xmlDeregisterNodeDefault(NodeDestructCallback); + } + +xmlChar* xmlCharFromDesC8L(const TDesC8& aDesc) + { + if(!aDesc.Length()) + { + return NULL; + } + xmlChar* newContent = (xmlChar*)new(ELeave) TUint8[aDesc.Length() + 1]; + *(Mem::Copy((TAny*)newContent, aDesc.Ptr(), aDesc.Length())) = 0; + return newContent; + } + +void xmlCharAssignToRbuf8L(RBuf8& aOutput,xmlChar* text) +{ +if(aOutput.Length()) + { + aOutput.Close(); + } +if(text) + { + aOutput.Assign(text,strlen((char*)text),strlen((char*)text)); + } +else + { + aOutput.Assign(text,0); + } +} +//-------------------------------------------- +//using CXmlEngOwnedNodesContainer; + +void LibxmlDocumentCleanup( + TAny* aDocPtr ) + { + if(((xmlDocPtr)aDocPtr)->ownedNodes) + { + CXmlEngOwnedNodesContainer* nc = (CXmlEngOwnedNodesContainer*)(((xmlDocPtr)aDocPtr)->ownedNodes); + nc->FreeAll(); + xmlFree(nc->iNodes); + xmlFree(nc); + } + xmlFreeDoc((xmlDocPtr)aDocPtr); + } + +void LibxmlNodeCleanup( + TAny* aNodePtr ) + { + xmlFreeNode((xmlNodePtr)aNodePtr); + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdomdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdomdefs.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,67 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Declaration of macros used in DOM and XPath +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGDOMDEFS_H +#define XMLENGDOMDEFS_H + +#include +#include +#include +#include + +// warning C4238: nonstandard extension used : class rvalue used as lvalue +// it happens often during casts or passing non-variable arguments to methods expecting a non-const reference +//#pragma warning(disable: 4238) + +#define INTERNAL_NODEPTR(aNodeObject) (*reinterpret_cast(&(aNodeObject))) +#define INTERNAL_ATTRPTR(aAttrObject) (*reinterpret_cast(&(aAttrObject))) +#define INTERNAL_NSPTR(aNsDefObject) (*reinterpret_cast(&(aNsDefObject))) +#define INTERNAL_DOCPTR(aDocObject) (*reinterpret_cast(&(aDocObject))) +#define INTERNAL_NODESETPTR(aSetObj) \ + (*reinterpret_cast(const_cast(&(aSetObj)))) +#define INTERNAL_XPATHOBJPTR(aObj) \ + (*reinterpret_cast(const_cast(&(aObj)))) +#define LIBXML_NODE (static_cast(iInternal)) +#define CAST_DOMSTRING_TO_XMLCHAR(domstring) \ + (reinterpret_cast(domstring.Cstring())) +#define CAST_XMLCHAR_TO_DOMSTRING(libxmlString) \ + (TXmlEngConstString(reinterpret_cast(libxmlString))) +#define CAST_XMLCHAR_TO_STRING(libxmlString) \ + (TXmlEngString(reinterpret_cast(libxmlString))) +#define CAST_NODELIST_REF(List) ((TXmlEngNodeListImpl&)(List)) + +#define TDOMNODETYPENONE ((TXmlEngDOMNodeType)0) +//data container type is stored in psvi field of text node +#define TEXT_NODE_DATA_TYPE LIBXML_NODE->psvi + +#define WRONG_USE_OF_API XmlEngLeaveL(KXmlEngErrWrongUseOfAPI) +#define XE_ASSERT_DEBUG(assertion) __ASSERT_DEBUG((assertion), XmlEngLeaveL(KXmlEngErrWrongUseOfAPI)) +#define XE_ASSERT_ALWAYS(assertion) __ASSERT_ALWAYS((assertion), XmlEngLeaveL(KXmlEngErrNullNode)) + +void SetUserDataCallbacks(); + +xmlChar* xmlCharFromDesC8L(const TDesC8& aDesc); + +void xmlCharAssignToRbuf8L(RBuf8& aOutput,xmlChar *text); + +#endif /* XMLENGDOMDEFS_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdomimplementation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdomimplementation.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for element node +// + +#include +#include +#include "xmlengdomdefs.h" + +// --------------------------------------------------------------------------------------------- +// Opens DOMImplementation +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDOMImplementation::OpenL( RHeap* /*aHeap not implemented yet*/ ) + { + XmlEngineAttachL(); + SetUserDataCallbacks(); + }; + +// --------------------------------------------------------------------------------------------- +// Close DOMImplementation +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDOMImplementation::Close(TBool /*aReserved*/) + { + Close(); + }; + +// --------------------------------------------------------------------------------------------- +// Close DOMImplementation +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDOMImplementation::Close() + { + XmlEngineCleanup(); + }; + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdomparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdomparser.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,305 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implements methods for parsing XML data +// + +#include + +#include +#include +#include +#include +#include +#include +#define PARSER_CTXT (static_cast(iInternal)) + +// --------------------------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDOMParser::RXmlEngDOMParser(): iInternal(NULL), iError(0), iImpl(NULL) + { + } + +// --------------------------------------------------------------------------------------------- +// Opens parser +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDOMParser::Open(RXmlEngDOMImplementation& aDOMImpl) + { + iImpl = &aDOMImpl; + return KErrNone; + }; + +// --------------------------------------------------------------------------------------------- +// Frees all allocated by parser resources. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDOMParser::Close() + { + Cleanup(); + iImpl = NULL; + } +// --------------------------------------------------------------------------------------------- +// Builds DOM document from file. File is read by blocks of specified size, thus, +// avoiding keeping in memory both file and DOM tree for it. +// +// @note Use RDOMPushParser for parsing large files. +// @param aRFs File server session +// @param aFileName File name +// @return The created document +// @see GetLastParsingError() +// @leave KXmlEngErrParsing Parsing error +// @leave KXmlEngErrWrongUseOfAPI OpenL() not previously called +// @leave - One of the system-wide error codes +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument RXmlEngDOMParser::ParseFileL( + RFs &aRFs, + const TDesC& aFileName, + TUint aChunkSize ) + { + if ( aChunkSize == 0 ) + { + return ParseFileWithoutChunksL( aRFs, aFileName ); + } + + RFile xmlFile; + TInt res; + + User::LeaveIfError(xmlFile.Open(aRFs, aFileName, EFileRead | EFileShareReadersOnly)); + CleanupClosePushL(xmlFile); + + RBuf8 buffer; + if (aChunkSize < (KMaxTInt/2)) + { + buffer.CreateL(aChunkSize); + } + else + { + User::Leave(KErrArgument); + } + CleanupClosePushL(buffer); + + User::LeaveIfError(xmlFile.Read(buffer,aChunkSize)); + TUint length; + + do + { + ParseChunkL(buffer); + res = xmlFile.Read(buffer, aChunkSize); + if(res) + { + Close(); + User::Leave(res); + } + length = buffer.Length(); + } while (length); + + CleanupStack::PopAndDestroy(&buffer); + CleanupStack::PopAndDestroy(&xmlFile); + return FinishL(); + } +// --------------------------------------------------------------------------------------------- +// Builds DOM document from file. +// @see ParseFileL(RFs,TDesC&,TUint) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument RXmlEngDOMParser::ParseFileL( + const TDesC& aFileName, + TUint aChunkSize ) + { + RFs aRFs; + User::LeaveIfError(aRFs.Connect()); + CleanupClosePushL(aRFs); + RXmlEngDocument doc = ParseFileL(aRFs, aFileName, aChunkSize); + CleanupStack::PopAndDestroy(); // aRFs + return doc; + } +// --------------------------------------------------------------------------------------------- +// Pushes new data from buffer to DOM parser. +// Parsing is performed synchronously; method returns as soon as block is parsed. +// +// Buffer contents is not needed for further parsing after this method. +// Method may leave with KErrXMLSyntax code or one of general codes (e.g. KErrNoMemory) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngDOMParser::ParseChunkL( + const TDesC8& aBuffer ) + { + if(!iImpl) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + xmlParserCtxtPtr ctxt = PARSER_CTXT; + if(!ctxt) + { + iError = KErrNone; + // First call after reset or parser creation + ctxt = xmlCreatePushParserCtxt( + NULL , /* default set of callbacks is used (for building tree) */ + NULL , /* save as userData */ + (const char*)aBuffer.Ptr(), + aBuffer.Size(), + NULL /* filename or URI */); + if(!ctxt) + { + XmlEngOOMTestL(); + }; + iInternal = ctxt; + xmlCtxtUseOptions(ctxt, XML_PARSE_DTDLOAD | XML_PARSE_NOENT | XML_PARSE_NODICT); + iError = xmlParseChunk(ctxt, + "" , /* char* data */ + 0 , /* int size */ + 0); /* flag: 0 - not the last chunk */ + } + else + { + iError = xmlParseChunk(ctxt, + (char*)aBuffer.Ptr(), /* char* data */ + (TInt)aBuffer.Size(), /* int size */ + 0); /* flag: 0 - not the last chunk */ + } + if(iError != XML_ERR_OK && ctxt->lastError.level == XML_ERR_FATAL) + { + Cleanup(); + XmlEngOOMTestL(); + User::Leave(KXmlEngErrParsing); + } + } + +// --------------------------------------------------------------------------------------------- +// Returns constructed document after the last block of XML document is parsed. +// Ownership over returned RXmlEngDocument object is transferred to the caller of the method. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument RXmlEngDOMParser::FinishL() + { + if(!iImpl) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + xmlDocPtr doc; + xmlParserCtxtPtr ctxt = PARSER_CTXT; + + if(!ctxt) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + iError = xmlParseChunk(ctxt, + NULL /* char* data */, + 0 /* int size */, + 1 /* flag: 1 - the last chunk */); + + if(iError != XML_ERR_OK && ctxt->lastError.level == XML_ERR_FATAL) + { + Cleanup(); + XmlEngOOMTestL(); + User::Leave(KXmlEngErrParsing); + } + + doc = ctxt->myDoc; + ctxt->myDoc = NULL; + xmlFreeParserCtxt(ctxt); + iInternal = NULL; + RXmlEngDocument rdoc; + rdoc.OpenL(*iImpl,doc); + return rdoc; + } + +// --------------------------------------------------------------------------------------------- +// Parses XML data from memory buffer and builds DOM RXmlEngDocument +// +// May leave with KXmlEngErrParsing code +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument RXmlEngDOMParser::ParseL( + const TDesC8& aBuffer ) + { + if(!iImpl) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + TInt code = 0; + xmlDocPtr tree = xmlSAXParseDoc( + NULL, + (xmlChar*) aBuffer.Ptr(), + aBuffer.Size(), + 0, + &code /* errorCode */); + TEST_OOM_FLAG; + iError = code; + if(!tree) + XmlEngLeaveL(KXmlEngErrParsing); + RXmlEngDocument doc; + doc.OpenL(*iImpl,tree); + return doc; + } +// --------------------------------------------------------------------------------------------- +// Return last parsing error +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngDOMParser::GetLastParsingError() + { + return iError; + } +// --------------------------------------------------------------------------------------------- +// Parses XML file and builds DOM RXmlEngDocument without usage of chunks +// +// May leave with KXmlEngErrParsing code (besides system I/O error codes) +// --------------------------------------------------------------------------------------------- +// +RXmlEngDocument RXmlEngDOMParser::ParseFileWithoutChunksL( + RFs &aRFs, + const TDesC& aFileName ) + { + TInt size; + RFile xmlFile; + + // Read file + User::LeaveIfError(xmlFile.Open(aRFs, aFileName, EFileRead | EFileShareReadersOnly)); + CleanupClosePushL(xmlFile); + User::LeaveIfError(xmlFile.Size(size)); + HBufC8* buffer = HBufC8::NewLC(size); + TPtr8 bufferPtr = buffer->Des(); + User::LeaveIfError(xmlFile.Read(bufferPtr, size)); + + RXmlEngDocument doc = ParseL(bufferPtr); + + CleanupStack::PopAndDestroy(buffer); + CleanupStack::PopAndDestroy(&xmlFile); + return doc; + } + +// --------------------------------------------------------------------------------------------- +// Cleanup internal data +// --------------------------------------------------------------------------------------------- +// +void RXmlEngDOMParser::Cleanup() + { + xmlParserCtxtPtr ctxt = PARSER_CTXT; + // free all allocated resources + if(ctxt) + { + if(ctxt->myDoc) + xmlFreeDoc(ctxt->myDoc); + xmlFreeParserCtxt(ctxt); + iInternal = NULL; + } + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengdomutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengdomutils.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Dom Utilities not part of SDK API +// + +#include +#include +#include "xmlengdomdefs.h" + +EXPORT_C void TDomUtils::XmlEngRenameElementL(TXmlEngElement aElement, const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix) + { + aElement.RenameElementL(aLocalName, aNamespaceUri, aPrefix); + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengelement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengelement.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1581 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for element node +// + +#include +#include +#include +#include +#include +#include +#include "xmlengdomdefs.h" +#include +#include +#include +#include +#include "libxml2_tree_private.h" + +#define LIBXML_ELEMENT (static_cast(iInternal)) + +void ResetNs(xmlNodePtr node,xmlNsPtr ns) + { + if(node->ns == ns) + { + node->ns = NULL; + } + xmlNodePtr child = node->children; + while (child) + { + if(child->type == XML_ELEMENT_NODE) + { + ResetNs(child,ns); + } + child = child->next; + } + xmlAttrPtr attr = node->properties; + while (attr) + { + if(attr->type == XML_ATTRIBUTE_NODE && attr->ns == ns) + { + attr->ns = NULL; + } + attr = attr->next; + } + }; + +// --------------------------------------------------------------------------------------------- +// Creates new attribute node out of any namespace (i.e. it has no prefix), +// sets attribute's value and links it as the last attribute of the current element +// +// @param aName A local name of attribute +// @param aValue Value to set for new attribute or NULL (sets value to "") +// @return A handler to the newly created attribute node; +// +// For adding attribute as the first one, use TXmlEngNode::SetAsFirstSibling() on the attribute: +// @code +// TXmlEngElement el = ... ; // get some element +// el.AddNewAttributeL("version","0.1").SetAsFirstSibling(); +// @endcode +// +// @see SetAsLastSibling(), MoveBeforeSibling(TXmlEngNode) and MoveAfterSibling(TXmlEngNode) +// +// @note - No checks are made that attribute with such name exists +// Use this method only on newly created elements! +// Otherwise, use TXmlEngElement::SetAttributeL(..) +// - Attributes do not inherit default namespace of its element +// (http://w3.org/TR/REC-xml-names/#defaulting) +// - attribute's value is the second argument in all AddNewAttributeL(..) methods +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddNewAttributeL( + const TDesC8& aName, + const TDesC8& aValue ) + { + if ( !iInternal ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( aName.Length() <= 0 ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + // + xmlChar* name = xmlCharFromDesC8L(aName); + CleanupStack::PushL(name); + xmlChar* value = xmlCharFromDesC8L(aValue); + xmlAttrPtr attr = xmlNewProp( // NOTE: no checks that such attribute already exists + LIBXML_ELEMENT, + name, + value); + delete value; + CleanupStack::PopAndDestroy(name); + OOM_IF_NULL(attr); + return TXmlEngNode(attr).AsAttr(); + } + +// --------------------------------------------------------------------------------------------- +// Creates new attribute node and add it to the element +// +// Provided handle to namespace declaration is used to set up +// attribute's namespace. +// +// @note If aNsDef is not defined in some of attributes ascendants +// (including this element), then +// ReconcileNamespacesL() method must be called on +// this element later. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddNewAttributeL( + const TDesC8& aName, + const TDesC8& aValue, + TXmlEngNamespace aNsDef) + { + TXmlEngAttr attr = AddNewAttributeL(aName, aValue); + + _LIT(KAutoPrefix,"_pr%d"); + const TInt KMaxPrefLength = 20; + TBuf prefix; + + TUint ind = 0; + char* prefCh = NULL; + xmlNsPtr ns; + + if (aNsDef.NotNull()) + { + if (aNsDef.IsDefault()) + { + // create new temporary namespace binding (with non-NULL prefix) + ns = NULL; + while(!ns) + { + // generate prefix + ++ind; + prefix.Format(KAutoPrefix,ind); + prefCh = XmlEngXmlCharFromDesL(prefix); + TXmlEngConstString pref(prefCh); + delete prefCh; + + if(!xmlSearchNs(LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + CAST_DOMSTRING_TO_XMLCHAR(pref))) + { + ns = xmlNewNs( + LIBXML_ELEMENT, + INTERNAL_NSPTR(aNsDef)->href, + CAST_DOMSTRING_TO_XMLCHAR(pref)); + TEST_OOM_FLAG; + } + } + } + else + { + ns = INTERNAL_NSPTR(aNsDef); + } + INTERNAL_ATTRPTR(attr)->ns = ns; + } + return attr; + } + +// --------------------------------------------------------------------------------------------- +// Creates new attribute on the element. Namespace declaration for the attribute namespace is +// created too. +// +// @note +// - Namespace declarations are reused if possible (no redundant ones are created) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddNewAttributeL( + const TDesC8& aName, + const TDesC8& aValue, + const TDesC8& aNsUri, + const TDesC8& aPrefix ) + { + TXmlEngAttr attr = AddNewAttributeL(aName, aValue); + + if (!aPrefix.Length()) // NULL or "" + { + if (aNsUri.Length()) // !(NULL or "") --> namespace URI is present + { + // An attribute cannot have default namespace (Pref = "" AND nsUri!="") + WRONG_USE_OF_API; + } + return attr; + } + + TXmlEngNamespace nsDef = AddNamespaceDeclarationL(aNsUri, aPrefix); + INTERNAL_ATTRPTR(attr)->ns = INTERNAL_NSPTR(nsDef); + return attr; + } + +// --------------------------------------------------------------------------------------------- +// Creates new attributes using namespace, which is bound to the specified prefix +// +// Please, use this mothod only for construction of new parts of DOM tree, where +// you know for sure that prefix is bound in the given scope. +// @code +// TXmlEngElement el = parent.AddNewAttributeUsePrefixL("property","ObjName","rdf"); +// el.AddNewAttributeUsePrefixL("type", "xs:integer", "rdf"); +// @endcode +// +// Otherwise, you should check that prefix is bound like this example shows: +// @code +// TXmlEngNamespace boundNS = TXmlEngNamespace::LookupByPrefix(thisElement, prefix); +// if (boundNS.NotNull()){ +// thisElement.AddNewAttributeUsePrefixL("name", value, prefix); +// } +// @endcode +// +// @note +// Use AddNewAttributeNsL(name,value,nsDefNode) as much as you can, because +// it is most efficient way to create namespaced DOM elements (no additional +// lookups for namespace declarations are required). +// +// @code +// // If namespace with given URI is not in the scope, then it will be declared +// // and bound to "data" prefix. +// TXmlEngNamespace nsDef = elem.FindOrCreateNsDeclL("http://../Data", "data"); +// elem.AddNewAttributeL("location", "...", nsDef); +// elem.AddNewElementL("child", nsDef).AddNewAttributeL("attr","...value..."); +// // the result is +// ... +// +// +// +// ... +// // +// @endcode +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddNewAttributeUsePrefixL( + const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aPrefix ) + { + _LIT8(KXml,"xml"); + TXmlEngAttr attr = AddNewAttributeL(aLocalName, aValue); + // try to locate namespace binding for the same prefix + xmlChar* prefix = xmlCharFromDesC8L(aPrefix); + xmlNsPtr ns = xmlSearchNs( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + prefix); + delete prefix; + + if (!ns) + { + // OOM may happen ONLY for "xml" prefix search + OOM_IF(!aPrefix.Compare(KXml)); + WRONG_USE_OF_API; // Prefix is not bound + } + INTERNAL_ATTRPTR(attr)->ns = ns; + return attr; +} + +// --------------------------------------------------------------------------------------------- +// Creates new attributes using namespace in the scope, which has specified URI +// +// Almost the same as AddNewAttributeUsePrefixL(...) but does lookup by namespace URI +// +// @return - NULL attribute if namespace declaration is not found OR newly added to the end of +// attribute list attribute of this element. +// +// @see AddNewAttributeUsePrefixL(TDesC8,TDesC8,TDesC8) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddNewAttributeWithNsL( + const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aNsUri ) + { + _LIT8(KXmlNs,"http://www.w3.org/XML/1998/namespace"); + // try to locate namespace binding for the same prefix + xmlChar* nsp = xmlCharFromDesC8L(aNsUri); + xmlNsPtr ns = xmlSearchNsByHref( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + nsp); + delete nsp; + + if (!ns) + { + // OOM may happen ONLY for "xml" prefix search + OOM_IF(!aNsUri.Compare(KXmlNs)); + TXmlEngAttr attr; + return attr; + } + + TXmlEngAttr attr = AddNewAttributeL(aLocalName, aValue); + + INTERNAL_ATTRPTR(attr)->ns = ns; + return attr; + } + +// --------------------------------------------------------------------------------------------- +// Adds child element with no namespace +// +// @param aName name of the element +// +// Results in adding element with aName and no prefix. +// +// This method is the best for creation of non-namespace based documents +// or document fragments, where no default namespace declared. +// +// It may be used also as a method for adding element from default namespace, +// BUT namespace will be assigned ONLY after serialization of the current +// document and parsing it back into a DOM tree!! If you need that default namespace +// was inherited by new element immediately use: +// @code +// ... +// TXmlEngNamespace defns = element.DefaultNamespace(); +// TXmlEngElement newEl = element.AddNewElementL("Name",defns); +// ... +// @endcode +// +// If truly undefined namespace for the element is required, then DO NOT USE +// this method if there is a default namespace in the scope! +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementL( + const TDesC8& aName ) + { + if ( !iInternal ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( aName.Length() <= 0 ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + xmlChar* name = xmlCharFromDesC8L(aName); + xmlNodePtr element = xmlNewNode(NULL, name); + delete name; + // + OOM_IF_NULL(element); + // + element->parent = LIBXML_ELEMENT; + element->doc = LIBXML_ELEMENT->doc; + // Link element as the last child + xmlNodePtr prev = LIBXML_ELEMENT->last; + LIBXML_ELEMENT->last = element; + element->prev = prev; + if (prev) + { + prev->next = element; + } + if (!(LIBXML_ELEMENT->children)) + { + LIBXML_ELEMENT->children = element; + } + return TXmlEngElement(element); + } + +// --------------------------------------------------------------------------------------------- +// Creates new child element with provided name, prefix and namespace URI +// +// New namespace declaration will be attached to the parent (this) element and used +// as namespace for newly created child element. If such binding already exists +// (same prefix is bound to same URI), it will be reused. If the prefix is already +// bound to some another namespace URI, it will be rebound by the new namespace +// declaration node. +// +// @param aLocalName Name of the element +// @param aNsUri URI of element's namespace +// @param aPrefix Prefix of the element +// @return Created element node (and added as the last child of its parent) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementL( + const TDesC8& aLocalName, + const TDesC8& aNsUri, + const TDesC8& aPrefix ) + { + TXmlEngElement element = AddNewElementL(aLocalName); + TXmlEngNamespace nsDef = AddNamespaceDeclarationL(aNsUri, aPrefix); + INTERNAL_NODEPTR(element)->ns = INTERNAL_NSPTR(nsDef); + return element; + } + +// --------------------------------------------------------------------------------------------- +// Creates new child element with provided name and namespace declaration +// +// @param aLocalName Name of the element +// @param aNsDef Handle of the namespace declaration, that must be retrieved from +// one of the ascendant nodes of the new elements (and its prefix +// should not be remapped to another namespace URI for the scope +// of the new element) +// @return Created element node (and added as the last child of its parent) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementL( + const TDesC8& aLocalName, + TXmlEngNamespace aNsDef ) + { + TXmlEngElement element = AddNewElementL(aLocalName); + INTERNAL_NODEPTR(element)->ns = INTERNAL_NSPTR(aNsDef); + return element; + } + +// --------------------------------------------------------------------------------------------- +// Adds child element with same namespace (and prefix if present) as parent element has +// +// @param aLocalName element's name +// @return New element that was added to the end of children list of its parent (this element) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementSameNsL( + const TDesC8& aLocalName ) + { + TXmlEngElement element = AddNewElementL(aLocalName); + INTERNAL_NODEPTR(element)->ns = LIBXML_ELEMENT->ns; + return element; + } + +// --------------------------------------------------------------------------------------------- +// Performs lookup for the namespace declaration for specified prefix and +// adds new child element with found namespace. +// +// The assumption is that prefix is bound, otherwise run-time error +// (Symbian's Leave or exception) occurs +// +// @note Use this method only if there is a binding for the given prefix. +// +// @param aLocalName element's name +// @param aPrefix prefix to use +// @return new TXmlEngElement that was added to the end of children list of its parent (this element) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementUsePrefixL( + const TDesC8& aLocalName, + const TDesC8& aPrefix ) + { + _LIT8(KXml,"xml"); + TXmlEngElement element = AddNewElementL(aLocalName); + // Can fail only with XML's namespace + xmlChar* pref = xmlCharFromDesC8L(aPrefix); + xmlNsPtr ns = xmlSearchNs( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + pref); + delete pref; + // + OOM_IF(!ns && !aPrefix.Compare(KXml)); + // + INTERNAL_NODEPTR(element)->ns = ns; + return element; + } + +// --------------------------------------------------------------------------------------------- +// Performs lookup for the namespace declaration for specified namespace URI and +// adds new child element with found namespace. +// +// The assumption is that namespace with given URI was declared, +// otherwise run-time error (Symbian' Leave or exception) occurs +// +// @note Use this method only if namespace declaration for the provided URI exists. +// +// @param aLocalName element's name +// @param aNsUri namespace of element +// @return new TXmlEngElement that was added to the end of children list of its parent (this element) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementWithNsL( + const TDesC8& aLocalName, + const TDesC8& aNsUri ) + { + _LIT8(KXmlNs,"http://www.w3.org/XML/1998/namespace"); + TXmlEngElement element = AddNewElementL(aLocalName); + /*xmlNsPtr ns = xmlSearchNsByHref( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + CAST_DOMSTRING_TO_XMLCHAR(aNsUri)); + */ + TXmlEngNamespace ns = LookupNamespaceByUriL(aNsUri); + // May fail only with XML's namespace + OOM_IF(ns.IsNull() && !aNsUri.Compare(KXmlNs)); + // + INTERNAL_NODEPTR(element)->ns = INTERNAL_NSPTR(ns); + return element; + } + +// --------------------------------------------------------------------------------------------- +// Creates new child element; if there is no a prefix binding for new element's namespace, +// a namespace decaration is created with generated prefix at specified element. +// +// @param aLocalName Name of the element to create +// @param aNsUri Namespace URI of the new element +// @param aNsDeclTarget An element where namespace declaraton should be placed +// if there is a needed to create new namespace declaration; +// NULL is used to specify the created element itself +// +// As aNsDeclTarget any ascendant of the new node may be provided: +// @code +// el.AddNewElementAutoPrefixL(tagName,uri,NULL); // declare on the new element +// el.AddNewElementAutoPrefixL(tagName,uri,el); // declare on the parent element +// el.AddNewElementAutoPrefixL(tagName,uri,doc.DocumentElement()); // declare on the root element +// ... +// @endcode +// +// @note +// The farther namespace declaration up in the document tree, +// the longer time namespace declaration lookups take. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::AddNewElementAutoPrefixL( + const TDesC8& aLocalName, + const TDesC8& aNsUri, + TXmlEngElement aNsDeclTarget ) + { + TXmlEngElement elem = AddNewElementL(aLocalName); + if (aNsDeclTarget.IsNull()) + aNsDeclTarget = elem; + TXmlEngNamespace ns = aNsDeclTarget.FindOrCreateNsDeclL(aNsUri); + INTERNAL_NODEPTR(elem)->ns = INTERNAL_NSPTR(ns); + return elem; + } + +// --------------------------------------------------------------------------------------------- +// Retrieves list of attribute nodes of the element +// +// @param aList - a node list object to initialize +// +// Passed by reference list of nodes is initialized and after call to +// Attributes(..) is ready for use with HasNext() and Next() methods: +// +// @code +// ... +// TXmlEngElement root = doc.DocumentElement(); +// TXmlEngNodeList attlist; +// root.GetAttributes(attlist); +// while (attlist.HasNext()) +// processAttribute(attlist.Next()); +// ... +// @endcode +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::GetAttributes( + RXmlEngNodeList& aList ) const + { + //pjj18 + aList.Open( LIBXML_ELEMENT->properties, + TXmlEngNode::EAttribute); + } + +// --------------------------------------------------------------------------------------------- +// Retrieves list of child elements of the element +// +// @param aList - a node list object to initialize +// +// Passed by reference list of nodes is initialized and after the call +// it is ready for use with HasNext() and Next() methods: +// +// @note Returned list is a "filtered view" of the underlying +// list of all element's children (with text nodes, comments +// processing instructions, etc.) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::GetChildElements( + RXmlEngNodeList& aList ) const + { + //pjj18 + aList.Open( LIBXML_ELEMENT->children, + TXmlEngNode::EElement); + } + +// --------------------------------------------------------------------------------------------- +// @return Basic contents of the element +// +// This method may be used in most cases, when element has only simple text content +// (without entity references embedded) +// +// If element's contents is mixed (other types of nodes present), only contents of +// first child node is returned if it is a TXmlEngTextNode node. For getting mixed contents of the +// element of contents with entity references, WholeTextValueCopyL() should be used. +// +// @see TXmlEngNode::WholeTextContentsCopyL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngElement::Text() const + { + if (LIBXML_ELEMENT && LIBXML_ELEMENT->children && LIBXML_ELEMENT->children->type == XML_TEXT_NODE) + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_ELEMENT->children->content)).PtrC8(); + } + return KNullDesC8(); + } + +// --------------------------------------------------------------------------------------------- +// Adds text as a child of the element. +// +// At the moment, content may be only added, replaced (set) and read from element. +// +// @param aString text to be added as element's content. +// +// @note There may be several TXmlEngTextNode and TXmlEngEntityReference nodes added actually, +// depending on the aString value +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::AddTextL( + const TDesC8& aString ) + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlNodePtr last, newNode, tmp; + last = LIBXML_ELEMENT->last; + xmlChar* text = xmlCharFromDesC8L(aString); + newNode = xmlNewTextLen(NULL, aString.Size()); + if(!newNode) + { + delete text; + OOM_HAPPENED; + } + newNode->content = text; + + tmp = xmlAddChild(LIBXML_ELEMENT, newNode); + if (xmlOOMFlag()) + { + xmlFreeNode(newNode); + OOM_HAPPENED; + } + + if (tmp == newNode && + last && last->next == newNode) + { + OOM_IF_NULL(xmlTextMerge(last, newNode)); + } + } + +// --------------------------------------------------------------------------------------------- +// Ad Xml:Id attribute to the element +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AddXmlIdL(const TDesC8& aLocalName, + const TDesC8& aValue, + TXmlEngNamespace aNs) + { + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + TXmlEngAttr attr; + xmlChar* value = xmlCharFromDesC8L(aValue); + xmlAttrPtr tmp = xmlGetID(LIBXML_ELEMENT->doc, value); + if(tmp) + { + delete value; + return attr; + } + + attr = AddNewAttributeL(aLocalName, aValue); + if(aNs.NotNull()) + { + TXmlEngNamespace tmp = LookupNamespaceByPrefixL(aNs.Prefix()); + if(!tmp.IsSameNode(aNs)) + { + attr.Remove(); + delete value; + return attr; + } + INTERNAL_ATTRPTR(attr)->ns = INTERNAL_NSPTR(aNs); + } + + if(attr.IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + if(!xmlAddID(NULL, LIBXML_ELEMENT->doc, value, INTERNAL_ATTRPTR(attr))) + { + delete value; + attr.Remove(); + XmlEngOOMTestL(); + } + delete value; + return attr; + } + +// --------------------------------------------------------------------------------------------- +// Sets text contents for the element. +// Any child nodes are removed. +// Same as TXmlEngNode::SetValueL(const TDesC8&) +// +// @see TXmlEngNode::SetValueL(const TDesC8&) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetTextL(const TDesC8& aString) + { + AsAttr().SetValueL(aString); + } + +// --------------------------------------------------------------------------------------------- +// Sets text content of the element from escaped string. +// @see TXmlEngAttr::SetEscapedValueL(const TDesC8&) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetEscapedTextL(const TDesC8& aEscapedString) + { + AsAttr().SetEscapedValueL(aEscapedString); + } + + +// ------------------------------------------------------------------------------------- +// Sets new element value exactly as presented in the string. +// Predefined entities are not converted into characters they represent. +// Any child nodes are removed. +// ------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetTextNoEncL(const TDesC8& aNotEncString) + { + AsAttr().SetValueNoEncL(aNotEncString); + } + +// ------------------------------------------------------------------------------------- +// Appends new text node with the value exactly as presented in the string. +// Predefined entities are not converted into characters they represent. +// Child nodes are not removed. +// ------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::AppendTextNoEncL(const TDesC8& aNotEncString) + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + + xmlNodePtr prop = LIBXML_ELEMENT; + xmlNodePtr new_ch; + + if (aNotEncString.Length()) + { + xmlChar* value = xmlCharFromDesC8L(aNotEncString); + new_ch = xmlNewText(NULL); + if(!new_ch) + { + delete value; + OOM_HAPPENED; + }; + + new_ch->name = xmlStringTextNoenc; + new_ch->content = value; + new_ch->parent = (xmlNodePtr) prop; + xmlNodePtr last = prop->last; + if(last) + { + last->next = new_ch; + new_ch->prev = last; + } + else + { + prop->children = new_ch; + } + prop->last = new_ch; + } + } + + +// --------------------------------------------------------------------------------------------- +// Adds default namespace declaration. +// +// @param aNsUri Namespace URI; both NULL and "" (empty string) are allowed to represent UNDEFINED NAMSPACE +// +// Same result as with AddNamespaceDeclarationL(aNsUri, NULL), but additionally +// element's namespace modified (if it has no prefix and there were no default +// namespace declaration in the scope) to the new default one. +// +// @return Handle to the created namespace declaration (NULL for UNDEFINED NAMESPACE) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::SetDefaultNamespaceL( + const TDesC8& aNsUri) + { + TXmlEngNamespace nsDef = AddNamespaceDeclarationL(aNsUri,KNullDesC8); + if (!LIBXML_ELEMENT->ns) + LIBXML_ELEMENT->ns = INTERNAL_NSPTR(nsDef); + return nsDef; + } + +// --------------------------------------------------------------------------------------------- +// Undeclares any default namespace for current element and its descendants. +// +// If there is already some default namespace, xmlns="" namespace +// declaration is added. Otherwise, nothing happens, since element with no +// prefix in such scope is automaticaly considered as out of any namespace. +// +// The side effect of this method is that namespace of the current element +// may change from previous default namespace to NULL TXmlEngNamespace, which is +// considered an absence of namespace. +// +// If the element has prefix (i.e. not having default namespace), +// then the only effect for the element is undeclaration of existing default namespace. +// +// If element is in the scope of another xmlns="" undeclaration, no +// actions are taken. +// +// @note +// Use AddNamespaceDeclarationL(NULL,NULL) to force creation of +// xmlns="" declaration within scope of another such declaration +// (otherwise unneccessary/duplicate declarations are not created) +// +// @note +// This method should be called on elements before adding children, +// because default namespace undeclaration is not spread into its subtree and +// descedants' default namespaces are not reset to NULL. This should be taken into +// account if later some processing on the subtree occurs. +// However, after serialization and deserialization, undeclared default namespace will +// affect whole element's subtree correctly. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetNoDefaultNamespaceL() + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + // + TXmlEngNamespace defns = LookupNamespaceByPrefixL(KNullDesC8); + if (defns.IsUndefined()) // NULL or Uri is NULL + { + // we are already in the scope of xmlns="" , so do nothing + return; + } + + // There is some default namespace in the scope. + // Add local "undefined" namespace and change element's namespace + // if it is the default one + AddNamespaceDeclarationL(KNullDesC8, KNullDesC8); + TXmlEngNamespace myNs(LIBXML_ELEMENT->ns); + if (myNs.IsDefault()) + { + // replace default namespace with undefined + LIBXML_ELEMENT->ns = NULL; // NULL means "NO NAMESPACE"(I.E. "UNDEFINED NAMESPACE") + } + } + +// --------------------------------------------------------------------------------------------- +// Finds namespace declaration that has specific prefix in the scope for given node +// +// Prefix "" or NULL are considered the same, meaning "NO PREFIX". +// If namespace declaration for "no prefix" is searched, then default namespace is returned. +// +// @return Namespace handler, which may be NULL if prefix is not bound. +// +// NULL result for "no prefix" means that default namespace is undefined. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::LookupNamespaceByPrefixL( + const TDesC8& aPrefix ) const + { + // OOM may happen ONLY during a lookup for {"xml","http://www.w3.org/XML/1998/namespace"} + + xmlChar* pref = xmlCharFromDesC8L(aPrefix); + // Allow "" instead of NULL + if(pref && !*pref) + { + delete pref; + pref = NULL; + } + + xmlNsPtr ns = xmlSearchNs( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + pref + ); + delete pref; + // Default namespace undeclarations are never returned + if (ns && ns->href && !*ns->href) + ns = NULL; + return TXmlEngNamespace(ns); + } + +// --------------------------------------------------------------------------------------------- +// Finds namespace declaration that has specific namespace URI +// in the scope for the given node. +// +// @param aUri Namespace URI, for which namespace declaration is searched +// @return Handler to the namespace declaration that binds given namespace URI to some prefix +// or NULL if the binding is not active at the scope of this element. +// +// NULL value of aUri is equivalent to "" and means "UNDEFINED NAMESPACE". +// For such URI a NULL namespace handle is always returned even if there is +// namespace undeclaration, which has "" URI (and NULL prefix). +// +// Hint:

+// Use returned instance of TXmlEngNamespace as aNsDef argument to element's methods +// that create new element's child elements and attributes. The same handler +// may be used on more deep descentants of the reference element (and doing +// this way will generally increase performance of DOM tree construction).
+// However, if namespace bindings are not controlled +// for element's children and prefix, which is bound to the search namespace, is +// rebound to some other namespace URI, then reusing namespace may lead to +// unwanted result. +// +// Consider an example: +// @code +// TXmlEngElement root = doc.DocumentElement(); +// TXmlEngNamespace targetNs = root.AddNamespaceDeclarationL("http://example.com/","ex"); +// TXmlEngElement el_1 = root.AddNewElementL("outer", targetNs); +// TXmlEngElement el_2 = el_1.AddNewElementL("inner"); // element without prefix +// +// // NOTE: prefix "ex" is not bound to "http://example.com/" anymore +// el_2.AddNamespaceDeclarationL("http://whatever.com/","ex"); +// TXmlEngElement el_3 = el_2.AddNewElementL("problem", targetNs); +// ... +// @endcode +// +// The sought result was (showing expanded names of elements): +// @code +// --> "root" +// --> {"http://example.com/","outer"} +// --> "inner" +// -->{"http://example.com/","problem"} +// ... +// <-- +// <-- "inner" +// <-- {"http://example.com/","outer"} +// ... +// <-- +// @endcode +// and it may look that it has been achieved. Indeed, if namespace of element "problem" +// was queried, it would have URI "http://example.com/" and prefix "ex". +// However, if namespace URI was looked up by "problem"'s prefix, it would be +// "http://whatever.com/". We have created illegal DOM tree. +// +// The actual DOM tree in serialized form will be: +// @code +// +// +// +// +// ... +// +// +// +// ... +// +// @endcode +// +// So, reuse of namespace handlers should be performed with special care. +// +// @note +// At the moment it is possible to retrieve namespace declaration nodes +// whose prefixes were rebound. Be careful when use returned TXmlEngNamespace object +// for creation of new elements. In later releases, this method will perform +// safe lookup. And so far, it is better to make check that prefix of returned +// namespace declaration has not rebound: +// @code +// TXmlEngNamespace ns = element.LookupNamespaceByUri("a_uri"); +// if (element.LookupNamespaceByPrefix(ns.Prefix()).IsSameNode(ns)){ +// ... // now it is safe to create new elements by using "ns" +// element.AddNewElementL("product",ns); +// ... +// } +// @endcode +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::LookupNamespaceByUriL( + const TDesC8& aUri ) const + { + // OOM may happen ONLY during a lookup for {"xml","http://www.w3.org/XML/1998/namespace"} + + xmlChar* uri = xmlCharFromDesC8L(aUri); + + if(!uri || !*uri) + { + delete uri; + return NULL; + } + else + { + TXmlEngNamespace ns = xmlSearchNsByHref( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + uri); + delete uri; + if(LookupNamespaceByPrefixL(ns.Prefix()).IsSameNode(ns)) + { + return ns; + } + else + { + return NULL; //the binding is not active at the scope of this element + } + } + } + +// --------------------------------------------------------------------------------------------- +// Retrieves implicitly declared on every XML infoset binding +// of 'xml' prefix to XML's namespace URI: +// "http://www.w3.org/XML/1998/namespace" +// +// @return Handler to {xml,"http://www.w3.org/XML/1998/namespace"} prefix +// binding in the current document +// +// The result should be used for creating attributes beloging to the XML namespace +// (xml:lang, xml:space, xml:id , etc.) +// +// DO NOT USE methods LookupNamespaceByUri(TDesC8) and LookupNamespaceByPrefix(TDesC8) +// (with "http://www.w3.org/XML/1998/namespace" and "xml" arguments) for retrieving +// namespace node, since in a case of [possible] memory allocation fault +// NULL result is returned (and breaks your program silently) +// +// @note Normally 'xml' prefix is bound to XML namespace URI in the document +// node, BUT if current node is not a part of the document tree yet, +// the requested namespace declaration WILL BE ADDED to the current node. +// This is the reason why the method may fail in OOM conditions. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::TheXMLNamespaceL() const + { + xmlNsPtr ns = xmlSearchNs( + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT, + BAD_CAST "xml"); + OOM_IF_NULL(ns); + return ns; + } + +// --------------------------------------------------------------------------------------------- +// Performs search of namespace handler in the scope of the element. This method will +// create new namespace declaration on the element if such namespace is not available. +// +// @param aNsUri Searched namespace +// @param aPrefix Prefix to use for new namespace declaration (if it is to be created) +// +// @return TXmlEngNamespace handler that may be used to create new attributes and child elements of +// the element. The namespace may be one of those existed previously or was created +// +// @see LookupNamespacebyUriL +// @note +// Be sure not to use the result of this method for non-descendants of the element or in situations +// when prefix overlapping might occur (read also about general considerations of attributes +// and elements creation using namespace handlers) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::FindOrCreateNsDeclL( + const TDesC8& aNsUri, + const TDesC8& aPrefix ) + { + TXmlEngNamespace ns = LookupNamespaceByUriL(aNsUri); + if (aNsUri.Length() && ns.IsNull()) + { + // Some (not the undefined one) namespace was not declared yet + ns = AddNamespaceDeclarationL(aNsUri, aPrefix); + } + else + { + // There is a namespacedeclaration, + // check that it is not "shielded" (its prefix is not rebound) + if (! LookupNamespaceByPrefixL(ns.Prefix()).IsSameNode(ns)) + { + // it was rebound, so we rebound it again + ns = AddNamespaceDeclarationL(aNsUri, aPrefix); + } + } + return ns; +} + +// --------------------------------------------------------------------------------------------- +// Performs search on the element and its ascendants for any namespace declaration +// with given URI and create a new namespace declaration with some (unique) prefix +// if the search was not successful. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::FindOrCreateNsDeclL( + const TDesC8& aNsUri ) + { + _LIT8(KAutoPrefix,"_pr%d"); + const TInt KMaxPrefLength = 20; + TBuf8 prefix; + + TXmlEngNamespace ns = LookupNamespaceByUriL(aNsUri); + if (ns.NotNull()) + return ns; + + TBool ready = false; + TUint ind = 0; + + while(!ready) + { + // generate prefix + ++ind; + prefix.Format(KAutoPrefix,ind); + + // check + ns = LookupNamespaceByPrefixL(prefix); + ready = ns.IsNull(); + } + return AddNamespaceDeclarationL(aNsUri, prefix); + } + +// --------------------------------------------------------------------------------------------- +// Adds namespace declaration to the current element, a binding of prefix to namespace URI. +// +// If same namespace declaration exists (same prefix and URI), redundant namespace declaration +// will not be created. +// +// Both NULL or "" (empty string) may be used for "UNDEFINED URI" and "NO PREFIX" values of arguments. +// +// @return A handle to the created (or found, if there is such) namespace declaration node. +// If namespace undeclaration is being created, NULL handle is returned -- it can be +// used in node-creation methods that take namespace handle as an argument. +// +// @note Undeclaring of default namespace (xmlns="") is supported by +// SetNoDefaultNamespace() method +// +// @see SetNoDefaulNamespace() +// +// @note By adding namespace declaration that rebinds prefix mapping (or default namespace) +// used by nodes lower in the tree, document tree may become +// wrongly constructed, because references to namespace declaration are +// not updated. However, after serialization the document will have +// desired structure. +// Use this method with care! +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngElement::AddNamespaceDeclarationL( + const TDesC8& aNsUri, + const TDesC8& aPrefix ) + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + if(!aNsUri.Length() && aPrefix.Length()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + // Now we allow NULL instead of "" + xmlChar* nsUri = NULL; + if(aNsUri.Length()) + { + nsUri = xmlCharFromDesC8L(aNsUri); + } + else + { + nsUri = (xmlChar*)new(ELeave) TUint8[1]; + *(Mem::Copy((TAny*)nsUri, aNsUri.Ptr(), aNsUri.Length())) = 0; + } + + CleanupStack::PushL(nsUri); + + // Now we allow "" instead of NULL + xmlChar* pref = NULL; + if(aPrefix.Length()) + { + pref = xmlCharFromDesC8L(aPrefix); + } + + xmlNsPtr ns = xmlNewNs( + LIBXML_ELEMENT, + nsUri, + pref); + + delete pref; + CleanupStack::PopAndDestroy(nsUri); + + TEST_OOM_FLAG; + if (!ns) + { + // OOM or Already exists + if (HasNsDeclarationForPrefixL(aPrefix)) + { + return FindOrCreateNsDeclL(aNsUri); // unique prefix will be generated + } + } + return TXmlEngNamespace(ns); + } + +// --------------------------------------------------------------------------------------------- +// Checks whether a prefix has been bound in this element (not in one of its ascendants) +// +// Use this method for preventig prefix-name collision in a element node +// +// @return TRUE if there is already namespace declaration that uses aPrefix on this element +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngElement::HasNsDeclarationForPrefixL( + const TDesC8& aPrefix ) const + { + xmlChar* prefix; + if(!aPrefix.Length()) + { + prefix = NULL; + } + else + { + prefix = xmlCharFromDesC8L(aPrefix); + } + // Convert "" into NULL + TXmlEngConstString pref((char*) prefix); + xmlNsPtr ns = LIBXML_ELEMENT->nsDef; + while (ns) + if(pref.Equals((char*)ns->prefix)) + { + delete prefix; + return true; + } + else + ns = ns->next; + delete prefix; + return false; + } + +// --------------------------------------------------------------------------------------------- +// Copies the element with its attributes, but not child nodes +// +// If context is preserved, then all namespace declarations that are in the element are +// writen to element's start tag too. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement TXmlEngElement::ElementCopyNoChildrenL( + TBool aPreserveNsContext ) const + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + // + xmlNodePtr ncopy = xmlStaticCopyNode(LIBXML_ELEMENT, NULL, NULL, 0 /* shallow copy */); + if (!ncopy) // for a copy of element node, it's not neccessary to check OOM flag + { + OOM_HAPPENED; + } + // OOM will be checked in the very end of methods + if (LIBXML_ELEMENT->properties) + { + ncopy->properties = xmlCopyPropList(ncopy, LIBXML_ELEMENT->properties); + } + if (aPreserveNsContext) + { + if (LIBXML_ELEMENT->nsDef) + { + ncopy->nsDef = xmlCopyNamespaceList(LIBXML_ELEMENT->nsDef); + } + } + // DONE: OOM: check OOM flag + if (xmlOOMFlag()) + { + xmlFreeNode(ncopy); + OOM_HAPPENED; + } + TXmlEngElement el(ncopy); + OwnerDocument().TakeOwnership(el); + return el; + } + +// --------------------------------------------------------------------------------------------- +// Resets element's content: all child nodes are removed +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RemoveChildren() + { + // + if(!LIBXML_ELEMENT) + { + return; + } + xmlFreeNodeList(LIBXML_ELEMENT->children); + LIBXML_ELEMENT->children = NULL; + LIBXML_ELEMENT->last = NULL; + } + +// --------------------------------------------------------------------------------------------- +// Resets element's attributes +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RemoveAttributes() + { + if(!LIBXML_ELEMENT) + { + return; + } + // + xmlFreePropList(LIBXML_ELEMENT->properties); + LIBXML_ELEMENT->properties = NULL; + } + +// --------------------------------------------------------------------------------------------- +// Resets all namespace declarations made in the element +// +// @note There can be references to these namespace declaration from elsewhere! +// Use ReconcileNamespacesL() to fix that. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RemoveNamespaceDeclarations() + { + if (!LIBXML_ELEMENT) + { + return; + } + xmlNsPtr ns = LIBXML_ELEMENT->nsDef; + while(ns) + { + ResetNs(LIBXML_NODE,ns); + ns = ns->next; + } + + xmlFreeNsList(LIBXML_ELEMENT->nsDef); + LIBXML_ELEMENT->nsDef = NULL; + } + +// --------------------------------------------------------------------------------------------- +// Copies attributes from another element +// +// It may be a very convenient method for initializing element with a set of predefined attributes. +// +// @note +// Namespaces of the this element may need to be reconciled if copied attributes +// belong to any namespace that is not declared on some ascendant of this node. +// +// @see ReconcileNamespacesL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::CopyAttributesL( + TXmlEngElement aSrc ) + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + // + if (INTERNAL_NODEPTR(aSrc)->properties) + { + xmlAttrPtr plist = xmlCopyPropList(LIBXML_ELEMENT, INTERNAL_NODEPTR(aSrc)->properties); + OOM_IF_NULL(plist); + + if (LIBXML_ELEMENT->properties) + { + xmlAttrPtr last = LIBXML_ELEMENT->properties; + while (last->next) + { + last = last->next; + } + last->next = plist; + } + else + { + LIBXML_ELEMENT->properties = plist; + } + } + } + +// --------------------------------------------------------------------------------------------- +// Copies a list of elements. +// +// Elements are appended to the element's children list. +// +// @note Namespaces of the this element may need to be reconciled after copy operation +// @see ReconcileNamespacesL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::CopyChildrenL( + TXmlEngElement aSrc ) + { + if ( !LIBXML_ELEMENT ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( aSrc.IsNull() ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + if (INTERNAL_NODEPTR(aSrc)->children) + { + xmlNodePtr plist = xmlStaticCopyNodeList( + INTERNAL_NODEPTR(aSrc)->children, + LIBXML_ELEMENT->doc, + LIBXML_ELEMENT); + OOM_IF_NULL(plist); + xmlNodePtr last = plist; + while (last->next) + { + last = last->next; + } + if (LIBXML_ELEMENT->children) + { + LIBXML_ELEMENT->last->next = plist; + plist->prev = LIBXML_ELEMENT->last; + } + else + { + LIBXML_ELEMENT->children = plist; + } + LIBXML_ELEMENT->last = last; + } + } + +// --------------------------------------------------------------------------------------------- +// Removes attribute with given name and namespace URI(if such exists). +// Memory allocated for the attribute is freed. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RemoveChildElementsL( + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri ) + { + if (!LIBXML_ELEMENT) + { + return; + } + //pjj18 + RXmlEngNodeList eList; + + eList.OpenL( + LIBXML_ELEMENT->children, + TXmlEngNode::EElement, + aLocalName, + aNamespaceUri); + + TXmlEngElement el; + while ((el = eList.Next()).NotNull()) + el.Remove(); + eList.Close(); + } + +// --------------------------------------------------------------------------------------------- +// Renames the element. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RenameElementL( + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix) + { + + xmlNodePtr element = INTERNAL_NODEPTR(*this); + + XE_ASSERT_DEBUG( element->type == XML_ELEMENT_NODE ); + + const xmlChar* oldName = element->name; + + XE_ASSERT_ALWAYS(aLocalName.Length()); + + element->name = xmlCharFromDesC8L(aLocalName); + + xmlFree((void*)oldName ); + + if (aNamespaceUri.Length() || aPrefix.Length()) + { + TXmlEngNamespace ns = (*this).FindOrCreateNsDeclL(aNamespaceUri, aPrefix); + element->ns = INTERNAL_NSPTR(ns); + } + + } + +// ======================================================================================== + +// DOM Level 3 Core + + +// --------------------------------------------------------------------------------------------- +// Links attribute into tree +// +// The replaced attribute node is not returned and just deleted +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetAttributeNodeL( + TXmlEngAttr aNewAttr ) + { + AppendChildL(aNewAttr); + xmlReconciliateNs(LIBXML_ELEMENT->doc, LIBXML_NODE); + } + +// --------------------------------------------------------------------------------------------- +// Returns value of attribute with given name and namespace URI +// +// @param aLocalName - local name of attribute node +// @param aNamespaceUri - namespace URI of attribute +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngElement::AttributeValueL( + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri ) const + { + TXmlEngAttr attr = AttributeNodeL(aLocalName, aNamespaceUri); + if( attr.IsNull() ) + return KNullDesC8(); + else + return attr.Value(); + } + +// --------------------------------------------------------------------------------------------- +// Sets value of attribute; attribute is created if there is no such attribute yet +// +// @note +// If prefix is not NULL (or ""), then namespace URI may not be empty +// see http://www.w3.org/TR/REC-xml-names/#ns-decl (Definition #3) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::SetAttributeL( + const TDesC8& aLocalName, + const TDesC8& aValue, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix ) + { + if ( aLocalName.Length() <= 0 ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + TXmlEngAttr attr = AttributeNodeL(aLocalName, aNamespaceUri); + if (attr.NotNull()) + { + attr.SetValueL(aValue); + } + else + { + AddNewAttributeL(aLocalName, aValue, aNamespaceUri, aPrefix); + } + } + +// --------------------------------------------------------------------------------------------- +// Removes attribute with given name and namespace URI(if such exists). +// Memory allocated for the attribute is freed. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::RemoveAttributeL( + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri ) + { + TXmlEngAttr attr = AttributeNodeL(aLocalName, aNamespaceUri); + xmlRemoveProp(INTERNAL_ATTRPTR(attr)); + } + +// --------------------------------------------------------------------------------------------- +// Retrieves attribute node from specific namespace by its name. +// +// @return Attribute node with matching namespace URI and name +// @note Use "" (empty string) for namespace name, not NULL (for undefined namespace) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngAttr TXmlEngElement::AttributeNodeL( + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri ) const + { + //pjj18 + RXmlEngNodeList attList; + + attList.OpenL( + LIBXML_ELEMENT->properties, + TXmlEngNode::EAttribute, + aLocalName, + aNamespaceUri); + TXmlEngAttr attr = attList.Next(); + attList.Close(); + return attr; + } + +// --------------------------------------------------------------------------------------------- +// Initializes list of child elements with matching name and namespace URI. +// +// @note This method does not lists all descedants of the element, only child elements +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngElement::GetElementsByTagNameL( + RXmlEngNodeList& aList, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri ) const + { + aList.OpenL( + LIBXML_ELEMENT->children, + TXmlEngNode::EElement, + aLocalName, + aNamespaceUri); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengfilecontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengfilecontainer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Methods for file container +// + +#include +#include "xmlengdomdefs.h" +#include + +// ------------------------------------------------------------------------------- +// @return RFile reference +// +// ------------------------------------------------------------------------------- +// +EXPORT_C RFile& TXmlEngFileContainer::File() const + { + return (RFile&) *LIBXML_NODE->content; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengfileoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengfileoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Text node functions +// + +#include +#include "xmlengfileoutputstream.h" + +TInt TXmlEngFileOutputStream::Write(const TDesC8 &aBuffer) + { + TRAP(iError,WriteL(aBuffer)); + if(iError) + { + return -1; + } + return aBuffer.Size(); + }; + +TInt TXmlEngFileOutputStream::Close() + { + return KErrNone; + } + +TInt TXmlEngFileOutputStream::CheckError() + { + return iError; + } + +TXmlEngFileOutputStream::TXmlEngFileOutputStream(RFile& aFile,RFs& aRFs) + { + TDriveInfo drInfo; + iError = aFile.Drive(iDrive, drInfo); + iFile = aFile; + iRFs = aRFs; + } + +void TXmlEngFileOutputStream::WriteL(const TDesC8 &aBuffer) + { + if(SysUtil::DiskSpaceBelowCriticalLevelL(&iRFs, aBuffer.Size(), iDrive)) + { + User::Leave(KErrDiskFull); + } + User::LeaveIfError(iFile.Write(aBuffer)); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengfileoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengfileoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,95 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// output stream for dom tree +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGTFILEOUTPUTSTREAM_H +#define XMLENGTFILEOUTPUTSTREAM_H + +#include +#include + + + +/** + * TXmlEngFileOutputStream is used by XML Engine to serialize XML data from file. + * + */ +class TXmlEngFileOutputStream : public MXmlEngOutputStream + { +public: + /** + * Default constructor + * + * @param aFile Instance of class RFile + * @param aRFs File server handle + */ + TXmlEngFileOutputStream(RFile& aFile,RFs& aRFs); + + /** + * Callback for writing a buffer with data to output stream + * + * @return number of bytes written or -1 in case of error + */ + TInt Write(const TDesC8 &aBuffer); + + /** + * Callback for closing output stream + * + * @return + * 0 is succeeded, + * -1 in case of error + */ + TInt Close(); + + /** + * Checks error flag + * + * @return error code + */ + TInt CheckError(); + +private: + + void WriteL(const TDesC8 &aBuffer); + +private: + /** + *Instance of class RFile + */ + RFile iFile; + + /** + * File server handle + */ + RFs iRFs; + + /** Error flag **/ + TInt iError; + + /** Drive No. **/ + TInt iDrive; +}; + + + +#endif /* XMLENGTFILEOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnamespace.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnamespace.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "xmlengdomdefs.h" +#include //pjj18 new + +#define LIBXML_NS (static_cast(iInternal)) + +// ----------------------------------------------------------------------------- +// @return Namespace URI string +// +// For TXmlEngNamespace(NULL) or namespace undeclaration (xmlns=""), which are +// treatet as undefined namespace returns NULL, +// otherwise result is not a NULL string and not a "" (empty string). +// +// @note "" is never returned - it is replaced with NULL +// ----------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNamespace::Uri() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING( + LIBXML_NS && + LIBXML_NS->href && + *(LIBXML_NS->href) + ? LIBXML_NS->href + : NULL + )).PtrC8(); + } + +// ----------------------------------------------------------------------------- +// Returns prefix that is bound in the namespace declaration +// or NULL string for default namespace or if no binding exist +// ----------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNamespace::Prefix() const + { + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING( + LIBXML_NS + ? LIBXML_NS->prefix + : NULL + )).PtrC8(); + } + +// ----------------------------------------------------------------------------- +// @return Whether it is a definition of default namespace +// TRUE -- is a default namespace (no prefix) +// FALSE -- not a default namespace (bound to prefix) or empty +// TXmlEngNamespace(NULL) instance +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNamespace::IsDefault() const + { + return IsUndefined() || (!LIBXML_NS->prefix); + } + +// ----------------------------------------------------------------------------- +// @return Whether the namespace is undefined +// +// A node's namespace is undefined if no namespace declaration associated with it. +// +// @note Same as TXmlEngNode::IsNull() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNamespace::IsUndefined() const + { + return IsNull() || (!LIBXML_NS->href); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnode.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1170 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node functions implementation +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libxml2_xmlsave_private.h" +#include "libxml2_tree_private.h" +#include "xmlengdomdefs.h" +#include +#include +#include + +// --------------------------------------------------------------------------------------------- +// Unlinks the internal libxml2's node from double-linked list. +// Relinks neighbour nodes.The node stays virtually linked to its old neighbours! Use with care!! +// +// No checks are made; nor parent's, nor node's properties updated +// --------------------------------------------------------------------------------------------- +// +void TXmlEngNode::DoUnlinkNode() + { + xmlNodePtr& next = LIBXML_NODE->next; + xmlNodePtr& prev = LIBXML_NODE->prev; + // Unlink this node; relink neighbors + if (prev) + { + prev->next = next; + } + else + { + // Unlinked node is the first in the list + // 'children' or 'properties' property of the parent node + // must be updated (depending on the type of the node: content node or attribute) + xmlNodePtr& parent = LIBXML_NODE->parent; + // Ugly, but works :) + xmlNodePtr* first = ((LIBXML_NODE->type == XML_ATTRIBUTE_NODE) + ? reinterpret_cast(&(parent->properties)) + : &(parent->children)); + *first = next; + } + if (next) + { + next->prev = prev; + } + else + { + // Unlinked node is the last in the list (of elements or attributes) + // 'last' property of the parent element must be updated (for content nodes only) + if(LIBXML_NODE->type != XML_ATTRIBUTE_NODE) + { + LIBXML_NODE->parent->last = prev; + } + } + } + + +// --------------------------------------------------------------------------------------------- +// Inserts the node in a double-linked list of nodes before specified node. +// +// No checks are made; nor parent's, nor node's properties updated (except prev/next) +// --------------------------------------------------------------------------------------------- +// +void TXmlEngNode::LinkBefore(TXmlEngNode aTargetNode) + { + xmlNodePtr node = INTERNAL_NODEPTR(aTargetNode); + xmlNodePtr& prev = node->prev; + LIBXML_NODE->next = node; + LIBXML_NODE->prev = prev; + prev->next = LIBXML_NODE; + node->prev = LIBXML_NODE; + } + +// --------------------------------------------------------------------------------------------- +// Get innerXML string. This method return all content of the node. +// Output text does not include node markup. +// +// @note Returned TString should be freed +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TInt TXmlEngNode::InnerXmlL(RBuf8& aBuffer) + { + if(aBuffer.Length()) + { + aBuffer.Close(); + } + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + if(NodeType() == TXmlEngNode::EDocument) + { + return OwnerDocument().SaveL(aBuffer, OwnerDocument(), NULL); + } + aBuffer.FillZ(); + RXmlEngNodeList nodeList; + RBuf8 tmpStr; + GetChildNodes(nodeList); + TXmlEngNode tmpNode; + while(nodeList.HasNext()) + { + tmpNode = nodeList.Next(); + tmpNode.OuterXmlL(tmpStr); + CleanupClosePushL(tmpStr); + if((aBuffer.MaxSize() - aBuffer.Size()) < tmpStr.Size()) + { + aBuffer.ReAllocL(aBuffer.MaxSize() + tmpStr.Size() + 1); + } + aBuffer.Append(tmpStr); + CleanupStack::PopAndDestroy(); + } + tmpStr.Close(); + + return aBuffer.Size(); + } + +// --------------------------------------------------------------------------------------------- +// Get outerXML string. This method return all content of the node. +// Output text includes node markup. +// +// @note Returned TString should be freed +// +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TInt TXmlEngNode::OuterXmlL(RBuf8& aBuffer) + { + TInt size = -1; + if(aBuffer.Length()) + { + aBuffer.Close(); + } + if(IsNull()) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + if(NodeType() == TXmlEngNode::EDocument) + { + return OwnerDocument().SaveL(aBuffer, OwnerDocument(), NULL); + } + + xmlSaveCtxt ctxt; + xmlOutputBufferPtr buf; + + /* + * save the content to a temp buffer. + */ + buf = xmlAllocOutputBuffer(NULL); + OOM_IF_NULL(buf); + + memset(&ctxt, 0, sizeof(ctxt)); + ctxt.doc = LIBXML_NODE->doc; + ctxt.buf = buf; + ctxt.level = 0; + ctxt.format = 0; + + xmlSaveCtxtInit(&ctxt); + + xmlNodeDumpOutputInternal(&ctxt, LIBXML_NODE); + if(xmlOOMFlag()) + { + xmlOutputBufferClose(buf); + OOM_HAPPENED; + } + + size = buf->buffer->use; + if(size > 0) + { + // frees any previous contents of aBuffer argument + aBuffer.Assign(buf->buffer->content,size,size); + // To prevent it from freeing + buf->buffer->content = NULL; + } + xmlOutputBufferClose(buf); + + // Leaves with KErrNoMemory + TEST_OOM_FLAG; + if (size < 0) + { + XmlEngLeaveL(KXmlEngErrNegativeOutputSize); + } + + return size; + } + +// --------------------------------------------------------------------------------------------- +// Moves the node to become the first in the list of its siblings +// Node is expected to have a parent. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::SetAsFirstSibling() + { + if (LIBXML_NODE->type == XML_NAMESPACE_DECL) + { + return; + } + xmlNodePtr& prev = LIBXML_NODE->prev; + if (prev) + { + DoUnlinkNode(); + // Insert as first + prev = NULL; + xmlNodePtr& parent = LIBXML_NODE->parent; + // Ugly, but works :) + xmlNodePtr* first = ((LIBXML_NODE->type == XML_ATTRIBUTE_NODE) + ? reinterpret_cast(&(parent->properties)) + : &(parent->children)); + + (*first)->prev = LIBXML_NODE; + LIBXML_NODE->next = *first; + *first = LIBXML_NODE; + // NOTE: it is possible to cope without having parent defined, + // it will need to iterate through sibling list to find the first one + } + } + + +// --------------------------------------------------------------------------------------------- +// Moves the node to become the last in the list of its siblings +// Node is expected to have a parent. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::SetAsLastSibling() + { + if (LIBXML_NODE->type == XML_NAMESPACE_DECL) + { + return; + } + xmlNodePtr& next = LIBXML_NODE->next; + if (next) + { + DoUnlinkNode(); + xmlNodePtr& parent = LIBXML_NODE->parent; + xmlNodePtr& prev = LIBXML_NODE->prev; + if (LIBXML_NODE->type != XML_ATTRIBUTE_NODE) + { + if (!prev) + parent->children = next; + prev = parent->last; + parent->last->next = LIBXML_NODE; + parent->last = LIBXML_NODE; + } + else + { + if (!prev) + parent->properties = (xmlAttrPtr)next; + prev = next; // NOTE: 'next' is always different than NULL + while (prev->next) + prev = prev->next; + prev->next = LIBXML_NODE; + } + next = NULL; + } + } + +// --------------------------------------------------------------------------------------------- +// Moves the node in the list of sibling nodes before another node +// Node is expected to have a parent. +// Do nothing if aSiblingNode is not one of node's siblings +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::MoveBeforeSibling( + TXmlEngNode aSiblingNode ) + { + if (LIBXML_NODE->type == XML_NAMESPACE_DECL) + { + return; + } + xmlNodePtr node = INTERNAL_NODEPTR(aSiblingNode); + if (!node->prev) + { + SetAsFirstSibling(); + } + else + { + DoUnlinkNode(); + LinkBefore(aSiblingNode); + } + } + +// --------------------------------------------------------------------------------------------- +// Moves the node in the list of sibling nodes after another node +// Node is expected to have a parent. +// Do nothing if aSiblingNode is not one of the node's siblings +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::MoveAfterSibling( + TXmlEngNode aSiblingNode) + { + if (LIBXML_NODE->type == XML_NAMESPACE_DECL) + { + return; + } + xmlNodePtr node = INTERNAL_NODEPTR(aSiblingNode); + if (!node->next) + { + SetAsLastSibling(); + } + else + { + DoUnlinkNode(); + LinkBefore(aSiblingNode.NextSibling()); + } + } + +// --------------------------------------------------------------------------------------------- +// Retrieves a "handle" for namespace declaration that applies to the node's namespace +// Note: DOM specs do not consider namespace declarations as a kind of nodes +// This API adds TXmlEngNamespace type of nodes, which is derived from TXmlEngNode. +// +// @return Object that represents namespace declaration and prefix binding that +// act on the node; returns NULL object (check using TXmlEngNamespace.IsNull() +// or TXmlEngNamespace.NotNull()) if no namespace associated +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNamespace TXmlEngNode::NamespaceDeclaration() const + { + // + switch(LIBXML_NODE->type) + { + case XML_ELEMENT_NODE: + case XML_ATTRIBUTE_NODE: + return TXmlEngNamespace(LIBXML_NODE->ns); + default: + return NULL; + } + } + +// --------------------------------------------------------------------------------------------- +// Clones the node completely: all attributes and namespace declarations (for TXmlEngElement nodes), +// values and children nodes are copied as well. +// +// Document nodes cannot be copied with this method: RXmlEngDocument::CloneDocumentL() must be used. +// +// @return Complete copy of a node or leaves. +// @note The node should not be NULL! +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::CopyL() const + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + // Copying of RXmlEngDocument should be made with RXmlEngDocument::CloneDocumentL() + if(NodeType() == TXmlEngNode::EDocument) + return NULL; + // + xmlNodePtr copy = xmlStaticCopyNode( + LIBXML_NODE, + NULL /* doc */, + NULL /* parent */, + 1); + // + if (xmlOOMFlag()) + { + if(copy) + xmlFreeNode(copy); // it may be a partial copy + OOM_HAPPENED; + } + TXmlEngNode ncopy(copy); + OwnerDocument().TakeOwnership(ncopy); + return ncopy; + } + +// --------------------------------------------------------------------------------------------- +// Creates a deep copy of the node and appends the subtree as a new child +// to the provided parent node. +// +// @return Created copy of the node after linking it into the target document tree. +// @note Document nodes cannot be copied with this method; use RXmlEngDocument::CloneDocumentL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::CopyToL( + TXmlEngNode aParent ) const + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( LIBXML_NODE->type == XML_DOCUMENT_NODE ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + if ( aParent.IsNull() ) + { + User::Leave(KXmlEngErrNullNode); + } + // + TXmlEngNode ncopy = CopyL(); + return aParent.AppendChildL(ncopy); + } + +// --------------------------------------------------------------------------------------------- +// Detaches a node from document tree +// +// @return This node, which is already not a part of any document +// @note Remember to use ReconcileNamespacesL() later, if extracted node (subtree) +// contains references to namespace declarations outside of the subtree. +// @see ReconcileNamespacesL() +// @note The document, from which the node is being unlinked, becomes an owner of the node +// until it is linked elsewhere. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::Unlink() + { + // + if(LIBXML_NODE && ParentNode().NotNull()) + { + RXmlEngDocument tmpDoc = OwnerDocument(); + xmlUnlinkNode(LIBXML_NODE); + tmpDoc.TakeOwnership(*this); + } + return *this; + } + +// --------------------------------------------------------------------------------------------- +// Unlinks the node and destroys it; all child nodes are destroyed as well and all memory is freed +// +// @note Document nodes cannot be "removed" with this method, uses RXmlEngDocument-specific methods. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::Remove() + { + // + if (!LIBXML_NODE || LIBXML_NODE->type == XML_DOCUMENT_NODE) + { + return; + } + if(ParentNode().NotNull()) + { + xmlUnlinkNode(LIBXML_NODE); + } + else + { + OwnerDocument().RemoveOwnership(*this); + } + if (LIBXML_NODE->type != XML_ATTRIBUTE_NODE) + { + xmlFreeNode(LIBXML_NODE); + } + else + { + xmlFreeProp(INTERNAL_ATTRPTR(iInternal)); + } + + iInternal = 0; + } + +// --------------------------------------------------------------------------------------------- +// Ensures that namespaces referred to in the node and its descendants are +// in the scope the node. +// +// * This method checks that all the namespaces declared within the given +// * tree are properly declared. This is needed for example after Copy or Unlink +// * and then Append operations. The subtree may still hold pointers to +// * namespace declarations outside the subtree or they may be invalid/masked. As much +// * as possible the function try to reuse the existing namespaces found in +// * the new environment. If not possible, the new namespaces are redeclared +// * on the top of the subtree. +// +// This method should be used after unlinking nodes and inserting to another +// document tree or to a another part of the original tree, if some nodes of the subtree +// are remove from the scope of a namespace declaration they refer to. +// +// When node is unlinked, it may still refer to namespace declarations from the previous location. +// It is important to reconcile subtree's namespaces if previous parent tree is to be destroyed. +// On the other hand, if the parent tree is not changed before pasting its unlinked part into another +// tree, then reconciliation is needed only after paste operation. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::ReconcileNamespacesL() + { + xmlReconciliateNs(LIBXML_NODE->doc, LIBXML_NODE); + TEST_OOM_FLAG; + } + +// --------------------------------------------------------------------------------------------- +// Current node is replaced with another node (subtree). +// +// The replacement node is linked into document tree instead of this node. +// The replaced node is destroyed. +// +// @see SubstituteForL(TXmlEngNode) +// +// In both cases the argument node is unlinked from its previous location +// (which can be NONE, i.e. not linked; SAME or ANOTHER document tree). +// +// @note Replacement of a node with NULL TXmlEngNode is legal and equivalent to removing the node. +// @note Not applicable to document nodes +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::ReplaceWithL(TXmlEngNode aNode) + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( LIBXML_NODE->type == XML_DOCUMENT_NODE ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + if(aNode.ParentNode().IsNull()) + { + // new node is unlinked, so owned by some (maybe other than this) document + // previous ownership must be withdrawn + aNode.OwnerDocument().RemoveOwnership(aNode); + } + if(ParentNode().IsNull()) + { + // This node is unlinked, thus owned by its document + // Ownership must be withdrawn before removing the node + RXmlEngDocument doc = OwnerDocument(); + doc.RemoveOwnership(*this); + // Also, there is no place to link the new node! + // So it will be unlinked, but owned by this node's document + doc.TakeOwnership(aNode); + } + // put new node instead of 'this' node: it works with all combinations of linked/unlinked states of the nodes + xmlFreeNode(xmlReplaceNode(LIBXML_NODE, INTERNAL_NODEPTR(aNode))); + } + +EXPORT_C void TXmlEngNode::ReplaceWith(TXmlEngNode aNode) + { + if(!LIBXML_NODE || LIBXML_NODE->type == XML_DOCUMENT_NODE) + return; + if(aNode.ParentNode().IsNull()) + { + // new node is unlinked, so owned by some (maybe other than this) document + // previous ownership must be withdrawn + aNode.OwnerDocument().RemoveOwnership(aNode); + } + if(ParentNode().IsNull()) + { + // This node is unlinked, thus owned by its document + // Ownership must be withdrawn before removing the node + RXmlEngDocument doc = OwnerDocument(); + doc.RemoveOwnership(*this); + // Also, there is no place to link the new node! + // So it will be unlinked, but owned by this node's document + doc.TakeOwnership(aNode); + } + // put new node instead of 'this' node: it works with all combinations of linked/unlinked states of the nodes + xmlFreeNode(xmlReplaceNode(LIBXML_NODE, INTERNAL_NODEPTR(aNode))); + } + +// --------------------------------------------------------------------------------------------- +// Another node is put instead of the current node. +// +// Does the same as ReplaceWith(TXmlEngNode) but does not free node and just returns it. +// +// @return Current node after unlinking it from document tree +// @see ReplaceWith(TXmlEngNode) +// +// In both cases the argument node is unlinked from its previous location +// (which can be NONE, i.e. not linked; SAME or ANOTHER document tree) +// +// It is possible to use NULL TXmlEngNode object as an argument. In such case +// no new node will be put instead of unlinked one. +// +// @note Not applicable to document nodes +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::SubstituteForL(TXmlEngNode aNode) + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + if ( LIBXML_NODE->type == XML_DOCUMENT_NODE ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + // + if(aNode.ParentNode().IsNull()) + { + // new node is unlinked, so owned by other document + // it must not be owned to be linked + aNode.OwnerDocument().RemoveOwnership(aNode); + } + if(ParentNode().IsNull()) + { + // this node is unlinked - nowhere to link new node: this node's document will own it + OwnerDocument().TakeOwnership(aNode); + // this node will stay as it is + // new node will be unlinked by call to xmlReplaceNode + } + TXmlEngNode tmpNode = TXmlEngNode(xmlReplaceNode(LIBXML_NODE, INTERNAL_NODEPTR(aNode))); + aNode.OwnerDocument().TakeOwnership(tmpNode); + return tmpNode; + } + +// --------------------------------------------------------------------------------------------- +// DOM Level 3 Core +// --------------------------------------------------------------------------------------------- + +// --------------------------------------------------------------------------------------------- +//Initializes a node list with all children of the node +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::GetChildNodes(RXmlEngNodeList& aList) const + { + aList.Open(LIBXML_NODE->children, TDOMNODETYPENONE); + } + +// --------------------------------------------------------------------------------------------- +// @return Parent node of the node or NULL if no parent +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::ParentNode() const + { + // + return TXmlEngNode(LIBXML_NODE->parent); + } + +// --------------------------------------------------------------------------------------------- +// @return The first child node or NULL if no children +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::FirstChild() const + { + // + return TXmlEngNode(LIBXML_NODE->children); + } + +// --------------------------------------------------------------------------------------------- +// @return The last child node or NULL if no children +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::LastChild() const + { + // + return TXmlEngNode(LIBXML_NODE->last); + } + +// --------------------------------------------------------------------------------------------- +// @return Previous node in a child list or NULL if no sibling before +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::PreviousSibling() const + { + if(!LIBXML_NODE->parent) + { + return NULL; + } + return TXmlEngNode(LIBXML_NODE->prev); + } + +// --------------------------------------------------------------------------------------------- +// @return Following node in a child list or NULL if no sibling after +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::NextSibling() const + { + if(!LIBXML_NODE->parent) + { + return NULL; + } + return TXmlEngNode(LIBXML_NODE->next); + } + +// --------------------------------------------------------------------------------------------- +// @return A document node of the DOM tree this node belongs to +// @note An instance of RXmlEngDocument class returns itself +// --------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument TXmlEngNode::OwnerDocument() const + { + // + return RXmlEngDocument(LIBXML_NODE->doc); + } + +// --------------------------------------------------------------------------------------------- +// Append a child node. +// +// This is universal operation for any types of nodes. +// Note, that some types of nodes cannot have children and +// some types of nodes are not allowed to be children of some other types. +// +// @return Appended node, which could changed as a result of adding it to +// list of child nodes (e.g. text nodes can coalesce together) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode TXmlEngNode::AppendChildL( + TXmlEngNode aNewChild) + { + if ( !LIBXML_NODE || aNewChild.IsNull() ) + { + User::Leave(KXmlEngErrNullNode); + } + // + if(aNewChild.ParentNode().IsNull()) + { + aNewChild.OwnerDocument().RemoveOwnership(aNewChild); + } + else + { + xmlUnlinkNode(INTERNAL_NODEPTR(aNewChild)); + } + xmlNodePtr child = xmlAddChild(LIBXML_NODE, INTERNAL_NODEPTR(aNewChild)); + + TEST_OOM_FLAG; + return child; +} + +// --------------------------------------------------------------------------------------------- +// @return Type of the node +// +// Use NodeType() to find out the type of the node prior to casting object +// of TXmlEngNode class to one of its derived subclasses (TXmlEngElement, TXmlEngAttr, TXmlEngTextNode, etc.) +// +// @see TXmlEngDOMNodeType +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode::TXmlEngDOMNodeType TXmlEngNode::NodeType() const + { + // + if((TXmlEngDOMNodeType)LIBXML_NODE->type == EText && TEXT_NODE_DATA_TYPE) + { + return (TXmlEngDOMNodeType)(TUint)TEXT_NODE_DATA_TYPE; + } + return (TXmlEngDOMNodeType)LIBXML_NODE->type; + } + +// Note: "" is used for undefined name; 0 means "to use libxml node's name field" +static const char* const KNodeNames[]={ + 0, + 0, // EElement = 1, + 0, // EAttribute = 2, + "#text", // EText = 3, + "#cdata-section", // ECDATASection = 4, + 0, // EEntityReference = 5, + "", // EEntity = 6, + 0, // EProcessingInstruction = 7, + "#comment", // EComment = 8, + 0, // EDocument = 9, + 0, // EDocumentType = 10, + "#document-fragment", // EDocumentFragment = 11, + "", // ENotation = 12, + 0, // ENamespaceDeclaration = 18 // not in use + "", // EBinaryContainer = 30, + "", // EChunkContainer = 31, + "" // EFileContainer = 32 +}; + +const TInt KNodeNamesSize = sizeof(KNodeNames); + +// --------------------------------------------------------------------------------------------- +// @return Name of the node +// +// This method generally follows DOM spec : +// \verbatim +// ------------------------------------------------------------------------------- +// The values of nodeName, nodeValue, and attributes vary according to the node +// type as follows: +// +// interface nodeName nodeValue attributes +// ------------------------------------------------------------------------------- +// Attr = Attr.name = Attr.value = null +// CDATASection = "#cdata-section" = CharacterData.data = null +// Comment = "#comment" = CharacterData.data = null +// Document = "#document" = null = null +// DocumentFragment = "#document-fragment" = null = null +// DocumentType = DocumentType.name = null = null +// Element = Element.tagName = null = NamedNodeMap +// Entity = entity name = null = null +// EntityReference = name of entity referenced = null = null +// Notation = notation name = null = null +// ProcessingInstruction = target = data = null +// Text = "#text" = CharacterData.data = null +// ------------------------------------------------------------------------------- +// \endverbatim +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::Name() const + { + // DONE: OPTIMIZE: Create static array of names with nodetype as index + // Use NULL if name is not constant and then use such switch.. + // + TUint type = (TUint) LIBXML_NODE->type; + if (type < KNodeNamesSize /sizeof(char*)) + { + const char* KName = KNodeNames[type]; + if(KName) + { + return TXmlEngConstString(KName).PtrC8(); + } + return TXmlEngConstString((char*)LIBXML_NODE->name).PtrC8(); + } + return KNullDesC8(); + } + + +// --------------------------------------------------------------------------------------------- +// Fetches value of this node, depending on its type. +// +// @note It is better to always cast nodes to specific type and then use specific +// method for getting "node value" +// +// @return Node value +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::Value() const + { + if (iInternal) + { + switch(LIBXML_NODE->type) + { + // The content of first Text child is returned + case XML_ATTRIBUTE_NODE: + return AsAttr().Value(); + // Note: in DOM spec element's value is Null, but we can + // access it: the content of first TXmlEngTextNode child node is returned + case XML_ELEMENT_NODE: + return AsElement().Text(); + // TXmlEngTextNode, TXmlEngCDATASection, TXmlEngProcessingInstruction and Comments store + // content in the same way. + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_NODE->content)).PtrC8(); + + default: + ; + } + } + return NULL; +} +// --------------------------------------------------------------------------------------------- +// Sets value of this node. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::SetValueL( + const TDesC8& aValue ) + { + if (iInternal) + { + switch(LIBXML_NODE->type) + { + // The content of first TXmlEngTextNode child is returned + case XML_ATTRIBUTE_NODE: + case XML_ELEMENT_NODE: + // Note: in DOM spec element's value is Null, but we can + // access it: the content of first TXmlEngTextNode child node is returned + AsAttr().SetValueL(aValue); // same as TXmlEngElement::SetTextL(aValue); + return; + // TXmlEngTextNode, TXmlEngCDATASection, TXmlEngProcessingInstruction and Comments store + // content in the same way. + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: + AsText().SetContentsL(aValue); + return; + default: + ; + } + } + } + + +// --------------------------------------------------------------------------------------------- +// @return Whether the value of the node is presented by only one TXmlEngTextNode node +// +// If the value is "simple text" then it is possible to access it as TDOMString +// without making copy, which combines values of all text nodes and entity reference nodes. +// +// @see TXmlEngNode::Value(), TXmlEngAttr::Value(), TXmlEngElement::Text() +// +// This method is applicable to TXmlEngElement and TXmlEngAttr nodes. On other nodes FALSE is returned. +// +// @note +// Values (contents) of TXmlEngComment, TXmlEngCDATASection, TXmlEngTextNode, ProcessingInstuction data are +// always "simple". +// +// When the returned result is FALSE, getting value of the node would not returned +// whole contents because of either entity references present in the contents or +// the contents is mixed (for TXmlEngElement node). In this case WholeTextContentsCopyL() +// should be used. +// +// @see TXmlEngNode::WholeTextContentsCopyL() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNode::IsSimpleTextContents() const + { + if (!LIBXML_NODE) + return false; + xmlElementType type = LIBXML_NODE->type; + if (type == XML_ELEMENT_NODE || + type == XML_ATTRIBUTE_NODE) + { + xmlNodePtr children = LIBXML_NODE->children; + + return children && children->type == XML_TEXT_NODE && + !(children->next); + } + return false; // incorrect type node +} + +// --------------------------------------------------------------------------------------------- +// @return the content of the node +// +// What is returned depends on the node type. +// Method caller is responsible for freeing returned string. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::WholeTextContentsCopyL(RBuf8& aOutput) const + { + XE_ASSERT_DEBUG(LIBXML_NODE); + // + xmlChar* text = xmlNodeGetContent(LIBXML_NODE); + if (xmlOOMFlag()) + { + if(text) + xmlFree(text); + OOM_HAPPENED; + } + xmlCharAssignToRbuf8L(aOutput,text); + } +// ----------------------------------------------------------------------------- + +EXPORT_C TBool TXmlEngNode::HasChildNodes() const + { + // + return (TBool)LIBXML_NODE->children; + } + +// --------------------------------------------------------------------------------------------- +// @return Namespace URI of a node +// - NULL is returned for elements and attributes that do not +// belong to any namespace. +// - bound namespace URI is returned for namespace declaration nodes (instances of TXmlEngNamespace). +// - NULL is returned to all other types of node. +// @note use IsNull() and NotNull() for testing returned result on the subject +// of having some URI +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::NamespaceUri() const + { + // + switch(LIBXML_NODE->type) + { + case XML_ELEMENT_NODE: + case XML_ATTRIBUTE_NODE: + return TXmlEngNamespace(LIBXML_NODE->ns).Uri(); + case XML_NAMESPACE_DECL: + return AsNamespace().Uri(); + default: + return NULL; + } + } + +// --------------------------------------------------------------------------------------------- +// @return Prefix of a node +// +// Returns NULL for elements and attributes that do not have prefix +// (node belongs to the default namespace or does not belong to any namespace) +// NULL is also returned for all types of node other than TXmlEngElement or TXmlEngAttr +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::Prefix() const + { + if (LIBXML_NODE->type < XML_TEXT_NODE) // NOTE: XML_ELEMENT_NODE = 1 and XML_ATTRIBUTE_NODE = 2 + { + xmlNs* ns = LIBXML_NODE->ns; + if (ns) + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(ns->prefix)).PtrC8(); + } + return KNullDesC8(); + } + + +// --------------------------------------------------------------------------------------------- +// @return True if the node is TXmlEngElement and has at least one attribute +// +// @note Namespace-to-prefix bindings are not attributes. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNode::HasAttributes() const + { + return iInternal && + LIBXML_NODE->type == XML_ELEMENT_NODE && + LIBXML_NODE->properties; + } + +// --------------------------------------------------------------------------------------------- +// Evaluates active base URI for the node by processing xml:base attributes of parents +// +// @return A copy of effective base URI for the node +// @note It's up to the caller to free the string with TDOMString::Free() +// --------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngNode::BaseUriL(RBuf8& aBaseUri) const + { + // + xmlChar* uri = xmlNodeGetBase(LIBXML_NODE->doc, LIBXML_NODE); + if (xmlOOMFlag()) + { + if(uri) + xmlFree(uri); // partial construction is possible + OOM_HAPPENED; + } + xmlCharAssignToRbuf8L(aBaseUri,uri); + } + +// --------------------------------------------------------------------------------------------- +// Searches the prefix that is bound to the given aNamespaceUri and +// applicable in the scope of this TXmlEngNode. +// +// @return A sought prefix or NULL if not found or aNamespaceUri is the default namespace +// @see TXmlEngElement::LookupNamespaceByUri(TXmlEngNode,TDOMString) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::LookupPrefixL( + const TDesC8& aNamespaceUri ) const + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + // + if (LIBXML_NODE->type == XML_ATTRIBUTE_NODE || + LIBXML_NODE->type == XML_ELEMENT_NODE) + { + return AsElement().LookupNamespaceByUriL(aNamespaceUri).Prefix(); + } + if(!ParentNode().IsNull()) + { + return ParentNode().AsElement().LookupNamespaceByUriL(aNamespaceUri).Prefix(); + } + return KNullDesC8(); + } + +// --------------------------------------------------------------------------------------------- +// @return True if given namespace URI is a default one for the node (applicable to elements only) +// +// @note "" or NULL can be used to denote undefined namespace +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNode::IsDefaultNamespaceL( + const TDesC8& aNamespaceUri ) const + { + if (LIBXML_NODE->type == XML_ELEMENT_NODE) // No default namespaces for attributes + { + return !AsElement().DefaultNamespaceL().Uri().Compare(aNamespaceUri); + } + return false; + } + +// --------------------------------------------------------------------------------------------- +// Searches the namespace URI that is bound to the given prefix. +// +// @return - a sought URI or NULL if the prefix is not bound +// @see TXmlEngElement::LookupNamespaceByPrefix(TXmlEngNode,TDOMString) +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngNode::LookupNamespaceUriL( + const TDesC8& aPrefix ) const + { + if ( !LIBXML_NODE ) + { + User::Leave(KXmlEngErrNullNode); + } + // + if (LIBXML_NODE->type == XML_ATTRIBUTE_NODE || + LIBXML_NODE->type == XML_ELEMENT_NODE) + { + return AsElement().LookupNamespaceByPrefixL(aPrefix).Uri(); + } + if(!ParentNode().IsNull()) + { + return ParentNode().AsElement().LookupNamespaceByPrefixL(aPrefix).Uri(); + } + return KNullDesC8(); + } + +// --------------------------------------------------------------------------------------------- +// Returns the user data object attached to this node. Ownership is not transferred. +// +// @return Pointer to data object or NULL if it doesn't exist. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C MXmlEngUserData* TXmlEngNode::UserData() const + { + return + (LIBXML_NODE && + (LIBXML_NODE->type == XML_ATTRIBUTE_NODE || + LIBXML_NODE->type == XML_ELEMENT_NODE)) + ? + static_cast(LIBXML_NODE->_private) + : + NULL; + } + +// --------------------------------------------------------------------------------------------- +// Removes the user data onject attached to this node. Ownership is transferred +// (the object is not deleted). +// +// @return Pointer to data object or NULL if it doesn't exist. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C MXmlEngUserData* TXmlEngNode::RemoveUserData() + { + MXmlEngUserData* data = UserData(); + if (data) + { + // node type has been checked by UserData() + LIBXML_NODE->_private = NULL; + } + return data; + } + +// --------------------------------------------------------------------------------------------- +// Attaches a user data object to this node. The ownership of the object is transferred. +// When the (underlying) node is deleted the Destroy method of the MXmlEngUserData class will be +// called. If there already is a user data object associated with this node, it will be +// deleted before attaching the new object. Notet that only TXmlEngElement and Attribute nodes +// currently support this feature. +// +// @param[in] aData Pointer to the data object. +// @return true if successful, false if for example underlying node type doesn't support +// attaching user data. +// --------------------------------------------------------------------------------------------- +// +EXPORT_C TBool TXmlEngNode::AddUserData( + MXmlEngUserData* aData ) + { + TBool ret = false; + if (iInternal) + { + if (LIBXML_NODE->type == XML_ATTRIBUTE_NODE || + LIBXML_NODE->type == XML_ELEMENT_NODE) + { + // release previous data + if (LIBXML_NODE->_private) + { + MXmlEngUserData* oldData = RemoveUserData(); + oldData->Destroy(); + } + LIBXML_NODE->_private = aData; + ret = true; + } + } + return ret; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnodecontextnamespaceresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnodecontextnamespaceresolver.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "xmlengdnodecontextnamespaceresolver.h" +#include "xmlengddomdefs.h" + + +EXPORT_C CXmlEngNodeContextNamespaceResolver::~CXmlEngNodeContextNamespaceResolver() + { + } + +EXPORT_C CXmlEngNodeContextNamespaceResolver::CXmlEngNodeContextNamespaceResolver( + const TXmlEngNode& aContextNode ) + { + TXmlEngNode node = aContextNode; + while (node.NodeType() != TXmlEngNode::EElement && + node.ParentNode().NotNull()) + { + node = node.ParentNode(); + } + iContextElement = (node.NodeType() == TXmlEngNode::EElement) ? node.AsElement() : TXmlEngElement(); + } + +EXPORT_C TDOMString CXmlEngNodeContextNamespaceResolver::LookupPrefixL( + const TDesC8& aNamespaceUri ) const + { + if(iContextElement.NotNull()) + return iContextElement.LookupPrefixL(aNamespaceUri); + else + return NULL; + } + +EXPORT_C TDOMString CXmlEngNodeContextNamespaceResolver::LookupNamespaceUriL( + const TDesC8& aPrefix ) const + { + if(iContextElement.NotNull()) + return iContextElement.LookupNamespaceUriL(aPrefix); + else + return NULL; + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnodecontextnamespaceresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnodecontextnamespaceresolver.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalComponent + @released +*/ + +#ifndef XMLENGNODECTXTNAMESPACERESOLVER_H +#define XMLENGNODECTXTNAMESPACERESOLVER_H + +#include +#include + +/** + * Implementation of namespace resolver for XPath + * + */ +class CXmlEngNodeContextNamespaceResolver: public CBase, public MXmlEngNamespaceResolver +{ +public: + /** + * Constructor + * + * @param aContextNode Node in which looking for namespace starts + */ + IMPORT_C CXmlEngNodeContextNamespaceResolver(const TXmlEngNode& aContextNode); + + /** + * Destructor + * + */ + IMPORT_C ~CXmlEngNodeContextNamespaceResolver(); + + /** + * Searches the prefix that is bound to the given aNamespaceUri and + * applicable in the scope of this TXmlEngNode. + * + * @param aNamespaceUri Namespace Uri that should be found + * @return A sought prefix or NULL if not found or aNamespaceUri is the default namespace + */ + IMPORT_C TPtrC8 LookupPrefixL(const TDesC8& aNamespaceUri) const; + + /** + * Searches the namespace URI that is bound to the given prefix. + * + * @param aPrefix Namespace prefix that should be found + * @return A sought URI or NULL if the prefix is not bound + */ + IMPORT_C TPtrC8 LookupNamespaceUriL(const TDesC8& aPrefix) const; + /** @} **/ +private: + /** Namespace resolver context */ + TXmlEngElement iContextElement; +}; + +#endif /* XMLENGNODECTXTNAMESPACERESOLVER_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnodelist_impl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnodelist_impl.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,187 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node list implementation functions +// + +#include +#include "xmlengdomdefs.h" +#include +#include + +#define IS_NAME_MATCHED(type) (type & 0x10) +#define MATCH_TYPE(type) (type & 0x0F) + + +/** +* Default constructor +*/ +EXPORT_C RXmlEngNodeListImpl::RXmlEngNodeListImpl() + { + iCurrentNode = NULL; + iType = 0; + iName = NULL; + iNsUri = NULL; + } + +// Finds next node +// +// @param aMatch Current node +// @return Next node +// ------------------------------------------------------------------------------- +// +void* RXmlEngNodeListImpl::FindNextNode(void* aCurrentNode) const + { + const void* node_href; + + xmlNodePtr node = (xmlNodePtr) aCurrentNode; + TInt nodeType = MATCH_TYPE(iType); // mask NodeType bits only + + if(nodeType) + { + // any node is not suitable --> search at least by type + TInt matchName = IS_NAME_MATCHED(iType); // mask bit with matchName flag + + while (node) + { + if(node->type == nodeType) + { + if(!matchName) + { + break; // type matches; no need to aMatch name/URI + } + // continue matching name/URI + + // NOTE: if NodeType is ANY then names/URIs are not checked + if (StrEqualOrNull(iName, node->name)) + { + // Internally node->ns->href is "" OR node->ns is NULL + // stand for undefined namespace of the node + // but both NULL and "" are allowed as namespace URI criteria ("" is converted to NULL) + node_href = node->ns && node->ns->href && node->ns->href[0] + ? node->ns->href + : NULL; + if (StrEqualOrNull(iNsUri, node_href)) + { + break; // Matching node with type/name/URI is found + } + } + } + // current node does not fulfil criteria + node = node->next; + } + } + return node; + } + +/** +@return Number of nodes in a node list +*/ +EXPORT_C TInt RXmlEngNodeListImpl::Count() const + { + // Not really efficient, but it will be used probably only once + // (eg. to know how much memory to allocate) + xmlNodePtr start = (xmlNodePtr) iCurrentNode; + TInt cnt = 0; + xmlNodePtr theNext; + theNext = (xmlNodePtr) FindNextNode( start ); + while (theNext) + { + cnt++; + theNext = theNext->next; + theNext = (xmlNodePtr) FindNextNode( theNext ); + } + return cnt; + } + +/** +Checks whether next node exists in a node list + +@return TRUE if next node exists, FALSE otherwise +*/ +EXPORT_C TBool RXmlEngNodeListImpl::HasNext() const +{ + xmlNodePtr node = (xmlNodePtr) FindNextNode( iCurrentNode ); + return ((TBool)node); +} + +/** +Retrieves next node from a node list + +@return Next node +*/ +EXPORT_C TXmlEngNode RXmlEngNodeListImpl::Next() + { + xmlNodePtr valid = (xmlNodePtr) FindNextNode( iCurrentNode ); + iCurrentNode = valid + ? valid->next + : NULL; + return TXmlEngNode(valid); + } + +// ----------------------------------------------------------------------------- +// Initializes node list +// +// @note If aType is NULL, aName and aNs are ignored +// ----------------------------------------------------------------------------- +// +void RXmlEngNodeListImpl::OpenL( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType, + const TDesC8& aName, + const TDesC8& aNs) + { + iCurrentNode = aHead; + iType = aName.Length() ? aType | 0x10 : aType; + iName = (unsigned char*) XmlEngXmlCharFromDes8L( aName ); + iNsUri = NULL; + if(aNs.Length()) + { + unsigned char* tmp = iName; + CleanupStack::PushL(tmp); + iNsUri = (unsigned char*) XmlEngXmlCharFromDes8L( aNs ); + CleanupStack::Pop(tmp); + } + } + +// ----------------------------------------------------------------------------- +// Initializes node list +// +// @note If aType is NULL, aName and aNs are ignored +// ----------------------------------------------------------------------------- +// +void RXmlEngNodeListImpl::Open( + void* aHead, + TXmlEngNode::TXmlEngDOMNodeType aType) + { + iCurrentNode = aHead; + iType = aType; + } + +EXPORT_C void RXmlEngNodeListImpl::Close() + { + delete[] iName; + delete[] iNsUri; + } + +// ----------------------------------------------------------------------------- +// Compares two strings +// ----------------------------------------------------------------------------- +// +TBool StrEqualOrNull(const void* aStr1, const void* aStr2) +{ + if (aStr1 && aStr2) + return !strcmp((char*)aStr1, (char*)aStr2); + return !aStr1 && !aStr2; +} + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengnodeset.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengnodeset.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,112 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node set functions implementation +// + +#include +#include +#include + +#include +#include +#include "xmlengdomdefs.h" +#include + +#define THIS_NODESET (static_cast(iInternal)) +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C RXmlEngNodeSet::RXmlEngNodeSet():iInternal(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Frees any allocated resources for the RXmlEngNodeSet instance. +// +// @note All nodes referred to in a node set are "live", +// meaning that they are not copies of actual nodes in +// a document tree.
+// The only exception for this are namespace declarations, +// which ARE COPIES AND ARE DESTROYED with a node set +// ----------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngNodeSet::Free() + { + // NOTE: namespace nodes are new objects (->next points to parent element) + // and should be destroyed; all other nodes are "live" and belong + // to the document tree (so, should not be deleted) + // xmlXPathNodeSetFreeNs(xmlNsPtr ns) is used for namespaces + if (!THIS_NODESET) + return; // nothing to free.. + xmlXPathFreeNodeSet(THIS_NODESET); + iInternal = NULL; + } + +// ----------------------------------------------------------------------------- +// @return Number of nodes in a node set +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RXmlEngNodeSet::Length() const + { + return THIS_NODESET ? THIS_NODESET->nodeNr : 0; + } + +// ----------------------------------------------------------------------------- +// Retrieves a node from node set by index +// +// @param aIndex Node index { 0 <= aIndex < Length() } +// ----------------------------------------------------------------------------- +// +EXPORT_C TXmlEngNode RXmlEngNodeSet::operator[]( + TInt aIndex) const + { + XE_ASSERT_DEBUG(THIS_NODESET && aIndex >= 0 && aIndex < THIS_NODESET->nodeNr); + return TXmlEngNode(THIS_NODESET->nodeTab[aIndex]); + } + +// ----------------------------------------------------------------------------- +// Checks whether aNode is in a resulting node set +// +// @return TRUE is node in the node set, FALSE otherwise +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool RXmlEngNodeSet::Contains( + TXmlEngNode aNode) const + { + return xmlXPathNodeSetContains(THIS_NODESET, INTERNAL_NODEPTR(aNode)); + } + +// ----------------------------------------------------------------------------- +// Initializes a RXmlEngNodeSet instance as being "empty" +// +// This method is used when preparing node sets that will +// be used with RXmlEngXPathExpression::EvaluateWithDependenciesL(TXmlEngNode,RXmlEngNodeSet&) +// and TXmlEngXPathEvaluator::EvaluateWithDependenciesL(aExpression,aContextNode,aResolver,aDependents) +// ----------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngNodeSet::InitializeL() + { + Free(); + // create the libxml nodeset "object" + iInternal = xmlXPathNodeSetCreate(NULL); + OOM_IF_NULL(iInternal); + } +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +RXmlEngNodeSet::RXmlEngNodeSet(void* aData):iInternal(aData) + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengownednodescontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengownednodescontainer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,141 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node container implementation +// + +#include +#include "xmlengownednodescontainer.h" +#include "xmlengdomdefs.h" +#include +#include + +// -------------------------------------------------------------------------------------- +// Creates an instance of CXmlEngOwnedNodesContainer +// -------------------------------------------------------------------------------------- +// +CXmlEngOwnedNodesContainer* CXmlEngOwnedNodesContainer::NewL() + { + CXmlEngOwnedNodesContainer* obj = new (ELeave) CXmlEngOwnedNodesContainer(); + obj->iNodes = NULL; + obj->iLast = NULL; + obj->iCount = 0; + return obj; + } + +CXmlEngOwnedNodesContainer::~CXmlEngOwnedNodesContainer() + { + } +// -------------------------------------------------------------------------------------- +// Searches for a node in the list +// +// @param aNode Pointer to a libxml2 node +// @return Index in the list of nodes [0; iCount-1] or iCount if not found +// -------------------------------------------------------------------------------------- +// +TUint CXmlEngOwnedNodesContainer::Lookup(xmlNodePtr aNode) + { + TUint i = 0; + xmlNodePtr tmp = iNodes; + for(; tmp; tmp = tmp->next, i++) + if(tmp == aNode) + return i; + return iCount; + } + +// -------------------------------------------------------------------------------------- +// Performs clean up of the list +// -------------------------------------------------------------------------------------- +// +void CXmlEngOwnedNodesContainer::RemoveAll() + { + iNodes = NULL; + iCount = 0; + } + +// -------------------------------------------------------------------------------------- +// Performs clean up of all owned nodes: +// xmlFreeNode is called on every contained pointer +// -------------------------------------------------------------------------------------- +// +void CXmlEngOwnedNodesContainer::FreeAll() + { + xmlNodePtr tmp = iNodes; + xmlNodePtr ptr; + for(;tmp;) + { + ptr = tmp; + tmp = tmp->next; + if(ptr) + xmlFreeNode(ptr); + } + iNodes = NULL; + iCount = 0; + } + + +// -------------------------------------------------------------------------------------- +// Adds an owned node. +// +// @param aNode A pointer to some node to be added into the container +// +// @note This method does not check whether the pointer is already in the container +// @note In OOM situation the node is destroyed before leave occurs +// -------------------------------------------------------------------------------------- +// +void CXmlEngOwnedNodesContainer::Add( + xmlNodePtr aNode ) + { + if(iLast) + { + iLast->next = aNode; + aNode->prev = iLast; + } + else + { + iNodes = iLast = aNode; + } + iLast = aNode; + ++iCount; + } + +// -------------------------------------------------------------------------------------- +// Excludes node pointer from the list of owned nodes. +// +// does nothing if provided node pointer is not on the list. +// -------------------------------------------------------------------------------------- +// +void CXmlEngOwnedNodesContainer::Remove( + xmlNodePtr aNode ) + { + if(aNode == iLast) + { + iLast = aNode->prev; + } + else + { + aNode->next->prev = aNode->prev; + } + if(aNode == iNodes) + { + iNodes = aNode->next; + } + else + { + aNode->prev->next = aNode->next; + } + + aNode->prev = NULL; + aNode->next = NULL; + --iCount; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengownednodescontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengownednodescontainer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,108 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of nodes container +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGOWNED_NODES_CONTAINER_H +#define XMLENGOWNED_NODES_CONTAINER_H + +#include +#include + + + +/** + * Container for nodes owned by document + * + */ +class CXmlEngOwnedNodesContainer: public CBase + { + public: + /** + * Creates an instance of CXmlEngOwnedNodesContainer. + * + */ + static CXmlEngOwnedNodesContainer* NewL(); + + /** + * Destructor. + * + */ + ~CXmlEngOwnedNodesContainer(); + + /** + * Adds an owned node. + * + * @param aNodePtr A pointer to some node to be added into the container + * + * @note This method does not check whether the pointer is already in the container + * @note In OOM situation the node is destroyed before leave occurs + */ + void Add(xmlNodePtr aNodePtr); + + /** + * Excludes node pointer from the list of owned nodes. + * Does nothing if provided node pointer is not on the list. + * + * @param aNodePtr A pointer to node that should be removed. + */ + void Remove(xmlNodePtr aNodePtr); + + /** + * Performs clean up of the list + * + */ + void RemoveAll(); + + /** + * Performs clean up of all owned nodes: + * xmlFreeNode is called on every contained pointer + * + */ + void FreeAll(); + +private: + /** + * Default constructor. + * + */ + CXmlEngOwnedNodesContainer() {} + + /** + * Searches for a node in the list + * + * @param aPtr Pointer to a libxml2 node + * @return Index in the list of nodes [0; iLastIndex-1] or iLastIndex if not found + */ + TUint Lookup(xmlNodePtr aPtr); + +public: + /** Node pointer */ + xmlNodePtr iNodes; + /** Last node pointer */ + xmlNodePtr iLast; + /** Element count */ + TUint iCount; + }; + + + +#endif /* XMLENGOWNED_NODES_CONTAINER_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengprocessinginstruction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengprocessinginstruction.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Processing instruction node functions +// + +#include +#include +#include "xmlengdomdefs.h" +#include //pjj18 + +// --------------------------------------------------------------- +// @return "Target" part of a processing instruction +// +// @code +// +// @endcode +// +// @see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-pi +// --------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngProcessingInstruction::Target() const + { + XE_ASSERT_DEBUG(LIBXML_NODE); + // + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_NODE->name)).PtrC8(); + } + +// --------------------------------------------------------------- +// @return "Data" part of a processing instruction +// +// @code +// +// @endcode +// +// @see http://www.w3.org/TR/2004/REC-xml-20040204/#sec-pi +// --------------------------------------------------------------- +// +EXPORT_C TPtrC8 TXmlEngProcessingInstruction::Data() const + { + XE_ASSERT_DEBUG(LIBXML_NODE); + // + return ((TXmlEngConstString)CAST_XMLCHAR_TO_DOMSTRING(LIBXML_NODE->content)).PtrC8(); + } + +// --------------------------------------------------------------- +// Sets data part of processing instruction +// +// @note PI contents should not contain "?>" sequence +// --------------------------------------------------------------- +// +EXPORT_C void TXmlEngProcessingInstruction::SetDataL(const TDesC8& aData) + { + AsComment().SetContentsL(aData); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengserializationoptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengserializationoptions.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Serialization options functions +// + +#include + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TXmlEngSerializationOptions::TXmlEngSerializationOptions( TUint aOptionFlags, + const TDesC8& aEncoding) + : iOptions(aOptionFlags), + iEncoding(aEncoding), + iNodeFilter(NULL), + iDataSerializer(NULL) + { + } + +// ----------------------------------------------------------------------------- +// Sets node filter +// ----------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngSerializationOptions::SetNodeFilter(MXmlEngNodeFilter* aFilter) + { + iNodeFilter = aFilter; + } + +EXPORT_C void TXmlEngSerializationOptions::SetDataSerializer(MXmlEngDataSerializer* aSerializer) + { + iDataSerializer = aSerializer; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengtext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengtext.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Text node functions +// + +#include +#include "xmlengdomdefs.h" +#include + +EXPORT_C TBool TXmlEngTextNode::IsElementContentWhitespace() const + { + // The code is taken and adapted from xmlIsBlankNode: + const xmlChar *cur; + xmlNodePtr node = LIBXML_NODE; + if (!node) + return EFalse; + + if (!(node->content)) + return ETrue; + cur = node->content; + while (*cur != 0) + { + if (!IS_BLANK_CH(*cur)) + return EFalse; + cur++; + } + return ETrue; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxformsinstancemap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxformsinstancemap.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XForms functions +// + +#include "xmlengdomdefs.h" +#include +#include +#include +#include +#include + +const TInt KHashTableSize = 10; + +// --------------------------------------------------------------------------- +// Initializes internal storage. Leaves created object on cleanup stack. +// @return New CXFormsInstanceMap object. +// @exception Leave on OOM. +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlEngXFormsInstanceMap* CXmlEngXFormsInstanceMap::NewLC() + { + CXmlEngXFormsInstanceMap* instance = new(ELeave) CXmlEngXFormsInstanceMap(); + CleanupStack::PushL(instance); + instance->ConstructL(); + return instance; + } + +// --------------------------------------------------------------------------- +// Initializes internal storage. +// @return New CXFormsInstanceMap object. +// @exception Leave on OOM. +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlEngXFormsInstanceMap* CXmlEngXFormsInstanceMap::NewL() + { + CXmlEngXFormsInstanceMap* instance = NewLC(); + CleanupStack::Pop(instance); + return instance; + } + +void CXmlEngXFormsInstanceMap::ConstructL() + { + iInternal = xmlHashCreate(KHashTableSize); + OOM_IF_NULL(iInternal); + } + +// --------------------------------------------------------------------------- +// Destructor. Frees internal storage, but does not free the Document +// instances that were added. These are owned by the caller. +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlEngXFormsInstanceMap::~CXmlEngXFormsInstanceMap() + { + xmlHashFree( + static_cast(iInternal), + (xmlHashDeallocator) NULL); + } + +// --------------------------------------------------------------------------- +// Adds entry to container. Document is associated with a name. If an entry +// with the same name already exists this method does nothing. +// @param[in] aInstance The DOM document to be stored. +// @param[in] aName The name that is associated with the document. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngXFormsInstanceMap::AddEntryL( + RXmlEngDocument& aInstance, + const TDesC8& aName ) + { + xmlChar* name = xmlCharFromDesC8L(aName); + if ( 0 > xmlHashAddEntry( + static_cast(iInternal), + name, + INTERNAL_DOCPTR(aInstance)) + ) + { + delete name; + TEST_OOM_FLAG; + // else: there is already instance with such name + } + else + { + delete name; + } + } + +// --------------------------------------------------------------------------- +// Removes an entry from the container. If the entry does not exists +// method does nothing. Note that document is not freed. +// @param[in] aName Name of entry to remove. +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngXFormsInstanceMap::RemoveEntryL( + const TDesC8& aName ) + { + xmlChar* name = xmlCharFromDesC8L(aName); + xmlHashRemoveEntry( + static_cast(iInternal), + name, + (xmlHashDeallocator) NULL); + delete name; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathconfiguration.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathconfiguration.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,300 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath configuraion functions +// + +#include "xmlengdomdefs.h" +#include +#include "xmlengxpathevaluationcontext_impl.h" +#include "libxml2_globals_private.h" +#include +#include +#include + +const TInt KHashTableSize = 32; + +// ----------------------------------------------------------------------------------------------------- +// Common callback for all extension functions +// +// Prototyped by: +// typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); +// +// Non-natively implemented XPath extension function cannot be registered in libxml2 XPath module +// directly without using libxml2 XPath API.Thus, native implementation is impossible +// when libxml2's APIs are hidden. +// +// That is why this callback is used: it is a front-end for function calls. +// Function pointers are registered in a separate storage (xmlXPathIntermediaryExtensionFunctionsHash) +// and are dynamically discovered during function call by function name and namespace uri. +// ----------------------------------------------------------------------------------------------------- +// +void XmlEngineXpathCommonExtensionCallback(xmlXPathParserContextPtr ctxt, int nargs) + { + // Select function to call + const xmlChar* KFunc = ctxt->context->function; + const xmlChar* KFuncNs = ctxt->context->functionURI; + + void* funcPtr = xmlHashLookup2( + xmlXPathIntermediaryExtensionFunctionsHash, + KFunc, + KFuncNs); + if (!funcPtr) + { + XP_ERROR(XPATH_UNKNOWN_FUNC_ERROR); + } + MXmlEngXPathExtensionFunction* extFunc = reinterpret_cast(funcPtr); + // Check arity + TInt maxArity = extFunc->MaxArity(); + if (nargs < ((TInt)extFunc->MinArity()) || + (maxArity >= 0 && nargs > maxArity)) + { + XP_ERROR(XPATH_INVALID_ARITY); + } + // Wrap arguments + TXmlEngXPathEvaluationContextImpl context(ctxt, nargs); + if (!context.Initialize()) + { + SET_OOM_FLAG; + XP_ERROR(XPATH_MEMORY_ERROR); + } + // Call function + MXmlEngXPathExtensionFunction::TXmlEngEvaluationStatus status = extFunc->Evaluate(&context); + RXmlEngXPathResult res = context.Result(); + if (status != MXmlEngXPathExtensionFunction::ESucceeded) + { + xmlXPathFreeObject(INTERNAL_XPATHOBJPTR(res)); + XP_ERROR(XPATH_XE_EXTENSION_FUNC_ERROR); + } + // Remove arguments from the evaluation stack + + for (TInt i = 0; i < nargs; i++) + { + xmlXPathFreeObject(valuePop(ctxt)); + } + + // Push the result to the stack + valuePush(ctxt, INTERNAL_XPATHOBJPTR(res)); // Note: no need to check OOM flag -- later... + + } + +// ----------------------------------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngExtensionFunctionDescriptor::TXmlEngExtensionFunctionDescriptor() + { + iFunc = NULL; + iName = NULL; + iNamespaceUri = NULL; + iReserved = 0; + } + +// ----------------------------------------------------------------------------------------------------- +// Switches On or Off support of XForms extensions by XML Engine: +// - instance() function +// +// @param aEnable ETrue/EFalse to Enable/Disable additional functions +// +// @note +// Currently, XForms extensions are always ON and this method does nothing. +// ----------------------------------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathConfiguration::Unused_Func1(TBool /*aEnable*/) + { + } + +// ----------------------------------------------------------------------------------------------------- +// Disables support of any previously registered extension functions +// and switches to support of only XPath Function Library. +// ----------------------------------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathConfiguration::ResetExtensionFunctionsL() + { + // Set the hash tables free: + // xmlXPathIntermediaryExtensionFunctionsHash and + // xmlXPathDefaultFunctionsHash + // + + xmlHashTablePtr& fExtHash = xmlXPathIntermediaryExtensionFunctionsHash; + xmlHashFree(fExtHash, NULL); + fExtHash = NULL; + // + xmlHashTablePtr& fHash = xmlXPathDefaultFunctionsHash; + xmlHashFree(fHash, NULL); + fHash = NULL; + + // Fill the hash table with standard functions + // + // This reinitializes hash tables of XPath functions + xmlXPathContextPtr ctxt = xmlXPathNewContext(NULL); + OOM_IF_NULL(ctxt); + xmlXPathFreeContext(ctxt); + } + +EXPORT_C TBool XmlEngXPathConfiguration::IsFunctionSupportedL( + const TDesC8& aFunc, + const TDesC8& aNsUri ) + { + if(!xmlXPathDefaultFunctionsHash) + { + return FALSE; + } + // If the function hashes are not initialized -- we should do it! + + + + + + + + xmlChar* func = xmlCharFromDesC8L(aFunc); + CleanupStack::PushL(func); + xmlChar* ns = NULL; + if(aNsUri.Length()) + ns = xmlCharFromDesC8L(aNsUri); + void* test = xmlHashLookup2( + xmlXPathDefaultFunctionsHash, + func, + ns); + TBool res = (NULL != test); + delete ns; + CleanupStack::PopAndDestroy(func); + return res; + } + +EXPORT_C void XmlEngXPathConfiguration::AddExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aFuncDes ) + { + xmlHashTablePtr fHash = xmlXPathIntermediaryExtensionFunctionsHash; + // store new function to XPath Extensions storage + if (!fHash) + { + + + xmlXPathIntermediaryExtensionFunctionsHash = fHash = xmlHashCreate(KHashTableSize); + OOM_IF_NULL(fHash); + } + + + + // Note: it is not critical, since redefinitions of core XPath function won't be found + TInt res = xmlHashUpdateEntry2( + fHash, + (const xmlChar*)aFuncDes.iName, + (const xmlChar*)aFuncDes.iNamespaceUri, + aFuncDes.iFunc, + NULL); + if (res == -1) + { + TEST_OOM_FLAG; + User::Leave(KXmlEngErrXPathResult); + } + // Note: for now it is fixed that once defined, an extension is available in all + // evaluations of XPath in this thread. + xmlXPathDefineExtensionFunctionsGlobally = 1; + // register common callback in XPath engine with new function's name + if (!xmlXPathDefaultFunctionsHash) + { + // It was not initialized yet + // This is temporal solution to force initialization + xmlXPathContextPtr tmpCtxt = xmlXPathNewContext(NULL); + OOM_IF_NULL(tmpCtxt); + xmlXPathFreeContext(tmpCtxt); + + } + + if ( !xmlXPathDefaultFunctionsHash ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + res = xmlHashUpdateEntry2( + xmlXPathDefaultFunctionsHash, + (const xmlChar*)aFuncDes.iName, + (const xmlChar*)aFuncDes.iNamespaceUri, + (void*)XmlEngineXpathCommonExtensionCallback, + NULL); + + if (res == -1) + { + TEST_OOM_FLAG; + User::Leave(KXmlEngErrXPathResult); + } + // Now, XmlEngineXpathCommonExtensionCallback is called for registered function. + // XmlEngineXpathCommonExtensionCallback performs lookup in + // xmlXPathIntermediaryExtensionFunctionsHash for a function pointer by function name + // wraps XPath evaluation context (arguments) and calls Evaluate() method of + // registered function + } + +EXPORT_C void XmlEngXPathConfiguration::AddExtensionFunctionVectorL (const RArray& aFuncVector, TUint aSize) + { + for (TUint i = 0; i < aSize; i++) + { + AddExtensionFunctionL(aFuncVector[i]); + } + } + +EXPORT_C void XmlEngXPathConfiguration::AddNativeExtensionFunctionL(const TXmlEngExtensionFunctionDescriptor& aNativeFuncDes ) + { + if (!xmlXPathDefaultFunctionsHash) + { + // It was not initialized yet + // This is temporal solution to force initialization + xmlXPathContextPtr tmpCtxt = xmlXPathNewContext(NULL); + OOM_IF_NULL(tmpCtxt); + xmlXPathFreeContext(tmpCtxt); + } + + if ( !xmlXPathDefaultFunctionsHash ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + TInt res = xmlHashUpdateEntry2( + xmlXPathDefaultFunctionsHash, + (const xmlChar*)aNativeFuncDes.iName, + (const xmlChar*)aNativeFuncDes.iNamespaceUri, + aNativeFuncDes.iFunc, + NULL); + + if (res == -1) + { + TEST_OOM_FLAG; + User::Leave(KXmlEngErrXPathResult); + } + } + +EXPORT_C void XmlEngXPathConfiguration::AddNativeExtensionFunctionVectorL(const RArray& aNativeFuncVector, TUint aSize) + { + for (TUint i = 0; i < aSize; i++) + { + AddNativeExtensionFunctionL(aNativeFuncVector[i]); + } + } + +EXPORT_C void XmlEngXPathConfiguration::RemoveExtensionFunction(const TXmlEngExtensionFunctionDescriptor& aFuncDes ) + { + xmlHashRemoveEntry2( + xmlXPathDefaultFunctionsHash, + (const xmlChar*)aFuncDes.iName, + (const xmlChar*)aFuncDes.iNamespaceUri, + NULL /* deallocator function */); + } + +EXPORT_C void XmlEngXPathConfiguration::RemoveExtensionFunctionVector(const RArray& aFuncVector, TUint aSize ) + { + for (TUint i = 0; i < aSize; i++) + { + RemoveExtensionFunction(aFuncVector[i]); + } + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluationcontext_impl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluationcontext_impl.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,144 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluation context implementation +// + +#include "xmlengdomdefs.h" +#include "xmlengxpathevaluationcontext_impl.h" +#include +#include +#include +#include + +TUint TXmlEngXPathEvaluationContextImpl::ArgCount() + { + return iArgCount; + } + +const RXmlEngXPathResult TXmlEngXPathEvaluationContextImpl::Argument( + TUint aIndex ) + { + XE_ASSERT_DEBUG(aIndex < iArgCount); + // "Peeking" a value from a XPath-expression evaluation stack + return RXmlEngXPathResult(iContext->valueTab[iContext->valueNr - (iArgCount - aIndex)]); + } + +const RXmlEngXPathResult TXmlEngXPathEvaluationContextImpl::Result() + { + XE_ASSERT_DEBUG(iCurrentResult); + if (iCurrentResult->type != XPATH_NODESET && + iCurrentResult->nodesetval) + { + xmlXPathFreeNodeSet(iCurrentResult->nodesetval); + iCurrentResult->nodesetval = NULL; + } + if (iCurrentResult->type != XPATH_STRING && iCurrentResult->stringval) + { + xmlFree(iCurrentResult->stringval); + iCurrentResult->stringval = NULL; + } + return RXmlEngXPathResult(iCurrentResult); + } + +void TXmlEngXPathEvaluationContextImpl::InitializeNodeSetResult() + { + XE_ASSERT_DEBUG(iCurrentResult); + iCurrentResult->nodesetval = xmlXPathNodeSetCreate(NULL); + if(iCurrentResult->nodesetval) + { + iCurrentResult->type = XPATH_NODESET; + } + // else OOM happened and will be handled later + } + +void TXmlEngXPathEvaluationContextImpl::AppendToResult( + const TXmlEngNode aNode ) + { + if(OOM_FLAG) + return; // Do nothing in OOM + if (aNode.NodeType() != TXmlEngNode::ENamespaceDeclaration) + { + xmlXPathNodeSetAdd(iCurrentResult->nodesetval, INTERNAL_NODEPTR(*const_cast(&aNode))); + } + } +void TXmlEngXPathEvaluationContextImpl::AppendToResult( + const TXmlEngNamespace aAppendedNsNode, + const TXmlEngElement aNsParentNode) + { + XE_ASSERT_DEBUG(iCurrentResult); + + if(OOM_FLAG) + return; // Do nothing in OOM + // Add a copy of namespace node with special function + xmlXPathNodeSetAddNs(iCurrentResult->nodesetval, + INTERNAL_NODEPTR(*const_cast(&aNsParentNode)), + INTERNAL_NSPTR(*const_cast(&aAppendedNsNode))); + } + +void TXmlEngXPathEvaluationContextImpl::AppendToResult( + const RXmlEngNodeSet aNodeSet ) + { + if(OOM_FLAG) + return; // Do nothing in OOM + xmlXPathNodeSetMerge(iCurrentResult->nodesetval, INTERNAL_NODESETPTR(aNodeSet)); + iCurrentResult->type = XPATH_NODESET; + } + +void TXmlEngXPathEvaluationContextImpl::SetResult( + TReal aNumber ) + { + XE_ASSERT_DEBUG(iCurrentResult); + iCurrentResult->type = XPATH_NUMBER; + iCurrentResult->floatval = aNumber; + } + +void TXmlEngXPathEvaluationContextImpl::SetResult( + TBool aBoolean ) + { + XE_ASSERT_DEBUG(iCurrentResult); + iCurrentResult->type = XPATH_BOOLEAN; + iCurrentResult->boolval = (aBoolean != 0); + } + +void TXmlEngXPathEvaluationContextImpl::SetResultL( + const TDesC8& aString ) + { + // Note: OOM flag is checked later (otherwise, there are two checks in the function) + xmlChar* copy = xmlCharFromDesC8L(aString); + + iCurrentResult->type = XPATH_STRING; + if(iCurrentResult->stringval) + xmlFree(iCurrentResult->stringval); + iCurrentResult->stringval = copy; + } + +// --------------------------------------------- Impementation-specific methods +/** +Allocates memory for function result + +@return TRUE is succeeded, FALSE if OOM has happened +*/ +TBool TXmlEngXPathEvaluationContextImpl::Initialize() + { + iCurrentResult = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); + if(iCurrentResult) + memset(iCurrentResult, 0, (size_t)sizeof(xmlXPathObject)); + iCurrentResult->type = XPATH_STRING; + return (TBool)iCurrentResult; + } + +void* TXmlEngXPathEvaluationContextImpl::ExtendedContext() + { + return iContext->comp->extendedContext; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluationcontext_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluationcontext_impl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,160 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluation context declaration +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGXPATHEVALCTXT_IMPL_H +#define XMLENGXPATHEVALCTXT_IMPL_H + +#include +#include + +/** + * XPath evaluation context + * + */ +class TXmlEngXPathEvaluationContextImpl: public MXmlEngXPathEvaluationContext + { +public: + /** + * Constructor + * + * @param aContext Pointer to XPath parser context + * @param aArgCount Number of arguments + */ + TXmlEngXPathEvaluationContextImpl(xmlXPathParserContextPtr aContext, TUint aArgCount) + : iContext(aContext), + iArgCount(aArgCount), + iCurrentResult(NULL), + iOOM(EFalse) {} + + /** + * Get number of arguments provided + * + * @return Number of arguments provided + * + * @note + * The implementation of extension function should not check + * that ArgCount() returns value in the range [ MinArity() ; MaxArity() ] + * - the function is called iif the statement holds:
+ * MinArity() =< arg.count =< MaxArity() + */ + TUint ArgCount(); + + /** + * Retrieves arguments by index (zero-based) + * + * @return N-th argument of the function + * + * @note + * - Argument index starts at 0 + * - Returned result should not be freed + */ + const RXmlEngXPathResult Argument(TUint aIndex); + + /** + * Get the result written so far. + * + * @return Result evaluated by the function so far. + * + * Initially, function result is undefined. It can be changed + * by SetResult() functions for a boolean, string or number values + * or by combined use of InitializeNodeSetResult() and AppendToResult() methods + */ + const RXmlEngXPathResult Result(); + + /** + * Sets a NODESET type of the result (floating-point number): an empty + * instance of NodeSet is created. + * + * The node set is to be filled up by methods AppendToResult(TXmlEngNode) and AppendToResult(RXmlEngNodeSet) + * This method replaces any existing prepared result so far + * (even an initialized already node set) + * @see AppendToResult(TXmlEngNode), AppendToResult(RXmlEngNodeSet) + * + */ + void InitializeNodeSetResult(); + + /** + * Appends a node to the node set result. + * @note InitializeNodeSetResult() should be called prior any call to + * AppendToResult(TXmlEngNode) or AppendToResult(RXmlEngNodeSet) + * + * @param aNode Node that should be add + */ + void AppendToResult(const TXmlEngNode aNode); + void AppendToResult(const TXmlEngNamespace aAppendedNsNode, const TXmlEngElement aNsParentNode); + /** + * Appends a node set to the node set result. Nodes are merged into resulting node set. + * @note InitializeNodeSetResult() should be called prior any call to + * AppendToResult(TXmlEngNode) or AppendToResult(RXmlEngNodeSet) + * + * @param aNodeSet Nodes that should be add + */ + void AppendToResult(const RXmlEngNodeSet aNodeSet); + + /** + * Sets a NUMBER type of the result (a floating-point number) + * + * @param aNumber New number + */ + void SetResult(TReal aNumber); + + /** + * Sets a BOOLEAN type of the result + * + * @param aBoolean New value + */ + void SetResult(TBool aBoolean); + + /** + * Sets a STRING type of the result + * + * @param aString New string value + */ + void SetResultL(const TDesC8& aString); + + /** + * Gets data specified in RXmlEngXPathExpression::SetExtendedContext(void*) method + * for the expression currently being evaluated. + * + */ + void* ExtendedContext(); + + /** + * Allocates memory for function result + * + * @return TRUE is succeeded, FALSE if OOM has happened + */ + TBool Initialize(); + +private: + /** XPath parser */ + xmlXPathParserContextPtr iContext; + /** Arguments count */ + TUint iArgCount; + /** XPath object */ + xmlXPathObjectPtr iCurrentResult; + /** OOM flag */ + TBool iOOM; + }; + +#endif /* XMLENGXPATHEVALCTXT_IMPL_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathevaluator.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,137 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath evaluator functions +// + +#include "xmlengdomdefs.h" +#include +#include +#include +#include +#include +#include +#include +#include +// Default constructor +// -------------------------------------------------------------------------------------------- +// +EXPORT_C TXmlEngXPathEvaluator::TXmlEngXPathEvaluator() : iInstanceTrees(NULL) + { + } + +// -------------------------------------------------------------------------------------------- +// Precompiles and stores an XPath expression, which is returned to caller. +// +// @param[in] aExpression The expression as a string. +// @param[in] aResolver An object that can resolve of namespace prefixes into namespace URIs +// @return Compiled XPath expression. +// +// May leave with KErrXPath code +// -------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathExpression TXmlEngXPathEvaluator::CreateExpressionL( + const TDesC8& aExpression, + const MXmlEngNamespaceResolver* /* aResolver */) + { + xmlChar* exp = xmlCharFromDesC8L(aExpression); + xmlXPathCompExprPtr cExpr = xmlXPathCtxtCompile(NULL, exp); + delete exp; + if(xmlOOMFlag()) + { + xmlXPathFreeCompExpr(cExpr); + OOM_HAPPENED; + } + if(!cExpr) + { + XmlEngLeaveL(KXmlEngErrXPathSyntax); + } + + return RXmlEngXPathExpression(cExpr, iInstanceTrees); + } + +// -------------------------------------------------------------------------------------------- +// Evaluates the XPath expression given as parameter. The result is returned. +// +// @param[in] aExpression The expression as a string. +// @param[in] aContextNode The node relative to which the expression is evaluated. +// @param[in] aResolver (for future use) +// @return Result of evaluation as an RXmlEngXPathResult object. +// May leave with KXmlEngErrXPathSyntax code for invalid XPathExpression and KXmlEngErrXPathResult +// for undefined result of evaluation. +// -------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult TXmlEngXPathEvaluator::EvaluateL( + const TDesC8& aExpression, + const TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* /* aResolver */ ) + { + RXmlEngXPathExpression expr = CreateExpressionL(aExpression, NULL); + CleanupClosePushL(expr); + + RXmlEngXPathResult result = expr.EvaluateL(aContextNode); + CleanupStack::PopAndDestroy(&expr); + return result; + } + +// -------------------------------------------------------------------------------------------- +// Does the same as #evaluate, but as a side-effect calculates the dependency list of the +// expression. This is meant to be used by the XForms engine. +// +// @param[in] aExpression The expression as a string. +// @param[in] aContextNode The node relative to which the expression is evaluated. +// @param[in] aResolver (for future use) +// @param[in,out] aDependents After the method has returned, contains set of nodes that +// the expression is dependent on. +// @return Result of evaluation as an RXmlEngXPathResult object. +// +// May leave with KXmlEngErrXPathResult or KXmlEngErrXPathSyntax codes. +// -------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult TXmlEngXPathEvaluator::EvaluateWithDependenciesL( + const TDesC8& aExpression, + const TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* /* aResolver */, + RXmlEngNodeSet& aDependents ) + { + RXmlEngXPathExpression expr = CreateExpressionL(aExpression, NULL); + CleanupClosePushL(expr); + RXmlEngXPathResult result = expr.EvaluateWithDependenciesL(aContextNode, aDependents); + CleanupStack::PopAndDestroy(&expr); + return result; + } + +// -------------------------------------------------------------------------------------------- +// Registers the instance map to be used when evaluating XForms expressions. The map +// contains DOM Documents and their names. For example, when evaluating the expression +// "instance('a')" the evaluator looks up a Document that has the name "a" from the map. +// Method does not take owership, caller has to free the map. +// +// @param[in] aInstanceTrees The instance map. +// -------------------------------------------------------------------------------------------- +// +EXPORT_C void TXmlEngXPathEvaluator::SetInstanceMap( + CXmlEngXFormsInstanceMap* aInstanceTrees ) + { + iInstanceTrees = aInstanceTrees; + } + +// ----------------------------------------------------------------------------- +// Returns the registered instance map. +// @return pointer instance map or NULL if not registered. +// ----------------------------------------------------------------------------- +// +EXPORT_C CXmlEngXFormsInstanceMap* TXmlEngXPathEvaluator::InstanceMap() + { + return iInstanceTrees; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathexpression.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathexpression.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,139 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath expression functions +// + +#include +#include +#include "libxml2_xpathinternals_private.h" +#include +#include +#include +#include "xmlengdomdefs.h" +#include + +#include +#include + +#define COMPILED_EXPR (static_cast(iInternal)) +#define INSTANCE_MAP (iInternal2 ? \ + static_cast \ + (static_cast(iInternal2)->iInternal) : NULL) + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathExpression::RXmlEngXPathExpression():iInternal(NULL), iInternal2(NULL), reserved1(0), reserved2(NULL) + { + } + +// -------------------------------------------------------------------------------------------- +// Resets the compiled expression and frees the allocated memory. +// -------------------------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngXPathExpression::Destroy() + { + xmlXPathFreeCompExpr(COMPILED_EXPR); + iInternal = NULL; + iInternal2 = NULL; + } + +// -------------------------------------------------------------------------------------------- +// Evaluates this expression. +// @param[in] aContextNode The node relative to which the expression is evaluated. +// @param[in] aResolver Namespace-resolver object +// +// @return Result of evaluation as an RXmlEngXPathResult object. +// May leave with KXmlEngErrXPathResult code if result is undefuned +// -------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult RXmlEngXPathExpression::EvaluateL( + TXmlEngNode aContextNode, + const MXmlEngNamespaceResolver* /* aResolver */) const + { + xmlXPathContextPtr ctxt = xmlXPathNewContext(INTERNAL_NODEPTR(aContextNode)->doc); + OOM_IF_NULL(ctxt); + ctxt->node = INTERNAL_NODEPTR(aContextNode); + ctxt->instanceDocs = INSTANCE_MAP; + xmlXPathObjectPtr resultObj = xmlXPathCompiledEval(COMPILED_EXPR, ctxt); + xmlXPathFreeContext(ctxt); + if(OOM_FLAG) + { + xmlXPathFreeObject(resultObj); + XmlEngLeaveL(KErrNoMemory); + } + if(!resultObj || resultObj->type == XPATH_UNDEFINED) + { + xmlXPathFreeObject(resultObj); + XmlEngLeaveL(KXmlEngErrXPathResult); + } + return RXmlEngXPathResult(resultObj); + } + +// -------------------------------------------------------------------------------------------- +// Does the same as #EvaluateL, but as a side-effect calculates the dependency list of the +// expression. This is meant to be used by the XForms engine. +// +// @param[in] aContextNode The node relative to which the expression is evaluated. +// @param[in,out] aDependents After the method has returned, contains set of nodes that +// the expression is dependent on. +// @param[in] aResolver Namespace-resolver object +// +// @return Result of evaluation as an RXmlEngXPathResult object. +// May leave with KXmlEngErrXPathResult code if result is undefuned, +// argument node set is not destroyed then. +// -------------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult RXmlEngXPathExpression::EvaluateWithDependenciesL( + TXmlEngNode aContextNode, + RXmlEngNodeSet& aDependents, + const MXmlEngNamespaceResolver* /* aResolver */) const + { + xmlXPathContextPtr ctxt = xmlXPathNewContext(INTERNAL_NODEPTR(aContextNode)->doc); + OOM_IF_NULL(ctxt); + ctxt->node = INTERNAL_NODEPTR(aContextNode); + ctxt->instanceDocs = INSTANCE_MAP; + xmlXPathObjectPtr resultObj = xmlXPathCompiledEvalWithDependencies( + COMPILED_EXPR, + ctxt, + static_cast(aDependents.iInternal)); + xmlXPathFreeContext(ctxt); + if(resultObj->type == XPATH_UNDEFINED) + { + xmlXPathFreeObject(resultObj); + XmlEngLeaveL(KXmlEngErrXPathResult); + } + + return RXmlEngXPathResult(resultObj); + } + +EXPORT_C void RXmlEngXPathExpression::SetExtendedContext( + void* aContext ) + { + COMPILED_EXPR->extendedContext = aContext; + } + +EXPORT_C void* RXmlEngXPathExpression::ExtendedContext() const + { + return COMPILED_EXPR->extendedContext; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +RXmlEngXPathExpression::RXmlEngXPathExpression(void* aData, void* aData2):iInternal(aData), iInternal2(aData2) + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathext.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file is to be included by API clients +// + + + +/** + @file + @released +*/ +#ifndef XMLENGXPATHEXT_H +#define XMLENGXPATHEXT_H + +#include +#include +#include + +#endif /* XMLENGXPATHEXT_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathresult.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathresult.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,129 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Result of XPath expression +// + +#include +#include +#include +#include "xmlengdomdefs.h" +#include +#include + +#define RESULT_OBJ (static_cast(iInternal)) + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult::RXmlEngXPathResult():iInternal(NULL) + { + } + +// --------------------------------------------------------------------------- +// Frees any allocated memory by this instance +// --------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngXPathResult::Free() + { + xmlXPathFreeObject(RESULT_OBJ); + } + +// --------------------------------------------------------------------------- +// Retrieves type of result +// @note Always check type of result before use it +// --------------------------------------------------------------------------- +// +EXPORT_C RXmlEngXPathResult::TXmlEngXPathResultType RXmlEngXPathResult::Type() const + { + return (TXmlEngXPathResultType)RESULT_OBJ->type; + } + +// --------------------------------------------------------------------------- +// Retrieves node-set result. +// Non-RXmlEngNodeSet result will return NULL. No conversion is done from other +// types. +// --------------------------------------------------------------------------- +// +EXPORT_C RXmlEngNodeSet RXmlEngXPathResult::AsNodeSet() const + { + return RXmlEngNodeSet(RESULT_OBJ->nodesetval); + } + +// --------------------------------------------------------------------------- +// Retrieves copy of result as TXmlEngParserString. +// In this version of API this method will make conversion from other types of +// XPath result. In the future release there will be separate method for +// conversion (this method will return TDOMString and conversion method - +// TString) +// NOTE: Returns a pointer to the copy of the string, the caller must free it +// --------------------------------------------------------------------------- +// +EXPORT_C void RXmlEngXPathResult::AsStringL(RBuf8& aOutput) const + { + xmlChar* copy = NULL; + if (RESULT_OBJ->type == XPATH_STRING) + { + if(RESULT_OBJ->stringval) + { + copy = xmlStrdup(RESULT_OBJ->stringval); + OOM_IF_NULL(copy); + } + } + else + { + copy = xmlXPathCastToString(RESULT_OBJ); + if(OOM_FLAG) + { + if(copy) + xmlFree(copy); + OOM_HAPPENED; + } + } + xmlCharAssignToRbuf8L(aOutput,copy); + } + +// --------------------------------------------------------------------------- +// Retrieves numeric value of the result. +// Conversion occurs as XPath spec says if the result is not of ENumber type +// --------------------------------------------------------------------------- +// +EXPORT_C TReal RXmlEngXPathResult::AsNumber() const + { + if (RESULT_OBJ->type == XPATH_NUMBER) + return RESULT_OBJ->floatval; + else + return xmlXPathCastToNumber(RESULT_OBJ); + } + +// --------------------------------------------------------------------------- +// Retrieves numeric value of the result. +// Conversion occurs as XPath spec says if the result is not of EBoolean type +// --------------------------------------------------------------------------- +// +EXPORT_C TBool RXmlEngXPathResult::AsBoolean() const + { + if (RESULT_OBJ->type == XPATH_BOOLEAN) + return RESULT_OBJ->boolval; + else + return xmlXPathCastToBoolean(RESULT_OBJ); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +RXmlEngXPathResult::RXmlEngXPathResult(void* aData):iInternal(aData) + { + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlenginedom/xmlengxpathutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlenginedom/xmlengxpathutils.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,180 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XPath utils +// + +#include +#include +#include +#include +#include "xmlengdomdefs.h" +#include +#include +#include + +#define XPATH_OBJ (static_cast(iInternal)) + +// --------------------------------------------------------------------------- +// Converts node to number +// --------------------------------------------------------------------------- +// +EXPORT_C TReal XmlEngXPathUtils::ToNumberL( + const TXmlEngNode& aNode ) + { + // construct a fake node set with one node + TXmlEngNode node = aNode; + xmlNodeSet nset; + xmlNodePtr pNode = INTERNAL_NODEPTR(node); + nset.nodeNr = 1; + nset.nodeMax = 1; + nset.nodeTab = &pNode; + // + TReal number = xmlXPathCastNodeSetToNumber(&nset); + TEST_OOM_FLAG; + return number; + } + +// --------------------------------------------------------------------------- +// Converts node-set to number +// --------------------------------------------------------------------------- +// +EXPORT_C TReal XmlEngXPathUtils::ToNumberL( + const RXmlEngNodeSet& aNodeSet ) + { + TReal number = xmlXPathCastNodeSetToNumber(INTERNAL_NODESETPTR(aNodeSet)); + TEST_OOM_FLAG; + return number; + } + +// --------------------------------------------------------------------------- +// Converts TBool value to number +// --------------------------------------------------------------------------- +// +EXPORT_C TReal XmlEngXPathUtils::ToNumberL( + TBool aValue ) + { + return aValue ? (1.0) :(0.0); + } + +// --------------------------------------------------------------------------- +// Converts string to number +// --------------------------------------------------------------------------- +// +EXPORT_C TReal XmlEngXPathUtils::ToNumberL( + const TDesC8& aString ) + { + xmlChar* str = xmlCharFromDesC8L(aString); + TReal number = (TReal)xmlXPathStringEvalNumber(str); + delete str; + TEST_OOM_FLAG; + return number; + } + +// --------------------------------------------------------------------------- +// Converts node to string +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathUtils::ToStringL( + const TXmlEngNode& aNode, RBuf8& aOutput) + { + aNode.WholeTextContentsCopyL(aOutput); + } + +// --------------------------------------------------------------------------- +// Converts node-set to string +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathUtils::ToStringL( + const RXmlEngNodeSet& aNodeSet, RBuf8& aOutput) + { + xmlChar* text= xmlXPathCastNodeSetToString(INTERNAL_NODESETPTR(aNodeSet)); + OOM_IF_NULL(text); + xmlCharAssignToRbuf8L(aOutput,text); + } + +// --------------------------------------------------------------------------- +// Converts TBool value to string +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathUtils::ToStringL( + TBool aValue, RBuf8& aOutput) + { + xmlChar* text = xmlStrdup((const xmlChar *)(aValue ? "true" : "false")); + OOM_IF_NULL(text); + xmlCharAssignToRbuf8L(aOutput,text); + } + +// --------------------------------------------------------------------------- +// Converts TReal value to string +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlEngXPathUtils::ToStringL( + TReal aValue, RBuf8& aOutput ) + { + xmlChar* text = xmlXPathCastNumberToString(aValue); + OOM_IF_NULL(text); + xmlCharAssignToRbuf8L(aOutput,text); + } + +// --------------------------------------------------------------------------- +// Converts node to boolean +// --------------------------------------------------------------------------- +// +EXPORT_C TBool XmlEngXPathUtils::ToBoolean( + const TXmlEngNode& aNode ) + { + return aNode.NotNull(); + } + +// --------------------------------------------------------------------------- +// Converts node-set to boolean +// --------------------------------------------------------------------------- +// +EXPORT_C TBool XmlEngXPathUtils::ToBoolean( + const RXmlEngNodeSet& aNodeSet ) + { + return xmlXPathCastNodeSetToBoolean(INTERNAL_NODESETPTR(aNodeSet)); + } + +// --------------------------------------------------------------------------- +// Converts string to boolean +// --------------------------------------------------------------------------- +// +EXPORT_C TBool XmlEngXPathUtils::ToBoolean( + const TDesC8& aValue ) + { + return aValue.Length() ? 1 : 0; + } + +// --------------------------------------------------------------------------- +// Converts stringArg to boolean +// @deprecated +// --------------------------------------------------------------------------- +// +EXPORT_C TBool XmlEngXPathUtils::ToBooleanL( + const TDesC8& aValue ) + { + return ToBoolean(aValue); + } + +// --------------------------------------------------------------------------- +// Converts TReal value to boolean +// --------------------------------------------------------------------------- +// +EXPORT_C TBool XmlEngXPathUtils::ToBoolean( + TReal aValue ) + { + return xmlXPathIsNaN(aValue) || (aValue == 0.0) ? 0 : 1; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengcontenthandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengcontenthandler.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,419 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Content handler implementation +// + +#include "xmlengcontenthandler.h" +#include +#include +#include "xmlengdeserializerxop.h" +#include +#include + +#include +#include + +CXmlEngContentHandler* CXmlEngContentHandler::NewL( CXmlEngDeserializer* aDeserializer, + MContentHandler* aContentHandler ) + { + CXmlEngContentHandler* self = new (ELeave) CXmlEngContentHandler(aDeserializer, aContentHandler); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); //self + return self; + } + +CXmlEngContentHandler::~CXmlEngContentHandler() + { + iCachedPrefixes.ResetAndDestroy(); + iCachedUris.ResetAndDestroy(); + iCachedErrors.Reset(); + iStrPool.Close(); + } + +CXmlEngContentHandler::CXmlEngContentHandler(CXmlEngDeserializer* aDeserializer, + MContentHandler* aContentHandler) +: iDeserializer(aDeserializer), + iContentHandler(aContentHandler) + { + iSkipIncludeElement = 0; + iSkipPrefixMapping = 0; + } + +void CXmlEngContentHandler::ConstructL() + { + iStrPool.OpenL(); + } + +/** +This method is a callback to indicate the start of the document. +@param aDocParam Specifies the various parameters of the document. +@param aDocParam.iCharacterSetName The character encoding of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) +{ + iContentHandler->OnStartDocumentL(aDocParam, aErrorCode); +} + + +/** +This method is a callback to indicate the end of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnEndDocumentL(TInt aErrorCode) +{ + iContentHandler->OnEndDocumentL(aErrorCode); +} + + +/** +This method is a callback to indicate an element has been parsed. +@param aElement is a handle to the element's details. +@param aAttributes contains the attributes for the element. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnStartElementL(const RTagInfo& aElement, + const RAttributeArray& aAttributes, + TInt aErrorCode) +{ + _LIT8(KInclude, "Include"); + _LIT8(KXopIncludeUri, "http://www.w3.org/2004/08/xop/include"); + _LIT8(KHref, "href"); + _LIT8(KHrefUriEmpty, ""); + + TBool xopInclude = EFalse; + + if(iSkipIncludeElement) + { + if( aElement.LocalName().DesC() == KInclude + && aElement.Uri().DesC() == KXopIncludeUri) + { + xopInclude = ETrue; + ++iSkipIncludeElement; + } + return; + } + + MXmlEngExtendedHandler* ext = (MXmlEngExtendedHandler*)iContentHandler->GetExtendedInterface(MXmlEngExtendedHandler::EExtInterfaceUid); + + // determine if this element is xop:Include + if( xopInclude || + (aElement.LocalName().DesC() == KInclude && + aElement.Uri().DesC() == KXopIncludeUri)) + { + for ( TInt i = 0; i < aAttributes.Count(); i++) + { + if( aAttributes[i].Attribute().LocalName().DesC() == KHref + && aAttributes[i].Attribute().Uri().DesC() == KHrefUriEmpty) + { + TPtrC8 cidValue; + TPtrC8 data; + cidValue.Set(CidValue(aAttributes[i].Value().DesC())); + if( (CXmlEngDeserializer*)iDeserializer->ExternalData() + && iDeserializer->GetDataContainer(cidValue) ) + { + ++iSkipIncludeElement; + iSkipPrefixMapping = ETrue; + if(ext) + ext->OnDataContainerL(*iDeserializer->GetDataContainer(cidValue), KErrNone); + } + else if(((CXmlEngDeserializerXOP*)iDeserializer)->GetData(cidValue, data) == KErrNone) + { + ++iSkipIncludeElement; + iSkipPrefixMapping = ETrue; + if(ext) + { + if(iDeserializer->ParsingOptions().iOptions & TXmlEngParsingOptions::KOptionEncodeToBase64) + { + //TImCodecB64 base64Codec; + // The encoded length of base64 is about twice (use 3x) decoded length + HBufC8* data64 = HBufC8::NewLC(3*data.Size()); + TPtr8 data64Ptr = data64->Des(); + // Encode to the base64 Content-Transfer-Encoding + //base64Codec.Encode(data, data64Ptr); + using namespace BSUL; + Base64Codec::Encode(data, data64Ptr); + if(data64Ptr.Length() == 0) + { + User::Leave(KErrGeneral); + } + ext->OnBinaryContentL(data64Ptr,cidValue,aErrorCode); + CleanupStack::PopAndDestroy(); //data64 + } + else + { + ext->OnBinaryContentL(data,cidValue,aErrorCode); + } + } + + } + else + { + User::Leave(KXmlEngErrBinDataNotFound); + //iContentHandler->OnStartElementL(aElement, aAttributes, aErrorCode); + } + } + } //for + } + + if(!iSkipIncludeElement) + { + if(iCachedUris.Count()) + { + RString prefix; + RString uri; + for(TInt i = 0; i < iCachedPrefixes.Count(); i++) + { + prefix = iStrPool.OpenStringL(iCachedPrefixes[i]->Des()); + CleanupClosePushL(prefix); + uri = iStrPool.OpenStringL(iCachedUris[i]->Des()); + CleanupClosePushL(uri); + iContentHandler->OnStartPrefixMappingL(prefix, uri, iCachedErrors[i]); + CleanupStack::PopAndDestroy(&uri); + CleanupStack::PopAndDestroy(&prefix); + } + } + if(iDeserializer->IsFeatureEnabled(EConvertTagsToLowerCase)) + { + RTagInfo elementTag = ConvertNameToLowerCaseL(aElement); + CleanupClosePushL(elementTag); + iContentHandler->OnStartElementL(elementTag, aAttributes, aErrorCode); + CleanupStack::PopAndDestroy(); //elementTag + } + else + { + iContentHandler->OnStartElementL(aElement, aAttributes, aErrorCode); + } + } + iCachedUris.ResetAndDestroy(); + iCachedPrefixes.ResetAndDestroy(); + iCachedErrors.Reset(); +} + + +/** +This method is a callback to indicate the end of the element has been reached. +@param aElement is a handle to the element's details. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) +{ + _LIT8(KInclude, "Include"); + _LIT8(KXopIncludeUri, "http://www.w3.org/2004/08/xop/include"); + + if(iSkipIncludeElement) + { + if( aElement.LocalName().DesC() == KInclude + && aElement.Uri().DesC() == KXopIncludeUri) + { + --iSkipIncludeElement; + } + return; + } + else + { + iSkipPrefixMapping = EFalse; + } + + if(iDeserializer->IsFeatureEnabled(EConvertTagsToLowerCase)) + { + RTagInfo elementTag = ConvertNameToLowerCaseL(aElement); + CleanupClosePushL(elementTag); + iContentHandler->OnEndElementL(elementTag, aErrorCode); + CleanupStack::PopAndDestroy(&elementTag); //elementTag + } + else + { + iContentHandler->OnEndElementL(aElement, aErrorCode); + } +} + +/** +This method is a callback that sends the content of the element. +Not all the content may be returned in one go. The data may be sent in chunks. +When an OnEndElementL is received this means there is no more content to be sent. +@param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode) +{ + if(iSkipIncludeElement) + { + return; + } + iContentHandler->OnContentL(aBytes, aErrorCode); +} + +/** +This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. +This method is always called before the corresponding OnStartElementL method. +@param aPrefix is the Namespace prefix being declared. +@param aUri is the Namespace URI the prefix is mapped to. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode) +{ + if(iSkipIncludeElement) + { + return; + } + iSkipPrefixMapping = EFalse; + HBufC8* pref = aPrefix.DesC().AllocL(); + HBufC8* uri = aUri.DesC().AllocL(); + iCachedPrefixes.AppendL(pref); + iCachedUris.AppendL(uri); + iCachedErrors.Append(aErrorCode); +} + +/** +This method is a notification of the end of the scope of a prefix-URI mapping. +This method is called after the corresponding DoEndElementL method. +@param aPrefix is the Namespace prefix that was mapped. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) +{ + if(iSkipPrefixMapping) + { + return; + } + iContentHandler->OnEndPrefixMappingL(aPrefix, aErrorCode); +} + +/** +This method is a notification of ignorable whitespace in element content. +@param aBytes are the ignored bytes from the document being parsed. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) +{ + if(iSkipIncludeElement) + { + return; + } + iContentHandler->OnIgnorableWhiteSpaceL(aBytes, aErrorCode); +} + +/** +This method is a notification of a skipped entity. If the parser encounters an +external entity it does not need to expand it - it can return the entity as aName +for the client to deal with. +@param aName is the name of the skipped entity. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnSkippedEntityL(const RString& aName, TInt aErrorCode) +{ + if(iSkipIncludeElement) + { + return; + } + iContentHandler->OnSkippedEntityL(aName, aErrorCode); +} + +/** +This method is a receive notification of a processing instruction. +@param aTarget is the processing instruction target. +@param aData is the processing instruction data. If empty none was supplied. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngContentHandler::OnProcessingInstructionL(const TDesC8& aTarget, + const TDesC8& aData, + TInt aErrorCode) +{ + if(iSkipIncludeElement) + { + return; + } + iContentHandler->OnProcessingInstructionL(aTarget, aData, aErrorCode); +} + +/** +This method indicates an error has occurred. +@param aError is the error code +*/ +void CXmlEngContentHandler::OnError(TInt aErrorCode) +{ + iContentHandler->OnError(aErrorCode); +} + +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ +TAny* CXmlEngContentHandler::GetExtendedInterface(const TInt32 /*aUid*/) +{ + return 0; +} + +/** +This method strips CID string from "cid:" prefix to fetch the pure CID value +@return CID value +@param aCid CID string +*/ +TPtrC8 CXmlEngContentHandler::CidValue(const TDesC8& aCid) + { + _LIT8(KCidPrefix, "cid:*"); + TInt position = aCid.Match(KCidPrefix); + if(position < 0) + { + position = 0; + } + return aCid.Mid( position + KCidPrefix().Size() - 1); // minus star character (*) + } + +/** +This method converts element name to lower case and creates new tag info +@return New tag info with lower case element name +@param aTagInfo Original tag info +*/ +RTagInfo CXmlEngContentHandler::ConvertNameToLowerCaseL(const RTagInfo& aElement) + { + // convert name to lower case, create new RTagInfo, invoke callback + HBufC8* uriBuf = aElement.Uri().DesC().AllocLC(); + HBufC8* prefBuf = aElement.Prefix().DesC().AllocLC(); + HBufC8* nameBuf = aElement.LocalName().DesC().AllocLC(); + nameBuf->Des().LowerCase(); + + RString uri = iStrPool.OpenStringL(uriBuf->Des()); + CleanupClosePushL(uri); + RString pref = iStrPool.OpenStringL(prefBuf->Des()); + CleanupClosePushL(pref); + RString name = iStrPool.OpenStringL(nameBuf->Des()); + CleanupStack::Pop(&pref); + CleanupStack::Pop(&uri); + CleanupStack::PopAndDestroy(nameBuf); + CleanupStack::PopAndDestroy(prefBuf); + CleanupStack::PopAndDestroy(uriBuf); + RTagInfo elementTag; + elementTag.Open(uri, pref, name); + TPtrC8 a = elementTag.LocalName().DesC(); + return elementTag; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengcontenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengcontenthandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,216 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Content handler +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSERIALIZER_CONTENTHANDLER_H +#define XMLENGSERIALIZER_CONTENTHANDLER_H + +#include +#include +#include + +const TInt KShortInfoSize = 256; +const TInt KLongInfoSize = 1000; + +using namespace Xml; + +class CXmlEngContentHandler : public CBase, public Xml::MContentHandler +{ + +public: + + static CXmlEngContentHandler* NewL( CXmlEngDeserializer* aDeserializer, + MContentHandler* aContentHandler ); + + ~CXmlEngContentHandler(); + +/** +This method is a callback to indicate the start of the document. +@param aDocParam Specifies the various parameters of the document. +@param aDocParam.iCharacterSetName The character encoding of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + + +/** +This method is a callback to indicate the end of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndDocumentL(TInt aErrorCode); + + +/** +This method is a callback to indicate an element has been parsed. +@param aElement is a handle to the element's details. +@param aAttributes contains the attributes for the element. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, + TInt aErrorCode); + + +/** +This method is a callback to indicate the end of the element has been reached. +@param aElement is a handle to the element's details. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + + +/** +This method is a callback that sends the content of the element. +Not all the content may be returned in one go. The data may be sent in chunks. +When an OnEndElementL is received this means there is no more content to be sent. +@param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + + +/** +This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. +This method is always called before the corresponding OnStartElementL method. +@param aPrefix is the Namespace prefix being declared. +@param aUri is the Namespace URI the prefix is mapped to. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode); + + +/** +This method is a notification of the end of the scope of a prefix-URI mapping. +This method is called after the corresponding DoEndElementL method. +@param aPrefix is the Namespace prefix that was mapped. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + + +/** +This method is a notification of ignorable whitespace in element content. +@param aBytes are the ignored bytes from the document being parsed. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + + +/** +This method is a notification of a skipped entity. If the parser encounters an +external entity it does not need to expand it - it can return the entity as aName +for the client to deal with. +@param aName is the name of the skipped entity. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + + +/** +This method is a receive notification of a processing instruction. +@param aTarget is the processing instruction target. +@param aData is the processing instruction data. If empty none was supplied. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, + TInt aErrorCode); + + +/** +This method indicates an error has occurred. +@param aError is the error code +*/ + void OnError(TInt aErrorCode); + + +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + TAny* GetExtendedInterface(const TInt32 aUid); + +private: +/** +Constructor + +@param aDeserializer Pointer to deserializer +@param aContentHandler Pointer to client content handler +*/ + CXmlEngContentHandler(CXmlEngDeserializer* aDeserializer, MContentHandler* aContentHandler); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + +/** +This method strips CID string from "cid:" prefix to fetch the pure CID value +@return CID value +@param aCid CID string +*/ + TPtrC8 CidValue(const TDesC8& aCid); + +/** +This method converts element name to lower case and creates new tag info +@return New tag info with lower case element name +@param aTagInfo Original tag info +*/ + RTagInfo ConvertNameToLowerCaseL(const RTagInfo& aElement); + +private: //data + +/** Handle to deserializer **/ +CXmlEngDeserializer* iDeserializer; + +/** Handle to client's content handler **/ +MContentHandler* iContentHandler; + +/** Indicates that xop:Include element is being processed **/ +TUint iSkipIncludeElement; +TBool iSkipPrefixMapping; + +/** Arrays for storing namespace mapping events **/ +RPointerArray iCachedPrefixes; +RPointerArray iCachedUris; +RArray iCachedErrors; + +/** Internal string pool */ +RStringPool iStrPool; + +}; + +#endif //XMLENGINE_SERIALIZER_CONTENTHANDLER_H diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,320 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML Deserializer implementation +// + +#include +#include +#include "xmlengdeserializerxop.h" +#include "xmlengdeserializergzip.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +_LIT8(KXmlMimeType, "text/xml"); +_LIT8(KParserType,"libxml2"); + +using namespace Xml; + +// -------------------------------------------------------------------------------------- +// Creates an instance of CXmlEngDeserializer +// -------------------------------------------------------------------------------------- +// +EXPORT_C CXmlEngDeserializer* CXmlEngDeserializer::NewL( MContentHandler& aContentHandler, TXmlEngDeserializerType aType ) + { + switch(aType) + { + case EDeserializerXOP: + { + return CXmlEngDeserializerXOP::NewL( aContentHandler, EFalse ); + } + case EDeserializerXOPInfoset: + { + return CXmlEngDeserializerXOP::NewL( aContentHandler, ETrue ); + } + case EDeserializerGZip: + { + return CXmlEngDeserializerGZIP::NewL( aContentHandler ); + } + case EDeserializerDefault: + default: + { + CXmlEngDeserializer* self = new (ELeave) CXmlEngDeserializer; + CleanupStack::PushL(self); + self->ConstructL( aContentHandler ); + CleanupStack::Pop(self); + return self; + } + } + } + + +// -------------------------------------------------------------------------------------- +// Set input type as file +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::SetInputFileL(const TDesC& aFileName) + { + if(iInputFileName) + { + delete iInputFileName; + iInputFileName=NULL; + } + iInputFileName = aFileName.AllocL(); + iSerializationOutput = EDeserializeFromFile; + } + +// -------------------------------------------------------------------------------------- +// Set input type as buffer +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::SetInputBuffer(const TDesC8& aBuffer) + { + iBuffer.Set(aBuffer); + iSerializationOutput = EDeserializeFromBuffer; + } + +// -------------------------------------------------------------------------------------- +// Set content handler +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::SetContentHandlerL(MContentHandler& aContentHandler) + { + TInt i; + delete iParser; + iParser = NULL; + ConstructL( aContentHandler ); + for(i=1; i<=ELastFeature; i*=2) + { + if(i & iFeatures) + { + iParser->EnableFeature(i); + } + } + } + +// -------------------------------------------------------------------------------------- +// Set parsing options +// May be used to alter deserializer output +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::SetParsingOptions(TXmlEngParsingOptions& aOptions) + { + iParsingOptions = aOptions; + } + +// -------------------------------------------------------------------------------------- +// Set parsing options +// May be used to alter deserializer output +// -------------------------------------------------------------------------------------- +// +EXPORT_C const TXmlEngParsingOptions& CXmlEngDeserializer::ParsingOptions() + { + return iParsingOptions; + } + +// -------------------------------------------------------------------------------------- +// Set external data array +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::UseExternalDataL(RArray& aList) + { + iDataList = &aList; + } + +// -------------------------------------------------------------------------------------- +// Fetches external data registered in this deserializer +// -------------------------------------------------------------------------------------- +// +EXPORT_C RArray* CXmlEngDeserializer::ExternalData() + { + return iDataList; + } + +// -------------------------------------------------------------------------------------- +// Enables CParser feature +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngDeserializer::EnableFeature(TInt aParserFeature) + { + TInt res = iParser->EnableFeature(aParserFeature); + if(!res) + { + iFeatures |= aParserFeature; + } + return res; + } + +// -------------------------------------------------------------------------------------- +// Disables CParser feature +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngDeserializer::DisableFeature(TInt aParserFeature) + { + TInt res = iParser->DisableFeature(aParserFeature); + if(!res) + { + iFeatures &= ~aParserFeature; + } + return res; + } + +// -------------------------------------------------------------------------------------- +// Checks if a feature is enabled +// -------------------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlEngDeserializer::IsFeatureEnabled(TInt aParserFeature) const + { + return iParser->IsFeatureEnabled(aParserFeature); + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::DeserializeL() + { + switch(iSerializationOutput) + { + case EDeserializeFromFile: + { + if(!iInputFileName) + { + User::Leave(KXmlEngErrNoParameters); + } + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + DeserializeL( fs, iInputFileName->Des() ); + CleanupStack::PopAndDestroy(&fs); + break; + } + case EDeserializeFromBuffer: + { + if(iBuffer.Length() == 0) + { + User::Leave(KXmlEngErrNoParameters); + } + DeserializeL(iBuffer); + break; + } + case EDeserializeFromStream: + { + // Currently this feature is not supported. Implement when need arises or remove. + User::Leave(KErrNotSupported); + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& /*aOptions*/) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + ParseL(*iParser,fs,aFileName); + CleanupStack::PopAndDestroy(&fs); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::DeserializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngParsingOptions& /*aOptions*/) + { + ParseL(*iParser,aRFs,aFileName); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializer::DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& /*aOptions*/) + { + ParseL(*iParser,aBuffer); + } +// -------------------------------------------------------------------------------------- +// Default Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializer::CXmlEngDeserializer() + { + iParsingOptions = TXmlEngParsingOptions(); + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializer::~CXmlEngDeserializer() + { + delete iParser; + delete iInputFileName; + } + +// -------------------------------------------------------------------------------------- +// 2nd phase constructor +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializer::ConstructL( MContentHandler& aContentHandler ) + { + if(iParser) + { + delete iParser; + iParser = NULL; + } + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlMimeType); + matchData->SetVariantL(KParserType); + iParser = CParser::NewL(*matchData, aContentHandler); + CleanupStack::PopAndDestroy(&(*matchData)); + } + + +// -------------------------------------------------------------------------------------- +// Retrieves pointer to data container referenced by CID +// -------------------------------------------------------------------------------------- +// +TXmlEngDataContainer* CXmlEngDeserializer::GetDataContainer(const TDesC8& aCid) + { + for(TInt i = 0; i < iDataList->Count(); i++) + { + if( (*iDataList)[i].Cid() == aCid ) + { + return &(*iDataList)[i]; + } + } + return NULL; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerdom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerdom.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,223 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML DOM Deserializer implementation +// + +#include +#include +#include +#include "xmlengdomcontenthandler.h" + +#include +#include +#include + +using namespace Xml; + +// -------------------------------------------------------------------------------------- +// Creates an instance of CXmlEngDeserializerDOM +// -------------------------------------------------------------------------------------- +// +EXPORT_C CXmlEngDeserializerDOM* CXmlEngDeserializerDOM::NewL() + { + CXmlEngDeserializerDOM* self = new (ELeave) CXmlEngDeserializerDOM; + return self; + } + +// -------------------------------------------------------------------------------------- +// Set input type as file +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializerDOM::SetInputFileL(const TDesC& aFileName, TXmlEngDeserializerType aType) + { + if(iInputFileName) + { + delete iInputFileName; + iInputFileName=NULL; + } + iBuffer.Set(KNullDesC8()); + iInputFileName = aFileName.AllocL(); + iType = aType; + } + +// -------------------------------------------------------------------------------------- +// Set input type as buffer +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializerDOM::SetInputBuffer(const TDesC8& aBuffer, TXmlEngDeserializerType aType) + { + if(iInputFileName) + { + delete iInputFileName; + iInputFileName=NULL; + } + iBuffer.Set(aBuffer); + iType = aType; + } + +// -------------------------------------------------------------------------------------- +// Set external data array +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializerDOM::UseExternalDataL(RArray& aList) + { + iDataList = &aList; + } + + +// -------------------------------------------------------------------------------------- +// Fetches external data registered in this deserializer +// -------------------------------------------------------------------------------------- +// +EXPORT_C RArray* CXmlEngDeserializerDOM::ExternalData() + { + return iDataList; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL() + { + RXmlEngDocument doc; + if(iInputFileName) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + doc =DeserializeL(fs, *iInputFileName, iType); + CleanupStack::PopAndDestroy(&fs); + return doc; + } + else if(iBuffer.Length()) + { + return DeserializeL(iBuffer, iType); + } + else + { + User::Leave(KXmlEngErrNoParameters); + } + return doc; + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(const TDesC& aFileName, + TXmlEngDeserializerType aType) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + RXmlEngDocument doc = DeserializeL(fs,aFileName,aType); + CleanupStack::PopAndDestroy(&fs); + return doc; + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(RFs& aRFs, + const TDesC& aFileName, + TXmlEngDeserializerType aType) + { + if(!iImpl) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + RXmlEngDocument doc; + doc.OpenL(*iImpl); + CleanupClosePushL(doc); + + CXmlEngDOMContentHandler* handler = CXmlEngDOMContentHandler::NewL(doc); + CleanupStack::PushL(handler); + + CXmlEngDeserializer* des = CXmlEngDeserializer::NewL(*handler,aType); + CleanupStack::PushL(des); + + des->UseExternalDataL(*iDataList); + des->EnableFeature(EReportNamespaceMapping); + des->DeserializeL(aRFs,aFileName); + + CleanupStack::PopAndDestroy(des); + CleanupStack::PopAndDestroy(handler); + CleanupStack::Pop(&doc); + + return doc; + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument CXmlEngDeserializerDOM::DeserializeL(const TDesC8& aBuffer, + TXmlEngDeserializerType aType) + { + if(!iImpl) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + RXmlEngDocument doc; + doc.OpenL(*iImpl); + CleanupClosePushL(doc); + + CXmlEngDOMContentHandler* handler = CXmlEngDOMContentHandler::NewL(doc); + CleanupStack::PushL(handler); + + CXmlEngDeserializer* des = CXmlEngDeserializer::NewL(*handler,aType); + CleanupStack::PushL(des); + + des->UseExternalDataL(*iDataList); + des->EnableFeature(EReportNamespaceMapping); + des->DeserializeL(aBuffer); + + CleanupStack::PopAndDestroy(des); + CleanupStack::PopAndDestroy(handler); + CleanupStack::Pop(&doc); + + return doc; + } + +// -------------------------------------------------------------------------------------- +// Sets DOM implementation that should be used during document creating. +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngDeserializerDOM::UseDOMImplementationL(RXmlEngDOMImplementation& aImpl) + { + iImpl = &aImpl; + } + + +// -------------------------------------------------------------------------------------- +// Default Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerDOM::CXmlEngDeserializerDOM( ) + { + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerDOM::~CXmlEngDeserializerDOM() + { + delete iInputFileName; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializergzip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializergzip.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,148 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of GZIP deserializer +// + +#include +#include +#include + +#include +#include "xmlengdeserializergzip.h" +#include "xmlenggzipbufferdeserializebm.h" +#include "xmlenggzipfiledeserializer.h" + +#include + + +using namespace Xml; + +// -------------------------------------------------------------------------------------- +// Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerGZIP* CXmlEngDeserializerGZIP::NewL( MContentHandler& aContentHandler ) + { + CXmlEngDeserializerGZIP* self = new (ELeave) CXmlEngDeserializerGZIP( ); + CleanupStack::PushL( self ); + self->ConstructL( aContentHandler ); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerGZIP::DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& /*aOptions*/ ) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + DeserializeL(fs, aFileName); + CleanupStack::PopAndDestroy(&fs); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerGZIP::DeserializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngParsingOptions& /*aOptions*/ ) + { + CXmlEngGZipFileDeserializer* deser = CXmlEngGZipFileDeserializer::NewLC( iParser, aRFs, aFileName, KOutputBufferSize ); + + while ( deser->InflateL() ) + { + /* empty */ + } + + CleanupStack::PopAndDestroy( deser ); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerGZIP::DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& /*aOptions*/ ) + { + CXmlEngGZipBufferDeserializeBM* bm = CXmlEngGZipBufferDeserializeBM::NewLC( iParser, aBuffer, KOutputBufferSize ); + CEZDecompressor* decompressor = CEZDecompressor::NewLC( *bm ); + + while ( decompressor->InflateL() ) + { + /* empty */ + } + + CleanupStack::PopAndDestroy( decompressor ); + CleanupStack::PopAndDestroy( bm ); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerGZIP::DeserializeL() + { + switch(iSerializationOutput) + { + case EDeserializeFromFile: + { + if(!iInputFileName) + { + User::Leave(KXmlEngErrNoParameters); + } + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + DeserializeL(fs, iInputFileName->Des()); + CleanupStack::PopAndDestroy(&fs); + break; + } + case EDeserializeFromBuffer: + { + if(iBuffer.Length() == 0) + { + User::Leave(KXmlEngErrNoParameters); + } + DeserializeL(iBuffer); + break; + } + default: + { + User::Leave(KErrGeneral); + } + } + } + +// -------------------------------------------------------------------------------------- +// Default Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerGZIP::CXmlEngDeserializerGZIP() + { + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerGZIP::~CXmlEngDeserializerGZIP() + { + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializergzip.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializergzip.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,102 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of GZIP deserializer +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGDESERIALIZER_GZIP__H +#define XMLENGDESERIALIZER_GZIP__H + +#include +#include + +/** + * GZIP XML deserializer + * + */ +class CXmlEngDeserializerGZIP: public CXmlEngDeserializer +{ +public: + static CXmlEngDeserializerGZIP* NewL( Xml::MContentHandler& aContentHandler ); + + /** + * Deserializes XML + * + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL(); + + /** + * Deserializes XML + * + * @param aFileName File to be parsed + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions() ); + + /** + * Deserializes XML + * + * @param aRFs File Server session + * @param aFileName File to be parsed + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( RFs& aRFs, const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions() ); + + /** + * Deserializes XML + * + * @param aBuffer Buffer to be parsed + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& aOptions = + TXmlEngParsingOptions() ); + + /** + * Destructor. + */ + ~CXmlEngDeserializerGZIP(); + +protected: + /** + * Default constructor. + */ + CXmlEngDeserializerGZIP( ); + +private: + /** + * Default output buffers size. + */ + static const TInt KOutputBufferSize = 4096; +}; + +#endif /* XMLENGDESERIALIZER_GZIP__H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerxop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerxop.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,309 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML XOP Deserializer implementation +// + +#include "xmlengdeserializerxop.h" +#include +#include "xmlengcontenthandler.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +_LIT8(KXmlMimeType, "text/xml"); +_LIT8(KParserType,"libxml2"); + +// Implemented according to XOP Spec (http://www.w3.org/TR/xop10/) +_LIT8(KMultipartMixed, "multipart/mixed"); +_LIT8(KBoundary1, "MIME_boundary"); +_LIT(KUrlStub, "http://url_stub"); + +using namespace Xml; + +// -------------------------------------------------------------------------------------- +// Creates an instance of CXMLDEDeserializerXOP +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerXOP* CXmlEngDeserializerXOP::NewL( MContentHandler& aContentHandler, + TBool aCleanXOPInfoset ) + { + CXmlEngDeserializerXOP* deserializerXop = new (ELeave) CXmlEngDeserializerXOP(aCleanXOPInfoset); + CleanupStack::PushL( deserializerXop ); + deserializerXop->ConstructL( aContentHandler ); + CleanupStack::Pop(); //deserializerXop + return deserializerXop; + } + +// -------------------------------------------------------------------------------------- +// Enables CParser feature +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngDeserializerXOP::EnableFeature(TInt aParserFeature) + { + if(aParserFeature == EConvertTagsToLowerCase) + { + iParserMode |= aParserFeature; + return KErrNone; + } + return CXmlEngDeserializer::EnableFeature(aParserFeature); + } + +// -------------------------------------------------------------------------------------- +// Disables CParser feature +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngDeserializerXOP::DisableFeature(TInt aParserFeature) + { + if(aParserFeature == EConvertTagsToLowerCase) + { + iParserMode &= ~aParserFeature; + return KErrNone; + } + return CXmlEngDeserializer::DisableFeature(aParserFeature); + } + +// -------------------------------------------------------------------------------------- +// Checks if a feature is enabled +// -------------------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlEngDeserializerXOP::IsFeatureEnabled(TInt aParserFeature) const + { + if(aParserFeature == EConvertTagsToLowerCase) + { + return iParserMode & aParserFeature; + } + return iParser->IsFeatureEnabled(aParserFeature); + } + +// -------------------------------------------------------------------------------------- +// Deserializes document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerXOP::DeserializeL() + { + switch(iSerializationOutput) + { + case EDeserializeFromFile: + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + DeserializeL(fs, iInputFileName->Des(), iParsingOptions); + CleanupStack::PopAndDestroy(&fs); //fs + break; + } + case EDeserializeFromBuffer: + { + if(iBuffer.Length() == 0) + { + User::Leave(KXmlEngErrNoParameters); + } + DeserializeL(iBuffer, iParsingOptions); + break; + } + case EDeserializeFromStream: + { + // Currently this feature is not supported. Implement when need arises or remove. + User::Leave(KErrNotSupported); + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerXOP::DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions ) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + DeserializeL(fs, aFileName, aOptions); + CleanupStack::PopAndDestroy(&fs); //fs + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerXOP::DeserializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions ) + { + iBodyPartArray.ResetAndDestroy(); + if(iData) + { + delete iData; + iData = NULL; + } + iData = ReadFileL( aRFs, aFileName ); + TPtrC8 dataPtr = iData->Des(); + CXmlEngDeserializerXOP::DeserializeL( dataPtr, aOptions ); + } + +// -------------------------------------------------------------------------------------- +// Deserialize document +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerXOP::DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& aOptions ) + { + TXmlEngParsingOptions originalOpts = iParsingOptions; + iParsingOptions = aOptions; + + if( iCleanXOPInfoset ) + { + Xml::ParseL(*iParser, aBuffer); + } + else + { + if(!aBuffer.Length()) + { + User::Leave(KXmlEngErrNoParameters); + } + if(iBodyPartArray.Count()) + iBodyPartArray.ResetAndDestroy(); + + MultipartParser::ParseL( aBuffer, KMultipartMixed, KBoundary1, KUrlStub, iBodyPartArray ); + + // get xml document + CBodyPart* bodyPart = NULL; + if(iBodyPartArray.Count() > 0) + { + bodyPart = iBodyPartArray[0]; + } + else + { + //The multipart document wasn't parsed correctly + User::Leave(KXmlEngErrBadMultipart); + } + Xml::ParseL(*iParser, bodyPart->Body()); + } + iParsingOptions = originalOpts; + iBodyPartArray.ResetAndDestroy(); + } + +// -------------------------------------------------------------------------------------- +// Retrieves pointer to data referenced by CID from parsed multipart package +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngDeserializerXOP::GetData(const TDesC8& aCid, TPtrC8& aData) + { + for(TInt i = 0; i < iBodyPartArray.Count(); i++) + { + TPtrC8 cid = iBodyPartArray[i]->ContentID(); + if(iBodyPartArray[i]->ContentID() == aCid) + { + TInt size = iBodyPartArray[i]->Body().Size(); + iDataPtr.Set(iBodyPartArray[i]->Body()); + aData.Set(iDataPtr); + return KErrNone; + } + } + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------- +// Default Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerXOP::CXmlEngDeserializerXOP( TBool aCleanXOPInfoset ) + : iData(NULL), iCleanXOPInfoset(aCleanXOPInfoset) + { + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngDeserializerXOP::~CXmlEngDeserializerXOP() + { + if(iData) + { + delete iData; + } + iBodyPartArray.ResetAndDestroy(); + delete iInternalHandler; + } + +// -------------------------------------------------------------------------------------- +// 2nd phase constructor +// -------------------------------------------------------------------------------------- +// +void CXmlEngDeserializerXOP::ConstructL( MContentHandler& aContentHandler ) + { + if(iInternalHandler) + { + delete iInternalHandler; + iInternalHandler = NULL; + } + iInternalHandler = CXmlEngContentHandler::NewL(this, &aContentHandler); + + if(iParser) + { + delete iParser; + iParser = NULL; + } + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlMimeType); + matchData->SetVariantL(KParserType); + iParser = CParser::NewL(*matchData, *iInternalHandler); + CleanupStack::PopAndDestroy(matchData); + } + +// -------------------------------------------------------------------------------------- +// Read file +// -------------------------------------------------------------------------------------- +// +HBufC8* CXmlEngDeserializerXOP::ReadFileL( RFs& aRFs, const TDesC& aFileName) + { + RFile file; + User::LeaveIfError(file.Open(aRFs, aFileName, EFileRead)); + CleanupClosePushL(file); + TInt size; + User::LeaveIfError(file.Size(size)); + HBufC8* buf = HBufC8::NewLC(size); + TPtr8 bufPtr(buf->Des()); + User::LeaveIfError(file.Read(bufPtr)); + CleanupStack::Pop(buf); // buf + CleanupStack::PopAndDestroy(&file); // file + return buf; + } + +/* +// -------------------------------------------------------------------------------------- +// SerializationOutput +// -------------------------------------------------------------------------------------- +// +TXmlEngDeserializationSource CXmlEngDeserializerXOP::SerializationOutput() + { + return iSerializationOutput; + } +*/ + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerxop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerxop.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,195 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML XOP Deserializer +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGDESERIALIZERXOP_H +#define XMLENGDESERIALIZERXOP_H + +#include +#include + +class RFs; +class CBodyPart; + +using namespace Xml; + +class CXmlEngContentHandler; + +/** + * XOP deserializer + * + */ +class CXmlEngDeserializerXOP: public CXmlEngDeserializer +{ + public: + /** + * Creates an instance of CXmlEngDeserializerXOP + * @param aContentHandler Content handler + * @param aCleanXOPInfoset Indicates that XOP package contains only clean XOP infoset + * + */ + static CXmlEngDeserializerXOP* NewL( MContentHandler& aContentHandler, TBool aCleanXOPInfoset ); + + /** + * Enables CParser feature + * + * @param aParserFeature Paser feature flag + */ + IMPORT_C TInt EnableFeature(TInt aParserFeature); + + /** + * Disables CParser feature + * + * @param aParserFeature Paser feature flag + */ + IMPORT_C TInt DisableFeature(TInt aParserFeature); + + /** + * Checks if a feature is enabled + * + * @param aParserFeature Paser feature flag + */ + IMPORT_C TBool IsFeatureEnabled(TInt aParserFeature) const; + + /** + * Deserializes XML + * + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL(); + + /** + * Deserializes XML + * + * @param aFileName File to be parsed + * @param aHandler Content handler for SAX callbacks + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions + = TXmlEngParsingOptions()); + + /** + * Deserializes XML + * + * @param aRFs File Server session + * @param aFileName File to be parsed + * @param aHandler Content handler for SAX callbacks + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngParsingOptions& aOptions + = TXmlEngParsingOptions()); + + /** + * Deserializes XML + * + * @param aBuffer Buffer to be parsed + * @param aHandler Content handler for SAX callbacks + * @param aOptions Parsing options + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + void DeserializeL( const TDesC8& aBuffer, + const TXmlEngParsingOptions& aOptions + = TXmlEngParsingOptions() ); + + /** + * Retrieves pointer to data referenced by CID from parsed multipart package + * + * @param aCid Content ID + * + * @return Pointer to referenced data, or NULL if data is not found + */ + TInt GetData(const TDesC8& aCid, TPtrC8& aData); + + /** + * Destructor. + * + */ + ~CXmlEngDeserializerXOP(); + +protected: + + +private: + /** + * Constructor + * + * @param aCleanXOPInfoset Indicates that XOP package contains only clean XOP infoset + */ + CXmlEngDeserializerXOP( TBool aCleanXOPInfoset ); + + /** + * 2nd Phase constructor + */ + void ConstructL( MContentHandler& aContentHandler ); + + /** + * Read the file + * + * @param aRFs File Server session + * @param aFileName File name to be read + * + * @return Pointer to memory buffer with file content + */ + HBufC8* ReadFileL( RFs& aRFs, const TDesC& aFileName ); + + +// TXmlEngDeserializationSource SerializationOutput(); + + +public: //data + +protected: //data + + /** body of multipart package **/ + HBufC8* iData; + + /** body part array for parsed multipart document **/ + RPointerArray iBodyPartArray; + + /** pointer to single binary data **/ + TPtrC8 iDataPtr; + + /** internal content handler **/ + CXmlEngContentHandler* iInternalHandler; + + /** Indicates that XOP package contains only clean XOP infoset **/ + TBool iCleanXOPInfoset; + + //Features mode + TInt iParserMode; + +private: //data + +}; //class CXmlEngDeserializerXOP + + + +#endif /* XMLENGDESERIALIZERXOP_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdomcontenthandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdomcontenthandler.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,366 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Content handler implementation +// + +#include +#include +#include +#include +#include "xmlengdomdefs.h" +#include +#include //xmlFree +#include +#include "xmlengdomcontenthandler.h" + +xmlChar* xmlCharFromDesC8L(const TDesC8& aDesc) + { + if(!aDesc.Length()) + { + return NULL; + } + xmlChar* newContent = (xmlChar*)new(ELeave) TUint8[aDesc.Length() + 1]; + *(Mem::Copy((TAny*)newContent, aDesc.Ptr(), aDesc.Length())) = 0; + return newContent; + } + +CXmlEngDOMContentHandler* CXmlEngDOMContentHandler::NewL(RXmlEngDocument& aDoc) + { + CXmlEngDOMContentHandler* self = new (ELeave) CXmlEngDOMContentHandler(aDoc); + return self; + } + +CXmlEngDOMContentHandler::~CXmlEngDOMContentHandler() + { + } + +CXmlEngDOMContentHandler::CXmlEngDOMContentHandler(RXmlEngDocument& aDoc): +iDoc(aDoc) + { + iLastElement = iDoc; + iTmpElement = TXmlEngElement(); + } + +/** +This method is a callback to indicate the start of the document. +@param aDocParam Specifies the various parameters of the document. +@param aDocParam.iCharacterSetName The character encoding of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + INTERNAL_DOCPTR(iDoc)->encoding = xmlCharFromDesC8L(aDocParam.CharacterSetName().DesC()); + iTmpElement = iDoc.CreateDocumentElementL(_L8("fake")); + } + + +/** +This method is a callback to indicate the end of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnEndDocumentL(TInt /*aErrorCode*/) + { + } + + +/** +This method is a callback to indicate an element has been parsed. +@param aElement is a handle to the element's details. +@param aAttributes contains the attributes for the element. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnStartElementL(const RTagInfo& aElement, + const RAttributeArray& aAttributes, + TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + TXmlEngElement element; + if(iTmpElement.IsNull()) + { + element = iDoc.CreateElementL(aElement.LocalName().DesC(), + aElement.Uri().DesC(), + aElement.Prefix().DesC()); + } + else + { + element = iTmpElement; + + CXmlEngDOMContentHandler::RenameElementL( element, + aElement.LocalName().DesC(), + aElement.Uri().DesC(), + aElement.Prefix().DesC() ); + + iTmpElement = TXmlEngElement(); + } + + RArray array = aAttributes; + TInt size = array.Count(); + RAttribute attr; + + for ( TInt i = 0; i < size; i++) + { + attr = array[i]; + if(attr.Attribute().Prefix().DesC().Length()) + { + element.AddNewAttributeL(attr.Attribute().LocalName().DesC(), + attr.Value().DesC(), + attr.Attribute().Uri().DesC(), + attr.Attribute().Prefix().DesC()); + } + else + { + element.AddNewAttributeL(attr.Attribute().LocalName().DesC(), + attr.Value().DesC()); + } + } + iLastElement.AppendChildL(element); + iLastElement = element; +} + +/** +This method is a callback to indicate the end of the element has been reached. +@param aElement is a handle to the element's details. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnEndElementL(const RTagInfo& /*aElement*/, TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + iLastElement = iLastElement.ParentNode(); + } + +/** +This method is a callback that sends the content of the element. +Not all the content may be returned in one go. The data may be sent in chunks. +When an OnEndElementL is received this means there is no more content to be sent. +@param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + iLastElement.AppendChildL(iDoc.CreateTextNodeL(aBytes)); + } + +/** +This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. +This method is always called before the corresponding OnStartElementL method. +@param aPrefix is the Namespace prefix being declared. +@param aUri is the Namespace URI the prefix is mapped to. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + if(iTmpElement.IsNull()) + { + iTmpElement = iDoc.CreateElementL(_L8("fake")); + } + iTmpElement.AddNamespaceDeclarationL(aUri.DesC(),aPrefix.DesC()); + } + +/** +This method is a notification of the end of the scope of a prefix-URI mapping. +This method is called after the corresponding DoEndElementL method. +@param aPrefix is the Namespace prefix that was mapped. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) + { + } + +/** +This method is a notification of ignorable whitespace in element content. +@param aBytes are the ignored bytes from the document being parsed. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +/** +This method is a notification of a skipped entity. If the parser encounters an +external entity it does not need to expand it - it can return the entity as aName +for the client to deal with. +@param aName is the name of the skipped entity. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) + { + + } + +/** +This method is a receive notification of a processing instruction. +@param aTarget is the processing instruction target. +@param aData is the processing instruction data. If empty none was supplied. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ +void CXmlEngDOMContentHandler::OnProcessingInstructionL(const TDesC8& aTarget, + const TDesC8& aData, + TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + iLastElement.AppendChildL(iDoc.CreateProcessingInstructionL(aTarget,aData)); + } + +/** + * This method is a callback that sends the binary content of the element. + * + * @param aBytes is the raw binary data of the element + * and must not be converted. + * @param aErrorCode is the error code. If this is not KErrNone + * then special action may be required. + */ +void CXmlEngDOMContentHandler::OnBinaryContentL(const TDesC8& aBytes, + const TDesC8& aCid, + TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + iLastElement.AppendChildL(iDoc.CreateBinaryContainerL(aCid,aBytes)); + } + +/** + * This method is a callback that provides data container reference + * + * @param aContainer Container encapsulating binary data + * @param aErrorCode is the error code. If this is not KErrNone + * then special action may be required. + */ +void CXmlEngDOMContentHandler::OnDataContainerL( const TXmlEngDataContainer& aContainer, + TInt aErrorCode) + { + if(aErrorCode) + { + return; + } + + iLastElement.AppendChildL(aContainer); + } + +/** +This method indicates an error has occurred. +@param aError is the error code +*/ +void CXmlEngDOMContentHandler::OnError(TInt /*aErrorCode*/) + { + } + +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ +TAny* CXmlEngDOMContentHandler::GetExtendedInterface(const TInt32 aUid) + { + if (aUid == MXmlEngExtendedHandler::EExtInterfaceUid) + { + return static_cast(this); + } + return 0; + } + +/** + Renames TXmlEngElement nodes only. (static helper method) + + @param aElement element to rename + @param aLocalName New name + @param aNamespaceUri New namespace uri + @param aPrefix New namespace prefix +*/ +void CXmlEngDOMContentHandler::RenameElementL(TXmlEngElement& aElement, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix ) + { + if ( !INTERNAL_NODEPTR(aElement)->type == XML_ELEMENT_NODE ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + + TXmlEngNode::TXmlEngDOMNodeType type = aElement.NodeType(); + if (type == TXmlEngNode::EElement) + { + SetNameL(aElement, aLocalName); + if (aNamespaceUri.Length() || aPrefix.Length()) + { + TXmlEngElement nsElem = aElement.AsElement(); + TXmlEngNamespace ns = nsElem.FindOrCreateNsDeclL(aNamespaceUri, aPrefix); + INTERNAL_NODEPTR(aElement)->ns = INTERNAL_NSPTR(ns); + } + } + } + +// --------------------------------------------------------------------------------------------- +// Changes name of the element so that Name() on it will return new name +// --------------------------------------------------------------------------------------------- + void CXmlEngDOMContentHandler::SetNameL( TXmlEngElement& aElement, + const TDesC8& aName ) + { + + if ( !INTERNAL_NODEPTR(aElement) ) + { + User::Leave(KXmlEngErrNullNode); + } + const xmlChar* KOldName = INTERNAL_NODEPTR(aElement)->name; + + if ( aName.Length() <= 0 ) + { + User::Leave(KXmlEngErrWrongUseOfAPI); + } + INTERNAL_NODEPTR(aElement)->name = xmlCharFromDesC8L(aName); + xmlFree((void *)KOldName); + + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengdomcontenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengdomcontenthandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,225 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Content handler +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSERIALIZER_CONTENTHANDLER_H +#define XMLENGSERIALIZER_CONTENTHANDLER_H + +#include +#include +#include +#include + +#include + +class RXmlEngDocument; +class TXmlEngElement; + +using namespace Xml; + +class CXmlEngDOMContentHandler : public CBase, public MContentHandler, public MXmlEngExtendedHandler +{ + +public: + + static CXmlEngDOMContentHandler* NewL(RXmlEngDocument& aDoc); + + ~CXmlEngDOMContentHandler(); + +/** +This method is a callback to indicate the start of the document. +@param aDocParam Specifies the various parameters of the document. +@param aDocParam.iCharacterSetName The character encoding of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + + +/** +This method is a callback to indicate the end of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndDocumentL(TInt aErrorCode); + + +/** +This method is a callback to indicate an element has been parsed. +@param aElement is a handle to the element's details. +@param aAttributes contains the attributes for the element. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, + TInt aErrorCode); + + +/** +This method is a callback to indicate the end of the element has been reached. +@param aElement is a handle to the element's details. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + + +/** +This method is a callback that sends the content of the element. +Not all the content may be returned in one go. The data may be sent in chunks. +When an OnEndElementL is received this means there is no more content to be sent. +@param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + + +/** +This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. +This method is always called before the corresponding OnStartElementL method. +@param aPrefix is the Namespace prefix being declared. +@param aUri is the Namespace URI the prefix is mapped to. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode); + + +/** +This method is a notification of the end of the scope of a prefix-URI mapping. +This method is called after the corresponding DoEndElementL method. +@param aPrefix is the Namespace prefix that was mapped. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + + +/** +This method is a notification of ignorable whitespace in element content. +@param aBytes are the ignored bytes from the document being parsed. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + + +/** +This method is a notification of a skipped entity. If the parser encounters an +external entity it does not need to expand it - it can return the entity as aName +for the client to deal with. +@param aName is the name of the skipped entity. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + + +/** +This method is a receive notification of a processing instruction. +@param aTarget is the processing instruction target. +@param aData is the processing instruction data. If empty none was supplied. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, + TInt aErrorCode); + +/** + * This method is a callback that sends the binary content of the element. + * + * @param aBytes is the raw binary data of the element + * and must not be converted. + * @param aErrorCode is the error code. If this is not KErrNone + * then special action may be required. + */ + void OnBinaryContentL(const TDesC8& aBytes, + const TDesC8& aCid, + TInt aErrorCode); + +/** + * This method is a callback that provides data container reference + * + * @param aContainer Container encapsulating binary data + * @param aErrorCode is the error code. If this is not KErrNone + * then special action may be required. + */ + void OnDataContainerL( const TXmlEngDataContainer& aContainer, + TInt aErrorCode); + +/** +This method indicates an error has occurred. +@param aError is the error code +*/ + void OnError(TInt aErrorCode); + + +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + TAny* GetExtendedInterface(const TInt32 aUid); + +private: +/** +Constructor + +@param aDeserializer Pointer to deserializer +@param aContentHandler Pointer to client content handler +*/ + CXmlEngDOMContentHandler(RXmlEngDocument& aDoc); + +/** + Renames TXmlEngElement nodes only. (static helper method) + + @param aElement element to rename + @param aLocalName New name + @param aNamespaceUri New namespace uri + @param aPrefix New namespace prefix +*/ + static void RenameElementL(TXmlEngElement& aElement, + const TDesC8& aLocalName, + const TDesC8& aNamespaceUri, + const TDesC8& aPrefix); + + /** + * Changes name of the element so that Name() on it will return new name + * + * @param aElement element to change the name on + * @param aName New name + */ + static void SetNameL(TXmlEngElement& aElement, + const TDesC8& aName); +private: + RXmlEngDocument& iDoc; + TXmlEngElement iTmpElement; + TXmlEngNode iLastElement; +}; + +#endif //XMLENGINE_SERIALIZER_CONTENTHANDLER_H diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferdeserializebm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferdeserializebm.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,87 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GZIP output stream functions +// + +#include "xmlenggzipbufferdeserializebm.h" +#include +#include + + + + CXmlEngGZipBufferDeserializeBM* CXmlEngGZipBufferDeserializeBM::NewLC( Xml::CParser* aParser, const TDesC8& aInputBuffer, TInt aOutBufSize ) + { + CXmlEngGZipBufferDeserializeBM* bm = new (ELeave) CXmlEngGZipBufferDeserializeBM( aParser, aInputBuffer ); + CleanupStack::PushL( bm ); + bm->ConstructL( aOutBufSize ); + return bm; + } + + CXmlEngGZipBufferDeserializeBM* CXmlEngGZipBufferDeserializeBM::NewL( Xml::CParser* aParser, const TDesC8& aInputBuffer, TInt aOutBufSize ) + { + CXmlEngGZipBufferDeserializeBM* bm = CXmlEngGZipBufferDeserializeBM::NewLC( aParser, aInputBuffer, aOutBufSize ); + CleanupStack::Pop( bm ); + return bm; + } + + CXmlEngGZipBufferDeserializeBM::CXmlEngGZipBufferDeserializeBM( Xml::CParser* aParser, const TDesC8& aInputBuffer ) + : iOutputDescriptor(NULL,0) + { + iParser = aParser; + iInputDescriptor.Set(aInputBuffer); + } + + void CXmlEngGZipBufferDeserializeBM::ConstructL( TInt aOutBufSize ) + { + if ( aOutBufSize <= 0 ) + { + User::Leave(KErrArgument); + } + iOutputBuffer = new (ELeave) TUint8[aOutBufSize]; + iOutputDescriptor.Set(iOutputBuffer,0,aOutBufSize); + } + + CXmlEngGZipBufferDeserializeBM::~CXmlEngGZipBufferDeserializeBM() + { + delete iOutputBuffer; + } + + void CXmlEngGZipBufferDeserializeBM::InitializeL( CEZZStream& aZStream ) + { + iParser->ParseBeginL(); + aZStream.SetInput( iInputDescriptor ); + aZStream.SetOutput( iOutputDescriptor ); + } + + void CXmlEngGZipBufferDeserializeBM::NeedInputL( CEZZStream& aZStream ) + { + //no input except iInputDescriptor + aZStream.SetInput( KNullDesC8 ); + } + + void CXmlEngGZipBufferDeserializeBM::NeedOutputL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + iParser->ParseL( od ); + aZStream.SetOutput( iOutputDescriptor ); + } + + void CXmlEngGZipBufferDeserializeBM::FinalizeL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + iParser->ParseL( od ); + iParser->ParseEndL(); + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferdeserializebm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferdeserializebm.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,70 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// output stream for dom tree +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGCGZIPBUFFERDESERIALIZEBM_H +#define XMLENGCGZIPBUFFERDESERIALIZEBM_H + +#include + +#include +#include + +class CXmlEngGZipBufferDeserializeBM : public CBase, public MEZBufferManager + { + public: + static CXmlEngGZipBufferDeserializeBM* NewLC( Xml::CParser* aParser, const TDesC8& aInputBuffer, TInt aOutBufSize = 0x8000 ); + + static CXmlEngGZipBufferDeserializeBM* NewL( Xml::CParser* aParser, const TDesC8& aInputBuffer, TInt aOutBufSize = 0x8000 ); + + ~CXmlEngGZipBufferDeserializeBM(); + + /** + * Implementation of MEZBufferManager interface. + */ + void InitializeL(CEZZStream& aZStream); + void NeedInputL(CEZZStream& aZStream); + void NeedOutputL(CEZZStream& aZStream); + void FinalizeL(CEZZStream& aZStream); + + + protected: + CXmlEngGZipBufferDeserializeBM( Xml::CParser* aParser, const TDesC8& aInputBuffer ); + void ConstructL( TInt aOutBufSize ); + + private: + + /** XML Framework Parser Interface **/ + Xml::CParser* iParser; + + /** Buffer to be parsed **/ + TPtrC8 iInputDescriptor; + TPtr8 iOutputDescriptor; // always points to start of the output Buffer + + /** chars array **/ + TUint8* iOutputBuffer; + + + }; + +#endif /* CGZipBufferDeserializeBM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GZIP output stream functions +// + +#include "xmlenggzipbufferoutputstream.h" +#include +#include + + + CXmlEngGZIPBufferOutputStream* CXmlEngGZIPBufferOutputStream::NewLC( RBuf8& aOutputBuffer ) + { + CXmlEngGZIPBufferOutputStream* gzbos = new (ELeave) CXmlEngGZIPBufferOutputStream( aOutputBuffer ); + CleanupStack::PushL( gzbos ); + gzbos->ConstructL(); + return gzbos; + } + + CXmlEngGZIPBufferOutputStream* CXmlEngGZIPBufferOutputStream::NewL( RBuf8& aOutputBuffer ) + { + CXmlEngGZIPBufferOutputStream* gzbos = CXmlEngGZIPBufferOutputStream::NewLC( aOutputBuffer ); + CleanupStack::Pop( gzbos ); + return gzbos; + } + + CXmlEngGZIPBufferOutputStream::CXmlEngGZIPBufferOutputStream( RBuf8& aOutputBuffer ) : iOutputString(aOutputBuffer) + { + iKeepGoing = ETrue; + } + + void CXmlEngGZIPBufferOutputStream::ConstructL() + { + if(!iOutputString.MaxSize()) + { + iOutputString.ReAllocL(KOutputBufferSize); + } + //we can't create compressor here, because we heve no input at this moment + iOutputDescriptor.CreateL( KOutputBufferSize ); + iInputDescriptor.CreateL( KDefaultInputBufferSize ); + iOldInputDescriptor.CreateL( KDefaultInputBufferSize ); + } + + CXmlEngGZIPBufferOutputStream::~CXmlEngGZIPBufferOutputStream() + { + delete iCompressor; + iOutputDescriptor.Close(); + iInputDescriptor.Close(); + iOldInputDescriptor.Close(); + } + + TInt CXmlEngGZIPBufferOutputStream::Write( const TDesC8& aBuffer ) + { + TRAP ( iError, WriteL( aBuffer ) ); + if ( iError ) + { + return -1; + } + + return aBuffer.Size(); + } + + void CXmlEngGZIPBufferOutputStream::WriteL( const TDesC8& aBuffer ) + { + iNoInputNeeded = ETrue; + if ( !iCompressor ) + { + const TInt newLength = aBuffer.Size(); + if ( newLength > iInputDescriptor.Size() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + iCompressor = CEZCompressor::NewL( *this ); + } + else + { + iInputDescriptor.Swap( iOldInputDescriptor ); + const TInt newLength = aBuffer.Length(); + if ( newLength > iInputDescriptor.MaxLength() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + + while ( iNoInputNeeded ) + { + iCompressor->DeflateL(); + } + } + } + + TInt CXmlEngGZIPBufferOutputStream::Close() + { + iCloseInvoked = ETrue; + if ( iError ) + { + return -1; + } + TRAP ( iError, CloseL() ); + if ( iError ) + { + return -1; + } + return KErrNone; + } + + void CXmlEngGZIPBufferOutputStream::CloseL() + { + while ( iKeepGoing ) + { + iKeepGoing = iCompressor->DeflateL(); + } + } + + TInt CXmlEngGZIPBufferOutputStream::CheckError() + { + return iError; + } + + void CXmlEngGZIPBufferOutputStream::InitializeL( CEZZStream& aZStream ) + { + aZStream.SetInput( iInputDescriptor ); + aZStream.SetOutput( iOutputDescriptor ); + iNoInputNeeded = EFalse; + } + + void CXmlEngGZIPBufferOutputStream::NeedInputL( CEZZStream& aZStream ) + { + if ( iCloseInvoked ) + { + aZStream.SetInput( KNullDesC8 ); + } + else + { + aZStream.SetInput( iInputDescriptor ); + iNoInputNeeded = EFalse; + } + } + + void CXmlEngGZIPBufferOutputStream::NeedOutputL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + while(TRUE) + { + if (od.Size() > (iOutputString.MaxSize() - iOutputString.Size())) + { + iOutputString.ReAllocL( iOutputString.MaxSize()*2 ); + } + else + { + break; + } + } + iOutputString.Append( od ); + aZStream.SetOutput( iOutputDescriptor ); + } + + void CXmlEngGZIPBufferOutputStream::FinalizeL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + while(TRUE) + { + if (od.Size() > (iOutputString.MaxSize() - iOutputString.Size())) + { + iOutputString.ReAllocL( iOutputString.MaxSize()*2 ); + } + else + { + break; + } + } + iOutputString.Append( od ); + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipbufferoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,112 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// output stream for dom tree +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGCGZIPBUFFEROUTPUTSTREAM_H +#define XMLENGCGZIPBUFFEROUTPUTSTREAM_H + +#include +#include //MEZBufferManager +#include //TEZGZipHeader + +class CEZCompressor; + + + +class CXmlEngGZIPBufferOutputStream : public CBase, public MXmlEngOutputStream, public MEZBufferManager + { + public: + static CXmlEngGZIPBufferOutputStream* NewLC(RBuf8& aOutputBuffer); + + static CXmlEngGZIPBufferOutputStream* NewL(RBuf8& aOutputBuffer); + + ~CXmlEngGZIPBufferOutputStream(); + + /** + * Get last error + */ + TInt CheckError(); + + /** + * Implementation of MXmlEngOutputStream interface. + */ + TInt Write( const TDesC8& aBuffer ); + TInt Close(); + + /** + * Implementation of MEZBufferManager interface. + */ + void InitializeL(CEZZStream& aZStream); + void NeedInputL(CEZZStream& aZStream); + void NeedOutputL(CEZZStream& aZStream); + void FinalizeL(CEZZStream& aZStream); + + + protected: + CXmlEngGZIPBufferOutputStream(RBuf8& aOutputBuffer); + void ConstructL(); + + private: + void WriteL(const TDesC8& aBuffer); + void CloseL(); + + private: + /** + * Last error + */ + TInt iError; + + /** + * Default input buffers size. + */ + static const TInt KDefaultInputBufferSize = 4096; + + /** + * Output buffer size. It determines, how often output data will be written + * to disk. (it's written to disk, when buffer is full. + * + */ + static const TInt KOutputBufferSize = 0x8000; + + RBuf8 iOutputDescriptor; + RBuf8 iInputDescriptor; + RBuf8 iOldInputDescriptor; + + /** + * Engine of GZiping + */ + CEZCompressor* iCompressor; + + RBuf8& iOutputString; + /** + * State of the object. + */ + TBool iNoInputNeeded; + TBool iKeepGoing; + TBool iCloseInvoked; + + }; + + + +#endif /* XMLENGCGZIPBUFFEROUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfiledeserializer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfiledeserializer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GZIP output stream functions +// + +#include "xmlenggzipfiledeserializer.h" +#include +#include + + + CXmlEngGZipFileDeserializer* CXmlEngGZipFileDeserializer::NewLC( Xml::CParser* aParser, RFs& aRfs, const TDesC& aGzFileName, TInt aBufSize ) + { + CXmlEngGZipFileDeserializer* bm = new (ELeave) CXmlEngGZipFileDeserializer( aParser ); + CleanupStack::PushL( bm ); + bm->ConstructL( aRfs, aGzFileName, aBufSize ); + return bm; + } + + CXmlEngGZipFileDeserializer* CXmlEngGZipFileDeserializer::NewL( Xml::CParser* aParser, RFs& aRfs, const TDesC& aGzFileName, TInt aBufSize ) + { + CXmlEngGZipFileDeserializer* bm = CXmlEngGZipFileDeserializer::NewLC( aParser, aRfs, aGzFileName, aBufSize ); + CleanupStack::Pop( bm ); + return bm; + } + + CXmlEngGZipFileDeserializer::CXmlEngGZipFileDeserializer( Xml::CParser* aParser ) + : iInputDescriptor(NULL,0), iOutputDescriptor(NULL,0) + { + iParser = aParser; + } + + void CXmlEngGZipFileDeserializer::ConstructL( RFs& aRfs, const TDesC& aGzFileName, TInt aBufSize ) + { + EZGZipFile::LocateAndReadTrailerL(aRfs,aGzFileName,iTrailer); + User::LeaveIfError(iInputFile.Open(aRfs,aGzFileName,EFileStream | EFileRead | EFileShareAny)); + EZGZipFile::ReadHeaderL(iInputFile,iHeader); + iCrc = crc32(iCrc,NULL,0); + + if ( aBufSize <= 0 ) + { + User::Leave(KErrArgument); + } + iInputBuffer = new (ELeave) TUint8[aBufSize]; + iOutputBuffer = new (ELeave) TUint8[aBufSize]; + + iInputDescriptor.Set(iInputBuffer,0,aBufSize); + iOutputDescriptor.Set(iOutputBuffer,0,aBufSize); + + + iDecompressor = CEZDecompressor::NewL(*this,-CEZDecompressor::EMaxWBits); + } + + CXmlEngGZipFileDeserializer::~CXmlEngGZipFileDeserializer() + { + //do NOT destroy iParser + delete iDecompressor; + delete[] iInputBuffer; + delete[] iOutputBuffer; + iInputFile.Close(); + } + + TBool CXmlEngGZipFileDeserializer::InflateL() + { + TBool keepGoing = iDecompressor->InflateL(); + + if (!keepGoing) + { + if (iCrc != iTrailer.iCrc32) + User::Leave(KEZlibErrBadGZipCrc); + iInputFile.Close(); + } + return keepGoing; + } + + void CXmlEngGZipFileDeserializer::InitializeL( CEZZStream& aZStream ) + { + iParser->ParseBeginL(); + User::LeaveIfError(iInputFile.Read(iInputDescriptor)); + aZStream.SetInput(iInputDescriptor); + aZStream.SetOutput( iOutputDescriptor ); + } + + void CXmlEngGZipFileDeserializer::NeedInputL( CEZZStream& aZStream ) + { + User::LeaveIfError(iInputFile.Read(iInputDescriptor)); + aZStream.SetInput(iInputDescriptor); + } + + void CXmlEngGZipFileDeserializer::NeedOutputL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + iCrc = crc32(iCrc,od.Ptr(),od.Size()); + iParser->ParseL( od ); + aZStream.SetOutput( iOutputDescriptor ); + } + + void CXmlEngGZipFileDeserializer::FinalizeL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + iCrc = crc32(iCrc,od.Ptr(),od.Size()); + iParser->ParseL( od ); + iParser->ParseEndL(); + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfiledeserializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfiledeserializer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as output stream for dom tree +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGCGZIPFILEDESERIALIZER_H +#define XMLENGCGZIPFILEDESERIALIZER_H + +#include +#include +#include +#include + +#include +class CEZDecompressor; + +class CXmlEngGZipFileDeserializer : public CBase, public MEZBufferManager + { + public: + static CXmlEngGZipFileDeserializer* NewLC( Xml::CParser* aParser, RFs& aRfs, const TDesC& aGzFileName, TInt aOutBufSize = 0x8000 ); + + static CXmlEngGZipFileDeserializer* NewL( Xml::CParser* aParser, RFs& aRfs, const TDesC& aGzFileName, TInt aOutBufSize = 0x8000 ); + + ~CXmlEngGZipFileDeserializer(); + + TBool InflateL(); + + /** + * Implementation of MEZBufferManager interface. + */ + void InitializeL(CEZZStream& aZStream); + void NeedInputL(CEZZStream& aZStream); + void NeedOutputL(CEZZStream& aZStream); + void FinalizeL(CEZZStream& aZStream); + + + protected: + CXmlEngGZipFileDeserializer( Xml::CParser* aParser ); + void ConstructL( RFs& aRfs, const TDesC& aGzFileName, TInt aBufSize ); + + private: + + /** XML Framework Parser Interface **/ + Xml::CParser* iParser; + + RFile iInputFile; + + CEZDecompressor *iDecompressor; + + TInt32 iCrc; + TEZGZipHeader iHeader; + TEZGZipTrailer iTrailer; + + /** Buffers **/ + TUint8* iInputBuffer; + TUint8* iOutputBuffer; + TPtr8 iInputDescriptor; // always points to start of the input Buffer + TPtr8 iOutputDescriptor; // always points to start of the output Buffer + + + }; + + +#endif /* XMLENGCGZIPFILEDESERIALIZER_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfileoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfileoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,188 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GZIP output stream functions +// + +#include "xmlenggzipfileoutputstream.h" +#include +#include + +/** + * Default input buffers size. + */ +const TInt CXmlEngGZIPFileOutputStream::KDefaultInputBufferSize = 4096; + +/** + * Output buffer size. It determines, how often output data will be written + * to disk. (it's written to disk, when buffer is full. + * + */ +const TInt CXmlEngGZIPFileOutputStream::KOutputBufferSize = 0x8000; + +CXmlEngGZIPFileOutputStream* CXmlEngGZIPFileOutputStream::NewLC( RFile& aOutputFile, + RFs& aRFs ) + { + CXmlEngGZIPFileOutputStream* gzfos = new (ELeave) CXmlEngGZIPFileOutputStream( aOutputFile, + aRFs ); + CleanupStack::PushL( gzfos ); + gzfos->ConstructL(); + return gzfos; + } + +CXmlEngGZIPFileOutputStream* CXmlEngGZIPFileOutputStream::NewL( RFile& aOutputFile, + RFs& aRFs ) + { + CXmlEngGZIPFileOutputStream* gzfos = CXmlEngGZIPFileOutputStream::NewLC( aOutputFile, + aRFs ); + CleanupStack::Pop( gzfos ); + return gzfos; + } + +CXmlEngGZIPFileOutputStream::CXmlEngGZIPFileOutputStream( RFile& aOutputFile, RFs& aRFs ) + { + iKeepGoing = ETrue; + iOutputFile = aOutputFile; + iRFs = aRFs; + iCrc = crc32( iCrc, NULL, 0 ); + } + +void CXmlEngGZIPFileOutputStream::ConstructL() + { + EZGZipFile::WriteHeaderL( iOutputFile, iHeader ); + //we can't create compressor here, because we heve no input at this moment + iOutputDescriptor.CreateL( KOutputBufferSize ); + iInputDescriptor.CreateL( KDefaultInputBufferSize ); + iOldInputDescriptor.CreateL( KDefaultInputBufferSize ); + } + +CXmlEngGZIPFileOutputStream::~CXmlEngGZIPFileOutputStream() + { + delete iCompressor; + iOutputDescriptor.Close(); + iInputDescriptor.Close(); + iOldInputDescriptor.Close(); + } + +TInt CXmlEngGZIPFileOutputStream::Write( const TDesC8& aBuffer ) + { + TRAP ( iError, WriteL( aBuffer ) ); + if ( iError ) + { + return KErrNotFound; + } + + TInt bufferSize = aBuffer.Size(); + iUncompressedDataSize += bufferSize; + + return bufferSize; + } + +void CXmlEngGZIPFileOutputStream::WriteL( const TDesC8& aBuffer ) + { + iNoInputNeeded = ETrue; + if ( !iCompressor ) + { + const TInt newLength = aBuffer.Length(); + if ( newLength > iInputDescriptor.MaxLength() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + iCompressor = CEZCompressor::NewL( *this, CEZCompressor::EDefaultCompression, + -CEZCompressor::EMaxWBits ); + } + else + { + iInputDescriptor.Swap( iOldInputDescriptor ); + const TInt newLength = aBuffer.Length(); + if ( newLength > iInputDescriptor.MaxLength() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + + while ( iNoInputNeeded ) + { + iCompressor->DeflateL(); + } + } + } + +TInt CXmlEngGZIPFileOutputStream::Close() + { + iCloseInvoked = ETrue; + if ( iError ) + { + return -1; + } + TRAP ( iError, CloseL() ); + if ( iError ) + { + return KErrNotFound; + } + return KErrNone; + } + +void CXmlEngGZIPFileOutputStream::CloseL() + { + while ( iKeepGoing ) + { + iKeepGoing = iCompressor->DeflateL(); + } + TEZGZipTrailer trailer( iCrc, iUncompressedDataSize ); + EZGZipFile::WriteTrailerL( iOutputFile, trailer ); + } + +TInt CXmlEngGZIPFileOutputStream::CheckError() + { + return iError; + } + +void CXmlEngGZIPFileOutputStream::InitializeL( CEZZStream& aZStream ) + { + aZStream.SetInput(iInputDescriptor); + aZStream.SetOutput(iOutputDescriptor); + iCrc = crc32(iCrc,iInputDescriptor.Ptr(),iInputDescriptor.Size()); + iNoInputNeeded = EFalse; + } + +void CXmlEngGZIPFileOutputStream::NeedInputL( CEZZStream& aZStream ) + { + if ( iCloseInvoked ) + { + aZStream.SetInput( KNullDesC8 ); + iCrc = crc32( iCrc, (unsigned char*)18, 0 ); + //second argument can't be null, and third should be 0 !!! + } + else + { + aZStream.SetInput( iInputDescriptor ); + iCrc = crc32( iCrc, iInputDescriptor.Ptr(), iInputDescriptor.Size() ); + iNoInputNeeded = EFalse; + } + } + +void CXmlEngGZIPFileOutputStream::NeedOutputL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + User::LeaveIfError( iOutputFile.Write(od) ); + aZStream.SetOutput( iOutputDescriptor ); + } + +void CXmlEngGZIPFileOutputStream::FinalizeL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + User::LeaveIfError( iOutputFile.Write(od) ); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfileoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipfileoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,106 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Interface class describing class that may be used as +// output stream for dom tree +// + + + +/** + @file + @internalComponent + @prototype +*/ +#ifndef XMLENGCGZIPFILEOUTPUTSTREAM_H +#define XMLENGCGZIPFILEOUTPUTSTREAM_H + +#include +#include //MEZBufferManager + +#include //TEZGZipHeader +class CEZCompressor; + + + +class CXmlEngGZIPFileOutputStream : public CBase, public MXmlEngOutputStream, + public MEZBufferManager +{ +public: + static CXmlEngGZIPFileOutputStream* NewLC(RFile& aOutputFile, RFs& aRFs); + static CXmlEngGZIPFileOutputStream* NewL(RFile& aOutputFile, RFs& aRFs); + ~CXmlEngGZIPFileOutputStream(); + TInt CheckError(); + + TInt Write( const TDesC8& aBuffer ); + TInt Close(); + + /** + * Implementation of MEZBufferManager interface. + */ + void InitializeL(CEZZStream& aZStream); + void NeedInputL(CEZZStream& aZStream); + void NeedOutputL(CEZZStream& aZStream); + void FinalizeL(CEZZStream& aZStream); + +protected: + CXmlEngGZIPFileOutputStream(RFile& aOutputFile, RFs& aRFs); + void ConstructL(); + +private: + void WriteL(const TDesC8& aBuffer); + void CloseL(); + +private: + TInt iError; + + /** + * Default input buffers size. + */ + static const TInt KDefaultInputBufferSize; + + /** + * Output buffer size. It determines, how often output data will be written + * to disk. (it's written to disk, when buffer is full. + * + */ + + + static const TInt KOutputBufferSize; + + RBuf8 iOutputDescriptor; + RBuf8 iInputDescriptor; + RBuf8 iOldInputDescriptor; + + /** + * Engine of GZiping + */ + CEZCompressor* iCompressor; + TInt32 iCrc; + TEZGZipHeader iHeader; + TInt iUncompressedDataSize; + RFile iOutputFile; + RFs iRFs; + + /** + * State of the object. + */ + TBool iNoInputNeeded; + TBool iKeepGoing; + TBool iCloseInvoked; + +}; + + + +#endif /* XMLENGCGZIPFILEOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,181 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// GZIP output stream functions +// + +#include "xmlenggzipoutputstream.h" +#include +#include + +/** + * Default input buffers size. + */ +static const TInt KDefaultInputBufferSize = 4096; + +/** + * Output buffer size. It determines, how often output data will be written + * to disk. (it's written to disk, when buffer is full. + * + */ +static const TInt KOutputSize = 0x1000; + + +CXmlEngGZIPOutputStream* CXmlEngGZIPOutputStream::NewLC(MXmlEngOutputStream& aOutputBuffer ) + { + CXmlEngGZIPOutputStream* gzbos = new (ELeave) CXmlEngGZIPOutputStream( aOutputBuffer ); + CleanupStack::PushL( gzbos ); + gzbos->ConstructL(); + return gzbos; + } + +CXmlEngGZIPOutputStream* CXmlEngGZIPOutputStream::NewL( MXmlEngOutputStream& aOutputBuffer ) + { + CXmlEngGZIPOutputStream* gzbos = CXmlEngGZIPOutputStream::NewLC( aOutputBuffer ); + CleanupStack::Pop( gzbos ); + return gzbos; + } + +CXmlEngGZIPOutputStream::CXmlEngGZIPOutputStream( MXmlEngOutputStream& aOutputBuffer ) + { + iOutputString = &aOutputBuffer; + iKeepGoing = ETrue; + } + +void CXmlEngGZIPOutputStream::ConstructL() + { + //we can't create compressor here, because we heve no input at this moment + iOutputDescriptor.CreateL( KOutputSize ); + iInputDescriptor.CreateL( KDefaultInputBufferSize ); + iOldInputDescriptor.CreateL( KDefaultInputBufferSize ); + } + +CXmlEngGZIPOutputStream::~CXmlEngGZIPOutputStream() + { + delete iCompressor; + iOutputDescriptor.Close(); + iInputDescriptor.Close(); + iOldInputDescriptor.Close(); + } + +TInt CXmlEngGZIPOutputStream::Write( const TDesC8& aBuffer ) + { + TRAP ( iError, WriteL( aBuffer ) ); + if ( iError ) + { + return -1; + } + + return aBuffer.Size(); + } + +void CXmlEngGZIPOutputStream::WriteL( const TDesC8& aBuffer ) + { + iNoInputNeeded = ETrue; + if ( !iCompressor ) + { + const TInt newLength = aBuffer.Size(); + if ( newLength > iInputDescriptor.Size() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + iCompressor = CEZCompressor::NewL( *this ); + } + else + { + iInputDescriptor.Swap( iOldInputDescriptor ); + const TInt newLength = aBuffer.Length(); + if ( newLength > iInputDescriptor.MaxLength() ) + { + iInputDescriptor.ReAllocL( newLength ); + } + iInputDescriptor.Copy( aBuffer ); + + while ( iNoInputNeeded ) + { + iCompressor->DeflateL(); + } + } + } + +TInt CXmlEngGZIPOutputStream::Close() + { + iCloseInvoked = ETrue; + TRAP ( iError, CloseL() ); + if ( iError ) + { + return -1; + } + return KErrNone; + } + +void CXmlEngGZIPOutputStream::CloseL() + { + while ( iKeepGoing ) + { + iKeepGoing = iCompressor->DeflateL(); + } + } + +TInt CXmlEngGZIPOutputStream::CheckError() + { + return iError; + } + +void CXmlEngGZIPOutputStream::InitializeL( CEZZStream& aZStream ) + { + aZStream.SetInput( iInputDescriptor ); + aZStream.SetOutput( iOutputDescriptor ); + iNoInputNeeded = EFalse; + } + +void CXmlEngGZIPOutputStream::NeedInputL( CEZZStream& aZStream ) + { + if ( iCloseInvoked ) + { + aZStream.SetInput( KNullDesC8 ); + } + else + { + aZStream.SetInput( iInputDescriptor ); + iNoInputNeeded = EFalse; + } + } + +void CXmlEngGZIPOutputStream::NeedOutputL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + TInt res = iOutputString->Write(od); + if (res < 0) + { + User::Leave(res); + } + aZStream.SetOutput( iOutputDescriptor ); + } + +void CXmlEngGZIPOutputStream::FinalizeL( CEZZStream& aZStream ) + { + TPtrC8 od = aZStream.OutputDescriptor(); + TInt res = iOutputString->Write(od); + if (res < 0) + { + User::Leave(res); + } + res = iOutputString->Close(); + if (res < 0) + { + User::Leave(res); + } + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,97 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Class used to serialize DOM tree to compressed stream +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGCGZIPOUTPUTSTREAM_H +#define XMLENGCGZIPOUTPUTSTREAM_H + +#include +#include //MEZBufferManager +#include //TEZGZipHeader + +class CEZCompressor; + +class CXmlEngGZIPOutputStream : public CBase, public MXmlEngOutputStream, public MEZBufferManager + { + public: + static CXmlEngGZIPOutputStream* NewLC(MXmlEngOutputStream& aOutputStream); + + static CXmlEngGZIPOutputStream* NewL(MXmlEngOutputStream& aOutputStream); + + ~CXmlEngGZIPOutputStream(); + + /** + * Get last error + */ + TInt CheckError(); + + /** + * Implementation of MXmlEngOutputStream interface. + */ + TInt Write( const TDesC8& aBuffer ); + TInt Close(); + + /** + * Implementation of MEZBufferManager interface. + */ + void InitializeL(CEZZStream& aZStream); + void NeedInputL(CEZZStream& aZStream); + void NeedOutputL(CEZZStream& aZStream); + void FinalizeL(CEZZStream& aZStream); + + + protected: + CXmlEngGZIPOutputStream(MXmlEngOutputStream& aOutputBuffer); + void ConstructL(); + + private: + void WriteL(const TDesC8& aBuffer); + void CloseL(); + + private: + /** + * Last error + */ + TInt iError; + + RBuf8 iOutputDescriptor; + RBuf8 iInputDescriptor; + RBuf8 iOldInputDescriptor; + + /** + * Engine of GZiping + */ + CEZCompressor* iCompressor; + + MXmlEngOutputStream* iOutputString; + /** + * State of the object. + */ + TBool iNoInputNeeded; + TBool iKeepGoing; + TBool iCloseInvoked; + + }; + + + +#endif /* XMLENGCGZIPOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengparsingoptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengparsingoptions.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Parsing options functions +// + +#include + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TXmlEngParsingOptions::TXmlEngParsingOptions(TUint aOptionFlags) + { + iOptions = aOptionFlags; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengserializer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengserializer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,211 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of serializer +// + +#include +#include +#include "xmlengserializerxop.h" +#include "xmlengserializergzip.h" +#include +#include + + +// -------------------------------------------------------------------------------------- +// Creates an instance of CXmlEngSerializer +// -------------------------------------------------------------------------------------- +// +EXPORT_C CXmlEngSerializer* CXmlEngSerializer::NewL(TXmlEngSerializerType aType) + { + switch(aType) + { + case ESerializerXOP: + { + return CXmlEngSerializerXOP::NewL( EFalse ); + } + case ESerializerXOPInfoset: + { + return CXmlEngSerializerXOP::NewL( ETrue ); + } + case ESerializerGZip: + { + return CXmlEngSerializerGZIP::NewL(); + } + case ESerializerDefault: + default: + { + CXmlEngSerializer* self = new (ELeave) CXmlEngSerializer(); + //2nd phase construction not needed currently + //CleanupStack::PushL(self); + //self->ConstructL(); + //CleanupStack::Pop(self); + return self; + } + } + } + +// -------------------------------------------------------------------------------------- +// Set output type as file +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngSerializer::SetOutputL(const TDesC& aFileName) + { + if(iOutFileName) + { + delete iOutFileName; + iOutFileName=NULL; + } + iOutFileName = aFileName.AllocL(); + iSerializationOutput = ESerializeToFile; + } + +// -------------------------------------------------------------------------------------- +// Set output type as buffer +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngSerializer::SetOutput(RBuf8& aBuffer) + { + iBuffer = &aBuffer; + iSerializationOutput = ESerializeToBuffer; + } + +// -------------------------------------------------------------------------------------- +// Set output type as output stream +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngSerializer::SetOutput(MXmlEngOutputStream& aStream) + { + iOutputStream = &aStream; + iSerializationOutput = ESerializeToStream; + } + +// -------------------------------------------------------------------------------------- +// Set serialization options +// -------------------------------------------------------------------------------------- +// +EXPORT_C void CXmlEngSerializer::SetSerializationOptions(TXmlEngSerializationOptions& aOptions) + { + iSerializationOptions = &aOptions; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngSerializer::SerializeL( TXmlEngNode aRoot) + { + TXmlEngSerializationOptions* defPtr = NULL; + TXmlEngSerializationOptions def = TXmlEngSerializationOptions(); + if(iSerializationOptions ) + { + defPtr = iSerializationOptions; + } + else + { + defPtr = &def; + } + + RXmlEngDocument doc = aRoot.OwnerDocument(); //CXmlEngSerializer isn't owner of doc - in case + //of leave, cleanup done by the caller + switch(iSerializationOutput) + { + case ESerializeToFile: + { + return SerializeL(iOutFileName->Des(), aRoot, *defPtr); + } + case ESerializeToBuffer: + { + return SerializeL(*iBuffer, aRoot, *defPtr); + } + case ESerializeToStream: + { + if(!iOutputStream) + { + User::Leave(KXmlEngErrNoParameters); + } + return doc.SaveL(*iOutputStream, aRoot, *defPtr ); + } + default: + { + User::Leave(KErrNotSupported); + } + } + return KErrGeneral; //should never happen + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngSerializer::SerializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ) + { + return aRoot.OwnerDocument().SaveL(aRFs, aFileName, aRoot, aOptions); + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngSerializer::SerializeL( const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ) + { + TInt size; + RFs rfs; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + size = aRoot.OwnerDocument().SaveL(rfs, aFileName, aRoot, aOptions); + CleanupStack::PopAndDestroy(&rfs); + return size; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to buffer +// -------------------------------------------------------------------------------------- +// +EXPORT_C TInt CXmlEngSerializer::SerializeL( RBuf8& aBuffer, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions) + { + return aRoot.OwnerDocument().SaveL(aBuffer, aRoot, aOptions); + } + +// -------------------------------------------------------------------------------------- +// Default Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializer::CXmlEngSerializer() + : iBuffer(NULL), + iOutputStream(NULL), + iSerializationOptions(NULL) + { + } + +void CXmlEngSerializer::ConstructL() + { + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializer::~CXmlEngSerializer() + { + delete iOutFileName; + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengserializergzip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengserializergzip.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,211 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Node container implementation +// + +#include +#include +#include "xmlengserializergzip.h" +#include "xmlenggzipoutputstream.h" +#include "xmlenggzipfileoutputstream.h" +#include "xmlenggzipbufferoutputstream.h" +#include "ezgzip.h" +#include + + + +TInt CXmlEngSerializerGZIP::SerializeToFileL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt) + { + RFile outFile; + + User::LeaveIfError(outFile.Replace(aRFs,aFileName,EFileStream | EFileWrite | EFileShareExclusive)); + CleanupClosePushL(outFile); + + CXmlEngGZIPFileOutputStream* gzfos = CXmlEngGZIPFileOutputStream::NewLC(outFile,aRFs); + TRAPD(err,aNode.OwnerDocument().SaveL(*gzfos,aNode,aOpt)); + TInt sErr = gzfos->CheckError(); + if(sErr) + { + User::Leave(sErr); + } + if(err) + { + User::Leave(err); + } + + TInt fSize; + outFile.Size(fSize); + CleanupStack::PopAndDestroy(gzfos); + CleanupStack::PopAndDestroy(&outFile); + + return fSize; + } + +TInt CXmlEngSerializerGZIP::SerializeToBufferL(RBuf8& aBuf, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt) + { + CXmlEngGZIPBufferOutputStream* gzbos = CXmlEngGZIPBufferOutputStream::NewLC(aBuf); + TRAPD(err,aNode.OwnerDocument().SaveL(*gzbos,aNode,aOpt)); + TInt sErr = gzbos->CheckError(); + if(sErr) + { + User::Leave(sErr); + } + if(err) + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(gzbos); + return aBuf.Size(); + } + +TInt CXmlEngSerializerGZIP::SerializeToStreamL(MXmlEngOutputStream& aStream, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt) + { + CXmlEngGZIPOutputStream* gzbos = CXmlEngGZIPOutputStream::NewLC(aStream); + TInt size = 0; + TRAPD(err,size = aNode.OwnerDocument().SaveL(*gzbos,aNode,aOpt)); + TInt sErr = gzbos->CheckError(); + if(sErr) + { + User::Leave(sErr); + } + if(err) + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(gzbos); + return size; + } + +// -------------------------------------------------------------------------------------- +// Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializerGZIP* CXmlEngSerializerGZIP::NewL() + { + CXmlEngSerializerGZIP* self = new (ELeave) CXmlEngSerializerGZIP(); + return self; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerGZIP::SerializeL(const TXmlEngNode aRoot) + { + TXmlEngSerializationOptions* defPtr = NULL; + TXmlEngSerializationOptions def = TXmlEngSerializationOptions(); + if(iSerializationOptions ) + { + defPtr = iSerializationOptions; + } + else + { + defPtr = &def; + } + + RXmlEngDocument doc = aRoot.OwnerDocument(); + + switch(iSerializationOutput) + { + case ESerializeToFile: + { + if (!iOutFileName) + { + User::Leave(KXmlEngErrNoParameters); + } + return SerializeL(iOutFileName->Des(), aRoot, *defPtr); + } + case ESerializeToBuffer: + { + return SerializeL(*iBuffer, aRoot, *defPtr); + } + case ESerializeToStream: + { + if(!iOutputStream) + { + User::Leave(KXmlEngErrNoParameters); + } + return SerializeToStreamL(*iOutputStream, aRoot, *defPtr); + } + default: + { + User::Leave(KErrNotSupported); + } + } + return KErrGeneral; //should never happen + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerGZIP::SerializeL( RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ) + { + return SerializeToFileL(aRFs, aFileName, aRoot, aOptions); + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerGZIP::SerializeL( const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ) + { + RFs rfs; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + TInt outSize = SerializeToFileL(rfs, aFileName, aRoot, aOptions); + CleanupStack::PopAndDestroy(&rfs); + return outSize; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to buffer +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerGZIP::SerializeL( RBuf8& aBuffer, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions) + { + return SerializeToBufferL(aBuffer,aRoot,aOptions); + } + +// -------------------------------------------------------------------------------------- +// Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializerGZIP::CXmlEngSerializerGZIP() + { + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializerGZIP::~CXmlEngSerializerGZIP() + { + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengserializergzip.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengserializergzip.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,124 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Serialize node to GZIP file +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSERIALIZERGZIP_H +#define XMLENGSERIALIZERGZIP_H + +#include + +/** + * XML serializer to GZIP format + */ +class CXmlEngSerializerGZIP: public CXmlEngSerializer + { + public: + /** + * Creates an instance of CXmlEngSerializerGZIP class + * + * @return Pointer to instance of CXmlEngSerializerGZIP class + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + static CXmlEngSerializerGZIP* NewL(); + + /** + * Destructor. + * + */ + ~CXmlEngSerializerGZIP(); + + /** + * Serializes TXmlEngNode + * + * @param aRoot Node to be serialized + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(const TXmlEngNode aRoot = TXmlEngNode()); + + /** + * Serializes TXmlEngNode + * + * @param aRoot Node to be serialized + * @param aFileName File name to which document will be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(const TDesC& aFileName, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aOptions = TXmlEngSerializationOptions(0)); + + /** + * Serializes TXmlEngNode + * + * @param aRoot Node to be serialized + * @param aRFs File server session + * @param aFileName File name to which document will be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aOptions = TXmlEngSerializationOptions(0)); + + /** + * Serializes TXmlEngNode to file + * + * @param aRoot XML data buffer + * @param aBuffer Buffer to which document will be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(RBuf8& aBuffer, + const TXmlEngNode aRoot = TXmlEngNode(), + const TXmlEngSerializationOptions& aOptions = TXmlEngSerializationOptions(0)); + +private: + /** + * Constructor + */ + CXmlEngSerializerGZIP(); + + TInt SerializeToFileL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt); + + TInt SerializeToBufferL(RBuf8& aBuf, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt); + + TInt SerializeToStreamL(MXmlEngOutputStream& aStream, + const TXmlEngNode aNode, + const TXmlEngSerializationOptions& aOpt); + }; + +#endif /* XMLENGSERIALIZERGZIP_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengserializerxop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengserializerxop.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,642 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer +// + +#include +#include + +#include "xmlengserializerxop.h" +#include +#include +#include "xmlengdomdefs.h" +#include +#include +#include +#include +#include "xmlengxopfileoutputstream.h" +#include "xmlengxopproxyoutputstream.h" +#include + +#include + +_LIT8(KStartTag, "<"); +// _LIT8(KCloseTag, "/>"); +_LIT8(KXOPInclude, "xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\""); +_LIT8(KXOPDocumentStart, "MIME-Version: 1.0\nContent-Type: Multipart/Related;boundary=MIME_boundary;\ntype=\"application/xop+xml\";\nstart=\"\";\n\n"); +_LIT8(KMimeRoot, "--MIME_boundary\nContent-ID: \n\n"); +_LIT8(KMimeHeaderStart, "\n\n--MIME_boundary\n"); +_LIT8(KMimeHeaderContentType, "Content-Type: "); +_LIT8(KMimeHeaderContentIdStart, "Content-ID: <"); +_LIT8(KMimeHeaderContentIdEnd, ">\n"); +// _LIT8(KMimeHeaderEnd, "\n\n"); +_LIT8(KXOPDocumentEnd, "\n--MIME_boundary--"); +_LIT8(KInclude, "Include"); +_LIT8(KXOPUri, "http://www.w3.org/2004/08/xop/include"); +_LIT8(KNewLine, "\n"); +_LIT8(KColon, ":"); +_LIT8(KHrefStart, " href=\"cid:"); +_LIT8(KHrefEnd, "\"/>"); + +// -------------------------------------------------------------------------------------- +// Constructor +// -------------------------------------------------------------------------------------- +// +EXPORT_C CXmlEngSerializerXOP* CXmlEngSerializerXOP::NewL( TBool aCleanXOPInfoset ) + { + CXmlEngSerializerXOP* serializerXop = new (ELeave) CXmlEngSerializerXOP( aCleanXOPInfoset ); + CleanupStack::PushL( serializerXop ); + serializerXop->ConstructL(); + CleanupStack::Pop(); //serializerXop + return serializerXop; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerXOP::SerializeL(const TXmlEngNode aRoot) + { + TXmlEngSerializationOptions* defPtr = NULL; + TXmlEngSerializationOptions def = TXmlEngSerializationOptions(); + if(iSerializationOptions ) + { + defPtr = iSerializationOptions; + } + else + { + defPtr = &def; + } + + switch(iSerializationOutput) + { + case ESerializeToFile: + { + if (!iOutFileName) + { + User::Leave(KXmlEngErrNoParameters); + } + return SerializeL(iOutFileName->Des(), aRoot, *defPtr); + } + case ESerializeToBuffer: + { + return SerializeL(*iBuffer, aRoot, *defPtr); + } + case ESerializeToStream: + { + TXmlEngSXOPProxyOutputStream stream = TXmlEngSXOPProxyOutputStream(*iOutputStream); + return StreamSerializeL(stream, aRoot, *defPtr); + } + default: + { + User::Leave(KErrNotSupported); + } + } + return 0; + } +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerXOP::SerializeL(const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions) + { + iRFs.Close(); + User::LeaveIfError(iRFs.Connect()); + return SerializeL(iRFs, aFileName, aRoot, aOptions); + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to file +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerXOP::SerializeL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions) + { + User::LeaveIfError( iOutputFile.Replace(aRFs, aFileName, EFileWrite) ); + TXmlEngSXOPFileOutputStream fileStream = TXmlEngSXOPFileOutputStream(iOutputFile, aRFs); + return StreamSerializeL(fileStream, aRoot, aOptions); + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to a given type of stream (file or stream) +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerXOP::StreamSerializeL(MXmlEngSXOPOutputStream& aOutputStream, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions) + { + LeaveIfXopIncludeL(aRoot); + iDataContainerArray.Reset(); + if(aOptions.iDataSerializer) + { + return aRoot.OwnerDocument().SaveL(aOutputStream, aRoot, aOptions); + } + + iTmpOutputStream = &aOutputStream; + iDataWritten = 0; + + if( !iCleanXOPInfoset ) + { + BufferedWriteL(KXOPDocumentStart, ETrue); + BufferedWriteL(KMimeRoot, ETrue); + } + + TXmlEngSerializationOptions opt = aOptions; + opt.iDataSerializer = this; + + iDataWritten += aRoot.OwnerDocument().SaveL(aOutputStream, aRoot, opt); + + if( !iCleanXOPInfoset ) + { + for( TInt i = 0; i < iDataContainerArray.Count(); i++ ) + { + BufferedWriteL(KMimeHeaderStart); + TPtrC8 contentTypeStr; + if(GetContentTypeValue(iDataContainerArray[i], contentTypeStr)) + { + BufferedWriteL(KMimeHeaderContentType); + BufferedWriteL(contentTypeStr); + BufferedWriteL(KNewLine); + } + BufferedWriteL(KMimeHeaderContentIdStart); + BufferedWriteL(iDataContainerArray[i].Cid()); + BufferedWriteL(KMimeHeaderContentIdEnd); + BufferedWriteL(KNewLine); + switch(iDataContainerArray[i].NodeType()) + { + case TXmlEngNode::EBinaryContainer: + { + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers) + { + HBufC8* decodedData = CreateDecodedBufLC( + iDataContainerArray[i].AsBinaryContainer().Contents()); + BufferedWriteL(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + BufferedWriteL(iDataContainerArray[i].AsBinaryContainer().Contents()); + } + break; + } + case TXmlEngNode::EChunkContainer: + { + TPtrC8 data = TPtrC8( + ((RChunk&)iDataContainerArray[i].AsChunkContainer().Chunk()).Base() + + iDataContainerArray[i].AsChunkContainer().ChunkOffset(), + iDataContainerArray[i].AsChunkContainer().Size()); + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers) + { + HBufC8* decodedData = CreateDecodedBufLC(data); + BufferedWriteL(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + BufferedWriteL(data); + } + break; + } + case TXmlEngNode::EFileContainer: + { + TInt size = iDataContainerArray[i].AsFileContainer().Size(); + HBufC8* data = HBufC8::NewLC(size); + TPtr8 dataPtr = data->Des(); + iDataContainerArray[i].AsFileContainer().File().Read(dataPtr, size); + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers ) + { + HBufC8* decodedData = CreateDecodedBufLC(dataPtr); + BufferedWriteL(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + BufferedWriteL(dataPtr); + } + CleanupStack::PopAndDestroy(); //data + break; + } + } + } + BufferedWriteL(KXOPDocumentEnd); + } //if( !iCleanXOPInfoset ) + CommitWriteL(); + return iDataWritten; + } + +// -------------------------------------------------------------------------------------- +// Serializes TXmlEngNode to buffer +// -------------------------------------------------------------------------------------- +// +TInt CXmlEngSerializerXOP::SerializeL( RBuf8& aBuffer, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ) + { + if(aBuffer.Length()) + { + aBuffer.Close(); + } + LeaveIfXopIncludeL(aRoot); + iDataContainerArray.Reset(); + if(aOptions.iDataSerializer) + { + return CXmlEngSerializer::SerializeL(aBuffer, aRoot, aOptions); + } + + TXmlEngSerializationOptions opt = aOptions; + opt.iDataSerializer = this; + + RBuf8 xopDocument; + CleanupClosePushL(xopDocument); + aRoot.OwnerDocument().SaveL(xopDocument, aRoot, opt); + + if( iCleanXOPInfoset ) + { + if(xopDocument.Size() > aBuffer.MaxSize()) + { + aBuffer.ReAllocL( xopDocument.Size() ); + } + aBuffer.Append(xopDocument); + } + else + { + // adjust buffer size + TInt bufSize = KXOPDocumentStart().Size() + + KMimeRoot().Size() + + xopDocument.Size() + + KXOPDocumentEnd().Size(); + for(TInt j = 0; j < iDataContainerArray.Count(); j++) + { + TPtrC8 contentTypeStr; + if(GetContentTypeValue(iDataContainerArray[j], contentTypeStr)) + { + bufSize += KMimeHeaderContentType().Size() + + contentTypeStr.Size() + + KNewLine().Size(); + } + bufSize += KMimeHeaderStart().Size() + + KMimeHeaderContentIdStart().Size() + + iDataContainerArray[j].Cid().Length() + + KMimeHeaderContentIdEnd().Size() + + KNewLine().Size() + + iDataContainerArray[j].Size(); + } + if (bufSize > aBuffer.MaxSize()) + { + aBuffer.ReAllocL( bufSize ); + } + + // write to buffer + aBuffer.Append(KXOPDocumentStart()); + aBuffer.Append(KMimeRoot()); + aBuffer.Append(xopDocument); + for(TInt i = 0; i < iDataContainerArray.Count(); i++) + { + aBuffer.Append(KMimeHeaderStart); + TPtrC8 contentTypeStr; + if(GetContentTypeValue(iDataContainerArray[i], contentTypeStr)) + { + aBuffer.Append(KMimeHeaderContentType); + aBuffer.Append(contentTypeStr); + aBuffer.Append(KNewLine); + } + aBuffer.Append(KMimeHeaderContentIdStart); + aBuffer.Append(iDataContainerArray[i].Cid()); + aBuffer.Append(KMimeHeaderContentIdEnd); + aBuffer.Append(KNewLine); + switch(iDataContainerArray[i].NodeType()) + { + case TXmlEngNode::EBinaryContainer: + { + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers ) + { + HBufC8* decodedData = CreateDecodedBufLC(iDataContainerArray[i].AsBinaryContainer().Contents()); + aBuffer.Append(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + aBuffer.Append(iDataContainerArray[i].AsBinaryContainer().Contents()); + } + break; + } + case TXmlEngNode::EChunkContainer: + { + TPtrC8 data = TPtrC8( + ((RChunk&)iDataContainerArray[i].AsChunkContainer().Chunk()).Base() + + iDataContainerArray[i].AsChunkContainer().ChunkOffset(), + iDataContainerArray[i].AsChunkContainer().Size()); + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers ) + { + HBufC8* decodedData = CreateDecodedBufLC(data); + aBuffer.Append(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + aBuffer.Append(data); + } + break; + } + case TXmlEngNode::EFileContainer: + { + TInt size = iDataContainerArray[i].AsFileContainer().Size(); + HBufC8* data = HBufC8::NewLC(size); + TPtr8 dataPtr = data->Des(); + iDataContainerArray[i].AsFileContainer().File().Read(dataPtr, size); + if(opt.iOptions & TXmlEngSerializationOptions::KOptionDecodeBinaryContainers ) + { + HBufC8* decodedData = CreateDecodedBufLC(dataPtr); + aBuffer.Append(decodedData->Des()); + CleanupStack::PopAndDestroy(); //decodedData + } + else + { + aBuffer.Append(dataPtr); + } + CleanupStack::PopAndDestroy(); //data + break; + } + } + } + aBuffer.Append(KXOPDocumentEnd); + } + CleanupStack::PopAndDestroy(); //xopDocument + return aBuffer.Size(); + } + +// -------------------------------------------------------------------------------------- +// Determines how binary data should be serialized +// -------------------------------------------------------------------------------------- +// +TPtrC8 CXmlEngSerializerXOP::SerializeDataL(TXmlEngNode aNode) + { + User::LeaveIfError(iDataContainerArray.Append(aNode.AsDataContainer())); + iXopStubPtr->Zero(); + iXopStubPtr->Append(KStartTag); + TXmlEngNamespace xopNs = aNode.AsElement().LookupNamespaceByUriL(KXOPUri); + if(xopNs.IsNull()) + { + iXopStubPtr->Append(KXOPInclude); + } + else + { + iXopStubPtr->Append(xopNs.Prefix()); + iXopStubPtr->Append(KColon); + iXopStubPtr->Append(KInclude); + } + iXopStubPtr->Append(KHrefStart); + iXopStubPtr->Append(aNode.AsDataContainer().Cid()); + iXopStubPtr->Append(KHrefEnd); + iXopStubPtr->ZeroTerminate(); + return *iXopStubPtr; + } + +// -------------------------------------------------------------------------------------- +// Constructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializerXOP::CXmlEngSerializerXOP( TBool aCleanXOPInfoset ) : + iCleanXOPInfoset(aCleanXOPInfoset) + { + } + +// -------------------------------------------------------------------------------------- +// Second phase constructor +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::ConstructL() + { + //create stub buffer + iXopStub = HBufC8::NewL(KXopStubMaxSize); + iXopStubPtr = new ( ELeave ) TPtr8(iXopStub->Des()); + //create output buffer + iOutputBuffer = HBufC8::NewL(KInitBufferSize); + iOutputBufferPtr = new ( ELeave ) TPtr8(iOutputBuffer->Des()); + + } + +// -------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------- +// +CXmlEngSerializerXOP::~CXmlEngSerializerXOP() + { + iDataContainerArray.Close(); + iRFs.Close(); + delete iXopStub; + delete iXopStubPtr; + delete iOutputBuffer; + delete iOutputBufferPtr; + } + +// -------------------------------------------------------------------------------------- +// Leaves if a DOM tree contains 'Include' elements from XOP +// namespace 'http://www.w3.org/2004/08/xop/include' +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::LeaveIfXopIncludeL(TXmlEngNode aRoot) + { + if(aRoot.NodeType() == XML_DOCUMENT_NODE) + { + if(HasXopInclude(aRoot.OwnerDocument().DocumentElement())) + { + User::Leave(KXmlEngErrBadInfoset); + } + } + else if(HasXopInclude(aRoot)) + { + User::Leave(KXmlEngErrBadInfoset); + } + } + +// -------------------------------------------------------------------------------------- +// Verifies if a DOM tree contains 'Include' elements from XOP +// namespace 'http://www.w3.org/2004/08/xop/include' +// -------------------------------------------------------------------------------------- +// +TBool CXmlEngSerializerXOP::HasXopInclude(TXmlEngNode aRoot) + { + if(aRoot.NodeType() == XML_ELEMENT_NODE) + { + if( aRoot.NamespaceDeclaration().NotNull() && + aRoot.Name().Compare(KInclude) == 0 && + aRoot.NamespaceUri().Compare(KXOPUri) == 0 ) + { + return ETrue; + } + if(aRoot.HasChildNodes()) + { + RXmlEngNodeList childList; + aRoot.GetChildNodes(childList); + while(childList.HasNext()) + { + if(HasXopInclude(childList.Next())) + return ETrue; + } + } + } + return EFalse; + } + +// -------------------------------------------------------------------------------------- +// Verifies if container's parent node has xmlmime:contentType +// attribute information item. If found, the function returns ETrue +// and xmlmime:contentType attribute value. Otherwise, function +// returns EFalse and aContentType is undefined. +// -------------------------------------------------------------------------------------- +// +TBool CXmlEngSerializerXOP::GetContentTypeValue(TXmlEngDataContainer aContainer, TPtrC8& aContentType) + { + _LIT8(KMimeNsUri, "http://www.w3.org/2004/11/xmlmime"); + _LIT8(KContentTypeName, "contentType"); + + TXmlEngElement parent = aContainer.ParentNode().AsElement(); + if(parent.HasAttributes()) + { + RXmlEngNodeList attrList; + parent.GetAttributes(attrList); + for(TInt i = 0; i < attrList.Count(); i++) + { + TXmlEngAttr attr = attrList.Next(); + if(attr.Name().Compare(KContentTypeName) == 0 + && attr.NamespaceUri().Compare(KMimeNsUri) == 0) + { + aContentType.Set(attr.Value()); + return ETrue; + } + } + } + return EFalse; + } + +// -------------------------------------------------------------------------------------- +// Decodes input data from base64 to binary octets and creates +// heap buffer with the decoded data. The buffer is pushed on the cleanup stack. +// -------------------------------------------------------------------------------------- +// +HBufC8* CXmlEngSerializerXOP::CreateDecodedBufLC(TPtrC8 aEncodedData) + { + // The decoded length of base64 is about half (use same) encoded length + HBufC8* decodedData = HBufC8::NewLC(aEncodedData.Size()); + TPtr8 decodedDataPtr = decodedData->Des(); + // Decode the base64 Content-Transfer-Encoding + using namespace BSUL; + Base64Codec::Decode(aEncodedData, decodedDataPtr); + if(decodedDataPtr.Length() == 0) + { + User::Leave(KXmlEngErrDecodingFailed); + } + return decodedData; + } + +// -------------------------------------------------------------------------------------- +// Appends given string to output buffer. If the serializer's +// output type is file, the output buffer is released to the output stream +// after reaching a specified threshold and the output buffer is cleared. +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::BufferedWriteL(const TDesC8& aString, TBool aFlush) + { + if(aFlush) + { + if(iOutputBufferPtr->Size() > 0) + { + if( iTmpOutputStream->Write(iOutputBuffer->Des()) == -1) + { + User::Leave(iTmpOutputStream->CheckError()); + } + iOutputBufferPtr->Delete(0, iOutputBufferPtr->Size()); + } + if( iTmpOutputStream->Write(aString) == -1) + { + User::Leave(iTmpOutputStream->CheckError()); + } + iDataWritten += aString.Size(); + return; + } + + // first, check if data is in the buffer and added string will not fit + // -> flush buffer + if(iOutputBufferPtr->Size() > 0 && + iOutputBufferPtr->Size() + aString.Size() > iOutputBufferPtr->MaxSize()) + { + if( iTmpOutputStream->Write(iOutputBuffer->Des()) == -1) + { + User::Leave(iTmpOutputStream->CheckError()); + } + iOutputBufferPtr->Delete(0, iOutputBufferPtr->Size()); + } + // if string alone doesn't fit in the buffer -> save string + if(aString.Size() > iOutputBufferPtr->MaxSize()) + { + if( iTmpOutputStream->Write(aString) == -1) + { + User::Leave(iTmpOutputStream->CheckError()); + } + } + // if string fits into the buffer -> append it + else + { + iOutputBufferPtr->Append(aString); + } + iDataWritten += aString.Size(); + } + +// -------------------------------------------------------------------------------------- +// Flushes the output buffer and closes the stream +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::CommitWriteL() + { + // release cached data to the output stream + if(iOutputBufferPtr->Size() > 0) + { + User::LeaveIfError(iTmpOutputStream->Write(iOutputBuffer->Des())); + iOutputBufferPtr->Delete(0, iOutputBufferPtr->MaxSize()); + } + iTmpOutputStream->CloseAll(); + } + + +// -------------------------------------------------------------------------------------- +// Generates random CID +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::GenerateRandomCid(TDes8& aCid) + { + _LIT8(KAt, "@"); + //generate random CID as @ + TTime now; + now.HomeTime(); + TInt64 homeTime = now.Int64(); + TUint32 randomNumber = Math::Random(); + aCid.AppendNum(randomNumber); + aCid.Append(KAt); + aCid.AppendNum(now.Int64()); + } + +// -------------------------------------------------------------------------------------- +// Sets callback for text nodes in serialization options +// -------------------------------------------------------------------------------------- +// +void CXmlEngSerializerXOP::SetCallbackL( TXmlEngSerializationOptions& /* aOptions */) + {/* + aOptions.iSerializationCallback = (void*)XOPSerializationCallback; + aOptions.iHandler = this;*/ + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengserializerxop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengserializerxop.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,258 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSERIALIZERXOP_H +#define XMLENGSERIALIZERXOP_H + +#include +#include +#include + +class CDesC8ArrayFlat; +class TXmlEngNode; +class TXmlEngDataContainer; +class MXmlEngSXOPOutputStream; + +const TInt KInitBufferSize = 4096; //initial output buffer size +const TInt KXopStubMaxSize = 256; // href='cid:' + cid length + +/** + * XOP serializer + */ +class CXmlEngSerializerXOP: public CXmlEngSerializer, public MXmlEngDataSerializer + { + public: + /** + * Creates an instance of CXmlEngSerializerXOP class + * + * @param aCleanXOPInfoset Indicates that MIME headers + * should be skipped upon serialization + * @return Pointer to instance of CXmlEngSerializerXOP class + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + IMPORT_C static CXmlEngSerializerXOP* NewL( TBool aCleanXOPInfoset ); + + /** + * Serializes TXmlEngNode + * + * @param aRoot Root node of a DOM tree to be serialized + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(const TXmlEngNode aRoot); + + /** + * Serializes TXmlEngNode to file in XOP format + * + * @param aFileName File to which DOM tree will be serialized + * @param aRoot Root node of a DOM tree to be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions); + + /** + * Serializes TXmlEngNode to file in XOP format + * + * @param aRFs File server handle + * @param aFileName File to which DOM tree will be serialized + * @param aRoot Root node of a DOM tree to be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL(RFs& aRFs, + const TDesC& aFileName, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions); + + /** + * Serializes TXmlEngNode to buffer in XOP format + * + * @param aBuffer Buffer to which DOM tree will be serialized + * @param aRoot Root node of a DOM tree to be serialized + * @param aOptions Serialization options + * @return Number of bytes written + * + * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding. + */ + TInt SerializeL( RBuf8& aBuffer, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions ); + + /** + * Destructor. + */ + ~CXmlEngSerializerXOP(); + + /** + * Determines how data node should be serialized + * @param aRoot Root node of a DOM tree to be serialized + * + */ + TPtrC8 SerializeDataL(TXmlEngNode aNode); + +protected: //functions + + +private: //functions + /** + * Constructor + * + * @param aCleanXOPInfoset Indicates that MIME headers + * should be skipped upon serialization + */ + CXmlEngSerializerXOP( TBool aCleanXOPInfoset ); + + /** + * Second phase constructor + */ + void ConstructL(); + + /** + * Serializes DOM tree to a stream + */ + TInt StreamSerializeL(MXmlEngSXOPOutputStream& aOutputStream, + const TXmlEngNode aRoot, + const TXmlEngSerializationOptions& aOptions); + + /** + * Generates random CID + * + * @param aCid randomly generated CID string + */ + void GenerateRandomCid(TDes8& aCid); + + /** + * Opens already existing or creates a new file + * + * @param aFileName file name + * @param aFile Instance of class RFile + */ + void OpenOrCreateL(TDesC& aFileName, RFile& aFile); + + /** + * Sets callback for text nodes in serialization options + * + * @param aOptions Serialization options + */ + void SetCallbackL(TXmlEngSerializationOptions& aOptions); + + /** + * Leaves if a DOM tree contains 'Include' elements from XOP + * namespace 'http://www.w3.org/2004/08/xop/include' + * + * @param aRoot Root node of a DOM tree to be serialized + */ + void LeaveIfXopIncludeL(TXmlEngNode aRoot); + + /** + * Verifies if a DOM tree contains 'Include' elements from XOP + * namespace 'http://www.w3.org/2004/08/xop/include' + * + * @param aRoot Root node of a DOM tree to be serialized + * @return ETrue if a DOM tree contains Include element from XOP namespace, + * EFalse otherwise. + */ + TBool HasXopInclude(TXmlEngNode aRoot); + + /** + * Verifies if container's parent node has xmlmime:contentType + * attribute information item. If found, the function returns ETrue + * and xmlmime:contentType attribute value. Otherwise, function + * returns EFalse and aContentType is undefined. + * + * @param aContainer Data container whose parent node is to be searched + * @return ETrue if xmlmime:contentType attribute is found, + * EFalse otherwise. + */ + TBool GetContentTypeValue(TXmlEngDataContainer aContainer, TPtrC8& aContentType); + + /** + * Decodes input data from base64 to binary octets and creates + * heap buffer with the decoded data. The buffer is pushed on the cleanup stack. + * + * @param aEncodedData Base64 encoded buffer + * @return Buffer with decoded data in binary octets + */ + HBufC8* CreateDecodedBufLC(TPtrC8 aEncodedData); + + /** + * Appends given string to output buffer. If the serializer's + * output type is file, the output buffer is released to the output stream + * after reaching a specified threshold and the output buffer is cleared. + * + * @param aString String to write + * @param aFlush Indicates that buffer is written immediately + */ + void BufferedWriteL(const TDesC8& aString, TBool aFlush = EFalse); + + /** + * Flushes the output buffer and closes the output file. + */ + void CommitWriteL(); + +public: //data + +private: //data + /** array that stores containers to be serialized **/ + RArray iDataContainerArray; + + /** output buffer **/ + HBufC8* iOutputBuffer; + + /** output buffer pointer **/ + TPtr8* iOutputBufferPtr; + + /** size of data written **/ + TInt iDataWritten; + + /** Indicates that MIME headers should be skipped upon serialization **/ + TBool iCleanXOPInfoset; + + /** file server handle **/ + RFs iRFs; + + /** output file handle **/ + RFile iOutputFile; + + /** buffer for storing xop stub that replaces binary data in xop document **/ + HBufC8* iXopStub; + + /** pointer to stub buffer **/ + TPtr8* iXopStubPtr; // pointer to TPtr8 to avoid initialization at construction + + /** pointer to current output stream **/ + MXmlEngSXOPOutputStream* iTmpOutputStream; + }; + + + +#endif /* XMLENGSERIALIZERXOP_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopfileoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopfileoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,61 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + +#include +#include "xmlengxopfileoutputstream.h" + +TXmlEngSXOPFileOutputStream::TXmlEngSXOPFileOutputStream(RFile& aFile,RFs& aRFs) + { + TDriveInfo drInfo; + iError = aFile.Drive(iDrive, drInfo); + iFile = aFile; + iRFs = aRFs; + } + +TInt TXmlEngSXOPFileOutputStream::Write(const TDesC8 &aBuffer) + { + TRAP(iError,WriteL(aBuffer)); + if(iError) + { + return -1; + } + return aBuffer.Size(); + } + +TInt TXmlEngSXOPFileOutputStream::Close() + { + return KErrNone; + } + +TInt TXmlEngSXOPFileOutputStream::CloseAll() + { + iFile.Close(); + return KErrNone; + } + +TInt TXmlEngSXOPFileOutputStream::CheckError() + { + return iError; + } + +void TXmlEngSXOPFileOutputStream::WriteL(const TDesC8 &aBuffer) + { + if(SysUtil::DiskSpaceBelowCriticalLevelL(&iRFs, aBuffer.Size(), iDrive)) + { + User::Leave(KErrDiskFull); + } + User::LeaveIfError(iFile.Write(aBuffer)); + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopfileoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopfileoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,103 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGXOPFILEOUTPUTSTREAM_H +#define XMLENGXOPFILEOUTPUTSTREAM_H + +#include +#include "xmlengxopoutputstream.h" + +/** + * TXmlEngSerializerXOPOS is used by XML Engine Serializer to + * serialize XML data to file. + * + */ +class TXmlEngSXOPFileOutputStream : public MXmlEngSXOPOutputStream + { +public: + /** + * Default constructor + * + * @param aFile Instance of class RFile + * @param aRFs File server handle + */ + TXmlEngSXOPFileOutputStream(RFile& aFile,RFs& aRFs); + + /** + * Callback for writing a buffer with data to output stream + * + * @return number of bytes written or -1 in case of error + */ + TInt Write(const TDesC8 &aBuffer); + + /** + * Callback for closing output stream + * + * @return + * 0 is succeeded, + * -1 in case of error + */ + TInt Close(); + + /** + * Callback for closing file + * + * @return KErrNone or other error code + */ + virtual TInt CloseAll(); + + /** + * Checks error flag + * + * @return error code + */ + virtual TInt CheckError(); + +private: // functions + + /** + * Callback for writing a buffer with data to output stream + */ + void WriteL(const TDesC8 &aBuffer); + +private: // data + /** + *Instance of class RFile + */ + RFile iFile; + + /** + * File server handle + */ + RFs iRFs; + + /** Error flag **/ + TInt iError; + + /** Drive No. **/ + TInt iDrive; +}; + + + +#endif /* XMLENGXOPFILEOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + +#include +#include "xmlengsxopoutputstream.h" + +TInt TXmlEngSXOPOutputStream::Write(const TDesC8 &aBuffer) + { + iStream->Write(aBuffer); + }; + +TInt TXmlEngSXOPOutputStream::Close() + { + return KErrNone; + } + +TInt TXmlEngSXOPOutputStream::CheckError() + { + return iError; + } + +TXmlEngSXOPOutputStream::TXmlEngSXOPOutputStream(MXmlEngOutputStream& aStream) + { + iStream = &aStream; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGXOPOUTPUTSTREAM_H +#define XMLENGXOPOUTPUTSTREAM_H + +#include +#include + +/** + * MXmlEngSXOPOutputStream is used by XML Engine Serializer to + * serialize XML data. + * NOTE: this class should never be exported due to binary compatibility issues + * + */ +class MXmlEngSXOPOutputStream : public MXmlEngOutputStream + { +public: + /** + * Callback for final closing stream + * + * @return Error code + */ + virtual TInt CloseAll() = 0; + + /** + * Checks error flag + * + * @return error code + */ + virtual TInt CheckError() = 0; +}; + + + +#endif /* XMLENGXOPOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopproxyoutputstream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopproxyoutputstream.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + +#include +#include "xmlengxopproxyoutputstream.h" + +TXmlEngSXOPProxyOutputStream::TXmlEngSXOPProxyOutputStream(MXmlEngOutputStream& aStream) + : iError(KErrNone) + { + iStream = &aStream; + } + +TInt TXmlEngSXOPProxyOutputStream::Write(const TDesC8& aBuffer) + { + iError = iStream->Write(aBuffer); + return iError; + } + +TInt TXmlEngSXOPProxyOutputStream::Close() + { + return KErrNone; + } + +TInt TXmlEngSXOPProxyOutputStream::CloseAll() + { + return iStream->Close(); + } + +TInt TXmlEngSXOPProxyOutputStream::CheckError() + { + return iError; + } + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/src/xmlengineserializer/xmlengxopproxyoutputstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/src/xmlengineserializer/xmlengxopproxyoutputstream.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of XOP serializer Output Stream +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGXOPPROXYOUTPUTSTREAM_H +#define XMLENGXOPPROXYOUTPUTSTREAM_H + +#include +#include "xmlengxopoutputstream.h" + +/** + * TXmlEngSXOPOutputStream is used by XML Engine Serializer to + * serialize XML data to client stream. + * + */ +class TXmlEngSXOPProxyOutputStream : public MXmlEngSXOPOutputStream + { +public: + /** + * Default constructor + * + * @param aStream Instance of client stream + */ + TXmlEngSXOPProxyOutputStream(MXmlEngOutputStream& aStream); + + /** + * Callback for writing a buffer with data to output stream + * + * @return number of bytes written or -1 in case of error + */ + TInt Write(const TDesC8& aBuffer); + + /** + * Callback for closing output stream + * + * @return KErrNone or other error code + */ + TInt Close(); + + /** + * Callback for closing client output stream + * + * @return KErrNone or other error code + */ + TInt CloseAll(); + + /** + * Checks error flag + * + * @return error code + */ + TInt CheckError(); + +private: + /** + * Client output stream + */ + MXmlEngOutputStream* iStream; + + /** Error flag **/ + TInt iError; +}; + + + +#endif /* XMLENGXOPPROXYOUTPUTSTREAM_H */ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,51 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +//Added new tef test case +#include "../xmlengdom_tef/group/bld.inf" +#include "../xmlengdomnodeset_tef/group/bld.inf" +#include "../xmlengdomutils_tef/group/bld.inf" +#include "../xmlengxpathutils_tef/group/bld.inf" +PRJ_TESTMMPFILES +//domsmoketestlib.mmp +//domsmoketesttefsuite.mmp +//domserializersmoketestlib.mmp +//domserializersmoketesttefsuite.mmp + + +PRJ_TESTEXPORTS +//../domsmoketest/scripts/domelemsmoketest.script z:/xml/scripts/domelemsmoketest.script +//../domsmoketest/scripts/domelemsmoketest.ini z:/xml/scripts/domelemsmoketest.ini +//../domsmoketest/scripts/domchunkcontsmoketest.script z:/xml/scripts/domchunkcontsmoketest.script +//../domsmoketest/scripts/domchunkcontsmoketest.ini z:/xml/scripts/domchunkcontsmoketest.ini + +//../domserializersmoketest/scripts/domserializersmoketest.script z:/xml/scripts/domserializersmoketest.script +//../domserializersmoketest/scripts/domserializersmoketest.ini z:/xml/scripts/domserializersmoketest.ini + +//../../data/domgeneral/element/input/correct/dom_elem_001.xml z:/xml/data/dom_elem_001.xml +//../../data/domgeneral/element/input/correct/dom_elem_002.xml z:/xml/data/dom_elem_002.xml +//../../data/domgeneral/element/input/correct/dom_elem_004.xml z:/xml/data/dom_elem_004.xml +//../../data/domgeneral/element/input/correct/dom_elem_000_schema.xml z:/xml/data/dom_elem_000_schema.xml +//../../data/domgeneral/element/verification/correct/dom_elem_001.ref z:/xml/data/dom_elem_001.ref +//../../data/domgeneral/element/verification/correct/dom_elem_002.ref z:/xml/data/dom_elem_002.ref +//../../data/domgeneral/element/verification/correct/dom_elem_004.ref z:/xml/data/dom_elem_004.ref + +//../../data/chunk/cont/input/correct/xml_wf_11.xml z:/xml/data/xml_wf_11.xml + +//../../data/serializer/default/verification/correct/serdefault-serializerl.ref //z:/xml/data/serdefault-serializerl.ref + + +//domsmoktesttefsuite.iby /epoc32/rom/include/domsmoktesttefsuite.iby +//domserializersmoktesttefsuite.iby /epoc32/rom/include/domserializersmoktesttefsuite.iby diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/group/te_headerstests.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/group/te_headerstests.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// te_headerstest.mmp +// +// + +TARGET t_xmlheaderstest.exe +TARGETTYPE exe + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/libc +SYSTEMINCLUDE /epoc32/include/bafl +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 +SYSTEMINCLUDE /epoc32/include/xml +SYSTEMINCLUDE /epoc32/include/xml/dom +SYSTEMINCLUDE /epoc32/include/xml/plugins +SYSTEMINCLUDE /epoc32/include/xml/utils +SYSTEMINCLUDE /epoc32/include/test + +USERINCLUDE ../headerstests/src +USERINCLUDE ../../../../../../unref/orphan/comgen/syslibs/s60_header_compat/xmlengine +USERINCLUDE ../../../../../../unref/orphan/comgen/syslibs/s60_header_compat/multipartparser + +SOURCEPATH ..\headerstests\src +SOURCE te_headersteststep.cpp +SOURCE te_headerstestserver.cpp + +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY xmlenginedom.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/headerstests/src/te_headerstestserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/headerstests/src/te_headerstestserver.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,98 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology +*/ + +#include "te_headerstestserver.h" +#include "te_headersteststep.h" + +_LIT(KServerName, "te_XmlDomHeaders"); + +CXmlDomHeadersTestServer* CXmlDomHeadersTestServer::NewL() +/** + * @return - Instance of the test server + * Called inside the MainL() function to create and start the + * CTestServer derived server. + */ + { + CXmlDomHeadersTestServer * server = new (ELeave) CXmlDomHeadersTestServer(); + CleanupStack::PushL(server); + // CServer base class call + server->StartL(KServerName); + CleanupStack::Pop(server); + return server; + } + +LOCAL_C void MainL() +/** + * Much simpler, uses the new Rendezvous() call to sync with the client + */ + { + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().SecureApi(RProcess::ESecureApiOn); + + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CXmlDomHeadersTestServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CXmlDomHeadersTestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + + +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on exit + */ + { + __UHEAP_MARK; + + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()); + delete cleanup; + + __UHEAP_MARKEND; + return err; + } + +CTestStep* CXmlDomHeadersTestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if (aStepName == KCHeadersTest) + { + testStep = new CXmlDomHeadersTestStep(); + } + + return testStep; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/headerstests/src/te_headerstestserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/headerstests/src/te_headerstestserver.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#if (!defined __TE_HEADERSTESTSERVER_H__) +#define __TE_HEADERSTESTSERVER_H__ +#include + +class CXmlDomHeadersTestServer : public CTestServer + { +public: + static CXmlDomHeadersTestServer* NewL(); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + }; +#endif diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/headerstests/src/te_headersteststep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/headerstests/src/te_headersteststep.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,123 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// te_s60HeadersTestStep.cpp +// +// + + +#include +#include "te_headersteststep.h" +#include + + +//test S60_header_files +//dom +#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 +#include +#include +//serializer +#include +#include +#include +#include +#include +#include +//xpath +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xmlengxpathobject.h" // is now xml xmlengxpathutils.h +#include +#include + +//test .inl files +//dom +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//xpath +#include +#include +#include +#include + + +/** + * A compiler test to ensure that our headerfiles will be included as the + * customer(s) expect them to. Since these header files are not used + * by our code, but only by our customer's, this may be the only way + * to verify any changes to them. + * + * SYSLIB-XML-UT-4003, DEF129353 + */ +TVerdict CXmlDomHeadersTestStep::doTestStepL() + { + SetTestStepResult(EPass); + + INFO_PRINTF1(_L("Compiler Test for s60 .h & xml .inl redirection. -- SYSLIB-XML-UT-4003")); + + // make sure the typdef in the S60 header file works. + // will throw a compiler error if it can't find the class. + TBuf8<4> str(_L8("true")); + TBool aBool = TXmlEngXPathObject::ToBoolean(str); + + return TestStepResult(); + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/headerstests/src/te_headersteststep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/headerstests/src/te_headersteststep.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#if (!defined __TE_HEADERSTESTSTEP_H__) +#define __TE_HEADERSTESTSTEP_H__ + +#include +#include + +_LIT(KCHeadersTest, "CXmlDomHeadersTestCase"); +class CXmlDomHeadersTestStep : public CTestStep + { + public: + inline CXmlDomHeadersTestStep(){SetTestStepName(KCHeadersTest);}; + virtual TVerdict doTestStepL(void); + + }; + +#endif diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file bld.inf + @internalTechnology +*/ + +PRJ_TESTMMPFILES +xmlengdom_tef.mmp manual + +PRJ_TESTEXPORTS +../scripts/xmlengdomtefsuite.script z:/xmlengdom_tef/xmlengdomtefsuite.script +xmlengdom_tef.iby /epoc32/rom/include/xmlengdom_tef.iby diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/group/xmlengdom_tef.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/group/xmlengdom_tef.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,28 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdom_tef.iby + @internalTechnology +*/ +#ifndef __XMLENGDOMTEF_IBY__ +#define __XMLENGDOMTEF_IBY__ + +#include +data=ABI_DIR\BUILD_DIR\xmlengdom_tef.exe System\bin\xmlengdom_tef.exe + +data=DATAZ_\xmlengdom_tef\xmlengdomtefsuite.script xmlengdom_tef\xmlengdomtefsuite.script + +#endif \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/group/xmlengdom_tef.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/group/xmlengdom_tef.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdom_tef.mmp + @internalTechnology +*/ + +TARGET xmlengdom_tef.exe +TARGETTYPE exe +UID 0 0xE81EE4AE + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../src + +SOURCEPATH ../src +SOURCE xmlengdom_tef.cpp CXmlEngDomTestServer.cpp +SOURCE CXmlEngDOMStep.cpp + + +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY xmlenginedom.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/CXmlEngDOMStep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/CXmlEngDOMStep.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDOMStep.h + @internalTechnology +*/ + +#ifndef CXMLENGDOMSTEP_H_ +#define CXMLENGDOMSTEP_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngLeaveOOMStep1, "XmlEngLeaveOOMStep1"); + + + +class CXmlEngDOMStep : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngDOMStep(const TDesC& aStepName); + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngLeaveOOMStep1(); +}; + +#endif /*CXMLENGDOMSTEP_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/CXmlEngDomTestServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/CXmlEngDomTestServer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomTestServer.h + @internalTechnology +*/ +#ifndef CXMLENGDOMTESTSERVER_H_ +#define CXMLENGDOMTESTSERVER_H_ + +#include + + +/** Test server to implement the pure virtual CreateTestStep + method. + */ +_LIT(KServerName, "xmlengdom_tef"); + + +class CXmlEngDomTestServer : public CTestServer +{ +public: + static CXmlEngDomTestServer* NewL(); + void ConstructL(const TDesC& aName); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); +}; + +#endif /*CXMLENGDOMTESTSERVER_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/xmlengdom_tef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/inc/xmlengdom_tef.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdom_tef.h + @internalTechnology +*/ +#ifndef __XMLENGDOM_TEF_H__ +#define __XMLENGDOM_TEF_H__ + +// Include Files + +#include + +// Function Prototypes + +GLDEF_C TInt E32Main(); + +#endif // __XMLENGDOM_TEF_H__ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/scripts/xmlengdomtefsuite.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/scripts/xmlengdomtefsuite.script Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Run XML xmlengdom_tef +LOAD_SUITE xmlengdom_tef +DELAY 500 +START_TESTCASE BASESRVCS-XML-CT-4933 +// +//! @SYMTestCaseID BASESRVCS-XML-CT-4933 +//! @SYMTestCaseDesc Tests the APIs to improve the code coverage +//! @SYMPREQ PREQ2051 +//! @SYMTestPriority High +//! @SYMTestActions The following API is tested for code coverage +//! RXmlEngDOMImplementation::Close(TBool) +//! @SYMTestExpectedResults EPass + RUN_TEST_STEP 100 xmlengdom_tef XmlEngLeaveOOMStep1 +END_TESTCASE BASESRVCS-XML-CT-4933 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/src/CXmlEngDOMStep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/src/CXmlEngDOMStep.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,67 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDOMStep.cpp + @internalTechnology +*/ + +#include "CXmlEngDOMStep.h" +#include + + +/** + * Class CXmlEngDOMStep Implementation + */ +CXmlEngDOMStep::CXmlEngDOMStep(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngDOMStep::doTestStepL(void) + { + if (TestStepName() == KXmlEngLeaveOOMStep1) + { + INFO_PRINTF1(KXmlEngLeaveOOMStep1); + SetTestStepResult(TestKXmlEngLeaveOOMStep1()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngDOMStep::TestKXmlEngLeaveOOMStep1() + { + //Open + RHeap* rHeap = NULL; + RXmlEngDOMImplementation rxmlDomObject; + + TInt err = KErrNone; + + TRAP(err, rxmlDomObject.OpenL(rHeap)); + + if (KErrNone != err) + { + return EFail; + } + + //For coverity coverage + //Close + TBool tBool = 1 ; + rxmlDomObject.Close(tBool); + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/src/CXmlEngDomTestServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/src/CXmlEngDomTestServer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomTestServer.cpp + @internalTechnology +*/ + +#include "CXmlEngDomTestServer.h" +#include "CXmlEngDOMStep.h" + + +/** + @return - Instance of the test server + */ +CXmlEngDomTestServer* CXmlEngDomTestServer::NewL() + { + //Create the server object + CXmlEngDomTestServer * server = new (ELeave) CXmlEngDomTestServer(); + + //Push it to cleanup stack + CleanupStack::PushL(server); + + //2nd phase construction + server->ConstructL(KServerName); + + //Now pop the object from the cleanup stack + CleanupStack::Pop(server); + + //Return the server object + return server; + } + + +void CXmlEngDomTestServer::ConstructL(const TDesC& aName) + { + //Call the base class implementation + CTestServer::ConstructL(aName); + } + + + +CTestStep* CXmlEngDomTestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep= NULL; + + //Create the test step object + testStep = new CXmlEngDOMStep(aStepName); + + //Return the test step object to the calling method + return testStep; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdom_tef/src/xmlengdom_tef.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdom_tef/src/xmlengdom_tef.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,69 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Include Files +// +// + +/** + @file xmlengdom_tef.cpp + @internalTechnology +*/ + +#include "xmlengdom_tef.h" +#include "CXmlEngDomTestServer.h" + +#include +#include +#include // Console + + +LOCAL_C void MainL() +{ + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CXmlEngDomTestServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CXmlEngDomTestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; +} + + +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on exit + */ +{ + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()) + ; + delete cleanup; + + __UHEAP_MARKEND; + return err; +} + + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file bld.inf + @internalTechnology +*/ + +PRJ_TESTMMPFILES +xmlengdomnodeset_tef.mmp manual + +PRJ_TESTEXPORTS +../scripts/xmlengdomnodetesttefsuite.script z:/xmlengdom_tef/xmlengdomnodetesttefsuite.script +xmlengdomnodeset_tef.iby /epoc32/rom/include/xmlengdomnodeset_tef.iby diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/xmlengdomnodeset_tef.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/xmlengdomnodeset_tef.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdomnodeset_tef.iby + @internalTechnology +*/ +#ifndef __XMLENGDOMNODESETTEF_IBY__ +#define __XMLENGDOMNODESETTEF_IBY__ + +#include +data=ABI_DIR\BUILD_DIR\xmlengdomnodeset_tef.exe System\bin\xmlengdomnodeset_tef.exe + + +data=DATAZ_\xmlengdom_tef\xmlengdomnodetesttefsuite.script xmlengdom_tef\xmlengdomnodetesttefsuite.script + +#endif \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/xmlengdomnodeset_tef.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/group/xmlengdomnodeset_tef.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdomnodeset_tef.mmp + @internalTechnology +*/ + +TARGET xmlengdomnodeset_tef.exe +TARGETTYPE exe +UID 0 0xE842FDD9 + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_LIBXML2_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE xmlengdomnodeset_tef.cpp +SOURCE CXmlEngDomNodeSetTestServer.cpp +SOURCE CXmlEngNodeSetTestContains.cpp +SOURCE CXmlEngTestFormInstanceMapCreation.cpp +SOURCE CXmlEngXpathCreation.cpp +SOURCE CXmlEngTestLibXMLNodeCleanup.cpp + +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY xmlenginedom.lib + + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngDomNodeSetTestServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngDomNodeSetTestServer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomNodeSetTestServer.h + @internalTechnology +*/ + +#ifndef CXMLENGDOMNODESETTESTSERVER_H_ +#define CXMLENGDOMNODESETTESTSERVER_H_ + +#include + + +_LIT(KServerName, "xmlengdomnodeset_tef"); + + +class CXmlEngDomNodeSetTestServer : public CTestServer +{ +public: + static CXmlEngDomNodeSetTestServer* NewL(); + void ConstructL(const TDesC& aName); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); +}; + +#endif /*CXMLENGDOMNODESETTESTSERVER_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngNodeSetTestContains.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngNodeSetTestContains.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,69 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeSetTestContains.h + @internalTechnology +*/ +#ifndef CXMLENGNODESETTESTCONTAINS_H_ +#define CXMLENGNODESETTESTCONTAINS_H_ + +#include +#include +#include +#include +#include + + +//Names of the sub steps of the test case +_LIT(KXmlEngNodeTestSetContains, "XmlEngNodeTestSetContains"); + + + +class CXmlEngNodeSetTestContains : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngNodeSetTestContains(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngNodeSetContains(); + +private: + // DOM implementation for dom tests + RXmlEngDOMImplementation iDOM_impl; + + // Dom parser + RXmlEngDOMParser iParser; + + + // XML document ( dom tree ) + RXmlEngDocument iDoc; + + // XML node ( dom tree ) + //TXmlEngNode iNode; + + // XML element + //TXmlEngElement iElement; + + // XPath result + RXmlEngXPathResult iResult; + +}; + +#endif /*CXMLENGNODESETTESTCONTAINS_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngTestFormInstanceMapCreation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngTestFormInstanceMapCreation.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngTestFormInstanceMapCreation.h + @internalTechnology +*/ +#ifndef CXMLENGTESTFORMINSTANCEMAPCREATION_H_ +#define CXMLENGTESTFORMINSTANCEMAPCREATION_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngCreateXFormInstanceMap, "XmlEngCreateXFormInstanceMap"); + + +class CXmlEngTestFormInstanceMapCreation : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngTestFormInstanceMapCreation(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngCreateXFormInstanceMap(); +}; + +#endif /*CXMLENGTESTFORMINSTANCEMAPCREATION_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngTestLibXMLNodeCleanup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngTestLibXMLNodeCleanup.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngTestLibXMLNodeCleanup.h + @internalTechnology +*/ +#ifndef CXMLENGTESTLIBXMLNODECLEANUP_H_ +#define CXMLENGTESTLIBXMLNODECLEANUP_H_ + +#include +#include "libxml2_xmlstring.h" + + +//Step name +_LIT(KXmlEngLibXMLNodeCleanup, "XmlEngLibXMLNodeCleanup"); + + +class CXmlEngTestLibXMLNodeCleanup : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngTestLibXMLNodeCleanup(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngLibXMLNodeCleanup(); +}; + +#endif /*CXMLENGTESTLIBXMLNODECLEANUP_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngXpathCreation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/CXmlEngXpathCreation.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngXpathCreation.h + @internalTechnology +*/ + +#ifndef CXMLENGXPATHCREATION_H_ +#define CXMLENGXPATHCREATION_H_ + +#include + + +#include +#include +#include +#include + + + + +//Names of the sub steps of the test case +_LIT(KXmlEngXPathCreation, "XmlEngXPathCreationTest"); + + + +class CXmlEngXpathCreation : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngXpathCreation(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngXPathCreation(); + +private: + // DOM implementation for dom tests + RXmlEngDOMImplementation iDOM_impl; + + // Dom parser + RXmlEngDOMParser iParser; + + // XML document ( dom tree ) + RXmlEngDocument iDoc; +}; + +#endif /*CXMLENGXPATHCREATION_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/xmlengdomnodeset_tef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/inc/xmlengdomnodeset_tef.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdomnodeset_tef.h + @internalTechnology +*/ + +#ifndef __XMLENGDOMNODESET_TEF_H__ +#define __XMLENGDOMNODESET_TEF_H__ + +// Include Files + +#include + +// Function Prototypes + +GLDEF_C TInt E32Main(); + +#endif // __XMLENGDOMNODESET_TEF_H__ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/scripts/xmlengdomnodetesttefsuite.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/scripts/xmlengdomnodetesttefsuite.script Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Run XML xmlengdomnodeset_tef +LOAD_SUITE xmlengdomnodeset_tef +DELAY 500 +START_TESTCASE BASESRVCS-XML-CT-4934 +// +//! @SYMTestCaseID BASESRVCS-XML-CT-4934 +//! @SYMTestCaseDesc Tests the APIs to improve the code coverage +//! @SYMPREQ PREQ2051 +//! @SYMTestPriority High +//! @SYMTestActions TThe following API is tested for code coverage +//! RXmlEngXPathExpression::CreateExpressionL RXmlEngXPathExpression::ExtendedContext +//! RXmlEngXPathExpression::SetExtendedContext RXmlEngNodeSet::Contains +//! CXmlEngXFormsInstanceMap::NewL LibxmlNodeCleanup +//! @SYMTestExpectedResults EPass + RUN_TEST_STEP 100 xmlengdomnodeset_tef XmlEngNodeTestSetContains + RUN_TEST_STEP 100 xmlengdomnodeset_tef XmlEngCreateXFormInstanceMap + RUN_TEST_STEP 100 xmlengdomnodeset_tef XmlEngXPathCreationTest + RUN_TEST_STEP 100 xmlengdomnodeset_tef XmlEngLibXMLNodeCleanup +END_TESTCASE BASESRVCS-XML-CT-4934 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngDomNodeSetTestServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngDomNodeSetTestServer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,95 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomNodeSetTestServer.cpp + @internalTechnology +*/ + +#include "CXmlEngDomNodeSetTestServer.h" + +//Test Steps +#include "CXmlEngNodeSetTestContains.h" +#include "CXmlEngTestFormInstanceMapCreation.h" +#include "CXmlEngXpathCreation.h" +#include "CXmlEngTestLibXMLNodeCleanup.h" + + + + +/** + @return - Instance of the test server + */ +CXmlEngDomNodeSetTestServer* CXmlEngDomNodeSetTestServer::NewL() + { + //Create the server object + CXmlEngDomNodeSetTestServer * server = new (ELeave) CXmlEngDomNodeSetTestServer(); + + //Push it to cleanup stack + CleanupStack::PushL(server); + + //2nd phase construction + server->ConstructL(KServerName); + + //Now pop the object from the cleanup stack + CleanupStack::Pop(server); + + //Return the server object + return server; + } + + +void CXmlEngDomNodeSetTestServer::ConstructL(const TDesC& aName) + { + //Call the base class implementation + CTestServer::ConstructL(aName); + } + + + +CTestStep* CXmlEngDomNodeSetTestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep= NULL; + + if (aStepName == KXmlEngNodeTestSetContains) + { + //Create the test step object + testStep = new CXmlEngNodeSetTestContains(aStepName); + } + else if (aStepName == KXmlEngCreateXFormInstanceMap) + { + //Create the test step object + testStep = new CXmlEngTestFormInstanceMapCreation(aStepName); + } + else if (aStepName == KXmlEngXPathCreation) + { + //Create the test step object + testStep = new CXmlEngXpathCreation(aStepName); + } + + else if (aStepName == KXmlEngLibXMLNodeCleanup) + { + //Create the test step object + testStep = new CXmlEngTestLibXMLNodeCleanup(aStepName); + } + + //Return the test step object to the calling method + return testStep; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngNodeSetTestContains.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngNodeSetTestContains.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,197 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeSetTestContains.cpp + @internalTechnology +*/ +#include "CXmlEngNodeSetTestContains.h" + + +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include + +#include +#include + +//#include +#include +#include +#include + + + +/** + * Class CXmlEngNodeSetTestContains Implementation + */ +CXmlEngNodeSetTestContains::CXmlEngNodeSetTestContains(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngNodeSetTestContains::doTestStepL(void) + { + if (TestStepName() == KXmlEngNodeTestSetContains) + { + INFO_PRINTF1(KXmlEngNodeTestSetContains); + SetTestStepResult(TestKXmlEngNodeSetContains()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngNodeSetTestContains::TestKXmlEngNodeSetContains() + { + + //Name of the XML source file name + //_LIT (KLitXMLSrcFileName, "c:\\testing\\data\\xmleng\\efute\\input\\dom\\xpath_02.xml"); + + //Create the dom utils object + TInt err = KErrNone; + + //Open the DOM implementation + TRAP(err, iDOM_impl.OpenL()); + + if (KErrNone != err) + { + return EFail; + } + + //Open the Dom Parser + iParser.Open(iDOM_impl); + + //Lets parse the XML file, and fill it to the RXMLDocument + //TRAP(err, iDoc = iParser.ParseFileL(KLitXMLSrcFileName)); + + _LIT8(KDataContext, "D10"); + RXmlEngDocument contextDoc; + + TRAP(err, contextDoc = iParser.ParseL(TPtrC8(KDataContext))); + if (KErrNone != err) + { + return EFail; + } + + // register instance doc trees + CXmlEngXFormsInstanceMap* map = CXmlEngXFormsInstanceMap::NewLC(); + + _LIT8(KInstA, "A56"); + _LIT8(KInstB, "BTestText"); + _LIT8(KInstC, "C345"); + + RXmlEngDocument instA; + instA = iParser.ParseL(TPtrC8(KInstA)); + if(KErrNone != err) + { + return EFail; + } + + RXmlEngDocument instB; + instB = iParser.ParseL(TPtrC8(KInstB)); + if(KErrNone != err) + { + return EFail; + } + + + RXmlEngDocument instC; + instC = iParser.ParseL(TPtrC8(KInstC)); + if(KErrNone != err) + { + return EFail; + } + + + TRAP(err, map->AddEntryL(instA, _L8("A"))); + if(KErrNone != err) + { + return EFail; + } + + TRAP(err, map->AddEntryL(instB, _L8("B"))); + if(KErrNone != err) + { + return EFail; + } + + TRAP(err, map->AddEntryL(instC, _L8("C"))); + if(KErrNone != err) + { + return EFail; + } + + // TC1 + TXmlEngXPathEvaluator eval; + eval.SetInstanceMap(map); + + RXmlEngXPathResult result; + TRAP(err, result = eval.EvaluateL(_L8("instance('A')"), contextDoc, NULL)); + if(KErrNone != err) + { + return EFail; + } + + //Get the node set + RXmlEngNodeSet set = result.AsNodeSet(); + + + _LIT8(KLit1, "A"); + _LIT8(KLit2, "B"); + _LIT8(KLit3, "C"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + + TXmlEngElement aElement; + TRAP(err, aElement = contextDoc.CreateElementL(aLocalName, aNamespaceUri, aPrefix)); + if(KErrNone != err) + { + return EFail; + } + + //Actual API call + TBool isContained = set.Contains(aElement); + + contextDoc.Close(); + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + CleanupStack::PopAndDestroy(map); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngTestFormInstanceMapCreation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngTestFormInstanceMapCreation.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,72 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngTestFormInstanceMapCreation.cpp + @internalTechnology +*/ + +#include "CXmlEngTestFormInstanceMapCreation.h" + + +#include +#include +#include +#include +#include + +#include + + +/** + * Class CXmlEngNodeSetTestContains Implementation + */ +CXmlEngTestFormInstanceMapCreation::CXmlEngTestFormInstanceMapCreation(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngTestFormInstanceMapCreation::doTestStepL(void) + { + if (TestStepName() == KXmlEngCreateXFormInstanceMap) + { + INFO_PRINTF1(KXmlEngCreateXFormInstanceMap); + SetTestStepResult(TestKXmlEngCreateXFormInstanceMap()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngTestFormInstanceMapCreation::TestKXmlEngCreateXFormInstanceMap() + { + //Create the dom utils object + TInt err = KErrNone; + + // register instance doc trees + CXmlEngXFormsInstanceMap* map = NULL; + + TRAP(err, map = CXmlEngXFormsInstanceMap::NewL()); + + delete map; + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngTestLibXMLNodeCleanup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngTestLibXMLNodeCleanup.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,87 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngTestLibXMLNodeCleanup.cpp + @internalTechnology +*/ +#include "CXmlEngTestLibXMLNodeCleanup.h" + +#include +#include +#include + + + + +/** + * Class CXmlEngTestLibXMLNodeCleanup Implementation + */ +CXmlEngTestLibXMLNodeCleanup::CXmlEngTestLibXMLNodeCleanup(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngTestLibXMLNodeCleanup::doTestStepL(void) + { + if (TestStepName() == KXmlEngLibXMLNodeCleanup) + { + INFO_PRINTF1(KXmlEngLibXMLNodeCleanup); + SetTestStepResult(TestKXmlEngLibXMLNodeCleanup()); + } + + return TestStepResult(); + } + + + +TVerdict CXmlEngTestLibXMLNodeCleanup::TestKXmlEngLibXMLNodeCleanup() + { +#ifdef _DEBUG + TInt err = KErrNone; + _LIT8(KLit1, "asdfds"); + _LIT8(KLit2, "xzcvcv"); + _LIT8(KLit3, "lklklk"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + doc.CreateDocumentElementL(aLocalName, aNamespaceUri, aPrefix); + + //To invoke the method 'LibxmlNodeCleanup() mrthod of file: XMLEngDomBase' for code coverage + __UHEAP_SETFAIL(RHeap::EDeterministic, 4); + TXmlEngElement aElement; + TRAP(err , aElement = doc.CreateElementL(aLocalName, aNamespaceUri, aPrefix)); + __UHEAP_SETFAIL(RHeap::ENone, 0); + + doc.Close(); + domImpl.Close(); + + if (KErrNoMemory != err) + { + return EFail; + } +#else + INFO_PRINTF1(_L("This test is meant to be run only in DEBUG builds. Returning EPASS")); +#endif + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngXpathCreation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/CXmlEngXpathCreation.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,177 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @fileCXmlEngXpathCreation.cpp + @internalTechnology +*/ + +#include "CXmlEngXpathCreation.h" +#include +#include "libxml2_tree.h" + + + +/** + * Class CXmlEngNodeSetTestContains Implementation + */ +CXmlEngXpathCreation::CXmlEngXpathCreation(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngXpathCreation::doTestStepL(void) + { + if (TestStepName() == KXmlEngXPathCreation) + { + INFO_PRINTF1(KXmlEngXPathCreation); + SetTestStepResult(TestKXmlEngXPathCreation()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngXpathCreation::TestKXmlEngXPathCreation() + { + //Create the dom utils object + TInt err = KErrNone; + + //Open the DOM implementation + TRAP(err, iDOM_impl.OpenL()); + + if (KErrNone != err) + { + return EFail; + } + + //Open the Dom Parser + iParser.Open(iDOM_impl); + + _LIT8(KInstA, "A56"); + _LIT8(KInstB, "BTestText"); + _LIT8(KInstC, "C345"); + + RXmlEngDocument instA; + TRAP(err, instA = iParser.ParseL(TPtrC8(KInstA))); + if (KErrNone != err) + { + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + + RXmlEngDocument instB; + TRAP(err, instB = iParser.ParseL(TPtrC8(KInstB))); + if (KErrNone != err) + { + instA.Close(); + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + RXmlEngDocument instC; + TRAP(err, instC = iParser.ParseL(TPtrC8(KInstC))); + + if (KErrNone != err) + { + instA.Close(); + instB.Close(); + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + CXmlEngXFormsInstanceMap* map = CXmlEngXFormsInstanceMap::NewLC(); + + TRAP(err, map->AddEntryL(instA, _L8("A"))); + if (KErrNone != err) + { + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + TRAP(err, map->AddEntryL(instB, _L8("B"))); + if (KErrNone != err) + { + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + TRAP(err, map->AddEntryL(instC, _L8("C"))); + if (KErrNone != err) + { + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + TXmlEngXPathEvaluator eval; + eval.SetInstanceMap(map); + + //Actual API to cover + RXmlEngXPathExpression expr; + TRAP(err, expr = eval.CreateExpressionL( _L8("/doc/test + instance('A')/test[position()=2]/@att + instance('C')/test3"), NULL)); + if (KErrNone != err) + { + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + return EFail; + } + + //2nd Actual API to cover + void *context = expr.ExtendedContext(); + + //3rd Actual API to cover + expr.SetExtendedContext(context); + + instA.Close(); + instB.Close(); + instC.Close(); + + iParser.Close(); + iDOM_impl.Close(); + + CleanupStack::PopAndDestroy(map); + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/xmlengdomnodeset_tef.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomnodeset_tef/src/xmlengdomnodeset_tef.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Include Files +// +// + +/** + @file xmlengdomnodeset_tef.cpp + @internalTechnology +*/ + +#include "xmlengdomnodeset_tef.h" +#include +#include +#include // Console + + +#include "CXmlEngDomNodeSetTestServer.h" + + +// Local Functions + +LOCAL_C void MainL() +{ + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + + + CXmlEngDomNodeSetTestServer* server = NULL; + + // Create the CTestServer derived server + TRAPD(err,server = CXmlEngDomNodeSetTestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; +} + + + +// Global Functions + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()) + ; + delete cleanup; + + __UHEAP_MARKEND; + return err; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,24 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_TESTMMPFILES +xmlengdomutils_tef.mmp manual + + + +PRJ_TESTEXPORTS +../scripts/xmlengdomutiltefsuite.script z:/xmlengdom_tef/xmlengdomutiltefsuite.script +xmlengdomutils_tef.iby /epoc32/rom/include/xmlengdomutils_tef.iby + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/xmlengdomutils_tef.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/xmlengdomutils_tef.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __XMLENGDOMUTILSTEF_IBY__ +#define __XMLENGDOMUTILSTEF_IBY__ + +#include +data=ABI_DIR\BUILD_DIR\xmlengdomutils_tef.exe System\bin\xmlengdomutils_tef.exe + +data=DATAZ_\xmlengdom_tef\xmlengdomutiltefsuite.script xmlengdom_tef\xmlengdomutiltefsuite.script + +#endif \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/xmlengdomutils_tef.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/group/xmlengdomutils_tef.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET xmlengdomutils_tef.exe +TARGETTYPE exe +UID 0 0xEC512F36 + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src +SOURCE xmlengdomutils_tef.cpp +SOURCE CXmlEngDomUtilTestServer.cpp +SOURCE CXmlEngDOMUtilStep1.cpp +SOURCE CXmlEngNodeTestSetValue.cpp +SOURCE CXmlEngNodeTestReplaceWith.cpp +SOURCE CXmlEngDocumentTestCreateDocumentFragment.cpp + +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY xmlenginedom.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDOMUtilStep1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDOMUtilStep1.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDOMUtilStep1.h + @internalTechnology +*/ +#ifndef CXMLENGDOMUTILSTEP1_H_ +#define CXMLENGDOMUTILSTEP1_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngDomUtilStep1, "XmlEngDomUtilStep1"); + + +class CXmlEngDOMUtilStep1 : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngDOMUtilStep1(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngDomUtilStep1(); +}; + +#endif /*CXMLENGDOMUTILSTEP1_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDocumentTestCreateDocumentFragment.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDocumentTestCreateDocumentFragment.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDocumentTestCreateDocumentFragment.h + @internalTechnology +*/ + +#ifndef CXMLENGDOCUMENTTESTCREATEDOCUMENTFRAGMENT_H_ +#define CXMLENGDOCUMENTTESTCREATEDOCUMENTFRAGMENT_H_ + +#include + + +_LIT(KXmlEngDocumentCreateDocumentFragment, "XmlEngDocumentCreateDocumentFragment"); + + + +class CXmlEngDocumentTestCreateDocumentFragment : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngDocumentTestCreateDocumentFragment(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngDocumentCreateDocumentFragment(); +}; + +#endif /*CXMLENGDOCUMENTTESTCREATEDOCUMENTFRAGMENT_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDomUtilTestServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngDomUtilTestServer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomUtilTestServer.h + @internalTechnology +*/ +#ifndef CXMLENGDOMUTILTESTSERVER_H_ +#define CXMLENGDOMUTILTESTSERVER_H_ + +#include + + +_LIT(KServerName, "xmlengdomutils_tef"); + + +class CXmlEngDomUtilTestServer : public CTestServer +{ +public: + static CXmlEngDomUtilTestServer* NewL(); + void ConstructL(const TDesC& aName); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); +}; + +#endif /*CXMLENGDOMUTILTESTSERVER_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngNodeTestReplaceWith.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngNodeTestReplaceWith.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeTestReplaceWith.h + @internalTechnology +*/ +#ifndef CXMLENGNODETESTREPLACEWITH_H_ +#define CXMLENGNODETESTREPLACEWITH_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngNodeTestReplaceWithStep, "XmlEngNodeTestReplaceWith"); + +class CXmlEngNodeTestReplaceWith : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngNodeTestReplaceWith(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngTestReplace(); +}; + +#endif /*CXMLENGNODETESTREPLACEWITH_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngNodeTestSetValue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/CXmlEngNodeTestSetValue.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeTestSetValue.h + @internalTechnology +*/ +#ifndef CXMLENGNODETESTSETVALUE_H_ +#define CXMLENGNODETESTSETVALUE_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngNodeTestSetValueStep, "XmlEngNodeTestSetValue"); + + +class CXmlEngNodeTestSetValue : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngNodeTestSetValue(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngTestSetValue(); +}; + +#endif /*CXMLENGNODETESTSETVALUE_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/xmlengdomutils_tef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/inc/xmlengdomutils_tef.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengdomutils_tef.h + @internalTechnology +*/ + +#ifndef __XMLENGDOMUTILS_TEF_H__ +#define __XMLENGDOMUTILS_TEF_H__ + +// Include Files + +#include + +// Function Prototypes + +GLDEF_C TInt E32Main(); + +#endif // __XMLENGDOMUTILS_TEF_H__ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/scripts/xmlengdomutiltefsuite.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/scripts/xmlengdomutiltefsuite.script Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Run XML xmlengdomutils_tef +LOAD_SUITE xmlengdomutils_tef +DELAY 500 +START_TESTCASE BASESRVCS-XML-CT-4935 +// +//! @SYMTestCaseID BASESRVCS-XML-CT-4935 +//! @SYMTestCaseDesc Tests the APIs to improve the code coverage +//! @SYMPREQ PREQ2051 +//! @SYMTestPriority High +//! @SYMTestActions The following API is tested for code coverage +//! TXmlEngElement::CreateElementL TXmlEngDocumentFragment::CreateDocumentFragmentL +//! TDomUtils::XmlEngRenameElementL TXmlEngElement::ReplaceWithL +//! @SYMTestExpectedResults EPass + RUN_TEST_STEP 100 xmlengdomutils_tef XmlEngDomUtilStep1 + RUN_TEST_STEP 100 xmlengdomutils_tef XmlEngNodeTestSetValue + RUN_TEST_STEP 100 xmlengdomutils_tef XmlEngNodeTestReplaceWith + RUN_TEST_STEP 100 xmlengdomutils_tef XmlEngDocumentCreateDocumentFragment +END_TESTCASE BASESRVCS-XML-CT-4935 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDOMUtilStep1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDOMUtilStep1.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDOMUtilStep1.cpp + @internalTechnology +*/ + +#include "CXmlEngDOMUtilStep1.h" + +#include +#include +#include + + + +/** + * Class CXmlEngDOMUtilStep1 Implementation + */ +CXmlEngDOMUtilStep1::CXmlEngDOMUtilStep1(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngDOMUtilStep1::doTestStepL(void) + { + if (TestStepName() == KXmlEngDomUtilStep1) + { + INFO_PRINTF1(KXmlEngDomUtilStep1); + SetTestStepResult(TestKXmlEngDomUtilStep1()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngDOMUtilStep1::TestKXmlEngDomUtilStep1() + { + //Create the dom utils object + TDomUtils domutilsObj; + TInt err = KErrNone; + _LIT8(KLit1, "asdfds"); + _LIT8(KLit2, "xzcvcv"); + _LIT8(KLit3, "lklklk"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + doc.CreateDocumentElementL(aLocalName, aNamespaceUri, aPrefix); + + TXmlEngElement aElement = doc.CreateElementL(aLocalName, aNamespaceUri, aPrefix); + + //For code coverage + TRAP(err, + domutilsObj.XmlEngRenameElementL(aElement,aLocalName, + aNamespaceUri,aPrefix)); + + doc.Close(); + domImpl.Close(); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDocumentTestCreateDocumentFragment.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDocumentTestCreateDocumentFragment.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,74 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDocumentTestCreateDocumentFragment.cpp + @internalTechnology +*/ +#include "CXmlEngDocumentTestCreateDocumentFragment.h" + +#include +#include +#include +#include + + +/** + * Class CXmlEngDOMUtilStep1 Implementation + */ +CXmlEngDocumentTestCreateDocumentFragment::CXmlEngDocumentTestCreateDocumentFragment(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngDocumentTestCreateDocumentFragment::doTestStepL(void) + { + if (TestStepName() == KXmlEngDocumentCreateDocumentFragment) + { + INFO_PRINTF1(KXmlEngDocumentCreateDocumentFragment); + SetTestStepResult(TestKXmlEngDocumentCreateDocumentFragment()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngDocumentTestCreateDocumentFragment::TestKXmlEngDocumentCreateDocumentFragment() + { + //Create the dom utils object + TInt err = KErrNone; + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + TXmlEngDocumentFragment xmlengDocFragment; + + //For code coverage + TRAP(err, xmlengDocFragment = doc.CreateDocumentFragmentL()); + + doc.Close(); + domImpl.Close(); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDomUtilTestServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngDomUtilTestServer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,93 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngDomUtilTestServer.cpp + @internalTechnology +*/ + +#include "CXmlEngDomUtilTestServer.h" + +//Different step objects +#include "CXmlEngDOMUtilStep1.h" +#include "CXmlEngNodeTestSetValue.h" +#include "CXmlEngNodeTestReplaceWith.h" +#include "CXmlEngDocumentTestCreateDocumentFragment.h" + +/** + @return - Instance of the test server + */ +CXmlEngDomUtilTestServer* CXmlEngDomUtilTestServer::NewL() + { + //Create the server object + CXmlEngDomUtilTestServer * server = new (ELeave) CXmlEngDomUtilTestServer(); + + //Push it to cleanup stack + CleanupStack::PushL(server); + + //2nd phase construction + server->ConstructL(KServerName); + + //Now pop the object from the cleanup stack + CleanupStack::Pop(server); + + //Return the server object + return server; + } + + +void CXmlEngDomUtilTestServer::ConstructL(const TDesC& aName) + { + //Call the base class implementation + CTestServer::ConstructL(aName); + } + + + +CTestStep* CXmlEngDomUtilTestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep= NULL; + + if (aStepName == KXmlEngDomUtilStep1) + { + //Create the test step object + testStep = new CXmlEngDOMUtilStep1(aStepName); + } + else if(aStepName == KXmlEngNodeTestSetValueStep) + { + //Create the test step object + testStep = new CXmlEngNodeTestSetValue(aStepName); + } + + else if(aStepName == KXmlEngNodeTestReplaceWithStep) + { + //Create the test step object + testStep = new CXmlEngNodeTestReplaceWith(aStepName); + } + + else if(aStepName == KXmlEngDocumentCreateDocumentFragment) + { + //Create the test step object + testStep = new CXmlEngDocumentTestCreateDocumentFragment(aStepName); + } + + //Return the test step object to the calling method + return testStep; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngNodeTestReplaceWith.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngNodeTestReplaceWith.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,80 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeTestReplaceWith.cpp + @internalTechnology +*/ + +#include "CXmlEngNodeTestReplaceWith.h" + +#include +#include +#include + +/** + * Class CXmlEngDOMUtilStep1 Implementation + */ +CXmlEngNodeTestReplaceWith::CXmlEngNodeTestReplaceWith(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngNodeTestReplaceWith::doTestStepL(void) + { + if (TestStepName() == KXmlEngNodeTestReplaceWithStep) + { + INFO_PRINTF1(KXmlEngNodeTestReplaceWithStep); + SetTestStepResult(TestKXmlEngTestReplace()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngNodeTestReplaceWith::TestKXmlEngTestReplace() + { + TInt err = KErrNone; + _LIT8(KLit1, "asdfds"); + _LIT8(KLit2, "xzcvcv"); + _LIT8(KLit3, "lklklk"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + TXmlEngElement aElement = doc.CreateElementL(aLocalName, aNamespaceUri, aPrefix); + TXmlEngElement bElement = doc.CreateElementL(aNamespaceUri, aLocalName, aPrefix); + + //For code coverage + TRAP(err, aElement.ReplaceWithL(bElement)); + + doc.Close(); + domImpl.Close(); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngNodeTestSetValue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/CXmlEngNodeTestSetValue.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngNodeTestSetValue.cpp + @internalTechnology +*/ + +#include "CXmlEngNodeTestSetValue.h" + +#include +#include +#include + +/** + * Class CXmlEngDOMUtilStep1 Implementation + */ +CXmlEngNodeTestSetValue::CXmlEngNodeTestSetValue(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + +TVerdict CXmlEngNodeTestSetValue::doTestStepL(void) + { + if (TestStepName() == KXmlEngNodeTestSetValueStep) + { + INFO_PRINTF1(KXmlEngNodeTestSetValueStep); + SetTestStepResult(TestKXmlEngTestSetValue()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngNodeTestSetValue::TestKXmlEngTestSetValue() + { + TInt err = KErrNone; + _LIT8(KLit1, "asdfds"); + _LIT8(KLit2, "xzcvcv"); + _LIT8(KLit3, "lklklk"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + TXmlEngElement aElement = doc.CreateElementL(aLocalName, aNamespaceUri, aPrefix); + + //For code coverage + TRAP(err, aElement.SetValueL(aPrefix)); + + + doc.Close(); + domImpl.Close(); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/xmlengdomutils_tef.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengdomutils_tef/src/xmlengdomutils_tef.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,71 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Include Files +// +// + +/** + @file xmlengdomutils_tef.cpp + @internalTechnology +*/ + +#include "xmlengdomutils_tef.h" +#include +#include +#include // Console +#include "CXmlEngDomUtilTestServer.h" + +// Local Functions + + +LOCAL_C void MainL() +{ + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + + + CXmlEngDomUtilTestServer* server = NULL; + + // Create the CTestServer derived server + TRAPD(err,server = CXmlEngDomUtilTestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; +} + + + +// Global Functions + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()) + ; + delete cleanup; + + __UHEAP_MARKEND; + return err; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_TESTMMPFILES +xmlengxpathutils_tef.mmp manual + + + +PRJ_TESTEXPORTS +../scripts/xmlengxpathutilstestsuite.script z:/xmlengdom_tef/xmlengxpathutilstestsuite.script +xmlengxpathutils_tef.iby /epoc32/rom/include/xmlengxpathutils_tef.iby + + + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/xmlengxpathutils_tef.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/xmlengxpathutils_tef.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __XMLENGXPATHUTILSTEF_IBY__ +#define __XMLENGXPATHUTILSTEF_IBY__ + +#include +data=ABI_DIR\BUILD_DIR\xmlengxpathutils_tef.exe System\bin\xmlengxpathutils_tef.exe + +data=DATAZ_\xmlengdom_tef\xmlengxpathutilstestsuite.script xmlengdom_tef\xmlengxpathutilstestsuite.script + +#endif \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/xmlengxpathutils_tef.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/group/xmlengxpathutils_tef.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,34 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET xmlengxpathutils_tef.exe +TARGETTYPE exe +UID 0 0xE83767FD + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src +SOURCE xmlengxpathutils_tef.cpp +SOURCE CXmlEngXPathUtilsTestServer.cpp +SOURCE CXmlEngXPathUtilsToBooleanTest.cpp + +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY xmlenginedom.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/CXmlEngXPathUtilsTestServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/CXmlEngXPathUtilsTestServer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngXPathUtilsTestServer.h + @internalTechnology +*/ + +#ifndef CXMLENGXPATHUTILSTESTSERVER_H_ +#define CXMLENGXPATHUTILSTESTSERVER_H_ + +#include + + +_LIT(KServerName, "xmlengxpathutils_tef"); + + +class CXmlEngXPathUtilsTestServer : public CTestServer +{ +public: + static CXmlEngXPathUtilsTestServer* NewL(); + void ConstructL(const TDesC& aName); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); +}; + +#endif /*CXMLENGXPATHUTILSTESTSERVER_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/CXmlEngXPathUtilsToBooleanTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/CXmlEngXPathUtilsToBooleanTest.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngXPathUtilsToBooleanTest.h + @internalTechnology +*/ +#ifndef CXMLENGXPATHUTILSTOBOOLEANTEST_H_ +#define CXMLENGXPATHUTILSTOBOOLEANTEST_H_ + +#include + +//Names of the sub steps of the test case +_LIT(KXmlEngXPathUtilsToBooleanTest, "XmlEngXPathUtilsToBoolean"); + + +class CXmlEngXPathUtilsToBooleanTest : public CTestStep +{ +public: + //The constructor is passed the step name + CXmlEngXPathUtilsToBooleanTest(const TDesC& aStepName); + + //This method is impelemented and from here various sub steps of the tests are invoked + virtual TVerdict doTestStepL(void); + + //These are the methods that are the sub steps for the testing + TVerdict TestKXmlEngXPathUtilsToBoolean(); +}; + +#endif /*CXMLENGXPATHUTILSTOBOOLEANTEST_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/xmlengxpathutils_tef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/inc/xmlengxpathutils_tef.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlengxpathutils_tef.h + @internalTechnology +*/ + +#ifndef __XMLENGXPATHUTILS_TEF_H__ +#define __XMLENGXPATHUTILS_TEF_H__ + +// Include Files + +#include + +// Function Prototypes + +GLDEF_C TInt E32Main(); + +#endif // __XMLENGXPATHUTILS_TEF_H__ + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/scripts/xmlengxpathutilstestsuite.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/scripts/xmlengxpathutilstestsuite.script Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Run XML xmlengxpathutils_tef +LOAD_SUITE xmlengxpathutils_tef +DELAY 500 +START_TESTCASE BASESRVCS-XML-CT-4936 +// +//! @SYMTestCaseID BASESRVCS-XML-CT-4936 +//! @SYMTestCaseDesc Tests the APIs to improve the code coverage +//! @SYMPREQ PREQ2051 +//! @SYMTestPriority High +//! @SYMTestActions The following API is tested for code coverage +//! XmlEngXPathUtils::ToBoolean +//! @SYMTestExpectedResults EPass + RUN_TEST_STEP 100 xmlengxpathutils_tef XmlEngXPathUtilsToBoolean +END_TESTCASE BASESRVCS-XML-CT-4936 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/CXmlEngXPathUtilsTestServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/CXmlEngXPathUtilsTestServer.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,74 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngXPathUtilsTestServer.cpp + @internalTechnology +*/ +#include "CXmlEngXPathUtilsTestServer.h" + +//Test step objects +#include "CXmlEngXPathUtilsToBooleanTest.h" + + + + +/** + @return - Instance of the test server + */ +CXmlEngXPathUtilsTestServer* CXmlEngXPathUtilsTestServer::NewL() + { + //Create the server object + CXmlEngXPathUtilsTestServer * server = new (ELeave) CXmlEngXPathUtilsTestServer(); + + //Push it to cleanup stack + CleanupStack::PushL(server); + + //2nd phase construction + server->ConstructL(KServerName); + + //Now pop the object from the cleanup stack + CleanupStack::Pop(server); + + //Return the server object + return server; + } + + +void CXmlEngXPathUtilsTestServer::ConstructL(const TDesC& aName) + { + //Call the base class implementation + CTestServer::ConstructL(aName); + } + + + +CTestStep* CXmlEngXPathUtilsTestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep= NULL; + + if (aStepName == KXmlEngXPathUtilsToBooleanTest) + { + //Create the test step object + testStep = new CXmlEngXPathUtilsToBooleanTest(aStepName); + } + + //Return the test step object to the calling method + return testStep; + } diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/CXmlEngXPathUtilsToBooleanTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/CXmlEngXPathUtilsToBooleanTest.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,89 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file CXmlEngXPathUtilsToBooleanTest.cpp + @internalTechnology +*/ +#include "CXmlEngXPathUtilsToBooleanTest.h" + + +#include +#include +#include + + +#include + + + + +/** + * Class CXmlEngXPathUtilsToBooleanTest Implementation + */ +CXmlEngXPathUtilsToBooleanTest::CXmlEngXPathUtilsToBooleanTest(const TDesC& aStepName) + { + //Set the test step name in the base class + SetTestStepName(aStepName); + } + + +TVerdict CXmlEngXPathUtilsToBooleanTest::doTestStepL(void) + { + if (TestStepName() == KXmlEngXPathUtilsToBooleanTest) + { + INFO_PRINTF1(KXmlEngXPathUtilsToBooleanTest); + SetTestStepResult(TestKXmlEngXPathUtilsToBoolean()); + } + + return TestStepResult(); + } + + +TVerdict CXmlEngXPathUtilsToBooleanTest::TestKXmlEngXPathUtilsToBoolean() + { + //Create the dom utils object + TInt err = KErrNone; + _LIT8(KLit1, "asdfds"); + _LIT8(KLit2, "xzcvcv"); + _LIT8(KLit3, "lklklk"); + TBufC8<30> aLocalName(KLit1); + TBufC8<30> aNamespaceUri(KLit2); + TBufC8<30> aPrefix(KLit3); + + RXmlEngDOMImplementation domImpl; + domImpl.OpenL(); + + RXmlEngDocument doc; + doc.OpenL(domImpl); + + doc.CreateDocumentElementL(aLocalName, aNamespaceUri, aPrefix); + + TXmlEngElement aElement; + + //For code coverage + TBool isEmpty = XmlEngXPathUtils::ToBoolean(aElement); + + doc.Close(); + domImpl.Close(); + + if (KErrNone != err) + { + return EFail; + } + + return EPass; + } + diff -r 000000000000 -r e35f40988205 xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/xmlengxpathutils_tef.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmldomandxpath/test/tef/xmlengxpathutils_tef/src/xmlengxpathutils_tef.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Include Files +// +// + +/** + @file xmlengxpathutils_tef.cpp + @internalTechnology +*/ + +#include "xmlengxpathutils_tef.h" +#include +#include +#include // Console + + +#include "CXmlEngXPathUtilsTestServer.h" + +// Local Functions + +LOCAL_C void MainL() +{ + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + + CXmlEngXPathUtilsTestServer* server = NULL; + + // Create the CTestServer derived server + + TRAPD(err,server = CXmlEngXPathUtilsTestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; +} + + + +// Global Functions + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()) + ; + delete cleanup; + + __UHEAP_MARKEND; + return err; + } + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains build information for the XML parser +// +// + +PRJ_EXPORTS +../inc/xmlparsererrors.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/xmlparsererrors.h) + +xmlparserplugin.iby /epoc32/rom/include/xmlparserplugin.iby + +../src/expatcopyright.txt z:/resource/xml/expatcopyright.txt + +PRJ_MMPFILES +xmlparserplugin.mmp + +PRJ_TESTEXPORTS +../test/rtest/group/xmlparsertests.iby /epoc32/rom/include/xmlparsertests.iby +../test/rtest/group/xmlparsertests.bat /epoc32/data/z/system/test/xmlparsertests.bat + +//xml zip test data +../test/rtest/data/xml.zip z:/system/data/xml/xml.zip +../test/rtest/data/xmldefect.zip z:/system/data/xml/xmldefect.zip + +PRJ_TESTMMPFILES +../test/rtest/group/t_xmlparser.mmp +../test/rtest/group/t_xmlparserheap.mmp +../test/rtest/group/t_xmldefect.mmp diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/group/syslibs_xmlparser.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/group/syslibs_xmlparser.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,38 @@ + + + + XML parser, implemented as Ecom plugin into the framework. + + + + Updated XML_GetBuffer in xmlparse.c,Added Test case in t_xmldefect.cpp. + + + + Changed Open Source code so that null pointers are checked before they are accidentally dereferenced + + + + Changed Open Source code so that null pointers are checked before they are dereferenced + + + + + Splitting the XML syslibs_xml CBR package into 3 CBR packages (syslibs_xml, syslibs_wbxmlparser, syslibs_xmlparser). + + + + + + + Splitting Mixed Header files for Base Services API + + + + + + + Relocating Header files for XML API + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/group/syslibs_xmlparser.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/group/syslibs_xmlparser.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,13 @@ +component syslibs_xmlparser + +source \sf\os\xmlsrv\xml\xmlexpatparser + +exports \sf\os\xmlsrv\xml\xmlexpatparser\group +binary \sf\os\xmlsrv\xml\xmlexpatparser\group all + +notes_source \component_defs\release.src + +ipr E +ipr T \sf\os\xmlsrv\xml\xmlexpatparser\test +ipr T \sf\os\xmlsrv\xml\xmlexpatparser\src\expat-1.95.5\tests + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/group/xmlparserplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/group/xmlparserplugin.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLPARSERPLUGIN_IBY__ +#define __XMLPARSERPLUGIN_IBY__ + +REM XML Parser + +ECOM_PLUGIN(xmlparserplugin.dll,101faa0a.rsc) + +data=ZRESOURCE\xml\expatcopyright.txt Resource\xml\expatcopyright.txt + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/group/xmlparserplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/group/xmlparserplugin.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// xmlparserplugin.dll xml parser plugin +// +// + +/** + @file +*/ + +TARGET xmlparserplugin.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x101FAA0A +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../src +USERINCLUDE ../src/expat-1.95.5/lib + +SOURCEPATH ../src +SOURCE xmlparserplugin.cpp +SOURCE cexpat.cpp + +START RESOURCE 101FAA0A.rss +TARGET xmlparserplugin.rsc +END + +SOURCEPATH ../src/expat-1.95.5/lib +SOURCE xmlparse.c +SOURCE xmlrole.c +SOURCE xmltok.c + +LIBRARY bafl.lib +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/inc/xmlparsererrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/inc/xmlparsererrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef XMLPARSERERRORS_H +#define XMLPARSERERRORS_H + +/** +@file + +This file contains XML specific errors returned by the XML Parser. + +@internalTechnology +*/ + +enum TXmlParserError { + EXmlParserError = -1000, + EXmlSyntax = 2+EXmlParserError, // -998 + EXmlNoElements, // -997 + EXmlInvalidToken, // -996 + EXmlUnclosedToken, // -995 + EXmlPartialChar, // -994 + EXmlTagMismatch, // -993 + EXmlDuplicateAttribute, // -992 + EXmlJunkAfterDocElement, // -991 + EXmlPeRef, // -990 + EXmlUndefinedEntity, // -989 + EXmlRecursiveEntity, // -988 + EXmlAsyncEntity, // -987 + EXmlBadCharRef, // -986 + EXmlBinaryEntityRef, // -985 + EXmlAttributeExternalEntityRef, // -984 + EXmlMisplacedPi, // -983 + EXmlUnknownEncoding, // -982 + EXmlIncorrectEncoding, // -981 + EXmlUnclosedCdata, // -980 + EXmlExternalEntityHandling, // -979 + EXmlNotStandalone, // -978 + EXmlUnexpectedState, // -977 + EXmlEntityDeclInPe, // -976 + EXmlDtdRequired, // -975 + EXmlFeatureLockedWhileParsing // -974 +}; + +#endif // XMLERRORS_H diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/101FAA0A.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/101FAA0A.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the Xml Framework Xml Parser +// pairs to xmlparserplugin.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO parserInfo + { + dll_uid = 0x101FAA0A; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FAA0C; + version_no = 1; + display_name = "Expat Xml Parser v1.95.5."; + default_data = "text/xml"; + opaque_data = "Symbian"; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/cexpat.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/cexpat.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,653 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include +#include +#include +#include +#include + +#include "cexpat.h" + +using namespace Xml; + +const XML_Char KNamespaceSeparator = '!'; +const TInt KExpatHeapSize = 64*1024-256; + +LOCAL_C void AttributeArrayDelete(TAny *aPtr); + +/* +aDebugFailCount is for testing only, to configure the parser heap to fail during CExpat construction. + +After construction CExpat::GetInternalHeap() can be used in conjunction with __RHEAP_FAILNEXT +for out-of-memory testing. +*/ +CExpat* CExpat::NewL(MContentHandler& aContentHandler, RStringPool& aStringPool, CCharSetConverter& aCharSetConverter, + RElementStack& aElementStack, TInt aDebugFailCount) + { + CExpat* self = new(ELeave) CExpat(aContentHandler, aStringPool, aCharSetConverter, aElementStack); + + CleanupStack::PushL(self); + self->ConstructL(aDebugFailCount); + CleanupStack::Pop(self); + + return self; + } + +CExpat::CExpat(MContentHandler& aContentHandler, RStringPool& aStringPool, CCharSetConverter& aCharSetConverter, + RElementStack& aElementStack) : + iContentHandler(&aContentHandler), iStringPool(aStringPool), iCharSetConverter(aCharSetConverter), + iElementStack(aElementStack), iInputBuffer(0,0,0), + iPrevStatus(XML_STATUS_OK), + iPrevError(KErrNone) + { + } + +void CExpat::ConstructL(TInt aDebugFailCount) + { + iAllocator.ConstructL(KExpatHeapSize, aDebugFailCount); + ResetL(); + } + +CExpat::~CExpat() + { + // iParser must be freed here. The destructor of iAllocator (~TExpat) is called automatically + // when CExpat is destructed, as it is a member variable of CExpat. *But* ~TExpat() will only close its heap + // which does not free any memory allocated on it. So - we have to free the memory here, before + // deleting the allocator. This memory is guaranteed to be freed here, before the heap is closed + // as the body of the destructor completes before the member destructors (~TExpat) are called. + if ( iParser ) + { + XML_ParserFree( iParser ); + } + } + +/* +ResetL resets an the parser or allocates one if none exists. This could be the case for one of two reasons: + + 1. This is called as part of the construction of CExpat + 2. A MContentHandler function left. In this case the parser and all its memory will have been deleted. + +*/ +void CExpat::ResetL() + { + iParseMode = EReportNamespaces | EReportNamespacePrefixes; + iBufferReady = EFalse; + + iPrevStatus = XML_STATUS_OK; + iPrevError = KErrNone; + + if(iParser) + XML_ParserReset(iParser, NULL); + else + { + XML_Memory_Handling_Suite m; + iAllocator.FillAllocStruct(m); + + // Expat element/attribute names are passed as a single string containing the prefix, uri and local part. + // This character is used to separate those three parts. + XML_Char sep[] = { KNamespaceSeparator, 0 }; + + iParser = XML_ParserCreate_MM(0, &m, sep); + User::LeaveIfNull(iParser); + } + + // UserData is the first argument passed to us by all Expat callbacks + XML_SetUserData(iParser, this); + + XML_SetElementHandler(iParser, StartElementHandlerL, EndElementHandlerL); + XML_SetCharacterDataHandler(iParser, CharacterDataHandlerL); + XML_SetProcessingInstructionHandler(iParser, ProcessingInstructionHandlerL); + XML_SetXmlDeclHandler(iParser, XmlDeclHandlerL); + + XML_SetNamespaceDeclHandler(iParser, StartNamespaceDeclHandlerL, EndNamespaceDeclHandlerL); + + // This tells Expat to pass all three parts of element/attribute names to us: prefix, uri and local part + XML_SetReturnNSTriplet(iParser, 1); + + XML_SetSkippedEntityHandler(iParser, SkippedEntityHandlerL); + XML_SetExternalEntityRefHandler(iParser, ExternalEntityRefHandlerL); + } + +TDes8& CExpat::GetBufferL(TInt aLength) + { + TUint8* buf = (TUint8*) User::LeaveIfNull(XML_GetBuffer(iParser, aLength)); + + iInputBuffer.Set(buf, 0, aLength); + + iBufferReady = ETrue; + + return iInputBuffer; + } + +void CExpat::ParseL(TBool done) + { + // GetBufferL must be called before each call to this function + if(!iBufferReady) + User::Leave(KErrNotReady); + + iBufferReady = EFalse; + + XML_Status status = XML_STATUS_OK; + TInt error = KErrNone; + + // Two forms of error come out of here: error will be set if an MContentHandler function has left, + // status notifies us of an internal from Expat + TRAP(error, status=XML_ParseBuffer(iParser, iInputBuffer.Length(), done)); + + if(error!=KErrNone) + { + // If a MContentHandler function left it is possible that some allocated memory may be + // leaked. We don't take that chance and de-allocate the parser and all its memory. + iParser = 0; + iAllocator.ResetL(); + + ClearElementStack(); + + // ResetL must be called to re-activate it. + ResetL(); + + User::Leave(error); + } + + if(status==XML_STATUS_ERROR) + { + error = (TInt)XML_GetErrorCode(iParser); + + if(error == (TInt)XML_ERROR_NO_MEMORY) + error = KErrNoMemory; + else + error += (EXmlSyntax-XML_ERROR_SYNTAX); // Convert to our external error range + + ClearElementStack(); + + // We don't want to regenerate the same callback. So check + // that the conditions are different. + // I.e. if the last parse resulted in a fatal error then + // subsequent parses will invoke the errorProcessor with the + // same error and status returned. Nothing more will be parsed. + if (iPrevStatus != XML_STATUS_ERROR || iPrevError != error) + { + iContentHandler->OnError(error); + } + } + else if(done) + { + iContentHandler->OnEndDocumentL(KErrNone); + } + + iPrevError = error; + iPrevStatus = status; + } + +const TInt KOptionalFeatures = EConvertTagsToLowerCase | EReportNamespaceMapping; +const TInt KMandatoryFeatures = EReportNamespaces | EReportNamespacePrefixes; + +TInt CExpat::EnableFeature(TInt aParseMode) + { + if(aParseMode & ~(KOptionalFeatures | KMandatoryFeatures)) + return KErrNotSupported; + + iParseMode |= aParseMode | KMandatoryFeatures; + + return KErrNone; + } + +TInt CExpat::DisableFeature(TInt aParseMode) + { + if(aParseMode & KMandatoryFeatures) + return KErrNotSupported; + + iParseMode &= ~aParseMode; + + return KErrNone; + } + +TBool CExpat::IsFeatureEnabled(TInt aParseMode) const + { + return iParseMode & aParseMode; + } + + +void CExpat::SetContentSink(class MContentHandler &aContentSink) + { + iContentHandler = &aContentSink; + } + +/* +CreateRStringL converts the UTF-16 descriptor to UTF-8 and stores it in the stringpool. +*/ +void CExpat::CreateRStringL(const TDesC& aInput, RString& aString, TBool aLowerCase) + { + TPtr8 conversionOutput(0,0); + //Uses the more efficient TPtr overload of ConvertFromUnicode. + TInt error = iCharSetConverter.ConvertFromUnicodeL(aInput, KCharacterSetIdentifierUtf8, conversionOutput); + User::LeaveIfError(error>0 ? KErrCorrupt : error); + + if(aLowerCase) + conversionOutput.LowerCase(); + + aString = iStringPool.OpenStringL(conversionOutput); + } + +/* +ScanNameL takes a null-terminated UTF-16 string of the form "uri!prefix!localpart" (although prefix, or uri and prefix, +may not be there. The separated parts will be converted to UTF-8 and stored in the stringpool. + +The prefix and local part will be converted to lowercase if EConvertTagsToLowerCase is one of the +current parse modes. +*/ +void CExpat::ScanNameL(const XML_Char* aName16, RString& aUriString, RString& aLocalPartString, RString& aPrefixString) + { + const TUint16* uri = 0; + const TUint16* prefix = 0; + const TUint16* localPart; + const TUint16* p; + + p = localPart = (TUint16*)aName16; + + while(*p) + if(*p++ == KNamespaceSeparator) + { + uri = (TUint16*)aName16; + localPart = p; + break; + } + + while(*p) + if(*p++ == KNamespaceSeparator) + { + prefix = p; + break; + } + + while(*p) + p++; + + TBool lowerCase = iParseMode & EConvertTagsToLowerCase; + XML_Char nullString[] = ""; + + if(uri) + CreateRStringL(TPtrC16(uri, localPart-uri-1), aUriString, EFalse); + else + aUriString = iStringPool.OpenStringL(TPtrC8((unsigned char*)nullString, 0)); + CleanupClosePushL(aUriString); + + + if(prefix) + CreateRStringL(TPtrC16(prefix, p-prefix), aPrefixString , lowerCase); + else + aPrefixString = iStringPool.OpenStringL(TPtrC8((unsigned char*)nullString, 0)); + CleanupClosePushL(aPrefixString); + + CreateRStringL(TPtrC16(localPart, (prefix ? prefix-1 : p)-localPart), aLocalPartString, lowerCase); + + CleanupStack::Pop(2); + } + +void CExpat::StartElementHandlerL(void* aUserData, const XML_Char* aName, const XML_Char** aAtts) + { + ((CExpat*)aUserData)->HandleStartElementL(aName, aAtts); + } + +void CExpat::HandleStartElementL(const XML_Char* aName, const XML_Char** aAtts) + { + RString uriString, nameString, prefixString; + ScanNameL(aName, uriString, nameString, prefixString); + + RTagInfo tagInfo; + tagInfo.Open(uriString, prefixString, nameString); + CleanupClosePushL(tagInfo); + + // Only create a copy of nameString if the append succeeds + User::LeaveIfError(iElementStack.Append(nameString)); + nameString.Copy(); // i.e. iElementStack now has a copy so flag this to the stringpool + + // Count the number of attributes in aAtts + // + // The layout of aAtts is an array of name, value, name, value, name, ... + // ... hence each attribute has two strings giving rise to the "att += 2;" + const XML_Char** att = aAtts; + while (*att) + att += 2; + TInt nAttributes = (att-aAtts)/2; + + RAttributeArray attributes; + CleanupStack::PushL(TCleanupItem(AttributeArrayDelete, &attributes)); + + att = aAtts; + for(TInt i=0; iOnStartElementL(tagInfo, attributes, KErrNone); + + CleanupStack::PopAndDestroy(2); // Finished with RTagInfo and RAttributeArray + } + +void CExpat::EndElementHandlerL(void* aUserData, const XML_Char* aName) + { + ((CExpat*)aUserData)->HandleEndElementL(aName); + } + +void CExpat::HandleEndElementL(const XML_Char* aName) + { + RString uriString, nameString, prefixString; + ScanNameL(aName, uriString, nameString, prefixString); + + RTagInfo tagInfo; + tagInfo.Open(uriString, prefixString, nameString); + CleanupClosePushL(tagInfo); + + TInt i = iElementStack.Count() - 1; + + // Expat will raise an error if the wrong element is closed. We only get an error here + // if somehow our element stack is wrong. + if(iElementStack[i]!=nameString) + User::Leave(KErrCorrupt); + + iElementStack[i].Close(); + iElementStack.Remove(i); + + iContentHandler->OnEndElementL(tagInfo, KErrNone); + + CleanupStack::PopAndDestroy(); // Finished with RTagInfo + } + +void CExpat::CharacterDataHandlerL(void* aUserData, const XML_Char* aString, int aLen) + { + ((CExpat*)aUserData)->HandleCharacterDataL(aString, aLen); + } + +void CExpat::HandleCharacterDataL(const XML_Char* aString, int aLen) + { + TPtr8 conversionOutput(0,0); + //Uses the more efficient TPtr overload of ConvertFromUnicode + TInt error = iCharSetConverter.ConvertFromUnicodeL(TPtrC16((TUint16*)aString, aLen), KCharacterSetIdentifierUtf8, conversionOutput); + User::LeaveIfError(error>0 ? KErrCorrupt : error); + iContentHandler->OnContentL(conversionOutput, KErrNone); + } + +void CExpat::ProcessingInstructionHandlerL(void* aUserData, const XML_Char* aTarget, const XML_Char* aData) + { + ((CExpat*)aUserData)->HandleProcessingInstructionL(aTarget, aData); + } + +void CExpat::HandleProcessingInstructionL(const XML_Char* aTarget, const XML_Char* aData) + { + TPtr8 utf8target(0,0); + //Uses the more efficient TPtr overload of the ConvertFromUnicodeL function + TInt error = iCharSetConverter.ConvertFromUnicodeL(TPtrC16((TUint16*)aTarget, StringLen((TUint16*)aTarget)), KCharacterSetIdentifierUtf8, utf8target); + User::LeaveIfError(error>0 ? KErrCorrupt : error); + + HBufC8 *utf8data; + //Uses the HBufC overload of ConvertFromUnicodeL as the data in the TPtr overload is still needed. + error = iCharSetConverter.ConvertFromUnicodeL(TPtrC16((TUint16*)aData, StringLen((TUint16*)aData)), KCharacterSetIdentifierUtf8, utf8data); + CleanupStack::PushL(utf8data); + User::LeaveIfError(error>0 ? KErrCorrupt : error); + + iContentHandler->OnProcessingInstructionL(utf8target, utf8data->Des(), KErrNone); + + CleanupStack::PopAndDestroy(utf8data); + } + +void CExpat::XmlDeclHandlerL(void* aUserData, const XML_Char* aVersion, const XML_Char* aEncoding, int aStandalone) + { + ((CExpat*)aUserData)->HandleXmlDeclL(aVersion, aEncoding, aStandalone); + } + +void CExpat::HandleXmlDeclL(const XML_Char*, const XML_Char* aEncoding16, int) + { + // + // Encoding + // + RString encodingString; + + if (aEncoding16) + { + TInt len = StringLen((TUint16*)aEncoding16); + TPtr8 encoding8 = HBufC8::NewLC(len)->Des(); + encoding8.Copy(TPtrC16((TUint16*)aEncoding16, len)); + encodingString = iStringPool.OpenStringL(encoding8); + CleanupStack::PopAndDestroy(); + } + else + { + encodingString = iStringPool.OpenStringL(KNullDesC8()); + } + + CleanupClosePushL(encodingString); + + RDocumentParameters params; + params.Open(encodingString); + CleanupStack::Pop(); // encodingString + CleanupClosePushL(params); + + iContentHandler->OnStartDocumentL(params, KErrNone); + + CleanupStack::PopAndDestroy(); // Finished with params + } + +void CExpat::StartNamespaceDeclHandlerL(void* aUserData, const XML_Char* aPrefix, const XML_Char* aUri) + { + ((CExpat*)aUserData)->HandleStartNamespaceDeclL(aPrefix, aUri); + } + +void CExpat::HandleStartNamespaceDeclL(const XML_Char* aPrefix, const XML_Char* aUri) + { + if(iParseMode & EReportNamespaceMapping) + { + RString prefixString; + RString uriString; + unsigned char nullString[] = ""; + + if(aPrefix) + CreateRStringL(TPtrC((TUint16*)aPrefix, StringLen((TUint16*)aPrefix)), prefixString, EFalse); + else + { + prefixString = iStringPool.OpenStringL(TPtrC8(nullString, 0)); + } + CleanupClosePushL(prefixString); + + + if(aUri) + CreateRStringL(TPtrC((TUint16*)aUri, StringLen((TUint16*)aUri)), uriString, EFalse); + else + { + uriString = iStringPool.OpenStringL(TPtrC8(nullString, 0)); + } + CleanupClosePushL(uriString); + + iContentHandler->OnStartPrefixMappingL(prefixString, uriString, KErrNone); + + CleanupStack::PopAndDestroy(2); + } + } + +void CExpat::EndNamespaceDeclHandlerL(void* aUserData, const XML_Char* aPrefix) + { + ((CExpat*)aUserData)->HandleEndNamespaceDeclL(aPrefix); + } + +void CExpat::HandleEndNamespaceDeclL(const XML_Char* aPrefix) + { + if(iParseMode & EReportNamespaceMapping) + { + RString prefixString; + + if(aPrefix) + CreateRStringL(TPtrC((TUint16*)aPrefix, StringLen((TUint16*)aPrefix)), prefixString, EFalse); + else + { + unsigned char nullString[] = ""; + prefixString = iStringPool.OpenStringL(TPtrC8(nullString, 0)); + } + + CleanupClosePushL(prefixString); + iContentHandler->OnEndPrefixMappingL(prefixString, KErrNone); + CleanupStack::PopAndDestroy(); + } + } + +void CExpat::SkippedEntityHandlerL(void* aUserData, const XML_Char* aName, int aIsParamEntity) + { + ((CExpat*)aUserData)->HandleSkippedEntityL(aName, aIsParamEntity); + } + +void CExpat::HandleSkippedEntityL(const XML_Char* aName, int) + { + RString nameString; + CreateRStringL(TPtrC((TUint16*)aName, StringLen((TUint16*)aName)), nameString, EFalse); + + CleanupClosePushL(nameString); + iContentHandler->OnSkippedEntityL(nameString, KErrNone); + CleanupStack::PopAndDestroy(); + } + +int CExpat::ExternalEntityRefHandlerL(void* aUserData, const XML_Char* aName) + { + ((CExpat*)aUserData)->HandleSkippedEntityL(aName, 0); + return 1; + } + +void CExpat::ClearElementStack() + { + for(TInt i=iElementStack.Count()-1; i>=0; i--) + iElementStack[i].Close(); + + iElementStack.Reset(); + } + +LOCAL_C void AttributeArrayDelete(TAny *aPtr) + { + RAttributeArray& attributes = *(RAttributeArray*)aPtr; + + TInt nAttributes = attributes.Count(); + + for(TInt i=0; i__DbgSetAllocFail(RHeap::EFailNext, aDebugFailCount-1); +#endif + } + +CExpat::TExpatAlloc::~TExpatAlloc() + { + if(iHeap) + { + iHeap->Close(); + iHeap = 0; + } + } + +void CExpat::TExpatAlloc::ResetL() + { + __ASSERT_DEBUG(iHeap, User::Invariant()); + + if(iHeap) + iHeap->Close(); + iHeap = UserHeap::ChunkHeap(0, iHeapSize, iHeapSize); + User::LeaveIfNull(iHeap); + } + +void CExpat::TExpatAlloc::FillAllocStruct(XML_Memory_Handling_Suite& aMem) const + { + aMem.malloc_fcn = CExpat::TExpatAlloc::Alloc; + aMem.realloc_fcn = CExpat::TExpatAlloc::ReAlloc; + aMem.free_fcn = CExpat::TExpatAlloc::Free; + aMem.allocData = (void*)this; + } + +void* CExpat::TExpatAlloc::Alloc(void* aUserData, size_t aSize) + { + RHeap* heap = ((TExpatAlloc*)aUserData)->iHeap; + return heap ? heap->Alloc(aSize) : 0; + } + +void* CExpat::TExpatAlloc::ReAlloc(void* aUserData, void* aPtr, size_t aSize) + { + RHeap* heap = ((TExpatAlloc*)aUserData)->iHeap; + + // Used during development to ensure good heap. Left in for future reference + __ASSERT_DEBUG(heap, User::Invariant()); + + return heap ? heap->ReAlloc(aPtr, aSize) : 0; + } + +void CExpat::TExpatAlloc::Free(void* aUserData, void *aPtr) + { + RHeap* heap = ((TExpatAlloc*)aUserData)->iHeap; + + // Used during development to ensure good heap. Left in for future reference + __ASSERT_DEBUG(heap, User::Invariant()); + + if(heap) + heap->Free(aPtr); + } + +RHeap* CExpat::TExpatAlloc::GetHeap() const + { + return iHeap; + } diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/cexpat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/cexpat.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,200 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef CEXPAT_H +#define CEXPAT_H + +#include +#include + +#include "expat.h" + +class CXmlParser; + +/* +CExpat class. + +1. +This class encapsulates the Expat xml parser. It is the engine behind +CXmlParserPlugin. + +2. +Handles construction and deletion of Expat xml parser. Defines handlers +required for Expat, transforms handler data to required types and passes +this to the client by MContentHandler callbacks. + +3. +MContentHandler functions can leave. Rather than trapping every one of +these, which could prove costly, the functions are allowed to leave 'through' +Expat but a tight control is kept on Expat-allocated memory to ensure no +leaks occur. This is handled via the sub-class TExpatAlloc. + +If a MContentHandler function does leave, the Expat parser is entirely +deleted for safety and a call to Reset is required to begin using it again. +*/ + +class CExpat : public CBase + { +public: + static CExpat* NewL(Xml::MContentHandler& aContentHandler, RStringPool& aStringPool, Xml::CCharSetConverter& aCharSetConverter, + RElementStack& aElementStack, TInt aDebugFailCount); + ~CExpat(); + + void ResetL(); + TInt EnableFeature(TInt aParserFeature); + TInt DisableFeature(TInt aParserFeature); + TBool IsFeatureEnabled(TInt aParserFeature) const; + + /* + Allocate a buffer in which to write xml to be parsed by the ParseL and + ParseLastL methods. Memory allocated with this method is managed + internally. Thus it must not be freed and not put on the cleanup stack. + + This must be called before every call to ParseL or ParseLastL + */ + TDes8& GetBufferL(TInt aLength); + + /* + Parsing methods: + + ParseLastL should be used if the buffer contains the last segment of + the document. ParseL should be called in any other case. + + It is perfectly valid to parse the entire document with ParseL and then + call ParseLastL with a zero-length buffer. + */ + void ParseL(TBool done=EFalse); + inline void ParseLastL(); + + void SetContentSink(class Xml::MContentHandler &); + + /* + Function used to access internal parser heap for testing + */ + RHeap* GetInternalHeap() const; + +private: + CExpat(Xml::MContentHandler& aContentHandler, RStringPool& aStringPool, Xml::CCharSetConverter& aCharSetConverter, + RElementStack& aElementStack); + void ConstructL(TInt aDebugFailCount); + + void CreateRStringL(const TDesC& aInput, RString& aString, TBool aLowerCase); + void ScanNameL(const XML_Char* aName, RString& aUriString, RString& aLocalPartString, RString& aPrefixString); + inline TInt StringLen(TUint16* p); + + void ClearElementStack(); + + static void StartElementHandlerL(void* aUserData, const XML_Char* aName, const XML_Char** aAtts); + static void EndElementHandlerL(void* aUserData, const XML_Char* aName); + static void CharacterDataHandlerL(void* aUserData, const XML_Char* aString, int aLen); + static void ProcessingInstructionHandlerL(void* aUserData, const XML_Char* aTarget, const XML_Char* aData); + static void XmlDeclHandlerL(void* aUserData, const XML_Char* aVersion, const XML_Char* aEncoding, int aStandalone); + static void StartNamespaceDeclHandlerL(void* aUserData, const XML_Char* aPrefix, const XML_Char* aUri); + static void EndNamespaceDeclHandlerL(void* aUserData, const XML_Char* aPrefix); + static void SkippedEntityHandlerL(void* aUserData, const XML_Char* aName, int aIsParamEntity); + static int ExternalEntityRefHandlerL(void* aUserData, const XML_Char* aName); + + void HandleStartElementL(const XML_Char* aName, const XML_Char** aAtts); + void HandleEndElementL(const XML_Char* aName); + void HandleCharacterDataL(const XML_Char* aString, int aLen); + void HandleProcessingInstructionL(const XML_Char* aTarget, const XML_Char* aData); + void HandleXmlDeclL(const XML_Char* aVersion, const XML_Char* aEncoding, int aStandalone); + void HandleStartNamespaceDeclL(const XML_Char* aPrefix, const XML_Char* aUri); + void HandleEndNamespaceDeclL(const XML_Char* aPrefix); + void HandleSkippedEntityL(const XML_Char* aName, int aIsParamEntity); + +private: + /* + Objects supplied on construction + */ + Xml::MContentHandler* iContentHandler; + RStringPool& iStringPool; + Xml::CCharSetConverter& iCharSetConverter; + RElementStack& iElementStack; + + TInt iParseMode; + + /* + Used to ensure GetBufferL has been called before a call to ParseL or ParseLastL + */ + TBool iBufferReady; + TPtr8 iInputBuffer; + + /* + Used to record the last status and error raised whilst parsing. + */ + XML_Status iPrevStatus; + TInt iPrevError; + + /* + The expat parser itself + */ + XML_Parser iParser; + + /* + TExpatAlloc class managing fenced-off memory area separate from the thread's heap. + This memory is contained in its own chunk created by UserHeap. + */ + class TExpatAlloc + { + public: + TExpatAlloc() {} + void ConstructL(TInt aHeapSize, TInt aDebugFailCount); + ~TExpatAlloc(); + + /* + Called when a leave from within Expat leaves the memory in an unknown state. + All memory will be freed. + */ + void ResetL(); + + /* + Fill supplied XML_Memory_Handling_Suite structure which may then be passed + to Expat's XML_ParserCreate_MM + */ + void FillAllocStruct(XML_Memory_Handling_Suite& aMem) const; + + static void* Alloc(void* aUserData, size_t aSize); + static void* ReAlloc(void* aUserData, void* aPtr, size_t aSize); + static void Free(void* aUserData, void *aPtr); + + /* + For testing + */ + RHeap* GetHeap() const; + + private: + TInt iHeapSize; + RHeap* iHeap; + } iAllocator; + }; + +inline void CExpat::ParseLastL() + { + ParseL(ETrue); + } + +/* +strlen for null-terminated 16-bit strings +*/ +inline TInt CExpat::StringLen(TUint16* aStart) + { + TUint16* p = aStart; + while (*p++) + ; + return p-1-aStart; + } + +#endif // CEXPAT_H diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/COPYING Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + and Clark Cooper +Copyright (c) 2001, 2002 Expat maintainers. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/Changes --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/Changes Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +Release 1.95.5 Fri Sep 6 2002 + - Added XML_UseForeignDTD() for improved SAX2 support. + - Added XML_GetFeatureList(). + - Defined XML_Bool type and the values XML_TRUE and XML_FALSE. + - Use an incomplete struct instead of a void* for the parser + (may not retain). + - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. + - Finally fixed bug where default handler would report DTD + events that were already handled by another handler. + Initial patch contributed by Darryl Miller. + - Removed unnecessary DllMain() function that caused static + linking into a DLL to be difficult. + - Added VC++ projects for building static libraries. + - Reduced line-length for all source code and headers to be + no longer than 80 characters, to help with AS/400 support. + - Reduced memory copying during parsing (SF patch #600964). + - Fixed a variety of bugs: see SF issues 580793, 434664, + 483514, 580503, 581069, 584041, 584183, 584832, 585537, + 596555, 596678, 598352, 598944, 599715, 600479, 600971. + +Release 1.95.4 Fri Jul 12 2002 + - Added support for VMS, contributed by Craig Berry. See + vms/README.vms for more information. + - Added Mac OS (classic) support, with a makefile for MPW, + contributed by Thomas Wegner and Daryle Walker. + - Added Borland C++ Builder 5 / BCC 5.5 support, contributed + by Patrick McConnell (SF patch #538032). + - Fixed a variety of bugs: see SF issues 441449, 563184, + 564342, 566334, 566901, 569461, 570263, 575168, 579196. + - Made skippedEntityHandler conform to SAX2 (see source comment) + - Re-implemented WFC: Entity Declared from XML 1.0 spec and + added a new error "entity declared in parameter entity": + see SF bug report 569461 and SF patch 578161 + - Re-implemented section 5.1 from XML 1.0 spec: + see SF bug report 570263 and SF patch 578161 + +Release 1.95.3 Mon Jun 3 2002 + - Added a project to the MSVC workspace to create a wchar_t + version of the library; the DLLs are named libexpatw.dll. + - Changed the name of the Windows DLLs from expat.dll to + libexpat.dll; this fixes SF bug #432456. + - Added the XML_ParserReset() API function. + - Fixed XML_SetReturnNSTriplet() to work for element names. + - Made the XML_UNICODE builds usable (thanks, Karl!). + - Allow xmlwf to read from standard input. + - Install a man page for xmlwf on Unix systems. + - Fixed many bugs; see SF bug reports 231864, 461380, 464837, + 466885, 469226, 477667, 484419, 487840, 494749, 496505, + 547350. Other bugs which we can't test as easily may also + have been fixed, especially in the area of build support. + +Release 1.95.2 Fri Jul 27 2001 + - More changes to make MSVC happy with the build; add a single + workspace to support both the library and xmlwf application. + - Added a Windows installer for Windows users; includes + xmlwf.exe. + - Added compile-time constants that can be used to determine the + Expat version + - Removed a lot of GNU-specific dependencies to aide portability + among the various Unix flavors. + - Fix the UTF-8 BOM bug. + - Cleaned up warning messages for several compilers. + - Added the -Wall, -Wstrict-prototypes options for GCC. + +Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 + - Changes to get expat to build under Microsoft compiler + - Removed all aborts and instead return an UNEXPECTED_STATE error. + - Fixed a bug where a stray '%' in an entity value would cause an + abort. + - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for + finding this oversight. + - Changed default patterns in lib/Makefile.in to fit non-GNU makes + Thanks to robin@unrated.net for reporting and providing an + account to test on. + - The reference had the wrong label for XML_SetStartNamespaceDecl. + Reported by an anonymous user. + +Release 1.95.0 Fri Sep 29 2000 + - XML_ParserCreate_MM + Allows you to set a memory management suite to replace the + standard malloc,realloc, and free. + - XML_SetReturnNSTriplet + If you turn this feature on when namespace processing is in + effect, then qualified, prefixed element and attribute names + are returned as "uri|name|prefix" where '|' is whatever + separator character is used in namespace processing. + - Merged in features from perl-expat + o XML_SetElementDeclHandler + o XML_SetAttlistDeclHandler + o XML_SetXmlDeclHandler + o XML_SetEntityDeclHandler + o StartDoctypeDeclHandler takes 3 additional parameters: + sysid, pubid, has_internal_subset + o Many paired handler setters (like XML_SetElementHandler) + now have corresponding individual handler setters + o XML_GetInputContext for getting the input context of + the current parse position. + - Added reference material + - Packaged into a distribution that builds a sharable library diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/MANIFEST --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/MANIFEST Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +Changes +COPYING +MANIFEST +Makefile.in +README +configure +configure.in +expat_config.h.in +bcb5/ExpatGroup.bpg +bcb5/ReadMe.txt +bcb5/elements.bpf +bcb5/elements.bpr +bcb5/elements.mak +bcb5/libexpat.bpf +bcb5/libexpat.bpr +bcb5/libexpat.mak +bcb5/libexpatw.bpf +bcb5/libexpatw.bpr +bcb5/libexpatw.mak +bcb5/makefile.mak +bcb5/outline.bpf +bcb5/outline.bpr +bcb5/outline.mak +bcb5/setup.bat +bcb5/xmlwf.bpf +bcb5/xmlwf.bpr +bcb5/xmlwf.mak +conftools/PrintPath +conftools/ac_c_bigendian_cross.m4 +conftools/config.guess +conftools/config.sub +conftools/expat.m4 +conftools/install-sh +conftools/libtool.m4 +conftools/ltmain.sh +conftools/mkinstalldirs +doc/reference.html +doc/style.css +doc/valid-xhtml10.png +doc/xmlwf.1 +doc/xmlwf.sgml +examples/elements.c +examples/outline.c +lib/ascii.h +lib/asciitab.h +lib/expat.h +lib/iasciitab.h +lib/internal.h +lib/latin1tab.h +lib/nametab.h +lib/utf8tab.h +lib/xmlparse.c +lib/xmlrole.c +lib/xmlrole.h +lib/xmltok.c +lib/xmltok.h +lib/xmltok_impl.c +lib/xmltok_impl.h +lib/xmltok_ns.c +lib/winconfig.h +tests/README.txt +tests/chardata.c +tests/chardata.h +tests/runtests.c +tests/xmltest.sh +vms/descrip.mms +vms/expat_config.h +vms/README.vms +win32/expat.iss +win32/MANIFEST.txt +xmlwf/codepage.c +xmlwf/codepage.h +xmlwf/ct.c +xmlwf/filemap.h +xmlwf/readfilemap.c +xmlwf/unixfilemap.c +xmlwf/win32filemap.c +xmlwf/xmlfile.c +xmlwf/xmlfile.h +xmlwf/xmlmime.c +xmlwf/xmlmime.h +xmlwf/xmltchar.h +xmlwf/xmlurl.h +xmlwf/xmlwf.c +xmlwf/xmlwin32url.cxx diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/Makefile.in Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,171 @@ +################################################################ +# Process this file with top-level configure script to produce Makefile +# +# Copyright 2000 Clark Cooper +# +# This file is part of EXPAT. +# +# EXPAT is free software; you can redistribute it and/or modify it +# under the terms of the License (based on the MIT/X license) contained +# in the file COPYING that comes with this distribution. +# +# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. +# + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +includedir = @includedir@ +mandir = ${prefix}/man/man1 + +top_builddir = . + + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs + +MANFILE = $(srcdir)/doc/xmlwf.1 +APIHEADER = $(srcdir)/lib/expat.h +LIBRARY = libexpat.la + + +default: buildlib xmlwf/xmlwf + +buildlib: $(LIBRARY) + +all: $(LIBRARY) xmlwf/xmlwf examples/elements examples/outline + +clean: + cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs + cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs + cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs + cd tests && rm -rf .libs runtests runtests.o chardata.o + rm -rf .libs libexpat.la + find . -name core | xargs rm -f + +distclean: clean + rm -f expat_config.h config.status config.log config.cache libtool + rm -f Makefile + +extraclean: distclean + rm -f expat_config.h.in configure + rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4 + +check: tests/runtests + tests/runtests + +install: xmlwf/xmlwf installlib + $(mkinstalldirs) $(bindir) $(mandir) + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(bindir)/xmlwf + $(INSTALL_DATA) $(MANFILE) $(mandir) + +installlib: $(LIBRARY) $(APIHEADER) + $(mkinstalldirs) $(libdir) $(includedir) + $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(libdir)/$(LIBRARY) + $(INSTALL_DATA) $(APIHEADER) $(includedir) + +uninstall: uninstalllib + $(LIBTOOL) --mode=uninstall rm -f $(bindir)/xmlwf + rm -f $(mandir)/xmlwf.1 + +uninstalllib: + $(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(LIBRARY) + rm -f $(includedir)/$(APIHEADER) + +# for VPATH builds (invoked by configure) +mkdir-init: + @for d in lib xmlwf examples tests ; do \ + (mkdir $$d 2> /dev/null || test 1) ; \ + done + +CC = @CC@ +LIBTOOL = @LIBTOOL@ + +INCLUDES = -I$(srcdir)/lib -I. +LDFLAGS = @LDFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ + +### autoconf this? +LTFLAGS = --silent + +COMPILE = $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $(INCLUDES) +LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) +LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ +LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ + +LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo +$(LIBRARY): $(LIB_OBJS) + $(LINK_LIB) $(LIB_OBJS) + +lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ + $(top_builddir)/expat_config.h lib/internal.h + +lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ + $(top_builddir)/expat_config.h lib/internal.h + +lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ + lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ + lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ + $(top_builddir)/expat_config.h + + +XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o +xmlwf/xmlwf.o: xmlwf/xmlwf.c +xmlwf/xmlfile.o: xmlwf/xmlfile.c +xmlwf/codepage.o: xmlwf/codepage.c +xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c +xmlwf/xmlwf: $(XMLWF_OBJS) $(LIBRARY) + $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) + +examples/elements.o: examples/elements.c +examples/elements: examples/elements.o $(LIBRARY) + $(LINK_EXE) $< $(LIBRARY) + +examples/outline.o: examples/outline.c +examples/outline: examples/outline.o $(LIBRARY) + $(LINK_EXE) $< $(LIBRARY) + +tests/chardata.o: tests/chardata.c tests/chardata.h +tests/runtests.o: tests/runtests.c tests/chardata.h +tests/runtests: tests/runtests.o tests/chardata.o $(LIBRARY) + $(LINK_EXE) $^ -lcheck + +tests/xmlts.zip: + wget --output-document=tests/xmlts.zip \ + http://www.w3.org/XML/Test/xmlts20020606.zip + +tests/XML-Test-Suite: tests/xmlts.zip + cd tests && unzip -q xmlts.zip + +run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite + tests/xmltest.sh + +.SUFFIXES: .c .lo .o + +.c.o: + $(COMPILE) -o $@ -c $< +.c.lo: + $(LTCOMPILE) -o $@ -c $< + +.PHONY: buildlib all \ + clean distclean extraclean maintainer-clean \ + dist distdir \ + install uninstall diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/README Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,112 @@ + + Expat, Release 1.95.5 + +This is Expat, a C library for parsing XML, written by James Clark. +Expat is a stream-oriented XML parser. This means that you register +handlers with the parser before starting the parse. These handlers +are called when the parser discovers the associated structures in the +document being parsed. A start tag is an example of the kind of +structures for which you may register handlers. + +Windows users should use the expat_win32bin package, which includes +both precompiled libraries and executalbes, and source code for +developers. + +Expat is free software. You may copy, distribute, and modify it under +the terms of the License contained in the file COPYING distributed +with this package. This license is the same as the MIT/X Consortium +license. + +Versions of Expat that have an odd minor version (the middle number in +the release above), are development releases and should be considered +as beta software. Releases with even minor version numbers are +intended to be production grade software. + +If you are building Expat from a check-out from the CVS repository, +you need to run a script that generates the configure script using the +GNU autoconf and libtool tools. To do this, you need to have +autoconf 2.52 or newer and libtool 1.4 or newer. Run the script like +this: + + ./buildconf.sh + +Once this has been done, follow the same instructions as for building +from a source distribution. + +To build Expat from a source distribution, you first run the +configuration shell script in the top level distribution directory: + + ./configure + +There are many options which you may provide to configure (which you +can discover by running configure with the --help option). But the +one of most interest is the one that sets the installation directory. +By default, the configure script will set things up to install +libexpat into /usr/local/lib, expat.h into /usr/local/include, and +xmlwf into /usr/local/bin. If, for example, you'd prefer to install +into /home/me/mystuff/lib, /home/me/mystuff/include, and +/home/me/mystuff/bin, you can tell configure about that with: + + ./configure --prefix=/home/me/mystuff + +After running the configure script, the "make" command will build +things and "make install" will install things into their proper +location. Note that you need to have write permission into the +directories into which things will be installed. + +If you are interested in building Expat to provide document +information in UTF-16 rather than the default UTF-8, following these +instructions: + + 1. For UTF-16 output as unsigned short (and version/error + strings as char), run: + + ./configure CPPFLAGS=-DXML_UNICODE + + For UTF-16 output as wchar_t (incl. version/error strings), + run: + + ./configure CFLAGS="-g -O2 -fshort-wchar" \ + CPPFLAGS=-DXML_UNICODE_WCHAR_T + + 2. Edit the MakeFile, changing: + + LIBRARY = libexpat.la + + to: + + LIBRARY = libexpatw.la + + (Note the additional "w" in the library name.) + + 3. Run "make buildlib" (which builds the library only). + + 4. Run "make installlib" (which installs the library only). + +Note for Solaris users: The "ar" command is usually located in +"/usr/ccs/bin", which is not in the default PATH. You will need to +add this to your path for the "make" command, and probably also switch +to GNU make (the "make" found in /usr/ccs/bin does not seem to work +properly -- appearantly it does not understand .PHONY directives). If +you're using ksh or bash, use this command to build: + + PATH=/usr/ccs/bin:$PATH make + +When using Expat with a project using autoconf for configuration, you +can use the probing macro in conftools/expat.m4 to determine how to +include Expat. See the comments at the top of that file for more +information. + +A reference manual is available in the file doc/reference.html in this +distribution. + +The homepage for this project is http://www.libexpat.org/. There +are links there to connect you to the bug reports page. If you need +to report a bug when you don't have access to a browser, you may also +send a bug report by email to expat-bugs@mail.libexpat.org. + +Discussion related to the direction of future expat development takes +place on expat-discuss@mail.libexpat.org. Archives of this list and +other Expat-related lists may be found at: + + http://mail.libexpat.org/mailman-21/listinfo/ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/ExpatGroup.bpg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/ExpatGroup.bpg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------ +VERSION = BWS.01 +#------------------------------------------------------------------------------ +!ifndef ROOT +ROOT = $(MAKEDIR)\.. +!endif +#------------------------------------------------------------------------------ +MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** +DCC = $(ROOT)\bin\dcc32.exe $** +BRCC = $(ROOT)\bin\brcc32.exe $** +#------------------------------------------------------------------------------ +PROJECTS = setup libexpat.dll libexpatw.dll elements.exe outline.exe xmlwf.exe +#------------------------------------------------------------------------------ +default: $(PROJECTS) +#------------------------------------------------------------------------------ + +elements.exe: elements.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +outline.exe: outline.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +xmlwf.exe: xmlwf.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +setup: setup.bat + call $** + +libexpat.dll: libexpat.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +libexpatw.dll: libexpatw.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/ReadMe.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ + + Using a Borland compiler product + +The files in this directory support using both the free Borland +command-line compiler tools and the Borland C++ Builder IDE. The +project files have been tested with both versions 5 and 6 of the C++ +Builder product. + + Using the free BCC32 command line compiler + +After downloading and installing the free C++ Builder commandline +version, perform the following steps (assuming it was installed under +C:\Borland\BCC55): + +1) Add "C:\Borland\BCC55\BIN" to your path +2) Set the environment variable BCB to "C:\Borland\BCC55". +3) edit makefile.mak: enable or comment out the appropriate commands + under clean & distclean, depending on whether your OS can use + deltree /y or del /s/f/q. + +After that, you should simply cd to the bcb5 directory in your Expat +directory tree (same structure as CVS) and run "make all". diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.bpf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.bpf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +USEUNIT("..\examples\elements.c"); +//--------------------------------------------------------------------------- +#define WinMain diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.bpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.bpr Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=7 +Item0=$(BCB)\include;..\Source\examples;..\Source\lib +Item1=..\Source\examples;..\examples;$(BCB)\include;..\lib +Item2=..\examples;$(BCB)\include;..\lib +Item3=..\..\..\examples;$(BCB)\include;..\..\..\lib +Item4=..\..\..\examples;$(BCB)\include +Item5=$(BCB)\include +Item6=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; + +[HistoryLists\hlLibraryPath] +Count=9 +Item0=$(BCB)\lib;..\Source\examples;debug +Item1=..\Source\examples;$(BCB)\lib;debug +Item2=..\Source\examples;$(BCB)\lib;.\debug +Item3=..\Source\examples;..\examples;$(BCB)\lib;..\lib\release +Item4=..\examples;$(BCB)\lib;..\lib\release +Item5=..\..\..\examples;$(BCB)\lib;..\..\..\lib\release +Item6=..\..\..\examples;$(BCB)\lib;..\..\..\examples\$(RELEASELIBPATH) +Item7=$(BCB)\lib;$(RELEASELIBPATH) +Item8=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=WIN32;NDEBUG;_CONSOLE;_MBCS;_DEBUG + +[HistoryLists\hlIntOutputDir] +Count=6 +Item0=debug\obj +Item1=..\..\win32\debug\obj +Item2=..\..\..\..\win32\debug\obj +Item3=..\..\..\..\win32\debug +Item4=..\..\..\examples\Release +Item5=Release + +[HistoryLists\hlFinalOutputDir] +Count=5 +Item0=debug\ +Item1=..\..\..\..\win32\debug\ +Item2=..\..\..\..\win32\debug +Item3=..\..\..\examples\Release\ +Item4=Release\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/elements.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.05.03 +# --------------------------------------------------------------------------- +PROJECT = debug\elements.exe +OBJFILES = debug\obj\elements.obj +RESFILES = +MAINSOURCE = elements.bpf +RESDEPEN = $(RESFILES) +LIBFILES = +IDLFILES = +IDLGENFILES = +LIBRARIES = +PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ + ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ + VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ + dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi +SPARELIBS = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .;..\examples +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = WIN32;NDEBUG;_CONSOLE;_MBCS;_DEBUG +SYSDEFINES = _MSC_VER=1100;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL +INCLUDEPATH = $(BCB)\include;..\examples;..\lib +LIBPATH = $(BCB)\lib;..\examples;debug +WARNINGS= -w-par -w-8027 -w-8026 +# --------------------------------------------------------------------------- +CFLAG1 = -Od -X- -r- -a8 -5 -b -k -y -v -vi- -q -I..\lib -c +IDLCFLAGS = -I$(BCB)\include +PFLAGS = -N2debug\obj -N0debug\obj -$YD -$W -$O- +RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include;$(BCB)\include\mfc +AFLAGS = /mx /w2 /zi +LFLAGS = -Idebug\obj -D"" -ap -Tpe -x -Gn -v -q +# --------------------------------------------------------------------------- +ALLOBJ = c0x32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) libexpat.lib import32.lib cw32i.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +!endif + + + + + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if "$(USERDEFINES)" != "" +AUSERDEFINES = -d$(USERDEFINES:;= -d) +!else +AUSERDEFINES = +!endif + +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) -L$(LIBPATH) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< +# --------------------------------------------------------------------------- + + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.bpf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.bpf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ +USEUNIT("..\lib\xmltok.c"); +USEUNIT("..\lib\xmlrole.c"); +USEUNIT("..\lib\xmlparse.c"); +//--------------------------------------------------------------------------- +#define DllEntryPoint diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.bpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.bpr Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=7 +Item0=$(BCB)\include;..\Source\lib +Item1=..\Source\lib;$(BCB)\include +Item2=..\Source\lib;..\lib;$(BCB)\include +Item3=..\lib;$(BCB)\include +Item4=..\..\..\lib;$(BCB)\include +Item5=$(BCB)\include +Item6=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; + +[HistoryLists\hlLibraryPath] +Count=9 +Item0=..\Source\lib;$(BCB)\lib +Item1=$(BCB)\lib +Item2=$(BCB)\lib;..\Source\lib +Item3=..\Source\lib +Item4=..\Source\lib;..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) +Item5=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) +Item6=..\..\..\lib;$(BCB)\lib;..\..\..\lib\$(RELEASELIBPATH) +Item7=$(BCB)\lib;$(RELEASELIBPATH) +Item8=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG + +[HistoryLists\hlIntOutputDir] +Count=6 +Item0=debug\obj +Item1=..\..\win32\debug\obj +Item2=..\..\..\..\win32\debug\obj +Item3=..\..\..\..\win32\debug +Item4=..\..\..\lib\Release +Item5=Release + +[HistoryLists\hlFinalOutputDir] +Count=6 +Item0=debug\ +Item1=..\..\..\..\win32\debug\ +Item2=..\..\..\..\win32\debug +Item3=..\..\..\lib\Release\ +Item4=..\..\..\lib\Release +Item5=Release\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpat.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.05.03 +# --------------------------------------------------------------------------- +PROJECT = debug\libexpat.dll +OBJFILES = debug\obj\xmltok.obj debug\obj\xmlrole.obj debug\obj\xmlparse.obj +RESFILES = +MAINSOURCE = libexpat.bpf +RESDEPEN = $(RESFILES) +LIBFILES = +IDLFILES = +IDLGENFILES = +LIBRARIES = +PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ + ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ + VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ + dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi +SPARELIBS = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .;..\lib +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG +SYSDEFINES = _MSC_VER=1100;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL +INCLUDEPATH = $(BCB)\include;..\lib +LIBPATH = ..\lib;$(BCB)\lib +WARNINGS= -w-rch -w-par -w-ccc +# --------------------------------------------------------------------------- +CFLAG1 = -WD -Od -X- -r- -a8 -5 -b -k -y -v -vi- -q -tWM -c -tWD +IDLCFLAGS = -I$(BCB)\include +PFLAGS = -N2debug\obj -N0debug\obj -$YD -$W -$O- +RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include;$(BCB)\include\mfc +AFLAGS = /mx /w2 /zi +LFLAGS = -Idebug\obj -D"" -aa -Tpd -x -Gn -Gi -v -q +# --------------------------------------------------------------------------- +ALLOBJ = c0d32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +!endif + + + + + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if "$(USERDEFINES)" != "" +AUSERDEFINES = -d$(USERDEFINES:;= -d) +!else +AUSERDEFINES = +!endif + +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) -L$(LIBPATH) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< +# --------------------------------------------------------------------------- + + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.bpf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.bpf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5 @@ +USEUNIT("..\lib\xmltok.c"); +USEUNIT("..\lib\xmlrole.c"); +USEUNIT("..\lib\xmlparse.c"); +//--------------------------------------------------------------------------- +#define DllEntryPoint diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.bpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.bpr Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=6 +Item0=$(BCB)\include;..\Source\lib +Item1=..\Source\lib;..\lib;$(BCB)\include +Item2=..\lib;$(BCB)\include +Item3=..\..\..\lib;$(BCB)\include +Item4=$(BCB)\include +Item5=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; + +[HistoryLists\hlLibraryPath] +Count=9 +Item0=$(BCB)\lib;..\Source\lib +Item1=..\Source\lib;$(BCB)\lib +Item2=$(BCB)\lib +Item3=..\Source\lib;..\lib;$(BCB)\lib +Item4=..\lib;$(BCB)\lib +Item5=..\..\..\lib;$(BCB)\lib +Item6=..\..\..\lib;$(BCB)\lib;..\..\..\lib\$(RELEASELIBPATH) +Item7=$(BCB)\lib;$(RELEASELIBPATH) +Item8=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG + +[HistoryLists\hlIntOutputDir] +Count=7 +Item0=debug\obj +Item1=..\..\win32\debug\obj +Item2=..\..\..\..\win32\debug\obj +Item3=..\..\..\..\win32\debug +Item4=..\..\..\..\win32\release +Item5=..\..\..\lib\Release-w +Item6=Release-w + +[HistoryLists\hlFinalOutputDir] +Count=7 +Item0=debug\ +Item1=..\..\..\..\win32\debug\ +Item2=..\..\..\..\win32\debug +Item3=..\..\..\..\win32\release\ +Item4=..\..\..\..\win32\release +Item5=..\..\..\lib\Release-w\ +Item6=Release-w\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/libexpatw.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.05.03 +# --------------------------------------------------------------------------- +PROJECT = debug\libexpatw.dll +OBJFILES = debug\obj\xmltok.obj debug\obj\xmlrole.obj debug\obj\xmlparse.obj +RESFILES = +MAINSOURCE = libexpatw.bpf +RESDEPEN = $(RESFILES) +LIBFILES = +IDLFILES = +IDLGENFILES = +LIBRARIES = +PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ + ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ + VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ + dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi +SPARELIBS = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .;..\lib +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG +SYSDEFINES = _MSC_VER=1100;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL +INCLUDEPATH = $(BCB)\include;..\lib +LIBPATH = $(BCB)\lib;..\lib +WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc +# --------------------------------------------------------------------------- +CFLAG1 = -WD -Od -X- -r- -a8 -5 -b -k -y -v -vi- -q -tWM -c -tWD +IDLCFLAGS = -I$(BCB)\include +PFLAGS = -N2debug\obj -N0debug\obj -$YD -$W -$O- +RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include;$(BCB)\include\mfc +AFLAGS = /mx /w2 /zi +LFLAGS = -Idebug\obj -D"" -aa -Tpd -x -Gn -Gi -w -v -q +# --------------------------------------------------------------------------- +ALLOBJ = c0d32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +!endif + + + + + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if "$(USERDEFINES)" != "" +AUSERDEFINES = -d$(USERDEFINES:;= -d) +!else +AUSERDEFINES = +!endif + +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) -L$(LIBPATH) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< +# --------------------------------------------------------------------------- + + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/makefile.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/makefile.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,31 @@ +all: setup expat expatw elements outline xmlwf + +setup: + setup + +expat: + make -l -flibexpat.mak + +expatw: + make -l -flibexpatw.mak + +elements: + make -l -felements.mak + +outline: + make -l -foutline.mak + +xmlwf: + make -l -fxmlwf.mak + +clean: +# works on Win98/ME +# deltree /y debug\obj +# works on WinNT/2000 + del /s/f/q debug\obj + +distclean: +# works on Win98/ME +# deltree /y debug\*.* +# works on WinNT/2000 + del /s/f/q debug\* diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.bpf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.bpf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +USEUNIT("..\examples\outline.c"); +//--------------------------------------------------------------------------- +#define WinMain diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.bpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.bpr Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=7 +Item0=$(BCB)\include;..\Source\examples;..\Source\lib +Item1=..\Source\examples;..\examples;$(BCB)\include;..\lib +Item2=..\examples;$(BCB)\include;..\lib +Item3=..\..\..\examples;$(BCB)\include;..\..\..\lib +Item4=..\..\..\examples;$(BCB)\include +Item5=$(BCB)\include +Item6=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; + +[HistoryLists\hlLibraryPath] +Count=11 +Item0=$(BCB)\lib;..\Source\examples;debug +Item1=$(BCB)\lib;..\Source\examples;.\debug +Item2=..\Source\examples;..\examples;$(BCB)\lib;..\lib\Release +Item3=..\examples;$(BCB)\lib;..\lib\Release +Item4=..\..\..\examples;$(BCB)\lib;..\..\..\lib\Release +Item5=..\..\..\examples;$(BCB)\lib;..\..\..\examples\$(RELEASELIBPATH);..\..\..\lib\Release +Item6=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release +Item7=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat2\expat\lib\Release +Item8=$(BCB)\lib;$(RELEASELIBPATH) +Item9=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat2\expat\lib +Item10=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=WIN32;NDEBUG;_CONSOLE;_MBCS;_DEBUG + +[HistoryLists\hlIntOutputDir] +Count=6 +Item0=debug\obj +Item1=..\..\win32\debug\obj +Item2=..\..\..\..\win32\debug\obj +Item3=..\..\..\..\win32\debug +Item4=..\..\..\examples\Release +Item5=Release + +[HistoryLists\hlFinalOutputDir] +Count=5 +Item0=debug\ +Item1=..\..\..\..\win32\debug\ +Item2=..\..\..\..\win32\debug +Item3=..\..\..\examples\Release\ +Item4=Release\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/outline.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.05.03 +# --------------------------------------------------------------------------- +PROJECT = debug\outline.exe +OBJFILES = debug\obj\outline.obj +RESFILES = +MAINSOURCE = outline.bpf +RESDEPEN = $(RESFILES) +LIBFILES = +IDLFILES = +IDLGENFILES = +LIBRARIES = +PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ + ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ + VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ + dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi +SPARELIBS = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .;..\examples +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = WIN32;NDEBUG;_CONSOLE;_MBCS;_DEBUG +SYSDEFINES = _MSC_VER=1100;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL +INCLUDEPATH = $(BCB)\include;..\examples;..\lib +LIBPATH = $(BCB)\lib;..\examples;debug +WARNINGS= -w-par -w-8027 -w-8026 +# --------------------------------------------------------------------------- +CFLAG1 = -Od -X- -r- -a8 -5 -b -k -y -v -vi- -q -I..\lib -c +IDLCFLAGS = -I$(BCB)\include +PFLAGS = -N2debug\obj -N0debug\obj -$YD -$W -$O- +RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include;$(BCB)\include\mfc +AFLAGS = /mx /w2 /zi +LFLAGS = -Idebug\obj -D"" -ap -Tpe -x -Gn -v -q +# --------------------------------------------------------------------------- +ALLOBJ = c0x32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) libexpat.lib import32.lib cw32i.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +!endif + + + + + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if "$(USERDEFINES)" != "" +AUSERDEFINES = -d$(USERDEFINES:;= -d) +!else +AUSERDEFINES = +!endif + +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) -L$(LIBPATH) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< +# --------------------------------------------------------------------------- + + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/setup.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/setup.bat Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ +@rem Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd +@rem See the file COPYING for copying permission. +@rem +REM CommandInterpreter: $(COMSPEC) +if not exist .\debug\nul mkdir debug +if not exist .\debug\obj\nul mkdir debug\obj diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.bpf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.bpf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ +USEUNIT("..\xmlwf\xmlfile.c"); +USEUNIT("..\xmlwf\win32filemap.c"); +USEUNIT("..\xmlwf\codepage.c"); +USEUNIT("..\xmlwf\xmlwf.c"); +//--------------------------------------------------------------------------- +#define WinMain diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.bpr --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.bpr Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[HistoryLists\hlIncludePath] +Count=7 +Item0=$(BCB)\include;..\Source\xmlwf;..\Source\lib +Item1=..\Source\xmlwf;..\xmlwf;$(BCB)\include;..\lib +Item2=..\xmlwf;$(BCB)\include;..\lib +Item3=..\..\..\xmlwf;$(BCB)\include;..\..\..\lib +Item4=..\..\..\xmlwf;$(BCB)\include +Item5=$(BCB)\include +Item6=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; + +[HistoryLists\hlLibraryPath] +Count=9 +Item0=$(BCB)\lib;..\Source\xmlwf;.\debug +Item1=..\Source\xmlwf;..\xmlwf;$(BCB)\lib;..\lib\Release +Item2=..\xmlwf;$(BCB)\lib;..\lib\Release +Item3=..\..\..\xmlwf;$(BCB)\lib;..\..\..\lib\Release +Item4=..\..\..\xmlwf;$(BCB)\lib;..\..\..\xmlwf\$(RELEASELIBPATH);..\..\..\lib\Release +Item5=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release +Item6=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat2\expat\lib\Release +Item7=$(BCB)\lib;$(RELEASELIBPATH) +Item8=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlConditionals] +Count=1 +Item0=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP + +[HistoryLists\hlIntOutputDir] +Count=7 +Item0=debug\obj +Item1=..\..\win32\debug\obj +Item2=..\..\..\..\win32\debug\obj +Item3=..\..\..\..\win32\debug +Item4=..\..\..\xmlwf\Release +Item5=Release +Item6=.\Release + +[HistoryLists\hlFinalOutputDir] +Count=5 +Item0=debug\ +Item1=..\..\..\..\win32\debug\ +Item2=..\..\..\..\win32\debug +Item3=..\..\..\xmlwf\Release\ +Item4=.\Release\ + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 +LinkCGLIB=0 + +[Language] +ActiveLang= +ProjectLang= +RootDir= + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/bcb5/xmlwf.mak Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,187 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.05.03 +# --------------------------------------------------------------------------- +PROJECT = debug\xmlwf.exe +OBJFILES = debug\obj\xmlfile.obj debug\obj\win32filemap.obj debug\obj\codepage.obj \ + debug\obj\xmlwf.obj +RESFILES = +MAINSOURCE = xmlwf.bpf +RESDEPEN = $(RESFILES) +LIBFILES = +IDLFILES = +IDLGENFILES = +LIBRARIES = +PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ + ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ + VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ + dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi +SPARELIBS = +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .;..\xmlwf +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP +SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL +INCLUDEPATH = $(BCB)\include;..\xmlwf;..\lib +LIBPATH = $(BCB)\lib;..\xmlwf;debug +WARNINGS= -w-8065 -w-par -w-8027 -w-8026 -w-csu +# --------------------------------------------------------------------------- +CFLAG1 = -O2 -X- -a8 -5 -b -k -vi -q -I..\lib -c +IDLCFLAGS = -I$(BCB)\include +PFLAGS = -N2debug\obj -N0debug\obj -$YD +RFLAGS = /l 0x809 /d "NDEBUG" /i$(BCB)\include;$(BCB)\include\mfc +AFLAGS = /mx /w2 /zd +LFLAGS = -Idebug\obj -D"" -ap -Tpe -x -Gn -v -q +# --------------------------------------------------------------------------- +ALLOBJ = c0x32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) libexpat.lib import32.lib cw32i.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 + +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +!endif + + + + + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if "$(USERDEFINES)" != "" +AUSERDEFINES = -d$(USERDEFINES:;= -d) +!else +AUSERDEFINES = +!endif + +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) -L$(LIBPATH) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< +# --------------------------------------------------------------------------- + + + + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/configure Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,10094 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53 for expat 1.95.5. +# +# Report bugs to . +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='expat' +PACKAGE_TARNAME='expat' +PACKAGE_VERSION='1.95.5' +PACKAGE_STRING='expat 1.95.5' +PACKAGE_BUGREPORT='expat-bugs@mail.libexpat.org' + +ac_unique_file="Makefile.in" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures expat 1.95.5 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of expat 1.95.5:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +expat configure 1.95.5 +generated by GNU Autoconf 2.53 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by expat $as_me 1.95.5, which was +generated by GNU Autoconf 2.53. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in conftools $srcdir/conftools; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in conftools $srcdir/conftools" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in conftools $srcdir/conftools" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + + + +LIBCURRENT=4 +LIBREVISION=0 +LIBAGE=4 + +ac_config_headers="$ac_config_headers expat_config.h" + + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## 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. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 46 AC_PROG_LIBTOOL + + + + + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- + # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +# AC_LIBTOOL_DLOPEN_SELF + +# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support + + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's + + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared + + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_DISABLE_STATIC - set the default static flag to --disable-static + + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install + + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. + + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library + + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library + + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker + + +# AC_PROG_LD_GNU - + + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. + + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics + + + +# AC_PROG_NM - find the path to a BSD-compatible name lister + + +# AC_CHECK_LIBM - check for math library + + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. + + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. + + +# old names + + + + + + + + +# This is just to silence aclocal about the macro not being used + + + + + + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi; +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi; +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi; +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + + + + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3850 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +## FIXME: this should be a separate macro +## +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 +## +## END FIXME + + +## FIXME: this should be a separate macro +## + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi +## +## END FIXME + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +## FIXME: this should be a separate macro +## +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" +## +## END FIXME + + +## FIXME: this should be a separate macro +## +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:4400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 +## +## END FIXME + +## FIXME: this should be a separate macro +## +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +## +## END FIXME + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +## FIXME: this should be a separate macro +## +# PORTME Fill in your ld.so characteristics +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 +## +## END FIXME + +## FIXME: this should be a separate macro +## +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 +## +## END FIXME + +## FIXME: this should be a separate macro +## +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 +## +## END FIXME + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +f = shl_load; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +f = dlopen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +## FIXME: this should be a separate macro +## +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} +## +## END FIXME + +## FIXME: this should be a separate macro +## +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi +## +## END FIXME + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +if test "$GCC" = yes ; then + OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" + CFLAGS="$OLDCFLAGS -fexceptions" + echo "$as_me:$LINENO: checking whether gcc accepts -fexceptions" >&5 +echo $ECHO_N "checking whether gcc accepts -fexceptions... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +(void)1 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; CFLAGS="$OLDCFLAGS" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + +for ac_header in fcntl.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + echo $ac_n "cross-compiling... " 2>&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +if test $ac_cv_c_bigendian = unknown; then +echo "$as_me:$LINENO: checking to probe for byte ordering" >&5 +echo $ECHO_N "checking to probe for byte ordering... $ECHO_C" >&6 + +cat >conftest.c <&6 + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&6 + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&6 + fi + fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +fi +if test $ac_cv_c_bigendian = yes; then + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + + BYTEORDER=4321 +else + BYTEORDER=1234 +fi + +cat >>confdefs.h <<_ACEOF +#define BYTEORDER $BYTEORDER +_ACEOF + +if test $ac_cv_c_bigendian = unknown; then + { { echo "$as_me:$LINENO: error: unknown endianess - sorry" >&5 +echo "$as_me: error: unknown endianess - sorry" >&2;} + { (exit please pre-set ac_cv_c_bigendian); exit please pre-set ac_cv_c_bigendian; }; } +fi + + +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define off_t long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_memcmp_working=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" + + + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP 1 +_ACEOF + +fi +rm -f conftest.mmap + + +if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then + FILEMAP=unixfilemap +else + FILEMAP=readfilemap +fi + + + + +for ac_func in memmove bcopy +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +cat >>confdefs.h <<\_ACEOF +#define XML_NS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XML_DTD 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XML_CONTEXT_BYTES 1024 +_ACEOF + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by expat $as_me 1.95.5, which was +generated by GNU Autoconf 2.53. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +expat config.status 1.95.5 +configured by $0, generated by GNU Autoconf 2.53, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "expat_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS expat_config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@CPP@,$CPP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBCURRENT@,$LIBCURRENT,;t t +s,@LIBREVISION@,$LIBREVISION,;t t +s,@LIBAGE@,$LIBAGE,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@FILEMAP@,$FILEMAP,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + +abs_srcdir="`cd $srcdir && pwd`" +abs_builddir="`pwd`" +if test "$abs_srcdir" != "$abs_builddir"; then + make mkdir-init +fi diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/configure.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/configure.in Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,124 @@ +dnl configuration script for expat +dnl Process this file with autoconf to produce a configure script. +dnl +dnl Copyright 2000 Clark Cooper +dnl +dnl This file is part of EXPAT. +dnl +dnl EXPAT is free software; you can redistribute it and/or modify it +dnl under the terms of the License (based on the MIT/X license) contained +dnl in the file COPYING that comes with this distribution. +dnl + +dnl Ensure that Expat is configured with autoconf 2.52 or newer +AC_PREREQ(2.52) + +dnl Get the version number of Expat, using m4's esyscmd() command to run +dnl the command at m4-generation time. This allows us to create an m4 +dnl symbol holding the correct version number. AC_INIT() requires the +dnl version number at m4-time, rather than when ./configure is run, so +dnl all this must happen as part of m4, not as part of the shell code +dnl contained in ./configure. +dnl +dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate +dnl test. I believe this test will work, but I don't have a place with non- +dnl GNU M4 to test it right now. +define([expat_version], ifdef([__gnu__], + [esyscmd(conftools/get-version.sh lib/expat.h)], + [1.95.x])) +AC_INIT(expat, expat_version, expat-bugs@mail.libexpat.org) +undefine([expat_version]) + +AC_CONFIG_SRCDIR(Makefile.in) +AC_CONFIG_AUX_DIR(conftools) + + +dnl +dnl Increment LIBREVISION if source code has changed at all +dnl +dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0 +dnl +dnl If the API changes compatibly (i.e. simply adding a new function +dnl without changing or removing earlier interfaces), then increment LIBAGE. +dnl +dnl If the API changes incompatibly set LIBAGE back to 0 +dnl + +LIBCURRENT=4 +LIBREVISION=0 +LIBAGE=4 + +AC_CONFIG_HEADER(expat_config.h) + +sinclude(conftools/libtool.m4) +sinclude(conftools/ac_c_bigendian_cross.m4) + +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +AC_SUBST(LIBCURRENT) +AC_SUBST(LIBREVISION) +AC_SUBST(LIBAGE) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL + +if test "$GCC" = yes ; then + dnl + dnl Be careful about adding the -fexceptions option; some versions of + dnl GCC don't support it and it causes extra warnings that are only + dnl distracting; avoid. + dnl + OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" + CFLAGS="$OLDCFLAGS -fexceptions" + AC_MSG_CHECKING(whether gcc accepts -fexceptions) + AC_TRY_COMPILE(,(void)1, + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS") +fi + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. + +dnl Note: Avoid using AC_C_BIGENDIAN because it does not +dnl work in a cross compile. +AC_C_BIGENDIAN_CROSS + +AC_C_CONST +AC_TYPE_OFF_T +AC_TYPE_SIZE_T + +dnl Checks for library functions. + +AC_FUNC_MEMCMP +AC_FUNC_MMAP + +if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then + FILEMAP=unixfilemap +else + FILEMAP=readfilemap +fi +AC_SUBST(FILEMAP) + +AC_CHECK_FUNCS(memmove bcopy) + +dnl some basic configuration +AC_DEFINE([XML_NS], 1, + [Define to make XML Namespaces functionality available.]) +AC_DEFINE([XML_DTD], 1, + [Define to make parameter entity parsing functionality available.]) +AC_DEFINE([XML_CONTEXT_BYTES], 1024, + [Define to specify how much context to retain around the current parse point.]) + +AC_CONFIG_FILES(Makefile) +AC_OUTPUT + +abs_srcdir="`cd $srcdir && pwd`" +abs_builddir="`pwd`" +if test "$abs_srcdir" != "$abs_builddir"; then + make mkdir-init +fi diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/PrintPath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/PrintPath Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,116 @@ +#!/bin/sh +# Look for program[s] somewhere in $PATH. +# +# Options: +# -s +# Do not print out full pathname. (silent) +# -pPATHNAME +# Look in PATHNAME instead of $PATH +# +# Usage: +# PrintPath [-s] [-pPATHNAME] program [program ...] +# +# Initially written by Jim Jagielski for the Apache configuration mechanism +# (with kudos to Kernighan/Pike) +# +# This script falls under the Apache License. +# See http://www.apache.org/licenses/LICENSE + +## +# Some "constants" +## +pathname=$PATH +echo="yes" + +## +# Find out what OS we are running for later on +## +os=`(uname) 2>/dev/null` + +## +# Parse command line +## +for args in $* +do + case $args in + -s ) echo="no" ;; + -p* ) pathname="`echo $args | sed 's/^..//'`" ;; + * ) programs="$programs $args" ;; + esac +done + +## +# Now we make the adjustments required for OS/2 and everyone +# else :) +# +# First of all, all OS/2 programs have the '.exe' extension. +# Next, we adjust PATH (or what was given to us as PATH) to +# be whitespace seperated directories. +# Finally, we try to determine the best flag to use for +# test/[] to look for an executable file. OS/2 just has '-r' +# but with other OSs, we do some funny stuff to check to see +# if test/[] knows about -x, which is the prefered flag. +## + +if [ "x$os" = "xOS/2" ] +then + ext=".exe" + pathname=`echo -E $pathname | + sed 's/^;/.;/ + s/;;/;.;/g + s/;$/;./ + s/;/ /g + s/\\\\/\\//g' ` + test_exec_flag="-r" +else + ext="" # No default extensions + pathname=`echo $pathname | + sed 's/^:/.:/ + s/::/:.:/g + s/:$/:./ + s/:/ /g' ` + # Here is how we test to see if test/[] can handle -x + testfile="pp.t.$$" + + cat > $testfile </dev/null`; then + test_exec_flag="-x" + else + test_exec_flag="-r" + fi + rm -f $testfile +fi + +for program in $programs +do + for path in $pathname + do + if [ $test_exec_flag $path/${program}${ext} ] && \ + [ ! -d $path/${program}${ext} ]; then + if [ "x$echo" = "xyes" ]; then + echo $path/${program}${ext} + fi + exit 0 + fi + +# Next try without extension (if one was used above) + if [ "x$ext" != "x" ]; then + if [ $test_exec_flag $path/${program} ] && \ + [ ! -d $path/${program} ]; then + if [ "x$echo" = "xyes" ]; then + echo $path/${program} + fi + exit 0 + fi + fi + done +done +exit 1 + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/ac_c_bigendian_cross.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/ac_c_bigendian_cross.m4 Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,81 @@ +dnl @synopsis AC_C_BIGENDIAN_CROSS +dnl +dnl Check endianess even when crosscompiling +dnl (partially based on the original AC_C_BIGENDIAN). +dnl +dnl The implementation will create a binary, and instead of running +dnl the binary it will be grep'ed for some symbols that will look +dnl different for different endianess of the binary. +dnl +dnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp $ +dnl @author Guido Draheim +dnl +AC_DEFUN([AC_C_BIGENDIAN_CROSS], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_TRY_COMPILE([#include +#include ], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include +#include ], [ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, +[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) +fi]) +if test $ac_cv_c_bigendian = unknown; then +AC_MSG_CHECKING(to probe for byte ordering) +[ +cat >conftest.c <&AC_FD_MSG + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG + fi + fi +AC_MSG_RESULT($ac_cv_c_bigendian) +fi +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) + BYTEORDER=4321 +else + BYTEORDER=1234 +fi +AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) +if test $ac_cv_c_bigendian = unknown; then + AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) +fi +]) diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/config.guess --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/config.guess Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1344 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-20' + +# This file 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +##################################################################### +# This file contains changes for Apache, clearly marked below. +# These changes are hereby donated to the public domain. +##################################################################### + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 c99 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; +######################### +# Apache changes +# +# *:OS/390:*:*) +# echo i370-ibm-openedition +# exit 0 ;; + *:OS390:*:* | *:OS/390:*:*) + echo s390-ibm-os390 + exit 0 ;; + *:OS400:*:* | *:OS/400:*:*) + echo as400-ibm-os400 + exit 0 ;; + *:OS/2:*:*) + echo "i386-pc-os2_emx" + exit 0;; +# +# end Apache changes +######################### + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/config.sub --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/config.sub Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1507 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +##################################################################### +# This file contains changes for Apache, clearly marked below. +# These changes are hereby donated to the public domain. +##################################################################### + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +######################## +# changes for Apache +# + tpf | os390 | vmcms) + os=-$maybe_os + basic_machine=s390; + ;; + os400) + os=-$maybe_os + basic_machine=as400; + ;; + mvs) + os=-mvs + basic_machine=i370; + ;; +# +# end Apache changes +######################## + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 | mipsisa64 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; +######################## +# changes for Apache +# + as400*) + basic_machine=as400-ibm + ;; +# +# end Apache changes +######################## + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; +######################## +# changes for Apache +# + -os2_emx | -tpf* | -os390* | -vmcms* | -os400* ) + ;; +# +# end Apache changes +######################## + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; +######################## +# changes for Apache +# +# *-ibm) +# os=-aix +# ;; +# + *-ibm) + case $basic_machine in + s390*) + os=-os390; + ;; + i370*) + os=-mvs; + ;; + as400*) + os=-os400; + ;; + *) + os=-aix + ;; + esac + ;; +# +# end Apache changes +######################## + + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/expat.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/expat.m4 Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,43 @@ +dnl Check if --with-expat[=PREFIX] is specified and +dnl Expat >= 1.95.0 is installed in the system. +dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to +dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX +dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined. +dnl If --with-expat has not been specified, set with_expat to 'no'. +dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly. +dnl This is necessary to adapt a whole lot of packages that have expat +dnl bundled as a static library. +AC_DEFUN(AM_WITH_EXPAT, +[ AC_ARG_WITH(expat, + [ --with-expat=PREFIX Use system Expat library], + , with_expat=no) + + AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no) + + EXPAT_CFLAGS= + EXPAT_LIBS= + if test $with_expat != no; then + if test $with_expat != yes; then + EXPAT_CFLAGS="-I$with_expat/include" + EXPAT_LIBS="-L$with_expat/lib" + fi + AC_CHECK_LIB(expat, XML_ParserCreate, + [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" + expat_found=yes ], + [ expat_found=no ], + "$EXPAT_LIBS") + if test $expat_found = no; then + AC_MSG_ERROR([Could not find the Expat library]) + fi + expat_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $EXPAT_CFLAGS" + AC_CHECK_HEADERS(expat.h, , expat_found=no) + if test $expat_found = no; then + AC_MSG_ERROR([Could not find expat.h]) + fi + CFLAGS="$expat_save_CFLAGS" + fi + + AC_SUBST(EXPAT_CFLAGS) + AC_SUBST(EXPAT_LIBS) +]) diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/install-sh Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/libtool.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/libtool.m4 Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3573 @@ +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## 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. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +## FIXME: this should be a separate macro +## +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) +## +## END FIXME + + +## FIXME: this should be a separate macro +## +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi +## +## END FIXME + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +## FIXME: this should be a separate macro +## +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" +## +## END FIXME + + +## FIXME: this should be a separate macro +## +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi +## +## END FIXME + +## FIXME: this should be a separate macro +## +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +AC_MSG_RESULT([$hardcode_action]) +## +## END FIXME + +## FIXME: this should be a separate macro +## +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +## +## END FIXME + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +## FIXME: this should be a separate macro +## +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +## +## END FIXME + +## FIXME: this should be a separate macro +## +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) +## +## END FIXME + +## FIXME: this should be a separate macro +## +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) +## +## END FIXME + +## FIXME: this should be a separate macro +## +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) +## +## END FIXME + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +## FIXME: this should be a separate macro +## +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} +## +## END FIXME + +## FIXME: this should be a separate macro +## +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi +## +## END FIXME + +])# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | [[A-Za-z]]:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +# AC_PROG_LD_GNU - +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/ltmain.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/ltmain.sh Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,4984 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test $linkmode = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test $pass = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test $pass = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test $pass = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test $pass != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test $pass = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + elif test $linkmode != prog && test $linkmode != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test $pass = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test $pass = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test $linkmode = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test $linkmode = prog && test $pass != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test $linkalldeplibs = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + + if test $linkmode = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test $linkmode = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test $linkmode = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test $linkmode = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test $linkmode = lib; then + if test -n "$dependency_libs" && + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + + if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test $pass = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix) + major=`expr $current - $age + 1` + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test $build_libtool_need_lc = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test $hardcode_into_libs = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test $need_relink = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="cd `pwd`; $relink_command" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test $need_relink = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = ":" && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd='"$cmd"$args' + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test $mode = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test $mode = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/conftools/mkinstalldirs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/conftools/mkinstalldirs Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2000/09/18 16:26:21 coopercc Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/examples/elements.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/examples/elements.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,53 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +/* This is simple demonstration of how to use expat. This program + reads an XML document from standard input and writes a line with + the name of each element to standard output indenting child + elements by one tab stop more than their parent element. +*/ + +#include +#include "expat.h" + +static void +startElement(void *userData, const char *name, const char **atts) +{ + int i; + int *depthPtr = userData; + for (i = 0; i < *depthPtr; i++) + putchar('\t'); + puts(name); + *depthPtr += 1; +} + +static void +endElement(void *userData, const char *name) +{ + int *depthPtr = userData; + *depthPtr -= 1; +} + +int +main(int argc, char *argv[]) +{ + char buf[BUFSIZ]; + XML_Parser parser = XML_ParserCreate(NULL); + int done; + int depth = 0; + XML_SetUserData(parser, &depth); + XML_SetElementHandler(parser, startElement, endElement); + do { + size_t len = fread(buf, 1, sizeof(buf), stdin); + done = len < sizeof(buf); + if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { + fprintf(stderr, + "%s at line %d\n", + XML_ErrorString(XML_GetErrorCode(parser)), + XML_GetCurrentLineNumber(parser)); + return 1; + } + } while (!done); + XML_ParserFree(parser); + return 0; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/examples/outline.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/examples/outline.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,90 @@ +/***************************************************************** + * outline.c + * + * Copyright 1999, Clark Cooper + * All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the license contained in the + * COPYING file that comes with the expat distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Read an XML document from standard input and print an element + * outline on standard output. + */ + + +#include +#include + +#define BUFFSIZE 8192 + +char Buff[BUFFSIZE]; + +int Depth; + +static void +start(void *data, const char *el, const char **attr) +{ + int i; + + for (i = 0; i < Depth; i++) + printf(" "); + + printf("%s", el); + + for (i = 0; attr[i]; i += 2) { + printf(" %s='%s'", attr[i], attr[i + 1]); + } + + printf("\n"); + Depth++; +} + +static void +end(void *data, const char *el) +{ + Depth--; +} + +int +main(int argc, char *argv[]) +{ + XML_Parser p = XML_ParserCreate(NULL); + if (! p) { + fprintf(stderr, "Couldn't allocate memory for parser\n"); + exit(-1); + } + + XML_SetElementHandler(p, start, end); + + for (;;) { + int done; + int len; + + len = fread(Buff, 1, BUFFSIZE, stdin); + if (ferror(stdin)) { + fprintf(stderr, "Read error\n"); + exit(-1); + } + done = feof(stdin); + + if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) { + fprintf(stderr, "Parse error at line %d:\n%s\n", + XML_GetCurrentLineNumber(p), + XML_ErrorString(XML_GetErrorCode(p))); + exit(-1); + } + + if (done) + break; + } + return 0; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/expat_config.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/expat_config.h.in Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,89 @@ +/* expat_config.h.in. Generated from configure.in by autoheader. */ + +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +#undef BYTEORDER + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* whether byteorder is bigendian */ +#undef WORDS_BIGENDIAN + +/* Define to specify how much context to retain around the current parse + point. */ +#undef XML_CONTEXT_BYTES + +/* Define to make parameter entity parsing functionality available. */ +#undef XML_DTD + +/* Define to make XML Namespaces functionality available. */ +#undef XML_NS + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to `unsigned' if does not define. */ +#undef size_t diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/ascii.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/ascii.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#define ASCII_A 0x41 +#define ASCII_B 0x42 +#define ASCII_C 0x43 +#define ASCII_D 0x44 +#define ASCII_E 0x45 +#define ASCII_F 0x46 +#define ASCII_G 0x47 +#define ASCII_H 0x48 +#define ASCII_I 0x49 +#define ASCII_J 0x4A +#define ASCII_K 0x4B +#define ASCII_L 0x4C +#define ASCII_M 0x4D +#define ASCII_N 0x4E +#define ASCII_O 0x4F +#define ASCII_P 0x50 +#define ASCII_Q 0x51 +#define ASCII_R 0x52 +#define ASCII_S 0x53 +#define ASCII_T 0x54 +#define ASCII_U 0x55 +#define ASCII_V 0x56 +#define ASCII_W 0x57 +#define ASCII_X 0x58 +#define ASCII_Y 0x59 +#define ASCII_Z 0x5A + +#define ASCII_a 0x61 +#define ASCII_b 0x62 +#define ASCII_c 0x63 +#define ASCII_d 0x64 +#define ASCII_e 0x65 +#define ASCII_f 0x66 +#define ASCII_g 0x67 +#define ASCII_h 0x68 +#define ASCII_i 0x69 +#define ASCII_j 0x6A +#define ASCII_k 0x6B +#define ASCII_l 0x6C +#define ASCII_m 0x6D +#define ASCII_n 0x6E +#define ASCII_o 0x6F +#define ASCII_p 0x70 +#define ASCII_q 0x71 +#define ASCII_r 0x72 +#define ASCII_s 0x73 +#define ASCII_t 0x74 +#define ASCII_u 0x75 +#define ASCII_v 0x76 +#define ASCII_w 0x77 +#define ASCII_x 0x78 +#define ASCII_y 0x79 +#define ASCII_z 0x7A + +#define ASCII_0 0x30 +#define ASCII_1 0x31 +#define ASCII_2 0x32 +#define ASCII_3 0x33 +#define ASCII_4 0x34 +#define ASCII_5 0x35 +#define ASCII_6 0x36 +#define ASCII_7 0x37 +#define ASCII_8 0x38 +#define ASCII_9 0x39 + +#define ASCII_TAB 0x09 +#define ASCII_SPACE 0x20 +#define ASCII_EXCL 0x21 +#define ASCII_QUOT 0x22 +#define ASCII_AMP 0x26 +#define ASCII_APOS 0x27 +#define ASCII_MINUS 0x2D +#define ASCII_PERIOD 0x2E +#define ASCII_COLON 0x3A +#define ASCII_SEMI 0x3B +#define ASCII_LT 0x3C +#define ASCII_EQUALS 0x3D +#define ASCII_GT 0x3E +#define ASCII_LSQB 0x5B +#define ASCII_RSQB 0x5D +#define ASCII_UNDERSCORE 0x5F diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/asciitab.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/asciitab.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, +/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, +/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, +/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, +/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, +/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, +/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, +/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, +/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, +/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, +/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/expat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/expat.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,912 @@ +/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. + Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +*/ + +#ifndef XmlParse_INCLUDED +#define XmlParse_INCLUDED 1 + +#ifdef __VMS +/* 0 1 2 3 0 1 2 3 + 1234567890123456789012345678901 1234567890123456789012345678901 */ +#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler +#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler +#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler +#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg +#endif + +#include + +#ifndef XMLPARSEAPI +#define XMLPARSEAPI(type) type +#endif /* not defined XMLPARSEAPI */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef XML_UNICODE_WCHAR_T +#define XML_UNICODE +#endif + +struct XML_ParserStruct; +typedef struct XML_ParserStruct *XML_Parser; + +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +#ifdef XML_UNICODE_WCHAR_T +typedef wchar_t XML_Char; +typedef wchar_t XML_LChar; +#else +typedef unsigned short XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE_WCHAR_T */ +#else /* Information is UTF-8 encoded. */ +typedef char XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE */ + +/* Should this be defined using stdbool.h when C99 is available? */ +typedef unsigned char XML_Bool; +#define XML_TRUE ((XML_Bool) 1) +#define XML_FALSE ((XML_Bool) 0) + +enum XML_Error { + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + XML_ERROR_NOT_STANDALONE, + XML_ERROR_UNEXPECTED_STATE, + XML_ERROR_ENTITY_DECLARED_IN_PE, + XML_ERROR_FEATURE_REQUIRES_XML_DTD, + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING +}; + +enum XML_Content_Type { + XML_CTYPE_EMPTY = 1, + XML_CTYPE_ANY, + XML_CTYPE_MIXED, + XML_CTYPE_NAME, + XML_CTYPE_CHOICE, + XML_CTYPE_SEQ +}; + +enum XML_Content_Quant { + XML_CQUANT_NONE, + XML_CQUANT_OPT, + XML_CQUANT_REP, + XML_CQUANT_PLUS +}; + +/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be + XML_CQUANT_NONE, and the other fields will be zero or NULL. + If type == XML_CTYPE_MIXED, then quant will be NONE or REP and + numchildren will contain number of elements that may be mixed in + and children point to an array of XML_Content cells that will be + all of XML_CTYPE_NAME type with no quantification. + + If type == XML_CTYPE_NAME, then the name points to the name, and + the numchildren field will be zero and children will be NULL. The + quant fields indicates any quantifiers placed on the name. + + CHOICE and SEQ will have name NULL, the number of children in + numchildren and children will point, recursively, to an array + of XML_Content cells. + + The EMPTY, ANY, and MIXED types will only occur at top level. +*/ + +typedef struct XML_cp XML_Content; + +struct XML_cp { + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char * name; + unsigned int numchildren; + XML_Content * children; +}; + + +/* This is called for an element declaration. See above for + description of the model argument. It's the caller's responsibility + to free model when finished with it. +*/ +typedef void (*XML_ElementDeclHandler) (void *userData, + const XML_Char *name, + XML_Content *model); + +XMLPARSEAPI(void) +XML_SetElementDeclHandler(XML_Parser parser, + XML_ElementDeclHandler eldecl); + +/* The Attlist declaration handler is called for *each* attribute. So + a single Attlist declaration with multiple attributes declared will + generate multiple calls to this handler. The "default" parameter + may be NULL in the case of the "#IMPLIED" or "#REQUIRED" + keyword. The "isrequired" parameter will be true and the default + value will be NULL in the case of "#REQUIRED". If "isrequired" is + true and default is non-NULL, then this is a "#FIXED" default. +*/ +typedef void (*XML_AttlistDeclHandler) (void *userData, + const XML_Char *elname, + const XML_Char *attname, + const XML_Char *att_type, + const XML_Char *dflt, + int isrequired); + +XMLPARSEAPI(void) +XML_SetAttlistDeclHandler(XML_Parser parser, + XML_AttlistDeclHandler attdecl); + +/* The XML declaration handler is called for *both* XML declarations + and text declarations. The way to distinguish is that the version + parameter will be NULL for text declarations. The encoding + parameter may be NULL for XML declarations. The standalone + parameter will be -1, 0, or 1 indicating respectively that there + was no standalone parameter in the declaration, that it was given + as no, or that it was given as yes. +*/ +typedef void (*XML_XmlDeclHandler) (void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); + +XMLPARSEAPI(void) +XML_SetXmlDeclHandler(XML_Parser parser, + XML_XmlDeclHandler xmldecl); + + +typedef struct { + void *(*malloc_fcn)(void *userData, size_t size); + void *(*realloc_fcn)(void *userData, void *ptr, size_t size); + void (*free_fcn)(void *userData, void *ptr); + void *allocData; +} XML_Memory_Handling_Suite; + +/* Constructs a new parser; encoding is the encoding specified by the + external protocol or NULL if there is none specified. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate(const XML_Char *encoding); + +/* Constructs a new parser and namespace processor. Element type + names and attribute names that belong to a namespace will be + expanded; unprefixed attribute names are never expanded; unprefixed + element type names are expanded only if there is a default + namespace. The expanded name is the concatenation of the namespace + URI, the namespace separator character, and the local part of the + name. If the namespace separator is '\0' then the namespace URI + and the local part will be concatenated without any separator. + When a namespace is not declared, the name and prefix will be + passed through without expansion. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); + + +/* Constructs a new parser using the memory management suit referred to + by memsuite. If memsuite is NULL, then use the standard library memory + suite. If namespaceSeparator is non-NULL it creates a parser with + namespace processing as described above. The character pointed at + will serve as the namespace separator. + + All further memory operations used for the created parser will come from + the given suite. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate_MM(const XML_Char *encoding, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); + +/* Prepare a parser object to be re-used. This is particularly + valuable when memory allocation overhead is disproportionatly high, + such as when a large number of small documnents need to be parsed. + All handlers are cleared from the parser, except for the + unknownEncodingHandler. The parser's external state is re-initialized + except for the values of ns and ns_triplets. + + Added in Expat 1.95.3. +*/ +XMLPARSEAPI(XML_Bool) +XML_ParserReset(XML_Parser parser, const XML_Char *encoding); + +/* atts is array of name/value pairs, terminated by 0; + names and values are 0 terminated. +*/ +typedef void (*XML_StartElementHandler)(void *userData, + const XML_Char *name, + const XML_Char **atts); + +typedef void (*XML_EndElementHandler)(void *userData, + const XML_Char *name); + + +/* s is not 0 terminated. */ +typedef void (*XML_CharacterDataHandler)(void *userData, + const XML_Char *s, + int len); + +/* target and data are 0 terminated */ +typedef void (*XML_ProcessingInstructionHandler)(void *userData, + const XML_Char *target, + const XML_Char *data); + +/* data is 0 terminated */ +typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); + +typedef void (*XML_StartCdataSectionHandler)(void *userData); +typedef void (*XML_EndCdataSectionHandler)(void *userData); + +/* This is called for any characters in the XML document for which + there is no applicable handler. This includes both characters that + are part of markup which is of a kind that is not reported + (comments, markup declarations), or characters that are part of a + construct which could be reported but for which no handler has been + supplied. The characters are passed exactly as they were in the XML + document except that they will be encoded in UTF-8 or UTF-16. + Line boundaries are not normalized. Note that a byte order mark + character is not passed to the default handler. There are no + guarantees about how characters are divided between calls to the + default handler: for example, a comment might be split between + multiple calls. +*/ +typedef void (*XML_DefaultHandler)(void *userData, + const XML_Char *s, + int len); + +/* This is called for the start of the DOCTYPE declaration, before + any DTD or internal subset is parsed. +*/ +typedef void (*XML_StartDoctypeDeclHandler)(void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); + +/* This is called for the start of the DOCTYPE declaration when the + closing > is encountered, but after processing any external + subset. +*/ +typedef void (*XML_EndDoctypeDeclHandler)(void *userData); + +/* This is called for entity declarations. The is_parameter_entity + argument will be non-zero if the entity is a parameter entity, zero + otherwise. + + For internal entities (), value will + be non-NULL and systemId, publicID, and notationName will be NULL. + The value string is NOT nul-terminated; the length is provided in + the value_length argument. Since it is legal to have zero-length + values, do not use this argument to test for internal entities. + + For external entities, value will be NULL and systemId will be + non-NULL. The publicId argument will be NULL unless a public + identifier was provided. The notationName argument will have a + non-NULL value only for unparsed entity declarations. + + Note that is_parameter_entity can't be changed to XML_Bool, since + that would break binary compatibility. +*/ +typedef void (*XML_EntityDeclHandler) (void *userData, + const XML_Char *entityName, + int is_parameter_entity, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +XMLPARSEAPI(void) +XML_SetEntityDeclHandler(XML_Parser parser, + XML_EntityDeclHandler handler); + +/* OBSOLETE -- OBSOLETE -- OBSOLETE + This handler has been superceded by the EntityDeclHandler above. + It is provided here for backward compatibility. + + This is called for a declaration of an unparsed (NDATA) entity. + The base argument is whatever was set by XML_SetBase. The + entityName, systemId and notationName arguments will never be + NULL. The other arguments may be. +*/ +typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +/* This is called for a declaration of notation. The base argument is + whatever was set by XML_SetBase. The notationName will never be + NULL. The other arguments can be. +*/ +typedef void (*XML_NotationDeclHandler)(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* When namespace processing is enabled, these are called once for + each namespace declaration. The call to the start and end element + handlers occur between the calls to the start and end namespace + declaration handlers. For an xmlns attribute, prefix will be + NULL. For an xmlns="" attribute, uri will be NULL. +*/ +typedef void (*XML_StartNamespaceDeclHandler)(void *userData, + const XML_Char *prefix, + const XML_Char *uri); + +typedef void (*XML_EndNamespaceDeclHandler)(void *userData, + const XML_Char *prefix); + +/* This is called if the document is not standalone, that is, it has an + external subset or a reference to a parameter entity, but does not + have standalone="yes". If this handler returns 0, then processing + will not continue, and the parser will return a + XML_ERROR_NOT_STANDALONE error. + If parameter entity parsing is enabled, then in addition to the + conditions above this handler will only be called if the referenced + entity was actually read. +*/ +typedef int (*XML_NotStandaloneHandler)(void *userData); + +/* This is called for a reference to an external parsed general + entity. The referenced entity is not automatically parsed. The + application can parse it immediately or later using + XML_ExternalEntityParserCreate. + + The parser argument is the parser parsing the entity containing the + reference; it can be passed as the parser argument to + XML_ExternalEntityParserCreate. The systemId argument is the + system identifier as specified in the entity declaration; it will + not be NULL. + + The base argument is the system identifier that should be used as + the base for resolving systemId if systemId was relative; this is + set by XML_SetBase; it may be NULL. + + The publicId argument is the public identifier as specified in the + entity declaration, or NULL if none was specified; the whitespace + in the public identifier will have been normalized as required by + the XML spec. + + The context argument specifies the parsing context in the format + expected by the context argument to XML_ExternalEntityParserCreate; + context is valid only until the handler returns, so if the + referenced entity is to be parsed later, it must be copied. + + The handler should return 0 if processing should not continue + because of a fatal error in the handling of the external entity. + In this case the calling parser will return an + XML_ERROR_EXTERNAL_ENTITY_HANDLING error. + + Note that unlike other handlers the first argument is the parser, + not userData. +*/ + +// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // +// Changed to allow entity name reporting for subsequent diversion to skipped entity handler +// 11/9/03 +typedef int (*XML_ExternalEntityRefHandler)(void *userData, const XML_Char *name); +/* +Original form: +typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); +*/ +// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // + +/* This is called in two situations: + 1) An entity reference is encountered for which no declaration + has been read *and* this is not an error. + 2) An internal entity reference is read, but not expanded, because + XML_SetDefaultHandler has been called. + Note: skipped parameter entities in declarations and skipped general + entities in attribute values cannot be reported, because + the event would be out of sync with the reporting of the + declarations or attribute values +*/ +typedef void (*XML_SkippedEntityHandler)(void *userData, + const XML_Char *entityName, + int is_parameter_entity); + +/* This structure is filled in by the XML_UnknownEncodingHandler to + provide information to the parser about encodings that are unknown + to the parser. + + The map[b] member gives information about byte sequences whose + first byte is b. + + If map[b] is c where c is >= 0, then b by itself encodes the + Unicode scalar value c. + + If map[b] is -1, then the byte sequence is malformed. + + If map[b] is -n, where n >= 2, then b is the first byte of an + n-byte sequence that encodes a single Unicode scalar value. + + The data member will be passed as the first argument to the convert + function. + + The convert function is used to convert multibyte sequences; s will + point to a n-byte sequence where map[(unsigned char)*s] == -n. The + convert function must return the Unicode scalar value represented + by this byte sequence or -1 if the byte sequence is malformed. + + The convert function may be NULL if the encoding is a single-byte + encoding, that is if map[b] >= -1 for all bytes b. + + When the parser is finished with the encoding, then if release is + not NULL, it will call release passing it the data member; once + release has been called, the convert function will not be called + again. + + Expat places certain restrictions on the encodings that are supported + using this mechanism. + + 1. Every ASCII character that can appear in a well-formed XML document, + other than the characters + + $@\^`{}~ + + must be represented by a single byte, and that byte must be the + same byte that represents that character in ASCII. + + 2. No character may require more than 4 bytes to encode. + + 3. All characters encoded must have Unicode scalar values <= + 0xFFFF, (i.e., characters that would be encoded by surrogates in + UTF-16 are not allowed). Note that this restriction doesn't + apply to the built-in support for UTF-8 and UTF-16. + + 4. No Unicode character may be encoded by more than one distinct + sequence of bytes. +*/ +typedef struct { + int map[256]; + void *data; + int (*convert)(void *data, const char *s); + void (*release)(void *data); +} XML_Encoding; + +/* This is called for an encoding that is unknown to the parser. + + The encodingHandlerData argument is that which was passed as the + second argument to XML_SetUnknownEncodingHandler. + + The name argument gives the name of the encoding as specified in + the encoding declaration. + + If the callback can provide information about the encoding, it must + fill in the XML_Encoding structure, and return 1. Otherwise it + must return 0. + + If info does not describe a suitable encoding, then the parser will + return an XML_UNKNOWN_ENCODING error. +*/ +typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); + +XMLPARSEAPI(void) +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + +XMLPARSEAPI(void) +XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); + +XMLPARSEAPI(void) +XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); + +XMLPARSEAPI(void) +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler); + +XMLPARSEAPI(void) +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler); +XMLPARSEAPI(void) +XML_SetCommentHandler(XML_Parser parser, + XML_CommentHandler handler); + +XMLPARSEAPI(void) +XML_SetCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end); + +XMLPARSEAPI(void) +XML_SetStartCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start); + +XMLPARSEAPI(void) +XML_SetEndCdataSectionHandler(XML_Parser parser, + XML_EndCdataSectionHandler end); + +/* This sets the default handler and also inhibits expansion of + internal entities. These entity references will be passed to the + default handler, or to the skipped entity handler, if one is set. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler); + +/* This sets the default handler but does not inhibit expansion of + internal entities. The entity reference will not be passed to the + default handler. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandlerExpand(XML_Parser parser, + XML_DefaultHandler handler); + +XMLPARSEAPI(void) +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndDoctypeDeclHandler(XML_Parser parser, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndNamespaceDeclHandler(XML_Parser parser, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetNotStandaloneHandler(XML_Parser parser, + XML_NotStandaloneHandler handler); + +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler); + +/* If a non-NULL value for arg is specified here, then it will be + passed as the first argument to the external entity ref handler + instead of the parser object. +*/ +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); + +XMLPARSEAPI(void) +XML_SetSkippedEntityHandler(XML_Parser parser, + XML_SkippedEntityHandler handler); + +XMLPARSEAPI(void) +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + +/* This can be called within a handler for a start element, end + element, processing instruction or character data. It causes the + corresponding markup to be passed to the default handler. +*/ +XMLPARSEAPI(void) +XML_DefaultCurrent(XML_Parser parser); + +/* If do_nst is non-zero, and namespace processing is in effect, and + a name has a prefix (i.e. an explicit namespace qualifier) then + that name is returned as a triplet in a single string separated by + the separator character specified when the parser was created: URI + + sep + local_name + sep + prefix. + + If do_nst is zero, then namespace information is returned in the + default manner (URI + sep + local_name) whether or not the name + has a prefix. + + Note: Calling XML_SetReturnNSTriplet after XML_Parse or + XML_ParseBuffer has no effect. +*/ + +XMLPARSEAPI(void) +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); + +/* This value is passed as the userData argument to callbacks. */ +XMLPARSEAPI(void) +XML_SetUserData(XML_Parser parser, void *userData); + +/* Returns the last value set by XML_SetUserData or NULL. */ +#define XML_GetUserData(parser) (*(void **)(parser)) + +/* This is equivalent to supplying an encoding argument to + XML_ParserCreate. On success XML_SetEncoding returns non-zero, + zero otherwise. + Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer + has no effect and returns zero. +*/ +XMLPARSEAPI(int) +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); + +/* If this function is called, then the parser will be passed as the + first argument to callbacks instead of userData. The userData will + still be accessible using XML_GetUserData. +*/ +XMLPARSEAPI(void) +XML_UseParserAsHandlerArg(XML_Parser parser); + +/* If useDTD == XML_TRUE is passed to this function, then the parser + will assume that there is an external subset, even if none is + specified in the document. In such a case the parser will call the + externalEntityRefHandler with a value of NULL for the systemId + argument (the publicId and context arguments will be NULL as well). + Note: If this function is called, then this must be done before + the first call to XML_Parse or XML_ParseBuffer, since it will + have no effect after that. Returns + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. + Note: If the document does not have a DOCTYPE declaration at all, + then startDoctypeDeclHandler and endDoctypeDeclHandler will not + be called, despite an external subset being parsed. + Note: If XML_DTD is not defined when Expat is compiled, returns + XML_ERROR_FEATURE_REQUIRES_XML_DTD. +*/ +XMLPARSEAPI(enum XML_Error) +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); + + +/* Sets the base to be used for resolving relative URIs in system + identifiers in declarations. Resolving relative identifiers is + left to the application: this value will be passed through as the + base argument to the XML_ExternalEntityRefHandler, + XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base + argument will be copied. Returns zero if out of memory, non-zero + otherwise. +*/ +XMLPARSEAPI(int) +XML_SetBase(XML_Parser parser, const XML_Char *base); + +XMLPARSEAPI(const XML_Char *) +XML_GetBase(XML_Parser parser); + +/* Returns the number of the attribute/value pairs passed in last call + to the XML_StartElementHandler that were specified in the start-tag + rather than defaulted. Each attribute/value pair counts as 2; thus + this correspondds to an index into the atts array passed to the + XML_StartElementHandler. +*/ +XMLPARSEAPI(int) +XML_GetSpecifiedAttributeCount(XML_Parser parser); + +/* Returns the index of the ID attribute passed in the last call to + XML_StartElementHandler, or -1 if there is no ID attribute. Each + attribute/value pair counts as 2; thus this correspondds to an + index into the atts array passed to the XML_StartElementHandler. +*/ +XMLPARSEAPI(int) +XML_GetIdAttributeIndex(XML_Parser parser); + +/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is + detected. The last call to XML_Parse must have isFinal true; len + may be zero for this call (or any other). + + The XML_Status enum gives the possible return values for the + XML_Parse and XML_ParseBuffer functions. Though the return values + for these functions has always been described as a Boolean value, + the implementation, at least for the 1.95.x series, has always + returned exactly one of these values. The preprocessor #defines + are included so this stanza can be added to code that still needs + to support older versions of Expat 1.95.x: + + #ifndef XML_STATUS_OK + #define XML_STATUS_OK 1 + #define XML_STATUS_ERROR 0 + #endif + + Otherwise, the #define hackery is quite ugly and would have been dropped. +*/ +enum XML_Status { + XML_STATUS_ERROR = 0, +#define XML_STATUS_ERROR XML_STATUS_ERROR + XML_STATUS_OK = 1 +#define XML_STATUS_OK XML_STATUS_OK +}; + +XMLPARSEAPI(enum XML_Status) +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); + +XMLPARSEAPI(void *) +XML_GetBuffer(XML_Parser parser, int len); + +XMLPARSEAPI(enum XML_Status) +XML_ParseBuffer(XML_Parser parser, int len, int isFinal); + +/* Creates an XML_Parser object that can parse an external general + entity; context is a '\0'-terminated string specifying the parse + context; encoding is a '\0'-terminated string giving the name of + the externally specified encoding, or NULL if there is no + externally specified encoding. The context string consists of a + sequence of tokens separated by formfeeds (\f); a token consisting + of a name specifies that the general entity of the name is open; a + token of the form prefix=uri specifies the namespace for a + particular prefix; a token of the form =uri specifies the default + namespace. This can be called at any point after the first call to + an ExternalEntityRefHandler so longer as the parser has not yet + been freed. The new parser is completely independent and may + safely be used in a separate thread. The handlers and userData are + initialized from the parser argument. Returns 0 if out of memory. + Otherwise returns a new XML_Parser object. +*/ +XMLPARSEAPI(XML_Parser) +XML_ExternalEntityParserCreate(XML_Parser parser, + const XML_Char *context, + const XML_Char *encoding); + +enum XML_ParamEntityParsing { + XML_PARAM_ENTITY_PARSING_NEVER, + XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, + XML_PARAM_ENTITY_PARSING_ALWAYS +}; + +/* Controls parsing of parameter entities (including the external DTD + subset). If parsing of parameter entities is enabled, then + references to external parameter entities (including the external + DTD subset) will be passed to the handler set with + XML_SetExternalEntityRefHandler. The context passed will be 0. + + Unlike external general entities, external parameter entities can + only be parsed synchronously. If the external parameter entity is + to be parsed, it must be parsed during the call to the external + entity ref handler: the complete sequence of + XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and + XML_ParserFree calls must be made during this call. After + XML_ExternalEntityParserCreate has been called to create the parser + for the external parameter entity (context must be 0 for this + call), it is illegal to make any calls on the old parser until + XML_ParserFree has been called on the newly created parser. + If the library has been compiled without support for parameter + entity parsing (ie without XML_DTD being defined), then + XML_SetParamEntityParsing will return 0 if parsing of parameter + entities is requested; otherwise it will return non-zero. + Note: If XML_SetParamEntityParsing is called after XML_Parse or + XML_ParseBuffer, then it has no effect and will always return 0. +*/ +XMLPARSEAPI(int) +XML_SetParamEntityParsing(XML_Parser parser, + enum XML_ParamEntityParsing parsing); + +/* If XML_Parse or XML_ParseBuffer have returned 0, then + XML_GetErrorCode returns information about the error. +*/ +XMLPARSEAPI(enum XML_Error) +XML_GetErrorCode(XML_Parser parser); + +/* These functions return information about the current parse + location. They may be called when XML_Parse or XML_ParseBuffer + return 0; in this case the location is the location of the + character at which the error was detected. + + They may also be called from any other callback called to report + some parse event; in this the location is the location of the first + of the sequence of characters that generated the event. +*/ +XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser); +XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser); +XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser); + +/* Return the number of bytes in the current event. + Returns 0 if the event is in an internal entity. +*/ +XMLPARSEAPI(int) +XML_GetCurrentByteCount(XML_Parser parser); + +/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets + the integer pointed to by offset to the offset within this buffer + of the current parse position, and sets the integer pointed to by size + to the size of this buffer (the number of input bytes). Otherwise + returns a NULL pointer. Also returns a NULL pointer if a parse isn't + active. + + NOTE: The character pointer returned should not be used outside + the handler that makes the call. +*/ +XMLPARSEAPI(const char *) +XML_GetInputContext(XML_Parser parser, + int *offset, + int *size); + +/* For backwards compatibility with previous versions. */ +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex + +/* Frees memory used by the parser. */ +XMLPARSEAPI(void) +XML_ParserFree(XML_Parser parser); + +/* Returns a string describing the error. */ +XMLPARSEAPI(const XML_LChar *) +XML_ErrorString(enum XML_Error code); + +/* Return a string containing the version number of this expat */ +XMLPARSEAPI(const XML_LChar *) +XML_ExpatVersion(void); + +typedef struct { + int major; + int minor; + int micro; +} XML_Expat_Version; + +/* Return an XML_Expat_Version structure containing numeric version + number information for this version of expat. +*/ +XMLPARSEAPI(XML_Expat_Version) +XML_ExpatVersionInfo(void); + +/* Added in Expat 1.95.5. */ +enum XML_FeatureEnum { + XML_FEATURE_END = 0, + XML_FEATURE_UNICODE, + XML_FEATURE_UNICODE_WCHAR_T, + XML_FEATURE_DTD, + XML_FEATURE_CONTEXT_BYTES, + XML_FEATURE_MIN_SIZE, + XML_FEATURE_SIZEOF_XML_CHAR, + XML_FEATURE_SIZEOF_XML_LCHAR + /* Additional features must be added to the end of this enum. */ +}; + +typedef struct { + enum XML_FeatureEnum feature; + XML_LChar *name; + long int value; +} XML_Feature; + +XMLPARSEAPI(const XML_Feature *) +XML_GetFeatureList(void); + + +/* Expat follows the GNU/Linux convention of odd number minor version for + beta/development releases and even number minor version for stable + releases. Micro is bumped with each release, and set to 0 with each + change to major or minor version. +*/ +#define XML_MAJOR_VERSION 1 +#define XML_MINOR_VERSION 95 +#define XML_MICRO_VERSION 5 + +#ifdef __cplusplus +} +#endif + +#endif /* not XmlParse_INCLUDED */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/iasciitab.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/iasciitab.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ +/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, +/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, +/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, +/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, +/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, +/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, +/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, +/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, +/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, +/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, +/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, +/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, +/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, +/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/internal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/internal.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,49 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +/* internal.h + + Internal definitions used by Expat. This is not needed to compile + client code. + + The following definitions are made: + + FASTCALL -- Used for most internal functions to specify that the + fastest possible calling convention be used. + + inline -- Used for selected internal functions for which inlining + may improve performance on some platforms. +*/ + +#if defined(__GNUC__) +/* Last minute instability reported with egcs on a RedHat Linux 7.3 + box; argh! +*/ +/* #define FASTCALL __attribute__((stdcall, regparm(3))) */ +#elif defined(WIN32) +/* XXX This seems to have an unexpected negative effect on Windows so + we'll disable it for now on that platform. It may be reconsidered + for a future release if it can be made more effective. +*/ +/* #define FASTCALL __fastcall */ +#endif + +#ifndef FASTCALL +#define FASTCALL +#endif + +#ifndef XML_MIN_SIZE +#if !defined(__cplusplus) && !defined(inline) +#ifdef __GNUC__ +#define inline __inline +#endif /* __GNUC__ */ +#endif +#endif /* XML_MIN_SIZE */ + +#ifdef __cplusplus +#define inline inline +#else +#ifndef inline +#define inline +#endif +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/latin1tab.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/latin1tab.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, +/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, +/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, +/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, +/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, +/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, +/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/nametab.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/nametab.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,154 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +static const unsigned namingBitmap[] = { +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, +0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, +0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, +0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, +0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, +0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, +0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, +0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, +0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, +0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, +0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, +0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, +0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, +0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, +0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, +0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, +0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, +0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, +0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, +0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, +0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, +0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, +0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, +0x40000000, 0xF580C900, 0x00000007, 0x02010800, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, +0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, +0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, +0x00000000, 0x00004C40, 0x00000000, 0x00000000, +0x00000007, 0x00000000, 0x00000000, 0x00000000, +0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, +0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, +0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, +0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, +0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, +0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, +0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, +0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, +0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, +0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, +0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, +0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, +0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, +0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, +0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, +0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, +0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, +0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, +0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, +0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, +0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, +0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, +0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, +0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, +0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, +0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, +0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, +0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, +0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, +0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, +}; +static const unsigned char nmstrtPages[] = { +0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, +0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, +0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +static const unsigned char namePages[] = { +0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, +0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, +0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, +0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/utf8tab.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/utf8tab.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + + +/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, +/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, +/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, +/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, +/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, +/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/winconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/winconfig.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +/*================================================================ +** Copyright 2000, Clark Cooper +** All rights reserved. +** +** This is free software. You are permitted to copy, distribute, or modify +** it under the terms of the MIT/X license (contained in the COPYING file +** with this distribution.) +*/ + +#ifndef WINCONFIG_H +#define WINCONFIG_H + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include +#include + +#define XML_NS 1 +#define XML_DTD 1 +#define XML_CONTEXT_BYTES 1024 + +/* we will assume all Windows platforms are little endian */ +#define BYTEORDER 1234 + +/* Windows has memmove() available. */ +#define HAVE_MEMMOVE + +#endif /* ndef WINCONFIG_H */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmlparse.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmlparse.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5695 @@ +/* Copyright (c) 1998, 1999, 2000,Thai Open Source Software Center Ltd + See the file COPYING for copying permission. + Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +*/ + +// This file produces 9 "unreferenced formal parameter" warnings on MS and CW +#if defined(__VC32__) +#pragma warning ( disable : 4100 ) + +#if !defined(_DEBUG) +// This file produces 1 "unreachable code" warning on MS for UREL builds +#pragma warning ( disable : 4702 ) +#endif // _DEBUG + +#elif defined(__CW32__) +#pragma warn_unusedarg off +#endif + +#include +#include /* memset(), memcpy() */ + +#include "expat_config.h" +#include "expat.h" + +#ifdef XML_UNICODE +#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX +#define XmlConvert XmlUtf16Convert +#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding +#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS +#define XmlEncode XmlUtf16Encode +#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) +typedef unsigned short ICHAR; +#else +#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX +#define XmlConvert XmlUtf8Convert +#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding +#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS +#define XmlEncode XmlUtf8Encode +#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) +typedef char ICHAR; +#endif + + +#ifndef XML_NS + +#define XmlInitEncodingNS XmlInitEncoding +#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding +#undef XmlGetInternalEncodingNS +#define XmlGetInternalEncodingNS XmlGetInternalEncoding +#define XmlParseXmlDeclNS XmlParseXmlDecl + +#endif + +#ifdef XML_UNICODE + +#ifdef XML_UNICODE_WCHAR_T +#define XML_T(x) (wchar_t)x +#define XML_L(x) L ## x +#else +#define XML_T(x) (unsigned short)x +#define XML_L(x) x +#endif + +#else + +#define XML_T(x) x +#define XML_L(x) x + +#endif + +/* Round up n to be a multiple of sz, where sz is a power of 2. */ +#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) + +/* Handle the case where memmove() doesn't exist. */ +#ifndef HAVE_MEMMOVE +#ifdef HAVE_BCOPY +#define memmove(d,s,l) bcopy((s),(d),(l)) +#else +#error memmove does not exist on this platform, nor is a substitute available +#endif /* HAVE_BCOPY */ +#endif /* HAVE_MEMMOVE */ + +#include "internal.h" +#include "xmltok.h" +#include "xmlrole.h" + +typedef const XML_Char *KEY; + +typedef struct { + KEY name; +} NAMED; + +typedef struct { + NAMED **v; + size_t size; + size_t used; + size_t usedLim; + XML_Memory_Handling_Suite *mem; +} HASH_TABLE; + +typedef struct { + NAMED **p; + NAMED **end; +} HASH_TABLE_ITER; + +#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ +#define INIT_DATA_BUF_SIZE 1024 +#define INIT_ATTS_SIZE 16 +#define INIT_BLOCK_SIZE 1024 +#define INIT_BUFFER_SIZE 1024 + +#define EXPAND_SPARE 24 + +typedef struct binding { + struct prefix *prefix; + struct binding *nextTagBinding; + struct binding *prevPrefixBinding; + const struct attribute_id *attId; + XML_Char *uri; + int uriLen; + int uriAlloc; +} BINDING; + +typedef struct prefix { + const XML_Char *name; + BINDING *binding; +} PREFIX; + +typedef struct { + const XML_Char *str; + const XML_Char *localPart; + const XML_Char *prefix; + int strLen; + int uriLen; + int prefixLen; +} TAG_NAME; + +/* TAG represents an open element. + The name of the element is stored in both the document and API + encodings. The memory buffer 'buf' is a separately-allocated + memory area which stores the name. During the XML_Parse()/ + XMLParseBuffer() when the element is open, the memory for the 'raw' + version of the name (in the document encoding) is shared with the + document buffer. If the element is open across calls to + XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to + contain the 'raw' name as well. + + A parser re-uses these structures, maintaining a list of allocated + TAG objects in a free list. +*/ +typedef struct tag { + struct tag *parent; /* parent of this element */ + const char *rawName; /* tagName in the original encoding */ + int rawNameLength; + TAG_NAME name; /* tagName in the API encoding */ + char *buf; /* buffer for name components */ + char *bufEnd; /* end of the buffer */ + BINDING *bindings; +} TAG; + +typedef struct { + const XML_Char *name; + const XML_Char *textPtr; + int textLen; + const XML_Char *systemId; + const XML_Char *base; + const XML_Char *publicId; + const XML_Char *notation; + XML_Bool open; + XML_Bool is_param; + XML_Bool is_internal; /* true if declared in internal subset outside PE */ +} ENTITY; + +typedef struct { + enum XML_Content_Type type; + enum XML_Content_Quant quant; + const XML_Char * name; + int firstchild; + int lastchild; + int childcnt; + int nextsib; +} CONTENT_SCAFFOLD; + +#define INIT_SCAFFOLD_ELEMENTS 32 + +typedef struct block { + struct block *next; + int size; + XML_Char s[1]; +} BLOCK; + +typedef struct { + BLOCK *blocks; + BLOCK *freeBlocks; + const XML_Char *end; + XML_Char *ptr; + XML_Char *start; + XML_Memory_Handling_Suite *mem; +} STRING_POOL; + +/* The XML_Char before the name is used to determine whether + an attribute has been specified. */ +typedef struct attribute_id { + XML_Char *name; + PREFIX *prefix; + XML_Bool maybeTokenized; + XML_Bool xmlns; +} ATTRIBUTE_ID; + +typedef struct { + const ATTRIBUTE_ID *id; + XML_Bool isCdata; + const XML_Char *value; +} DEFAULT_ATTRIBUTE; + +typedef struct { + const XML_Char *name; + PREFIX *prefix; + const ATTRIBUTE_ID *idAtt; + int nDefaultAtts; + int allocDefaultAtts; + DEFAULT_ATTRIBUTE *defaultAtts; +} ELEMENT_TYPE; + +typedef struct { + HASH_TABLE generalEntities; + HASH_TABLE elementTypes; + HASH_TABLE attributeIds; + HASH_TABLE prefixes; + STRING_POOL pool; + STRING_POOL entityValuePool; + /* false once a parameter entity reference has been skipped */ + XML_Bool keepProcessing; + /* true once an internal or external PE reference has been encountered; + any external subset is considered an external PE reference */ + XML_Bool hasParamEntityRefs; + XML_Bool standalone; +#ifdef XML_DTD + /* indicates if external PE has been read */ + XML_Bool paramEntityRead; + HASH_TABLE paramEntities; +#endif /* XML_DTD */ + PREFIX defaultPrefix; + /* === scaffolding for building content model === */ + XML_Bool in_eldecl; + CONTENT_SCAFFOLD *scaffold; + unsigned contentStringLen; + unsigned scaffSize; + unsigned scaffCount; + int scaffLevel; + int *scaffIndex; +} DTD; + +typedef struct open_internal_entity { + const char *internalEventPtr; + const char *internalEventEndPtr; + struct open_internal_entity *next; + ENTITY *entity; +} OPEN_INTERNAL_ENTITY; + +typedef enum XML_Error FASTCALL Processor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr); + +static Processor prologProcessor; +static Processor prologInitProcessor; +static Processor contentProcessor; +static Processor cdataSectionProcessor; +#ifdef XML_DTD +static Processor ignoreSectionProcessor; +static Processor externalParEntProcessor; +static Processor externalParEntInitProcessor; +static Processor entityValueProcessor; +static Processor entityValueInitProcessor; +#endif /* XML_DTD */ +static Processor epilogProcessor; +static Processor errorProcessor; +#ifndef SYMBIAN_MIN_SIZE +static Processor externalEntityInitProcessor; +static Processor externalEntityInitProcessor2; +static Processor externalEntityInitProcessor3; +#endif // SYMBIAN_MIN_SIZE +static Processor externalEntityContentProcessor; + +static enum XML_Error FASTCALL +handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); +static enum XML_Error FASTCALL +processXmlDecl(XML_Parser parser, int isGeneralTextEntity, + const char *, const char *); +static enum XML_Error FASTCALL +initializeEncoding(XML_Parser parser); +static enum XML_Error FASTCALL +doProlog(XML_Parser parser, const ENCODING *enc, const char *s, + const char *end, int tok, const char *next, const char **nextPtr); + +#ifdef XML_DTD +static enum XML_Error FASTCALL +processInternalParamEntity(XML_Parser parser, ENTITY *entity); +#endif + +static enum XML_Error FASTCALL +doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, + const char *start, const char *end, const char **endPtr); +static enum XML_Error FASTCALL +doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, + const char *end, const char **nextPtr); +#ifdef XML_DTD +static enum XML_Error FASTCALL +doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, + const char *end, const char **nextPtr); +#endif /* XML_DTD */ +static enum XML_Error FASTCALL +storeAtts(XML_Parser parser, const ENCODING *, + const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); +static int FASTCALL +addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, + const XML_Char *uri, BINDING **bindingsPtr); + +static int FASTCALL +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, + XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, + XML_Parser parser); + +static enum XML_Error FASTCALL +storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, + const char *, const char *, STRING_POOL *); +static enum XML_Error FASTCALL +appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, + const char *, const char *, STRING_POOL *); +static ATTRIBUTE_ID * FASTCALL +getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end); +static int FASTCALL +setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); +static enum XML_Error FASTCALL +storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end); +static int FASTCALL +reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end); +static int FASTCALL +reportComment(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end); +static void FASTCALL +reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end); + +static const XML_Char * FASTCALL getContext(XML_Parser parser); +static XML_Bool FASTCALL +setContext(XML_Parser parser, const XML_Char *context); +static void FASTCALL normalizePublicId(XML_Char *s); +static void FASTCALL dtdInit(DTD *, XML_Parser parser); + +/* do not call if parentParser != NULL */ +static void FASTCALL dtdReset(DTD *, XML_Parser parser); +static void FASTCALL dtdDestroy(DTD *, XML_Parser parser); + +#ifndef SYMBIAN_MIN_SIZE +static int FASTCALL dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser); +static int FASTCALL copyEntityTable(HASH_TABLE *, STRING_POOL *, + const HASH_TABLE *, XML_Parser parser); +#endif // SYMBIAN_MIN_SIZE + +#ifdef XML_DTD +static void FASTCALL dtdSwap(DTD *, DTD *); +#endif /* XML_DTD */ + +static NAMED * FASTCALL +lookup(HASH_TABLE *table, KEY name, size_t createSize); + +static void FASTCALL +hashTableInit(HASH_TABLE *, XML_Memory_Handling_Suite *ms); + +static void FASTCALL hashTableClear(HASH_TABLE *); +static void FASTCALL hashTableDestroy(HASH_TABLE *); +static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); +static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); +static void FASTCALL poolInit(STRING_POOL *, XML_Memory_Handling_Suite *ms); +static void FASTCALL poolClear(STRING_POOL *); +static void FASTCALL poolDestroy(STRING_POOL *); +static XML_Char * FASTCALL +poolAppend(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); +static XML_Char * FASTCALL +poolStoreString(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); + +static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); + +static int FASTCALL nextScaffoldPart(XML_Parser parser); +static XML_Content * FASTCALL build_model(XML_Parser parser); + +static const XML_Char * FASTCALL +poolCopyString(STRING_POOL *pool, const XML_Char *s); + +#ifndef SYMBIAN_MIN_SIZE +static const XML_Char * FASTCALL +poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); +static const XML_Char * FASTCALL +poolAppendString(STRING_POOL *pool, const XML_Char *s); +#endif // SYMBIAN_MIN_SIZE + +static ELEMENT_TYPE * FASTCALL +getElementType(XML_Parser Paraser, const ENCODING *enc, + const char *ptr, const char *end); + +static void FASTCALL +parserInit(XML_Parser parser, const XML_Char *encodingName); + +#define poolStart(pool) ((pool)->start) +#define poolEnd(pool) ((pool)->ptr) +#define poolLength(pool) ((pool)->ptr - (pool)->start) +#define poolChop(pool) ((void)--(pool->ptr)) +#define poolLastChar(pool) (((pool)->ptr)[-1]) +#define poolDiscard(pool) ((pool)->ptr = (pool)->start) +#define poolFinish(pool) ((pool)->start = (pool)->ptr) +#define poolAppendChar(pool, c) \ + (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ + ? 0 \ + : ((*((pool)->ptr)++ = c), 1)) + +struct XML_ParserStruct { + /* The first member must be userData so that the XML_GetUserData + macro works. */ + void *m_userData; + void *m_handlerArg; + char *m_buffer; + XML_Memory_Handling_Suite m_mem; + /* first character to be parsed */ + const char *m_bufferPtr; + /* past last character to be parsed */ + char *m_bufferEnd; + /* allocated end of buffer */ + const char *m_bufferLim; + long m_parseEndByteIndex; + const char *m_parseEndPtr; + XML_Char *m_dataBuf; + XML_Char *m_dataBufEnd; + XML_StartElementHandler m_startElementHandler; + XML_EndElementHandler m_endElementHandler; + XML_CharacterDataHandler m_characterDataHandler; + XML_ProcessingInstructionHandler m_processingInstructionHandler; + XML_CommentHandler m_commentHandler; + XML_StartCdataSectionHandler m_startCdataSectionHandler; + XML_EndCdataSectionHandler m_endCdataSectionHandler; + XML_DefaultHandler m_defaultHandler; + XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; + XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; + XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; + XML_NotationDeclHandler m_notationDeclHandler; + XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; + XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; + XML_NotStandaloneHandler m_notStandaloneHandler; + XML_ExternalEntityRefHandler m_externalEntityRefHandler; + void *m_externalEntityRefHandlerArg; + XML_SkippedEntityHandler m_skippedEntityHandler; + XML_UnknownEncodingHandler m_unknownEncodingHandler; + XML_ElementDeclHandler m_elementDeclHandler; + XML_AttlistDeclHandler m_attlistDeclHandler; + XML_EntityDeclHandler m_entityDeclHandler; + XML_XmlDeclHandler m_xmlDeclHandler; + const ENCODING *m_encoding; + INIT_ENCODING m_initEncoding; + const ENCODING *m_internalEncoding; + const XML_Char *m_protocolEncodingName; + XML_Bool m_ns; + XML_Bool m_ns_triplets; + void *m_unknownEncodingMem; + void *m_unknownEncodingData; + void *m_unknownEncodingHandlerData; + void (*m_unknownEncodingRelease)(void *); + PROLOG_STATE m_prologState; + Processor *m_processor; + enum XML_Error m_errorCode; + const char *m_eventPtr; + const char *m_eventEndPtr; + const char *m_positionPtr; + OPEN_INTERNAL_ENTITY *m_openInternalEntities; + XML_Bool m_defaultExpandInternalEntities; + int m_tagLevel; + ENTITY *m_declEntity; + const XML_Char *m_doctypeName; + const XML_Char *m_doctypeSysid; + const XML_Char *m_doctypePubid; + const XML_Char *m_declAttributeType; + const XML_Char *m_declNotationName; + const XML_Char *m_declNotationPublicId; + ELEMENT_TYPE *m_declElementType; + ATTRIBUTE_ID *m_declAttributeId; + XML_Bool m_declAttributeIsCdata; + XML_Bool m_declAttributeIsId; + DTD m_dtd; + const XML_Char *m_curBase; + TAG *m_tagStack; + TAG *m_freeTagList; + BINDING *m_inheritedBindings; + BINDING *m_freeBindingList; + int m_attsSize; + int m_nSpecifiedAtts; + int m_idAttIndex; + ATTRIBUTE *m_atts; + POSITION m_position; + STRING_POOL m_tempPool; + STRING_POOL m_temp2Pool; + char *m_groupConnector; + unsigned m_groupSize; + XML_Char m_namespaceSeparator; + XML_Parser m_parentParser; +#ifdef XML_DTD + XML_Bool m_isParamEntity; + XML_Bool m_useForeignDTD; + enum XML_ParamEntityParsing m_paramEntityParsing; +#endif +}; + +#define MALLOC(s) ( (parser)->m_mem.malloc_fcn ( ((parser)->m_mem.allocData), (s) ) ) +#define REALLOC(p,s) ( (parser)->m_mem.realloc_fcn ( ((parser)->m_mem.allocData), (p), (s) ) ) +#define FREE(p) ( (parser)->m_mem.free_fcn ( ((parser)->m_mem.allocData), (p) ) ) + +#define userData (parser->m_userData) +#define handlerArg (parser->m_handlerArg) +#define startElementHandler (parser->m_startElementHandler) +#define endElementHandler (parser->m_endElementHandler) +#define characterDataHandler (parser->m_characterDataHandler) +#define processingInstructionHandler \ + (parser->m_processingInstructionHandler) +#define commentHandler (parser->m_commentHandler) +#define startCdataSectionHandler \ + (parser->m_startCdataSectionHandler) +#define endCdataSectionHandler (parser->m_endCdataSectionHandler) +#define defaultHandler (parser->m_defaultHandler) +#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) +#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) +#define unparsedEntityDeclHandler \ + (parser->m_unparsedEntityDeclHandler) +#define notationDeclHandler (parser->m_notationDeclHandler) +#define startNamespaceDeclHandler \ + (parser->m_startNamespaceDeclHandler) +#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) +#define notStandaloneHandler (parser->m_notStandaloneHandler) +#define externalEntityRefHandler \ + (parser->m_externalEntityRefHandler) +#define externalEntityRefHandlerArg \ + (parser->m_externalEntityRefHandlerArg) +#define internalEntityRefHandler \ + (parser->m_internalEntityRefHandler) +#define skippedEntityHandler (parser->m_skippedEntityHandler) +#define unknownEncodingHandler (parser->m_unknownEncodingHandler) +#define elementDeclHandler (parser->m_elementDeclHandler) +#define attlistDeclHandler (parser->m_attlistDeclHandler) +#define entityDeclHandler (parser->m_entityDeclHandler) +#define xmlDeclHandler (parser->m_xmlDeclHandler) +#define encoding (parser->m_encoding) +#define initEncoding (parser->m_initEncoding) +#define internalEncoding (parser->m_internalEncoding) +#define unknownEncodingMem (parser->m_unknownEncodingMem) +#define unknownEncodingData (parser->m_unknownEncodingData) +#define unknownEncodingHandlerData \ + (parser->m_unknownEncodingHandlerData) +#define unknownEncodingRelease (parser->m_unknownEncodingRelease) +#define protocolEncodingName (parser->m_protocolEncodingName) +#define ns (parser->m_ns) +#define ns_triplets (parser->m_ns_triplets) +#define prologState (parser->m_prologState) +#define processor (parser->m_processor) +#define errorCode (parser->m_errorCode) +#define eventPtr (parser->m_eventPtr) +#define eventEndPtr (parser->m_eventEndPtr) +#define positionPtr (parser->m_positionPtr) +#define position (parser->m_position) +#define openInternalEntities (parser->m_openInternalEntities) +#define defaultExpandInternalEntities \ + (parser->m_defaultExpandInternalEntities) +#define tagLevel (parser->m_tagLevel) +#define buffer (parser->m_buffer) +#define bufferPtr (parser->m_bufferPtr) +#define bufferEnd (parser->m_bufferEnd) +#define parseEndByteIndex (parser->m_parseEndByteIndex) +#define parseEndPtr (parser->m_parseEndPtr) +#define bufferLim (parser->m_bufferLim) +#define dataBuf (parser->m_dataBuf) +#define dataBufEnd (parser->m_dataBufEnd) +#define dtd (parser->m_dtd) +#define curBase (parser->m_curBase) +#define declEntity (parser->m_declEntity) +#define doctypeName (parser->m_doctypeName) +#define doctypeSysid (parser->m_doctypeSysid) +#define doctypePubid (parser->m_doctypePubid) +#define declAttributeType (parser->m_declAttributeType) +#define declNotationName (parser->m_declNotationName) +#define declNotationPublicId (parser->m_declNotationPublicId) +#define declElementType (parser->m_declElementType) +#define declAttributeId (parser->m_declAttributeId) +#define declAttributeIsCdata (parser->m_declAttributeIsCdata) +#define declAttributeIsId (parser->m_declAttributeIsId) +#define freeTagList (parser->m_freeTagList) +#define freeBindingList (parser->m_freeBindingList) +#define inheritedBindings (parser->m_inheritedBindings) +#define tagStack (parser->m_tagStack) +#define atts (parser->m_atts) +#define attsSize (parser->m_attsSize) +#define nSpecifiedAtts (parser->m_nSpecifiedAtts) +#define idAttIndex (parser->m_idAttIndex) +#define tempPool (parser->m_tempPool) +#define temp2Pool (parser->m_temp2Pool) +#define groupConnector (parser->m_groupConnector) +#define groupSize (parser->m_groupSize) +#define namespaceSeparator (parser->m_namespaceSeparator) +#define parentParser (parser->m_parentParser) +#ifdef XML_DTD +#define isParamEntity (parser->m_isParamEntity) +#define useForeignDTD (parser->m_useForeignDTD) +#define paramEntityParsing (parser->m_paramEntityParsing) +#endif /* XML_DTD */ + +#define parsing (processor != prologInitProcessor) + +#ifndef SYMBIAN_MIN_SIZE +XML_Parser +XML_ParserCreate(const XML_Char *encodingName) +{ + return XML_ParserCreate_MM(encodingName, NULL, NULL); +} +#endif // SYMBIAN_MIN_SIZE + +#ifndef SYMBIAN_MIN_SIZE +XML_Parser +XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) +{ + XML_Char tmp[2]; + *tmp = nsSep; + return XML_ParserCreate_MM(encodingName, NULL, tmp); +} +#endif // SYMBIAN_MIN_SIZE + +inline void* internal_malloc(void* allocData, size_t size) +{ return malloc(size); } + +inline void* internal_realloc(void* allocData, void* ptr, size_t size) +{ return realloc(ptr, size); } + +inline void internal_free(void* allocData, void* ptr) +{ free(ptr); } + +XML_Parser +XML_ParserCreate_MM(const XML_Char *encodingName, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *nameSep) { + XML_Parser parser; + static const XML_Char implicitContext[] = { + 'x', 'm', 'l', '=', 'h', 't', 't', 'p', ':', '/', '/', + 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/', + 'X', 'M', 'L', '/', '1', '9', '9', '8', '/', + 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', '\0' + }; + + + if (memsuite) { + XML_Memory_Handling_Suite *mtemp; + parser = (XML_Parser)memsuite->malloc_fcn(memsuite->allocData, sizeof(struct XML_ParserStruct)); + if (parser != NULL) { + mtemp = &(parser->m_mem); + mtemp->malloc_fcn = memsuite->malloc_fcn; + mtemp->realloc_fcn = memsuite->realloc_fcn; + mtemp->free_fcn = memsuite->free_fcn; + mtemp->allocData = memsuite->allocData; + + } + } + else { + XML_Memory_Handling_Suite *mtemp; + parser = (XML_Parser)internal_malloc(0, sizeof(struct XML_ParserStruct)); + if (parser != NULL) { + mtemp = &(parser->m_mem); + mtemp->malloc_fcn = internal_malloc; + mtemp->realloc_fcn = internal_realloc; + mtemp->free_fcn = internal_free; + mtemp->allocData = 0; + } + } + + if (!parser) + return parser; + + buffer = NULL; + bufferLim = NULL; + + attsSize = INIT_ATTS_SIZE; + atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); + if (atts == NULL) { + FREE(parser); + return NULL; + } + dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); + if (dataBuf == NULL) { + FREE(atts); + FREE(parser); + return NULL; + } + dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; + + freeBindingList = NULL; + freeTagList = NULL; + + groupSize = 0; + groupConnector = NULL; + + unknownEncodingHandler = NULL; + unknownEncodingHandlerData = NULL; + + namespaceSeparator = '!'; + ns = XML_FALSE; + ns_triplets = XML_FALSE; + + poolInit(&tempPool, &(parser->m_mem)); + poolInit(&temp2Pool, &(parser->m_mem)); + parserInit(parser, encodingName); + dtdInit(&dtd, parser); + + if (!atts || !dataBuf || (encodingName && !protocolEncodingName)) { + XML_ParserFree(parser); + return NULL; + } + + if (nameSep) { + ns = XML_TRUE; + internalEncoding = XmlGetInternalEncodingNS(); + namespaceSeparator = *nameSep; + + if (!setContext(parser, implicitContext)) { + XML_ParserFree(parser); + return NULL; + } + } + else { + internalEncoding = XmlGetInternalEncoding(); + } + + return parser; +} + +static void FASTCALL +parserInit(XML_Parser parser, const XML_Char *encodingName) +{ + processor = prologInitProcessor; + XmlPrologStateInit(&prologState); + protocolEncodingName = (encodingName != NULL + ? poolCopyString(&tempPool, encodingName) + : NULL); + curBase = NULL; + XmlInitEncoding(&initEncoding, &encoding, 0); + userData = NULL; + handlerArg = NULL; + startElementHandler = NULL; + endElementHandler = NULL; + characterDataHandler = NULL; + processingInstructionHandler = NULL; + commentHandler = NULL; + startCdataSectionHandler = NULL; + endCdataSectionHandler = NULL; + defaultHandler = NULL; + startDoctypeDeclHandler = NULL; + endDoctypeDeclHandler = NULL; + unparsedEntityDeclHandler = NULL; + notationDeclHandler = NULL; + startNamespaceDeclHandler = NULL; + endNamespaceDeclHandler = NULL; + notStandaloneHandler = NULL; + externalEntityRefHandler = NULL; + externalEntityRefHandlerArg = parser; + skippedEntityHandler = NULL; + elementDeclHandler = NULL; + attlistDeclHandler = NULL; + entityDeclHandler = NULL; + xmlDeclHandler = NULL; + bufferPtr = buffer; + bufferEnd = buffer; + parseEndByteIndex = 0; + parseEndPtr = NULL; + declElementType = NULL; + declAttributeId = NULL; + declEntity = NULL; + doctypeName = NULL; + doctypeSysid = NULL; + doctypePubid = NULL; + declAttributeType = NULL; + declNotationName = NULL; + declNotationPublicId = NULL; + declAttributeIsCdata = XML_FALSE; + declAttributeIsId = XML_FALSE; + memset(&position, 0, sizeof(POSITION)); + errorCode = XML_ERROR_NONE; + eventPtr = NULL; + eventEndPtr = NULL; + positionPtr = NULL; + openInternalEntities = 0; + defaultExpandInternalEntities = XML_TRUE; + tagLevel = 0; + tagStack = NULL; + inheritedBindings = NULL; + nSpecifiedAtts = 0; + unknownEncodingMem = NULL; + unknownEncodingRelease = NULL; + unknownEncodingData = NULL; + parentParser = NULL; +#ifdef XML_DTD + isParamEntity = XML_FALSE; + useForeignDTD = XML_FALSE; + paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; +#endif +} + +/* moves list of bindings to freeBindingList */ +static void FASTCALL +moveToFreeBindingList(XML_Parser parser, BINDING *bindings) +{ + while (bindings) { + BINDING *b = bindings; + bindings = bindings->nextTagBinding; + b->nextTagBinding = freeBindingList; + freeBindingList = b; + } +} + +XML_Bool +XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) +{ + TAG *tStk; + if (parentParser) + return XML_FALSE; + /* move tagStack to freeTagList */ + tStk = tagStack; + while (tStk) { + TAG *tag = tStk; + tStk = tStk->parent; + tag->parent = freeTagList; + moveToFreeBindingList(parser, tag->bindings); + tag->bindings = NULL; + freeTagList = tag; + } + moveToFreeBindingList(parser, inheritedBindings); + if (unknownEncodingMem) + FREE(unknownEncodingMem); + if (unknownEncodingRelease) + unknownEncodingRelease(unknownEncodingData); + poolClear(&tempPool); + poolClear(&temp2Pool); + parserInit(parser, encodingName); + dtdReset(&dtd, parser); + return XML_TRUE; +} + +#ifndef SYMBIAN_MIN_SIZE +int +XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) +{ + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parsing) + return 0; + if (encodingName == NULL) + protocolEncodingName = NULL; + else { + protocolEncodingName = poolCopyString(&tempPool, encodingName); + if (!protocolEncodingName) + return 0; + } + return 1; +} +#endif // SYMBIAN_MIN_SIZE + +#ifndef SYMBIAN_MIN_SIZE +XML_Parser +XML_ExternalEntityParserCreate(XML_Parser oldParser, + const XML_Char *context, + const XML_Char *encodingName) +{ + XML_Parser parser = oldParser; + DTD *oldDtd = &dtd; + XML_StartElementHandler oldStartElementHandler = startElementHandler; + XML_EndElementHandler oldEndElementHandler = endElementHandler; + XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; + XML_ProcessingInstructionHandler oldProcessingInstructionHandler + = processingInstructionHandler; + XML_CommentHandler oldCommentHandler = commentHandler; + XML_StartCdataSectionHandler oldStartCdataSectionHandler + = startCdataSectionHandler; + XML_EndCdataSectionHandler oldEndCdataSectionHandler + = endCdataSectionHandler; + XML_DefaultHandler oldDefaultHandler = defaultHandler; + XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler + = unparsedEntityDeclHandler; + XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; + XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler + = startNamespaceDeclHandler; + XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler + = endNamespaceDeclHandler; + XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; + XML_ExternalEntityRefHandler oldExternalEntityRefHandler + = externalEntityRefHandler; + XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; + XML_UnknownEncodingHandler oldUnknownEncodingHandler + = unknownEncodingHandler; + XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; + XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; + XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; + XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; + ELEMENT_TYPE * oldDeclElementType = declElementType; + + void *oldUserData = userData; + void *oldHandlerArg = handlerArg; + XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; + void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; +#ifdef XML_DTD + int oldParamEntityParsing = paramEntityParsing; + int oldInEntityValue = prologState.inEntityValue; +#endif + XML_Bool oldns_triplets = ns_triplets; + + /* Note that the magical uses of the pre-processor to make field + access look more like C++ require that `parser' be overwritten + here. This makes this function more painful to follow than it + would be otherwise. + */ + if (ns) { + XML_Char tmp[2]; + + *tmp = namespaceSeparator; + parser = XML_ParserCreate_MM(encodingName, &parser->m_mem, + tmp); + } + else { + parser = XML_ParserCreate_MM(encodingName, &parser->m_mem, + NULL); + } + + if (!parser) + return NULL; + + startElementHandler = oldStartElementHandler; + endElementHandler = oldEndElementHandler; + characterDataHandler = oldCharacterDataHandler; + processingInstructionHandler = oldProcessingInstructionHandler; + commentHandler = oldCommentHandler; + startCdataSectionHandler = oldStartCdataSectionHandler; + endCdataSectionHandler = oldEndCdataSectionHandler; + defaultHandler = oldDefaultHandler; + unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; + notationDeclHandler = oldNotationDeclHandler; + startNamespaceDeclHandler = oldStartNamespaceDeclHandler; + endNamespaceDeclHandler = oldEndNamespaceDeclHandler; + notStandaloneHandler = oldNotStandaloneHandler; + externalEntityRefHandler = oldExternalEntityRefHandler; + skippedEntityHandler = oldSkippedEntityHandler; + unknownEncodingHandler = oldUnknownEncodingHandler; + elementDeclHandler = oldElementDeclHandler; + attlistDeclHandler = oldAttlistDeclHandler; + entityDeclHandler = oldEntityDeclHandler; + xmlDeclHandler = oldXmlDeclHandler; + declElementType = oldDeclElementType; + userData = oldUserData; + if (oldUserData == oldHandlerArg) + handlerArg = userData; + else + handlerArg = parser; + if (oldExternalEntityRefHandlerArg != oldParser) + externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; + defaultExpandInternalEntities = oldDefaultExpandInternalEntities; + ns_triplets = oldns_triplets; + parentParser = oldParser; +#ifdef XML_DTD + paramEntityParsing = oldParamEntityParsing; + prologState.inEntityValue = oldInEntityValue; + if (context) { +#endif /* XML_DTD */ + if (!dtdCopy(&dtd, oldDtd, parser) || !setContext(parser, context)) { + XML_ParserFree(parser); + return NULL; + } + processor = externalEntityInitProcessor; +#ifdef XML_DTD + } + else { + dtdSwap(&dtd, oldDtd); + isParamEntity = XML_TRUE; + XmlPrologStateInitExternalEntity(&prologState); + processor = externalParEntInitProcessor; + } +#endif /* XML_DTD */ + return parser; +} +#endif // SYMBIAN_MIN_SIZE + +static void FASTCALL +destroyBindings(BINDING *bindings, XML_Parser parser) +{ + for (;;) { + BINDING *b = bindings; + if (!b) + break; + bindings = b->nextTagBinding; + FREE(b->uri); + FREE(b); + } +} + +void +XML_ParserFree(XML_Parser parser) +{ + for (;;) { + TAG *p; + if (tagStack == 0) { + if (freeTagList == NULL) + break; + tagStack = freeTagList; + freeTagList = NULL; + } + p = tagStack; + tagStack = tagStack->parent; + FREE(p->buf); + destroyBindings(p->bindings, parser); + FREE(p); + } + destroyBindings(freeBindingList, parser); + destroyBindings(inheritedBindings, parser); + poolDestroy(&tempPool); + poolDestroy(&temp2Pool); +#ifdef XML_DTD + if (isParamEntity) + dtdSwap(&dtd, &parentParser->m_dtd); +#endif /* XML_DTD */ + dtdDestroy(&dtd, parser); + FREE((void *)atts); + if (groupConnector) + FREE(groupConnector); + if (buffer) + FREE(buffer); + FREE(dataBuf); + if (unknownEncodingMem) + FREE(unknownEncodingMem); + if (unknownEncodingRelease) + unknownEncodingRelease(unknownEncodingData); + FREE(parser); +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_UseParserAsHandlerArg(XML_Parser parser) +{ + handlerArg = parser; +} + +enum XML_Error +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) +{ +#ifdef XML_DTD + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parsing) + return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; + useForeignDTD = useDTD; + return XML_ERROR_NONE; +#else + return XML_ERROR_FEATURE_REQUIRES_XML_DTD; +#endif +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) +{ + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parsing) + return; + ns_triplets = (XML_Bool)(do_nst ? XML_TRUE : XML_FALSE); +} + +void +XML_SetUserData(XML_Parser parser, void *p) +{ + if (handlerArg == userData) + handlerArg = userData = p; + else + userData = p; +} + +#ifndef SYMBIAN_MIN_SIZE +int +XML_SetBase(XML_Parser parser, const XML_Char *p) +{ + if (p) { + p = poolCopyString(&dtd.pool, p); + if (!p) + return 0; + curBase = p; + } + else + curBase = NULL; + return 1; +} + +const XML_Char * +XML_GetBase(XML_Parser parser) +{ + return curBase; +} + +int +XML_GetSpecifiedAttributeCount(XML_Parser parser) +{ + return nSpecifiedAtts; +} + +int +XML_GetIdAttributeIndex(XML_Parser parser) +{ + return idAttIndex; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end) +{ + startElementHandler = start; + endElementHandler = end; +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_SetStartElementHandler(XML_Parser parser, + XML_StartElementHandler start) { + startElementHandler = start; +} + +void +XML_SetEndElementHandler(XML_Parser parser, + XML_EndElementHandler end) { + endElementHandler = end; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler) +{ + characterDataHandler = handler; +} + +void +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler) +{ + processingInstructionHandler = handler; +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_SetCommentHandler(XML_Parser parser, + XML_CommentHandler handler) +{ + commentHandler = handler; +} + +void +XML_SetCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end) +{ + startCdataSectionHandler = start; + endCdataSectionHandler = end; +} + +void +XML_SetStartCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start) { + startCdataSectionHandler = start; +} + +void +XML_SetEndCdataSectionHandler(XML_Parser parser, + XML_EndCdataSectionHandler end) { + endCdataSectionHandler = end; +} + +void +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler) +{ + defaultHandler = handler; + defaultExpandInternalEntities = XML_FALSE; +} + +void +XML_SetDefaultHandlerExpand(XML_Parser parser, + XML_DefaultHandler handler) +{ + defaultHandler = handler; + defaultExpandInternalEntities = XML_TRUE; +} + +void +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end) +{ + startDoctypeDeclHandler = start; + endDoctypeDeclHandler = end; +} + +void +XML_SetStartDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start) { + startDoctypeDeclHandler = start; +} + +void +XML_SetEndDoctypeDeclHandler(XML_Parser parser, + XML_EndDoctypeDeclHandler end) { + endDoctypeDeclHandler = end; +} + +void +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler) +{ + unparsedEntityDeclHandler = handler; +} + +void +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler) +{ + notationDeclHandler = handler; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end) +{ + startNamespaceDeclHandler = start; + endNamespaceDeclHandler = end; +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_SetStartNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start) { + startNamespaceDeclHandler = start; +} + +void +XML_SetEndNamespaceDeclHandler(XML_Parser parser, + XML_EndNamespaceDeclHandler end) { + endNamespaceDeclHandler = end; +} + +void +XML_SetNotStandaloneHandler(XML_Parser parser, + XML_NotStandaloneHandler handler) +{ + notStandaloneHandler = handler; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler) +{ + externalEntityRefHandler = handler; +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) +{ + if (arg) + externalEntityRefHandlerArg = arg; + else + externalEntityRefHandlerArg = parser; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetSkippedEntityHandler(XML_Parser parser, + XML_SkippedEntityHandler handler) +{ + skippedEntityHandler = handler; +} + +#ifndef SYMBIAN_MIN_SIZE +void +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *data) +{ + unknownEncodingHandler = handler; + unknownEncodingHandlerData = data; +} + +void +XML_SetElementDeclHandler(XML_Parser parser, + XML_ElementDeclHandler eldecl) +{ + elementDeclHandler = eldecl; +} + +void +XML_SetAttlistDeclHandler(XML_Parser parser, + XML_AttlistDeclHandler attdecl) +{ + attlistDeclHandler = attdecl; +} + +void +XML_SetEntityDeclHandler(XML_Parser parser, + XML_EntityDeclHandler handler) +{ + entityDeclHandler = handler; +} +#endif // SYMBIAN_MIN_SIZE + +void +XML_SetXmlDeclHandler(XML_Parser parser, + XML_XmlDeclHandler handler) { + xmlDeclHandler = handler; +} + +#ifndef SYMBIAN_MIN_SIZE +int +XML_SetParamEntityParsing(XML_Parser parser, + enum XML_ParamEntityParsing peParsing) +{ + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parsing) + return 0; +#ifdef XML_DTD + paramEntityParsing = peParsing; + return 1; +#else + return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; +#endif +} + +enum XML_Status +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) +{ + if (len == 0) { + if (!isFinal) + return XML_STATUS_OK; + positionPtr = bufferPtr; + errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0); + if (errorCode == XML_ERROR_NONE) + return XML_STATUS_OK; + eventEndPtr = eventPtr; + processor = errorProcessor; + return XML_STATUS_ERROR; + } +#ifndef XML_CONTEXT_BYTES + else if (bufferPtr == bufferEnd) { + const char *end; + int nLeftOver; + parseEndByteIndex += len; + positionPtr = s; + if (isFinal) { + errorCode = processor(parser, s, parseEndPtr = s + len, 0); + if (errorCode == XML_ERROR_NONE) + return XML_STATUS_OK; + eventEndPtr = eventPtr; + processor = errorProcessor; + return XML_STATUS_ERROR; + } + errorCode = processor(parser, s, parseEndPtr = s + len, &end); + if (errorCode != XML_ERROR_NONE) { + eventEndPtr = eventPtr; + processor = errorProcessor; + return XML_STATUS_ERROR; + } + XmlUpdatePosition(encoding, positionPtr, end, &position); + nLeftOver = s + len - end; + if (nLeftOver) { + if (buffer == NULL || nLeftOver > bufferLim - buffer) { + /* FIXME avoid integer overflow */ + char *temp; + temp = buffer == NULL ? MALLOC(len * 2) : REALLOC(buffer, len * 2); + if (temp == NULL) { + errorCode = XML_ERROR_NO_MEMORY; + return XML_STATUS_ERROR; + } + buffer = temp; + if (!buffer) { + errorCode = XML_ERROR_NO_MEMORY; + eventPtr = eventEndPtr = NULL; + processor = errorProcessor; + return XML_STATUS_ERROR; + } + bufferLim = buffer + len * 2; + } + memcpy(buffer, end, nLeftOver); + bufferPtr = buffer; + bufferEnd = buffer + nLeftOver; + } + return XML_STATUS_OK; + } +#endif /* not defined XML_CONTEXT_BYTES */ + else { + void *buff = XML_GetBuffer(parser, len); + if (buff == NULL) + return XML_STATUS_ERROR; + else { + memcpy(buff, s, len); + return XML_ParseBuffer(parser, len, isFinal); + } + } +} +#endif // SYMBIAN_MIN_SIZE + +enum XML_Status +XML_ParseBuffer(XML_Parser parser, int len, int isFinal) +{ + const char *start = bufferPtr; + positionPtr = start; + bufferEnd += len; + parseEndByteIndex += len; + errorCode = processor(parser, start, parseEndPtr = bufferEnd, + isFinal ? (const char **)NULL : &bufferPtr); + if (errorCode == XML_ERROR_NONE) { + if (!isFinal) + XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); + return XML_STATUS_OK; + } + else { + eventEndPtr = eventPtr; + processor = errorProcessor; + return XML_STATUS_ERROR; + } +} + +void * +XML_GetBuffer(XML_Parser parser, int len) +{ + if (len > bufferLim - bufferEnd) { + /* FIXME avoid integer overflow */ + int neededSize = len + (bufferEnd - bufferPtr); +#ifdef XML_CONTEXT_BYTES + int keep = bufferPtr - buffer; + + if (keep > XML_CONTEXT_BYTES) + keep = XML_CONTEXT_BYTES; + neededSize += keep; +#endif /* defined XML_CONTEXT_BYTES */ + if (neededSize <= bufferLim - buffer) { +#ifdef XML_CONTEXT_BYTES + if (keep < bufferPtr - buffer) { + int offset = (bufferPtr - buffer) - keep; + memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); + bufferEnd -= offset; + bufferPtr -= offset; + } +#else + memmove(buffer, bufferPtr, bufferEnd - bufferPtr); + bufferEnd = buffer + (bufferEnd - bufferPtr); + bufferPtr = buffer; +#endif /* not defined XML_CONTEXT_BYTES */ + } + else { + char *newBuf; + int bufferSize = bufferLim - bufferPtr; + // If the XML file is Very Big and corrupt,then bufferSize would increase drastically + //as the bufferLim incrases and BufferPtr doesnt move.Hence To Avoid XML_ERROR_NO_MEMORY + //the bufferPtr is set to bufferEnd and bufferSize is controlled/Reset.The UpperLimit for bufferSize for + // Wrong Parsed buffer has been set to 8KB. + if(bufferSize>=0X2000) + { + bufferPtr=bufferEnd; + bufferSize=2048; + newBuf = (char *)MALLOC(bufferSize); + if (newBuf == 0) + { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } + } + else + { + if (bufferSize == 0) + bufferSize = INIT_BUFFER_SIZE; + do { + bufferSize *= 2; + } while (bufferSize < neededSize); + newBuf = (char *)MALLOC(bufferSize); + if (newBuf == 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } + + } + bufferLim = newBuf + bufferSize; +#ifdef XML_CONTEXT_BYTES + if (bufferPtr) { + int keep = bufferPtr - buffer; + if (keep > XML_CONTEXT_BYTES) + keep = XML_CONTEXT_BYTES; + memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); + FREE(buffer); + buffer = newBuf; + bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; + bufferPtr = buffer + keep; + } + else { + bufferEnd = newBuf + (bufferEnd - bufferPtr); + bufferPtr = buffer = newBuf; + } +#else + if (bufferPtr) { + memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); + FREE(buffer); + } + bufferEnd = newBuf + (bufferEnd - bufferPtr); + bufferPtr = buffer = newBuf; +#endif /* not defined XML_CONTEXT_BYTES */ + } + } + return bufferEnd; +} + +enum XML_Error +XML_GetErrorCode(XML_Parser parser) +{ + return errorCode; +} + +#ifndef SYMBIAN_MIN_SIZE +long +XML_GetCurrentByteIndex(XML_Parser parser) +{ + if (eventPtr) + return parseEndByteIndex - (parseEndPtr - eventPtr); + return -1; +} + +int +XML_GetCurrentByteCount(XML_Parser parser) +{ + if (eventEndPtr && eventPtr) + return eventEndPtr - eventPtr; + return 0; +} + +const char * +XML_GetInputContext(XML_Parser parser, int *offset, int *size) +{ +#ifdef XML_CONTEXT_BYTES + if (eventPtr && buffer) { + *offset = eventPtr - buffer; + *size = bufferEnd - buffer; + return buffer; + } +#endif /* defined XML_CONTEXT_BYTES */ + return (char *) 0; +} + +int +XML_GetCurrentLineNumber(XML_Parser parser) +{ + if (eventPtr) { + XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); + positionPtr = eventPtr; + } + return position.lineNumber + 1; +} + +int +XML_GetCurrentColumnNumber(XML_Parser parser) +{ + if (eventPtr) { + XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); + positionPtr = eventPtr; + } + return position.columnNumber; +} + +void +XML_DefaultCurrent(XML_Parser parser) +{ + if (defaultHandler) { + if (openInternalEntities) + reportDefault(parser, + internalEncoding, + openInternalEntities->internalEventPtr, + openInternalEntities->internalEventEndPtr); + else + reportDefault(parser, encoding, eventPtr, eventEndPtr); + } +} + +const XML_LChar * +XML_ErrorString(enum XML_Error code) +{ + static const XML_LChar *const message[] = { + 0, + XML_L("out of memory"), + XML_L("syntax error"), + XML_L("no element found"), + XML_L("not well-formed (invalid token)"), + XML_L("unclosed token"), + XML_L("partial character"), + XML_L("mismatched tag"), + XML_L("duplicate attribute"), + XML_L("junk after document element"), + XML_L("illegal parameter entity reference"), + XML_L("undefined entity"), + XML_L("recursive entity reference"), + XML_L("asynchronous entity"), + XML_L("reference to invalid character number"), + XML_L("reference to binary entity"), + XML_L("reference to external entity in attribute"), + XML_L("xml declaration not at start of external entity"), + XML_L("unknown encoding"), + XML_L("encoding specified in XML declaration is incorrect"), + XML_L("unclosed CDATA section"), + XML_L("error in processing external entity reference"), + XML_L("document is not standalone"), + XML_L("unexpected parser state - please send a bug report"), + XML_L("entity declared in parameter entity"), + XML_L("requested feature requires XML_DTD support in Expat"), + XML_L("cannot change setting once parsing has begun") + }; + if (code > 0 && code < sizeof(message)/sizeof(message[0])) + return message[code]; + return NULL; +} + +const XML_LChar * +XML_ExpatVersion(void) { + + /* V1 is used to string-ize the version number. However, it would + string-ize the actual version macro *names* unless we get them + substituted before being passed to V1. CPP is defined to expand + a macro, then rescan for more expansions. Thus, we use V2 to expand + the version macros, then CPP will expand the resulting V1() macro + with the correct numerals. */ + /* ### I'm assuming cpp is portable in this respect... */ + +#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) +#define V2(a,b,c) XML_L("expat_")V1(a,b,c) + + return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); + +#undef V1 +#undef V2 +} + +XML_Expat_Version +XML_ExpatVersionInfo(void) +{ + XML_Expat_Version version; + + version.major = XML_MAJOR_VERSION; + version.minor = XML_MINOR_VERSION; + version.micro = XML_MICRO_VERSION; + + return version; +} + +const XML_Feature * +XML_GetFeatureList(void) +{ + static const XML_Feature features[] = { + {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), sizeof(XML_Char)}, + {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), sizeof(XML_LChar)}, +#ifdef XML_UNICODE + {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")}, +#endif +#ifdef XML_UNICODE_WCHAR_T + {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")}, +#endif +#ifdef XML_DTD + {XML_FEATURE_DTD, XML_L("XML_DTD")}, +#endif +#ifdef XML_CONTEXT_BYTES + {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), + XML_CONTEXT_BYTES}, +#endif +#ifdef XML_MIN_SIZE + {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE")}, +#endif + {XML_FEATURE_END, NULL} + }; + + return features; +} +#endif // SYMBIAN_MIN_SIZE + +/* Initially tag->rawName always points into the parse buffer; + for those TAG instances opened while the current parse buffer was + processed, and not yet closed, we need to store tag->rawName in a more + permanent location, since the parse buffer is about to be discarded. +*/ +static XML_Bool FASTCALL +storeRawNames(XML_Parser parser) +{ + TAG *tag = tagStack; + while (tag) { + int bufSize; + int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); + char *rawNameBuf = tag->buf + nameLen; + /* Stop if already stored. Since tagStack is a stack, we can stop + at the first entry that has already been copied; everything + below it in the stack is already been accounted for in a + previous call to this function. + */ + if (tag->rawName == rawNameBuf) + break; + /* For re-use purposes we need to ensure that the + size of tag->buf is a multiple of sizeof(XML_Char). + */ + bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); + if (bufSize > tag->bufEnd - tag->buf) { + char *temp = (char *)REALLOC(tag->buf, bufSize); + if (temp == NULL) + return XML_FALSE; + if(tag->name.str == (XML_Char *)tag->buf) + tag->name.str = (XML_Char *)temp; + if(tag->name.localPart) + tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - (XML_Char *)tag->buf); + tag->buf = temp; + tag->bufEnd = temp + bufSize; + rawNameBuf = temp + nameLen; + } + memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); + tag->rawName = rawNameBuf; + tag = tag->parent; + } + return XML_TRUE; +} + +static enum XML_Error FASTCALL +contentProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = + doContent(parser, 0, encoding, start, end, endPtr); + if (result != XML_ERROR_NONE) + return result; + if (!storeRawNames(parser)) + return XML_ERROR_NO_MEMORY; + return result; +} + +#ifndef SYMBIAN_MIN_SIZE +static enum XML_Error FASTCALL +externalEntityInitProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = initializeEncoding(parser); + if (result != XML_ERROR_NONE) + return result; + processor = externalEntityInitProcessor2; + return externalEntityInitProcessor2(parser, start, end, endPtr); +} + +static enum XML_Error FASTCALL +externalEntityInitProcessor2(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + const char *next = start; /* XmlContentTok doesn't always set the last arg */ + int tok = XmlContentTok(encoding, start, end, &next); + switch (tok) { + case XML_TOK_BOM: + /* If we are at the end of the buffer, this would cause the next stage, + i.e. externalEntityInitProcessor3, to pass control directly to + doContent (by detecting XML_TOK_NONE) without processing any xml text + declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. + */ + if (next == end && endPtr) { + *endPtr = next; + return XML_ERROR_NONE; + } + start = next; + break; + case XML_TOK_PARTIAL: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_PARTIAL_CHAR; + } + processor = externalEntityInitProcessor3; + return externalEntityInitProcessor3(parser, start, end, endPtr); +} + +static enum XML_Error FASTCALL +externalEntityInitProcessor3(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + const char *next = start; /* XmlContentTok doesn't always set the last arg */ + int tok = XmlContentTok(encoding, start, end, &next); + switch (tok) { + case XML_TOK_XML_DECL: + { + enum XML_Error result = processXmlDecl(parser, 1, start, next); + if (result != XML_ERROR_NONE) + return result; + start = next; + } + break; + case XML_TOK_PARTIAL: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + eventPtr = start; + return XML_ERROR_PARTIAL_CHAR; + } + processor = externalEntityContentProcessor; + tagLevel = 1; + return externalEntityContentProcessor(parser, start, end, endPtr); +} +#endif // SYMBIAN_MIN_SIZE + +static enum XML_Error FASTCALL +externalEntityContentProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = + doContent(parser, 1, encoding, start, end, endPtr); + if (result != XML_ERROR_NONE) + return result; + if (!storeRawNames(parser)) + return XML_ERROR_NO_MEMORY; + return result; +} + +static enum XML_Error FASTCALL +doContent(XML_Parser parser, + int startTagLevel, + const ENCODING *enc, + const char *s, + const char *end, + const char **nextPtr) +{ + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + eventEndPP = &eventEndPtr; + } + else { + eventPP = &(openInternalEntities->internalEventPtr); + eventEndPP = &(openInternalEntities->internalEventEndPtr); + } + *eventPP = s; + for (;;) { + const char *next = s; /* XmlContentTok doesn't always set the last arg */ + int tok = XmlContentTok(enc, s, end, &next); + *eventEndPP = next; + switch (tok) { + case XML_TOK_TRAILING_CR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + *eventEndPP = end; + if (characterDataHandler) { + XML_Char c = 0xA; + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, end); + if (startTagLevel == 0) + return XML_ERROR_NO_ELEMENTS; + if (tagLevel != startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + return XML_ERROR_NONE; + case XML_TOK_NONE: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + if (startTagLevel > 0) { + if (tagLevel != startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + return XML_ERROR_NONE; + } + return XML_ERROR_NO_ELEMENTS; + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_ENTITY_REF: + { + const XML_Char *name; + ENTITY *entity; + XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (ch) { + if (characterDataHandler) + characterDataHandler(handlerArg, &ch, 1); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + name = poolStoreString(&dtd.pool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); + poolDiscard(&dtd.pool); + /* First, determine if a check for an existing declaration is needed; + if yes, check that the entity exists, and that it is internal, + otherwise call the skipped entity or default handler. + */ + if (!dtd.hasParamEntityRefs || dtd.standalone) { + if (!entity) + return XML_ERROR_UNDEFINED_ENTITY; + else if (!entity->is_internal) + return XML_ERROR_ENTITY_DECLARED_IN_PE; + } + else if (!entity) { + if (skippedEntityHandler) + skippedEntityHandler(handlerArg, name, 0); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + if (entity->open) + return XML_ERROR_RECURSIVE_ENTITY_REF; + if (entity->notation) + return XML_ERROR_BINARY_ENTITY_REF; + if (entity->textPtr) { + enum XML_Error result; + OPEN_INTERNAL_ENTITY openEntity; + if (!defaultExpandInternalEntities) { + if (skippedEntityHandler) + skippedEntityHandler(handlerArg, entity->name, 0); + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + entity->open = XML_TRUE; + openEntity.next = openInternalEntities; + openInternalEntities = &openEntity; + openEntity.entity = entity; + openEntity.internalEventPtr = NULL; + openEntity.internalEventEndPtr = NULL; + result = doContent(parser, + tagLevel, + internalEncoding, + (char *)entity->textPtr, + (char *)(entity->textPtr + entity->textLen), + 0); + entity->open = XML_FALSE; + openInternalEntities = openEntity.next; + if (result) + return result; + } + else if (externalEntityRefHandler) { + const XML_Char *context; + entity->open = XML_TRUE; + context = getContext(parser); + entity->open = XML_FALSE; + if (!context) + return XML_ERROR_NO_MEMORY; + if (!externalEntityRefHandler(handlerArg, name)) + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + poolDiscard(&tempPool); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + case XML_TOK_START_TAG_WITH_ATTS: + if (!startElementHandler) { + enum XML_Error result = storeAtts(parser, enc, s, 0, 0); + if (result) + return result; + } + /* fall through */ + case XML_TOK_START_TAG_NO_ATTS: + { + TAG *tag; + enum XML_Error result; + XML_Char *toPtr; + if (freeTagList) { + tag = freeTagList; + freeTagList = freeTagList->parent; + } + else { + tag = (TAG *)MALLOC(sizeof(TAG)); + if (!tag) + return XML_ERROR_NO_MEMORY; + tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); + if (!tag->buf) { + FREE(tag); + return XML_ERROR_NO_MEMORY; + } + tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; + } + tag->bindings = NULL; + tag->parent = tagStack; + tagStack = tag; + tag->name.localPart = NULL; + tag->name.prefix = NULL; + tag->rawName = s + enc->minBytesPerChar; + tag->rawNameLength = XmlNameLength(enc, tag->rawName); + ++tagLevel; + { + const char *rawNameEnd = tag->rawName + tag->rawNameLength; + const char *fromPtr = tag->rawName; + toPtr = (XML_Char *)tag->buf; + for (;;) { + int bufSize; + int convLen; + XmlConvert(enc, + &fromPtr, rawNameEnd, + (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); + convLen = toPtr - (XML_Char *)tag->buf; + if (fromPtr == rawNameEnd) { + tag->name.strLen = convLen; + break; + } + bufSize = (tag->bufEnd - tag->buf) << 1; + { + char *temp = (char *)REALLOC(tag->buf, bufSize); + if (temp == NULL) + return XML_ERROR_NO_MEMORY; + tag->buf = temp; + tag->bufEnd = temp + bufSize; + toPtr = (XML_Char *)temp + convLen; + } + } + } + tag->name.str = (XML_Char *)tag->buf; + *toPtr = XML_T('\0'); + if (startElementHandler) { + result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); + if (result) + return result; + startElementHandler(handlerArg, tag->name.str, + (const XML_Char **)atts); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + poolClear(&tempPool); + break; + } + case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: + if (!startElementHandler) { + enum XML_Error result = storeAtts(parser, enc, s, 0, 0); + if (result) + return result; + } + /* fall through */ + case XML_TOK_EMPTY_ELEMENT_NO_ATTS: + if (startElementHandler || endElementHandler) { + const char *rawName = s + enc->minBytesPerChar; + enum XML_Error result; + BINDING *bindings = NULL; + TAG_NAME name; + name.str = poolStoreString(&tempPool, enc, rawName, + rawName + XmlNameLength(enc, rawName)); + if (!name.str) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + result = storeAtts(parser, enc, s, &name, &bindings); + if (result) + return result; + poolFinish(&tempPool); + if (startElementHandler) + startElementHandler(handlerArg, name.str, (const XML_Char **)atts); + if (endElementHandler) { + if (startElementHandler) + *eventPP = *eventEndPP; + endElementHandler(handlerArg, name.str); + } + poolClear(&tempPool); + while (bindings) { + BINDING *b = bindings; + if (endNamespaceDeclHandler) + endNamespaceDeclHandler(handlerArg, b->prefix->name); + bindings = bindings->nextTagBinding; + b->nextTagBinding = freeBindingList; + freeBindingList = b; + b->prefix->binding = b->prevPrefixBinding; + } + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + if (tagLevel == 0) + return epilogProcessor(parser, next, end, nextPtr); + break; + case XML_TOK_END_TAG: + if (tagLevel == startTagLevel) + return XML_ERROR_ASYNC_ENTITY; + else { + int len; + const char *rawName; + TAG *tag = tagStack; + tagStack = tag->parent; + tag->parent = freeTagList; + freeTagList = tag; + rawName = s + enc->minBytesPerChar*2; + len = XmlNameLength(enc, rawName); + if (len != tag->rawNameLength + || memcmp(tag->rawName, rawName, len) != 0) { + *eventPP = rawName; + return XML_ERROR_TAG_MISMATCH; + } + --tagLevel; + if (endElementHandler) { + const XML_Char *localPart; + const XML_Char *prefix; + XML_Char *uri; + localPart = tag->name.localPart; + if (ns && localPart) { + /* localPart and prefix may have been overwritten in + tag->name.str, since this points to the binding->uri + buffer which gets re-used; so we have to add them again + */ + uri = (XML_Char *)tag->name.str + tag->name.uriLen; + /* don't need to check for space - already done in storeAtts() */ + while (*localPart) *uri++ = *localPart++; + prefix = (XML_Char *)tag->name.prefix; + if (ns_triplets && prefix) { + *uri++ = namespaceSeparator; + while (*prefix) *uri++ = *prefix++; + } + *uri = XML_T('\0'); + } + endElementHandler(handlerArg, tag->name.str); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + while (tag->bindings) { + BINDING *b = tag->bindings; + if (endNamespaceDeclHandler) + endNamespaceDeclHandler(handlerArg, b->prefix->name); + tag->bindings = tag->bindings->nextTagBinding; + b->nextTagBinding = freeBindingList; + freeBindingList = b; + b->prefix->binding = b->prevPrefixBinding; + } + if (tagLevel == 0) + return epilogProcessor(parser, next, end, nextPtr); + } + break; + case XML_TOK_CHAR_REF: + { + int n = XmlCharRefNumber(enc, s); + if (n < 0) + return XML_ERROR_BAD_CHAR_REF; + if (characterDataHandler) { + XML_Char buf[XML_ENCODE_MAX]; + characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + } + break; + case XML_TOK_XML_DECL: + return XML_ERROR_MISPLACED_XML_PI; + case XML_TOK_DATA_NEWLINE: + if (characterDataHandler) { + XML_Char c = 0xA; + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_CDATA_SECT_OPEN: + { + enum XML_Error result; + if (startCdataSectionHandler) + startCdataSectionHandler(handlerArg); +#if 0 + /* Suppose you doing a transformation on a document that involves + changing only the character data. You set up a defaultHandler + and a characterDataHandler. The defaultHandler simply copies + characters through. The characterDataHandler does the + transformation and writes the characters out escaping them as + necessary. This case will fail to work if we leave out the + following two lines (because & and < inside CDATA sections will + be incorrectly escaped). + + However, now we have a start/endCdataSectionHandler, so it seems + easier to let the user deal with this. + */ + else if (characterDataHandler) + characterDataHandler(handlerArg, dataBuf, 0); +#endif + else if (defaultHandler) + reportDefault(parser, enc, s, next); + result = doCdataSection(parser, enc, &next, end, nextPtr); + if (!next) { + processor = cdataSectionProcessor; + return result; + } + } + break; + case XML_TOK_TRAILING_RSQB: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + characterDataHandler(handlerArg, dataBuf, + dataPtr - (ICHAR *)dataBuf); + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (XML_Char *)end - (XML_Char *)s); + } + else if (defaultHandler) + reportDefault(parser, enc, s, end); + if (startTagLevel == 0) { + *eventPP = end; + return XML_ERROR_NO_ELEMENTS; + } + if (tagLevel != startTagLevel) { + *eventPP = end; + return XML_ERROR_ASYNC_ENTITY; + } + return XML_ERROR_NONE; + case XML_TOK_DATA_CHARS: + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + characterDataHandler(handlerArg, dataBuf, + dataPtr - (ICHAR *)dataBuf); + if (s == next) + break; + *eventPP = s; + } + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (XML_Char *)next - (XML_Char *)s); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_PI: + if (!reportProcessingInstruction(parser, enc, s, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_COMMENT: + if (!reportComment(parser, enc, s, next)) + return XML_ERROR_NO_MEMORY; + break; + default: + if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + *eventPP = s = next; + } + /* not reached */ +} + +/* If tagNamePtr is non-null, build a real list of attributes, + otherwise just check the attributes for well-formedness. +*/ +static enum XML_Error FASTCALL +storeAtts(XML_Parser parser, const ENCODING *enc, + const char *attStr, TAG_NAME *tagNamePtr, + BINDING **bindingsPtr) +{ + ELEMENT_TYPE *elementType = NULL; + int nDefaultAtts = 0; + const XML_Char **appAtts; /* the attribute list for the application */ + int attIndex = 0; + int prefixLen; + int i; + int n; + XML_Char *uri; + int nPrefixes = 0; + BINDING *binding; + const XML_Char *localPart; + + /* SYMBIAN: the following lines have been modified to correct a "Directly dereferenced + pointer 'tagNamePtr' Coverity error. + */ + if (tagNamePtr) { + /* lookup the element type name */ + elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,0); + if (!elementType) { + const XML_Char* name = poolCopyString(&dtd.pool, tagNamePtr->str); + if (!name) + return XML_ERROR_NO_MEMORY; + elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, name, + sizeof(ELEMENT_TYPE)); + if (!elementType) + return XML_ERROR_NO_MEMORY; + if (ns && !setElementTypePrefix(parser, elementType)) + return XML_ERROR_NO_MEMORY; + + nDefaultAtts = elementType->nDefaultAtts; + } + } + /* SYMBIAN: end */ + + /* get the attributes from the tokenizer */ + n = XmlGetAttributes(enc, attStr, attsSize, atts); + if (n + nDefaultAtts > attsSize) { + int oldAttsSize = attsSize; + ATTRIBUTE *temp; + attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; + temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); + if (temp == NULL) + return XML_ERROR_NO_MEMORY; + atts = temp; + if (n > oldAttsSize) + XmlGetAttributes(enc, attStr, n, atts); + } + appAtts = (const XML_Char **)atts; + for (i = 0; i < n; i++) { + /* add the name and value to the attribute list */ + ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name, + atts[i].name + + XmlNameLength(enc, atts[i].name)); + if (!attId) + return XML_ERROR_NO_MEMORY; + /* detect duplicate attributes */ + if ((attId->name)[-1]) { + if (enc == encoding) + eventPtr = atts[i].name; + return XML_ERROR_DUPLICATE_ATTRIBUTE; + } + (attId->name)[-1] = 1; + appAtts[attIndex++] = attId->name; + if (!atts[i].normalized) { + enum XML_Error result; + XML_Bool isCdata = XML_TRUE; + + /* figure out whether declared as other than CDATA */ + if (attId->maybeTokenized) { + int j; + for (j = 0; j < nDefaultAtts; j++) { + if (attId == elementType->defaultAtts[j].id) { + isCdata = elementType->defaultAtts[j].isCdata; + break; + } + } + } + + /* normalize the attribute value */ + result = storeAttributeValue(parser, enc, isCdata, + atts[i].valuePtr, atts[i].valueEnd, + &tempPool); + if (result) + return result; + if (tagNamePtr) { + appAtts[attIndex] = poolStart(&tempPool); + poolFinish(&tempPool); + } + else + poolDiscard(&tempPool); + } + else if (tagNamePtr) { + /* the value did not need normalizing */ + appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, + atts[i].valueEnd); + if (appAtts[attIndex] == 0) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + } + /* handle prefixed attribute names */ + if (attId->prefix && tagNamePtr) { + if (attId->xmlns) { + /* deal with namespace declarations here */ + if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], + bindingsPtr)) + return XML_ERROR_NO_MEMORY; + --attIndex; + } + else { + /* deal with other prefixed names later */ + attIndex++; + nPrefixes++; + (attId->name)[-1] = 2; + } + } + else + attIndex++; + } + if (tagNamePtr) { + int j; + nSpecifiedAtts = attIndex; + if (elementType->idAtt && (elementType->idAtt->name)[-1]) { + for (i = 0; i < attIndex; i += 2) + if (appAtts[i] == elementType->idAtt->name) { + idAttIndex = i; + break; + } + } + else + idAttIndex = -1; + /* do attribute defaulting */ + for (j = 0; j < nDefaultAtts; j++) { + const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j; + if (!(da->id->name)[-1] && da->value) { + if (da->id->prefix) { + if (da->id->xmlns) { + if (!addBinding(parser, da->id->prefix, da->id, da->value, + bindingsPtr)) + return XML_ERROR_NO_MEMORY; + } + else { + (da->id->name)[-1] = 2; + nPrefixes++; + appAtts[attIndex++] = da->id->name; + appAtts[attIndex++] = da->value; + } + } + else { + (da->id->name)[-1] = 1; + appAtts[attIndex++] = da->id->name; + appAtts[attIndex++] = da->value; + } + } + } + appAtts[attIndex] = 0; + } + i = 0; + if (nPrefixes) { + /* expand prefixed attribute names */ + for (; i < attIndex; i += 2) { + if (appAtts[i][-1] == 2) { + ATTRIBUTE_ID *id; + ((XML_Char *)(appAtts[i]))[-1] = 0; + id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0); + /* SYMBIAN: the following lines have been added to correct a "Variable 'id' assigned + to NULL return value from 'lookup' " error found by Coverity + */ + if (id == NULL) { + return XML_ERROR_NO_MEMORY; + } + /* SYMBIAN: end */ + if (id->prefix->binding) { + int j; + const BINDING *b = id->prefix->binding; + const XML_Char *s = appAtts[i]; + for (j = 0; j < b->uriLen; j++) { + if (!poolAppendChar(&tempPool, b->uri[j])) + return XML_ERROR_NO_MEMORY; + } + while (*s++ != XML_T(':')) + ; + do { + if (!poolAppendChar(&tempPool, *s)) + return XML_ERROR_NO_MEMORY; + } while (*s++); + if (ns_triplets) { + tempPool.ptr[-1] = namespaceSeparator; + s = b->prefix->name; + do { + if (!poolAppendChar(&tempPool, *s)) + return XML_ERROR_NO_MEMORY; + } while (*s++); + } + + appAtts[i] = poolStart(&tempPool); + poolFinish(&tempPool); + } + if (!--nPrefixes) + break; + } + else + ((XML_Char *)(appAtts[i]))[-1] = 0; + } + } + /* clear the flags that say whether attributes were specified */ + for (; i < attIndex; i += 2) + ((XML_Char *)(appAtts[i]))[-1] = 0; + if (!tagNamePtr) + return XML_ERROR_NONE; + for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) + binding->attId->name[-1] = 0; + /* expand the element type name */ + if (elementType->prefix) { + binding = elementType->prefix->binding; + if (!binding) + return XML_ERROR_NONE; + localPart = tagNamePtr->str; + while (*localPart++ != XML_T(':')) + ; + } + else if (dtd.defaultPrefix.binding) { + binding = dtd.defaultPrefix.binding; + localPart = tagNamePtr->str; + } + else + return XML_ERROR_NONE; + prefixLen = 0; + if (ns && ns_triplets && binding->prefix->name) { + for (; binding->prefix->name[prefixLen++];) + ; + } + tagNamePtr->localPart = localPart; + tagNamePtr->uriLen = binding->uriLen; + tagNamePtr->prefix = binding->prefix->name; + tagNamePtr->prefixLen = prefixLen; + for (i = 0; localPart[i++];) + ; + n = i + binding->uriLen + prefixLen; + if (n > binding->uriAlloc) { + TAG *p; + uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); + if (!uri) + return XML_ERROR_NO_MEMORY; + binding->uriAlloc = n + EXPAND_SPARE; + memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); + for (p = tagStack; p; p = p->parent) + if (p->name.str == binding->uri) + p->name.str = uri; + FREE(binding->uri); + binding->uri = uri; + } + uri = binding->uri + binding->uriLen; + memcpy(uri, localPart, i * sizeof(XML_Char)); + if (prefixLen) { + uri = uri + (i - 1); + if (namespaceSeparator) { *(uri) = namespaceSeparator; } + memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); + } + tagNamePtr->str = binding->uri; + return XML_ERROR_NONE; +} + +static int FASTCALL +addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, + const XML_Char *uri, BINDING **bindingsPtr) +{ + BINDING *b; + int len; + for (len = 0; uri[len]; len++) + ; + if (namespaceSeparator) + len++; + if (freeBindingList) { + b = freeBindingList; + if (len > b->uriAlloc) { + XML_Char *temp = (XML_Char *)REALLOC(b->uri, + sizeof(XML_Char) * (len + EXPAND_SPARE)); + if (temp == NULL) + return 0; + b->uri = temp; + b->uriAlloc = len + EXPAND_SPARE; + } + freeBindingList = b->nextTagBinding; + } + else { + b = (BINDING *)MALLOC(sizeof(BINDING)); + if (!b) + return 0; + b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); + if (!b->uri) { + FREE(b); + return 0; + } + b->uriAlloc = len + EXPAND_SPARE; + } + b->uriLen = len; + memcpy(b->uri, uri, len * sizeof(XML_Char)); + if (namespaceSeparator) + b->uri[len - 1] = namespaceSeparator; + b->prefix = prefix; + b->attId = attId; + b->prevPrefixBinding = prefix->binding; + if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix) + prefix->binding = NULL; + else + prefix->binding = b; + b->nextTagBinding = *bindingsPtr; + *bindingsPtr = b; + if (startNamespaceDeclHandler) + startNamespaceDeclHandler(handlerArg, prefix->name, + prefix->binding ? uri : 0); + return 1; +} + +/* The idea here is to avoid using stack for each CDATA section when + the whole file is parsed with one call. +*/ +static enum XML_Error FASTCALL +cdataSectionProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = doCdataSection(parser, encoding, &start, + end, endPtr); + if (start) { + if (parentParser) { /* we are parsing an external entity */ + processor = externalEntityContentProcessor; + return externalEntityContentProcessor(parser, start, end, endPtr); + } + else { + processor = contentProcessor; + return contentProcessor(parser, start, end, endPtr); + } + } + return result; +} + +/* startPtr gets set to non-null is the section is closed, and to null if + the section is not yet closed. +*/ +static enum XML_Error FASTCALL +doCdataSection(XML_Parser parser, + const ENCODING *enc, + const char **startPtr, + const char *end, + const char **nextPtr) +{ + const char *s = *startPtr; + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + *eventPP = s; + eventEndPP = &eventEndPtr; + } + else { + eventPP = &(openInternalEntities->internalEventPtr); + eventEndPP = &(openInternalEntities->internalEventEndPtr); + } + *eventPP = s; + *startPtr = NULL; + for (;;) { + const char *next; + int tok = XmlCdataSectionTok(enc, s, end, &next); + *eventEndPP = next; + switch (tok) { + case XML_TOK_CDATA_SECT_CLOSE: + if (endCdataSectionHandler) + endCdataSectionHandler(handlerArg); +#if 0 + /* see comment under XML_TOK_CDATA_SECT_OPEN */ + else if (characterDataHandler) + characterDataHandler(handlerArg, dataBuf, 0); +#endif + else if (defaultHandler) + reportDefault(parser, enc, s, next); + *startPtr = next; + return XML_ERROR_NONE; + case XML_TOK_DATA_NEWLINE: + if (characterDataHandler) { + XML_Char c = 0xA; + characterDataHandler(handlerArg, &c, 1); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_DATA_CHARS: + if (characterDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = next; + characterDataHandler(handlerArg, dataBuf, + dataPtr - (ICHAR *)dataBuf); + if (s == next) + break; + *eventPP = s; + } + } + else + characterDataHandler(handlerArg, + (XML_Char *)s, + (XML_Char *)next - (XML_Char *)s); + } + else if (defaultHandler) + reportDefault(parser, enc, s, next); + break; + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_PARTIAL: + case XML_TOK_NONE: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_CDATA_SECTION; + default: + *eventPP = next; + return XML_ERROR_UNEXPECTED_STATE; + } + *eventPP = s = next; + } + /* not reached */ +} + +#ifdef XML_DTD + +/* The idea here is to avoid using stack for each IGNORE section when + the whole file is parsed with one call. +*/ +static enum XML_Error FASTCALL +ignoreSectionProcessor(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + enum XML_Error result = doIgnoreSection(parser, encoding, &start, + end, endPtr); + if (start) { + processor = prologProcessor; + return prologProcessor(parser, start, end, endPtr); + } + return result; +} + +/* startPtr gets set to non-null is the section is closed, and to null + if the section is not yet closed. +*/ +static enum XML_Error FASTCALL +doIgnoreSection(XML_Parser parser, + const ENCODING *enc, + const char **startPtr, + const char *end, + const char **nextPtr) +{ + const char *next; + int tok; + const char *s = *startPtr; + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + *eventPP = s; + eventEndPP = &eventEndPtr; + } + else { + eventPP = &(openInternalEntities->internalEventPtr); + eventEndPP = &(openInternalEntities->internalEventEndPtr); + } + *eventPP = s; + *startPtr = NULL; + tok = XmlIgnoreSectionTok(enc, s, end, &next); + *eventEndPP = next; + switch (tok) { + case XML_TOK_IGNORE_SECT: + if (defaultHandler) + reportDefault(parser, enc, s, next); + *startPtr = next; + return XML_ERROR_NONE; + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_PARTIAL: + case XML_TOK_NONE: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ + default: + *eventPP = next; + return XML_ERROR_UNEXPECTED_STATE; + } + /* not reached */ +} + +#endif /* XML_DTD */ + +static enum XML_Error FASTCALL +initializeEncoding(XML_Parser parser) +{ + const char *s; +#ifdef XML_UNICODE + char encodingBuf[128]; + if (!protocolEncodingName) + s = NULL; + else { + int i; + for (i = 0; protocolEncodingName[i]; i++) { + if (i == sizeof(encodingBuf) - 1 + || (protocolEncodingName[i] & ~0x7f) != 0) { + encodingBuf[0] = '\0'; + break; + } + encodingBuf[i] = (char)protocolEncodingName[i]; + } + encodingBuf[i] = '\0'; + s = encodingBuf; + } +#else + s = protocolEncodingName; +#endif + if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) + return XML_ERROR_NONE; + return handleUnknownEncoding(parser, protocolEncodingName); +} + +static enum XML_Error FASTCALL +processXmlDecl(XML_Parser parser, int isGeneralTextEntity, + const char *s, const char *next) +{ + const char *encodingName = NULL; + const XML_Char *storedEncName = NULL; + const ENCODING *newEncoding = NULL; + const char *version = NULL; + const char *versionend; + const XML_Char *storedversion = NULL; + int standalone = -1; + if (!(ns + ? XmlParseXmlDeclNS + : XmlParseXmlDecl)(isGeneralTextEntity, + encoding, + s, + next, + &eventPtr, + &version, + &versionend, + &encodingName, + &newEncoding, + &standalone)) + return XML_ERROR_SYNTAX; + if (!isGeneralTextEntity && standalone == 1) { + dtd.standalone = XML_TRUE; +#ifdef XML_DTD + if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) + paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; +#endif /* XML_DTD */ + } + if (xmlDeclHandler) { + if (encodingName != NULL) { + storedEncName = poolStoreString(&temp2Pool, + encoding, + encodingName, + encodingName + + XmlNameLength(encoding, encodingName)); + if (!storedEncName) + return XML_ERROR_NO_MEMORY; + poolFinish(&temp2Pool); + } + if (version) { + storedversion = poolStoreString(&temp2Pool, + encoding, + version, + versionend - encoding->minBytesPerChar); + if (!storedversion) + return XML_ERROR_NO_MEMORY; + } + xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); + } + else if (defaultHandler) + reportDefault(parser, encoding, s, next); + if (protocolEncodingName == NULL) { + if (newEncoding) { + if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { + eventPtr = encodingName; + return XML_ERROR_INCORRECT_ENCODING; + } + encoding = newEncoding; + } + else if (encodingName) { + enum XML_Error result; + if (!storedEncName) { + storedEncName = poolStoreString( + &temp2Pool, encoding, encodingName, + encodingName + XmlNameLength(encoding, encodingName)); + if (!storedEncName) + return XML_ERROR_NO_MEMORY; + } + result = handleUnknownEncoding(parser, storedEncName); + poolClear(&temp2Pool); + if (result == XML_ERROR_UNKNOWN_ENCODING) + eventPtr = encodingName; + return result; + } + } + + if (storedEncName || storedversion) + poolClear(&temp2Pool); + + return XML_ERROR_NONE; +} + +static enum XML_Error FASTCALL +handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) +{ +#ifndef SYMBIAN_MIN_SIZE + if (unknownEncodingHandler) { + XML_Encoding info; + int i; + for (i = 0; i < 256; i++) + info.map[i] = -1; + info.convert = NULL; + info.data = NULL; + info.release = NULL; + if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, + &info)) { + ENCODING *enc; + unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); + if (!unknownEncodingMem) { + if (info.release) + info.release(info.data); + return XML_ERROR_NO_MEMORY; + } + enc = (ns + ? XmlInitUnknownEncodingNS + : XmlInitUnknownEncoding)(unknownEncodingMem, + info.map, + info.convert, + info.data); + if (enc) { + unknownEncodingData = info.data; + unknownEncodingRelease = info.release; + encoding = enc; + return XML_ERROR_NONE; + } + } + if (info.release != NULL) + info.release(info.data); + } +#endif // SYMBIAN_MIN_SIZE + return XML_ERROR_UNKNOWN_ENCODING; +} + +static enum XML_Error FASTCALL +prologInitProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + enum XML_Error result = initializeEncoding(parser); + if (result != XML_ERROR_NONE) + return result; + processor = prologProcessor; + return prologProcessor(parser, s, end, nextPtr); +} + +#ifdef XML_DTD + +static enum XML_Error FASTCALL +externalParEntInitProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + enum XML_Error result = initializeEncoding(parser); + if (result != XML_ERROR_NONE) + return result; + + /* we know now that XML_Parse(Buffer) has been called, + so we consider the external parameter entity read */ + dtd.paramEntityRead = XML_TRUE; + + if (prologState.inEntityValue) { + processor = entityValueInitProcessor; + return entityValueInitProcessor(parser, s, end, nextPtr); + } + else { + processor = externalParEntProcessor; + return externalParEntProcessor(parser, s, end, nextPtr); + } +} + +static enum XML_Error FASTCALL +entityValueInitProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + const char *start = s; + const char *next = s; + int tok; + + for (;;) { + tok = XmlPrologTok(encoding, start, end, &next); + if (tok <= 0) { + if (nextPtr != 0 && tok != XML_TOK_INVALID) { + *nextPtr = s; + return XML_ERROR_NONE; + } + switch (tok) { + case XML_TOK_INVALID: + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_NONE: /* start == end */ + default: + break; + } + return storeEntityValue(parser, encoding, s, end); + } + else if (tok == XML_TOK_XML_DECL) { + enum XML_Error result = processXmlDecl(parser, 0, start, next); + if (result != XML_ERROR_NONE) + return result; + if (nextPtr) *nextPtr = next; + /* stop scanning for text declaration - we found one */ + processor = entityValueProcessor; + return entityValueProcessor(parser, next, end, nextPtr); + } + /* If we are at the end of the buffer, this would cause XmlPrologTok to + return XML_TOK_NONE on the next call, which would then cause the + function to exit with *nextPtr set to s - that is what we want for other + tokens, but not for the BOM - we would rather like to skip it; + then, when this routine is entered the next time, XmlPrologTok will + return XML_TOK_INVALID, since the BOM is still in the buffer + */ + else if (tok == XML_TOK_BOM && next == end && nextPtr) { + *nextPtr = next; + return XML_ERROR_NONE; + } + start = next; + } +} + +static enum XML_Error FASTCALL +externalParEntProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + const char *start = s; + const char *next = s; + int tok; + + tok = XmlPrologTok(encoding, start, end, &next); + if (tok <= 0) { + if (nextPtr != 0 && tok != XML_TOK_INVALID) { + *nextPtr = s; + return XML_ERROR_NONE; + } + switch (tok) { + case XML_TOK_INVALID: + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_NONE: /* start == end */ + default: + break; + } + } + /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. + However, when parsing an external subset, doProlog will not accept a BOM + as valid, and report a syntax error, so we have to skip the BOM + */ + else if (tok == XML_TOK_BOM) { + s = next; + tok = XmlPrologTok(encoding, s, end, &next); + } + + processor = prologProcessor; + return doProlog(parser, encoding, s, end, tok, next, nextPtr); +} + +static enum XML_Error FASTCALL +entityValueProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + const char *start = s; + const char *next = s; + const ENCODING *enc = encoding; + int tok; + + for (;;) { + tok = XmlPrologTok(enc, start, end, &next); + if (tok <= 0) { + if (nextPtr != 0 && tok != XML_TOK_INVALID) { + *nextPtr = s; + return XML_ERROR_NONE; + } + switch (tok) { + case XML_TOK_INVALID: + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_NONE: /* start == end */ + default: + break; + } + return storeEntityValue(parser, enc, s, end); + } + start = next; + } +} + +#endif /* XML_DTD */ + +static enum XML_Error FASTCALL +prologProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + const char *next = s; + int tok = XmlPrologTok(encoding, s, end, &next); + return doProlog(parser, encoding, s, end, tok, next, nextPtr); +} + +static enum XML_Error FASTCALL +doProlog(XML_Parser parser, + const ENCODING *enc, + const char *s, + const char *end, + int tok, + const char *next, + const char **nextPtr) +{ +#ifdef XML_DTD + static const XML_Char externalSubsetName[] = { '#' , '\0' }; +#endif /* XML_DTD */ + static const XML_Char atypeCDATA[] = { 'C', 'D', 'A', 'T', 'A', '\0' }; + static const XML_Char atypeID[] = { 'I', 'D', '\0' }; + static const XML_Char atypeIDREF[] = { 'I', 'D', 'R', 'E', 'F', '\0' }; + static const XML_Char atypeIDREFS[] = { 'I', 'D', 'R', 'E', 'F', 'S', '\0' }; + static const XML_Char atypeENTITY[] = { 'E', 'N', 'T', 'I', 'T', 'Y', '\0' }; + static const XML_Char atypeENTITIES[] = + { 'E', 'N', 'T', 'I', 'T', 'I', 'E', 'S', '\0' }; + static const XML_Char atypeNMTOKEN[] = { + 'N', 'M', 'T', 'O', 'K', 'E', 'N', '\0' }; + static const XML_Char atypeNMTOKENS[] = { + 'N', 'M', 'T', 'O', 'K', 'E', 'N', 'S', '\0' }; + +#ifndef SYMBIAN_MIN_SIZE + static const XML_Char notationPrefix[] = { + 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N', '(', '\0' }; + static const XML_Char enumValueSep[] = { '|', '\0' }; + static const XML_Char enumValueStart[] = { '(', '\0' }; +#endif // SYMBIAN_MIN_SIZE + + const char **eventPP; + const char **eventEndPP; + enum XML_Content_Quant quant; + + if (enc == encoding) { + eventPP = &eventPtr; + eventEndPP = &eventEndPtr; + } + else { + eventPP = &(openInternalEntities->internalEventPtr); + eventEndPP = &(openInternalEntities->internalEventEndPtr); + } + for (;;) { + int role; + XML_Bool handleDefault = XML_TRUE; + *eventPP = s; + *eventEndPP = next; + if (tok <= 0) { + if (nextPtr != 0 && tok != XML_TOK_INVALID) { + *nextPtr = s; + return XML_ERROR_NONE; + } + switch (tok) { + case XML_TOK_INVALID: + *eventPP = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + return XML_ERROR_PARTIAL_CHAR; + case XML_TOK_NONE: +#ifdef XML_DTD + if (enc != encoding) + return XML_ERROR_NONE; + if (isParamEntity) { + if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) + == XML_ROLE_ERROR) + return XML_ERROR_SYNTAX; + return XML_ERROR_NONE; + } +#endif /* XML_DTD */ + return XML_ERROR_NO_ELEMENTS; + default: + tok = -tok; + next = end; + break; + } + } + role = XmlTokenRole(&prologState, tok, s, next, enc); + switch (role) { + case XML_ROLE_XML_DECL: + { + enum XML_Error result = processXmlDecl(parser, 0, s, next); + if (result != XML_ERROR_NONE) + return result; + enc = encoding; + handleDefault = XML_FALSE; + } + break; + case XML_ROLE_DOCTYPE_NAME: +#ifndef SYMBIAN_MIN_SIZE + if (startDoctypeDeclHandler) { + doctypeName = poolStoreString(&tempPool, enc, s, next); + if (!doctypeName) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + doctypePubid = NULL; + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + doctypeSysid = NULL; /* always initialize to NULL */ + break; + case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: +#ifndef SYMBIAN_MIN_SIZE + if (startDoctypeDeclHandler) { + startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, + doctypePubid, 1); + doctypeName = NULL; + poolClear(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; +#ifdef XML_DTD + case XML_ROLE_TEXT_DECL: + { + enum XML_Error result = processXmlDecl(parser, 1, s, next); + if (result != XML_ERROR_NONE) + return result; + enc = encoding; + handleDefault = XML_FALSE; + } + break; +#endif /* XML_DTD */ + case XML_ROLE_DOCTYPE_PUBLIC_ID: +#ifdef XML_DTD + useForeignDTD = XML_FALSE; +#endif /* XML_DTD */ + dtd.hasParamEntityRefs = XML_TRUE; +#ifndef SYMBIAN_MIN_SIZE + if (startDoctypeDeclHandler) { + doctypePubid = poolStoreString(&tempPool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!doctypePubid) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE +#ifdef XML_DTD + declEntity = (ENTITY *)lookup(&dtd.paramEntities, + externalSubsetName, + sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; +#endif /* XML_DTD */ + /* fall through */ + case XML_ROLE_ENTITY_PUBLIC_ID: + if (!XmlIsPublicId(enc, s, next, eventPP)) + return XML_ERROR_SYNTAX; + if (dtd.keepProcessing && declEntity) { + XML_Char *tem = poolStoreString(&dtd.pool, + enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!tem) + return XML_ERROR_NO_MEMORY; + normalizePublicId(tem); + declEntity->publicId = tem; + poolFinish(&dtd.pool); + if (entityDeclHandler) + handleDefault = XML_FALSE; + } + break; + case XML_ROLE_DOCTYPE_CLOSE: + if (doctypeName) { + startDoctypeDeclHandler(handlerArg, doctypeName, + doctypeSysid, doctypePubid, 0); + poolClear(&tempPool); + handleDefault = XML_FALSE; + } + /* doctypeSysid will be non-NULL in the case of a previous + XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler + was not set, indicating an external subset + */ +#ifdef XML_DTD + if (doctypeSysid || useForeignDTD) { + dtd.hasParamEntityRefs = XML_TRUE; /* when docTypeSysid == NULL */ + if (paramEntityParsing && externalEntityRefHandler) { + ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, + externalSubsetName, + sizeof(ENTITY)); + if (!entity) + return XML_ERROR_NO_MEMORY; + if (useForeignDTD) + entity->base = curBase; + dtd.paramEntityRead = XML_FALSE; + if (!externalEntityRefHandler(handlerArg, name)) + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + if (dtd.paramEntityRead && + !dtd.standalone && + notStandaloneHandler && + !notStandaloneHandler(handlerArg)) + return XML_ERROR_NOT_STANDALONE; + /* end of DTD - no need to update dtd.keepProcessing */ + } + useForeignDTD = XML_FALSE; + } +#endif /* XML_DTD */ +#ifndef SYMBIAN_MIN_SIZE + if (endDoctypeDeclHandler) { + endDoctypeDeclHandler(handlerArg); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; + case XML_ROLE_INSTANCE_START: +#ifdef XML_DTD + /* if there is no DOCTYPE declaration then now is the + last chance to read the foreign DTD + */ + if (useForeignDTD) { + dtd.hasParamEntityRefs = XML_TRUE; + if (paramEntityParsing && externalEntityRefHandler) { + ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, + externalSubsetName, + sizeof(ENTITY)); + if (!entity) + return XML_ERROR_NO_MEMORY; + entity->base = curBase; + dtd.paramEntityRead = XML_FALSE; + if (!externalEntityRefHandler(handlerArg, name)) + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + if (dtd.paramEntityRead && + !dtd.standalone && + notStandaloneHandler && + !notStandaloneHandler(handlerArg)) + return XML_ERROR_NOT_STANDALONE; + /* end of DTD - no need to update dtd.keepProcessing */ + } + } +#endif /* XML_DTD */ + processor = contentProcessor; + return contentProcessor(parser, s, end, nextPtr); + case XML_ROLE_ATTLIST_ELEMENT_NAME: + declElementType = getElementType(parser, enc, s, next); + if (!declElementType) + return XML_ERROR_NO_MEMORY; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_NAME: + declAttributeId = getAttributeId(parser, enc, s, next); + if (!declAttributeId) + return XML_ERROR_NO_MEMORY; + declAttributeIsCdata = XML_FALSE; + declAttributeType = NULL; + declAttributeIsId = XML_FALSE; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_CDATA: + declAttributeIsCdata = XML_TRUE; + declAttributeType = atypeCDATA; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_ID: + declAttributeIsId = XML_TRUE; + declAttributeType = atypeID; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_IDREF: + declAttributeType = atypeIDREF; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: + declAttributeType = atypeIDREFS; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: + declAttributeType = atypeENTITY; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: + declAttributeType = atypeENTITIES; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: + declAttributeType = atypeNMTOKEN; + goto checkAttListDeclHandler; + case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: + declAttributeType = atypeNMTOKENS; + checkAttListDeclHandler: + if (dtd.keepProcessing && attlistDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_ATTRIBUTE_ENUM_VALUE: + case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: +#ifndef SYMBIAN_MIN_SIZE + if (dtd.keepProcessing && attlistDeclHandler) { + const XML_Char *prefix; + if (declAttributeType) { + prefix = enumValueSep; + } + else { + prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE + ? notationPrefix + : enumValueStart); + } + if (!poolAppendString(&tempPool, prefix)) + return XML_ERROR_NO_MEMORY; + if (!poolAppend(&tempPool, enc, s, next)) + return XML_ERROR_NO_MEMORY; + declAttributeType = tempPool.start; + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; + case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: + case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: + if (dtd.keepProcessing) { + if (!defineAttribute(declElementType, declAttributeId, + declAttributeIsCdata, declAttributeIsId, 0, + parser)) + return XML_ERROR_NO_MEMORY; +#ifndef SYMBIAN_MIN_SIZE + if (attlistDeclHandler && declAttributeType) { + if (*declAttributeType == XML_T('(') + || (*declAttributeType == XML_T('N') + && declAttributeType[1] == XML_T('O'))) { + /* Enumerated or Notation type */ + if (!poolAppendChar(&tempPool, XML_T(')')) + || !poolAppendChar(&tempPool, XML_T('\0'))) + return XML_ERROR_NO_MEMORY; + declAttributeType = tempPool.start; + poolFinish(&tempPool); + } + *eventEndPP = s; + attlistDeclHandler(handlerArg, declElementType->name, + declAttributeId->name, declAttributeType, + 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); + poolClear(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + } + break; + case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: + case XML_ROLE_FIXED_ATTRIBUTE_VALUE: + if (dtd.keepProcessing) { + const XML_Char *attVal; + enum XML_Error result + = storeAttributeValue(parser, enc, declAttributeIsCdata, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar, + &dtd.pool); + if (result) + return result; + attVal = poolStart(&dtd.pool); + poolFinish(&dtd.pool); + /* ID attributes aren't allowed to have a default */ + if (!defineAttribute(declElementType, declAttributeId, + declAttributeIsCdata, XML_FALSE, attVal, parser)) + return XML_ERROR_NO_MEMORY; +#ifndef SYMBIAN_MIN_SIZE + if (attlistDeclHandler && declAttributeType) { + if (*declAttributeType == XML_T('(') + || (*declAttributeType == XML_T('N') + && declAttributeType[1] == XML_T('O'))) { + /* Enumerated or Notation type */ + if (!poolAppendChar(&tempPool, XML_T(')')) + || !poolAppendChar(&tempPool, XML_T('\0'))) + return XML_ERROR_NO_MEMORY; + declAttributeType = tempPool.start; + poolFinish(&tempPool); + } + *eventEndPP = s; + attlistDeclHandler(handlerArg, declElementType->name, + declAttributeId->name, declAttributeType, + attVal, + role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); + poolClear(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + } + break; + case XML_ROLE_ENTITY_VALUE: + if (dtd.keepProcessing) { + enum XML_Error result = storeEntityValue(parser, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (declEntity) { + declEntity->textPtr = poolStart(&dtd.entityValuePool); + declEntity->textLen = poolLength(&dtd.entityValuePool); + poolFinish(&dtd.entityValuePool); +#ifndef SYMBIAN_MIN_SIZE + if (entityDeclHandler) { + *eventEndPP = s; + entityDeclHandler(handlerArg, + declEntity->name, + declEntity->is_param, + declEntity->textPtr, + declEntity->textLen, + curBase, 0, 0, 0); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + } + else + poolDiscard(&dtd.entityValuePool); + if (result != XML_ERROR_NONE) + return result; + } + break; + case XML_ROLE_DOCTYPE_SYSTEM_ID: +#ifdef XML_DTD + useForeignDTD = XML_FALSE; +#endif /* XML_DTD */ + dtd.hasParamEntityRefs = XML_TRUE; +#ifndef SYMBIAN_MIN_SIZE + if (startDoctypeDeclHandler) { + doctypeSysid = poolStoreString(&tempPool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (doctypeSysid == NULL) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE +#ifdef XML_DTD + else + /* use externalSubsetName to make doctypeSysid non-NULL + for the case where no startDoctypeDeclHandler is set */ + doctypeSysid = externalSubsetName; +#endif /* XML_DTD */ + if (!dtd.standalone +#ifdef XML_DTD + && !paramEntityParsing +#endif /* XML_DTD */ + && notStandaloneHandler + && !notStandaloneHandler(handlerArg)) + return XML_ERROR_NOT_STANDALONE; +#ifndef XML_DTD + break; +#else /* XML_DTD */ + if (!declEntity) { + declEntity = (ENTITY *)lookup(&dtd.paramEntities, + externalSubsetName, + sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; + declEntity->publicId = NULL; + } + /* fall through */ +#endif /* XML_DTD */ + case XML_ROLE_ENTITY_SYSTEM_ID: + if (dtd.keepProcessing && declEntity) { + declEntity->systemId = poolStoreString(&dtd.pool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!declEntity->systemId) + return XML_ERROR_NO_MEMORY; + declEntity->base = curBase; + poolFinish(&dtd.pool); + if (entityDeclHandler) + handleDefault = XML_FALSE; + } + break; + case XML_ROLE_ENTITY_COMPLETE: +#ifndef SYMBIAN_MIN_SIZE + if (dtd.keepProcessing && declEntity && entityDeclHandler) { + *eventEndPP = s; + entityDeclHandler(handlerArg, + declEntity->name, + declEntity->is_param, + 0,0, + declEntity->base, + declEntity->systemId, + declEntity->publicId, + 0); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; + case XML_ROLE_ENTITY_NOTATION_NAME: + if (dtd.keepProcessing && declEntity) { + declEntity->notation = poolStoreString(&dtd.pool, enc, s, next); + if (!declEntity->notation) + return XML_ERROR_NO_MEMORY; + poolFinish(&dtd.pool); +#ifndef SYMBIAN_MIN_SIZE + if (unparsedEntityDeclHandler) { + *eventEndPP = s; + unparsedEntityDeclHandler(handlerArg, + declEntity->name, + declEntity->base, + declEntity->systemId, + declEntity->publicId, + declEntity->notation); + handleDefault = XML_FALSE; + } + else if (entityDeclHandler) { + *eventEndPP = s; + entityDeclHandler(handlerArg, + declEntity->name, + 0,0,0, + declEntity->base, + declEntity->systemId, + declEntity->publicId, + declEntity->notation); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + } + break; + case XML_ROLE_GENERAL_ENTITY_NAME: + { + if (XmlPredefinedEntityName(enc, s, next)) { + declEntity = NULL; + break; + } + if (dtd.keepProcessing) { + const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, + sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; + if (declEntity->name != name) { + poolDiscard(&dtd.pool); + declEntity = NULL; + } + else { + poolFinish(&dtd.pool); + declEntity->publicId = NULL; + declEntity->is_param = XML_FALSE; + /* if we have a parent parser or are reading an internal parameter + entity, then the entity declaration is not considered "internal" + */ + declEntity->is_internal = (XML_Bool)!(parentParser || openInternalEntities); + if (entityDeclHandler) + handleDefault = XML_FALSE; + } + } + else { + poolDiscard(&dtd.pool); + declEntity = NULL; + } + } + break; + case XML_ROLE_PARAM_ENTITY_NAME: +#ifdef XML_DTD + if (dtd.keepProcessing) { + const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); + if (!name) + return XML_ERROR_NO_MEMORY; + declEntity = (ENTITY *)lookup(&dtd.paramEntities, + name, sizeof(ENTITY)); + if (!declEntity) + return XML_ERROR_NO_MEMORY; + if (declEntity->name != name) { + poolDiscard(&dtd.pool); + declEntity = NULL; + } + else { + poolFinish(&dtd.pool); + declEntity->publicId = NULL; + declEntity->is_param = XML_TRUE; + /* if we have a parent parser or are reading an internal parameter + entity, then the entity declaration is not considered "internal" + */ + declEntity->is_internal = (XML_Bool)!(parentParser || openInternalEntities); + if (entityDeclHandler) + handleDefault = XML_FALSE; + } + } + else { + poolDiscard(&dtd.pool); + declEntity = NULL; + } +#else /* not XML_DTD */ + declEntity = NULL; +#endif /* XML_DTD */ + break; + case XML_ROLE_NOTATION_NAME: + declNotationPublicId = NULL; + declNotationName = NULL; +#ifndef SYMBIAN_MIN_SIZE + if (notationDeclHandler) { + declNotationName = poolStoreString(&tempPool, enc, s, next); + if (!declNotationName) + return XML_ERROR_NO_MEMORY; + poolFinish(&tempPool); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; + case XML_ROLE_NOTATION_PUBLIC_ID: + if (!XmlIsPublicId(enc, s, next, eventPP)) + return XML_ERROR_SYNTAX; + if (declNotationName) { /* means notationDeclHandler != NULL */ + XML_Char *tem = poolStoreString(&tempPool, + enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!tem) + return XML_ERROR_NO_MEMORY; + normalizePublicId(tem); + declNotationPublicId = tem; + poolFinish(&tempPool); + handleDefault = XML_FALSE; + } + break; + case XML_ROLE_NOTATION_SYSTEM_ID: +#ifndef SYMBIAN_MIN_SIZE + if (declNotationName && notationDeclHandler) { + const XML_Char *systemId + = poolStoreString(&tempPool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!systemId) + return XML_ERROR_NO_MEMORY; + *eventEndPP = s; + notationDeclHandler(handlerArg, + declNotationName, + curBase, + systemId, + declNotationPublicId); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + poolClear(&tempPool); + break; + case XML_ROLE_NOTATION_NO_SYSTEM_ID: +#ifndef SYMBIAN_MIN_SIZE + if (declNotationPublicId && notationDeclHandler) { + *eventEndPP = s; + notationDeclHandler(handlerArg, + declNotationName, + curBase, + 0, + declNotationPublicId); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + poolClear(&tempPool); + break; + case XML_ROLE_ERROR: + switch (tok) { + case XML_TOK_PARAM_ENTITY_REF: + return XML_ERROR_PARAM_ENTITY_REF; + case XML_TOK_XML_DECL: + return XML_ERROR_MISPLACED_XML_PI; + default: + return XML_ERROR_SYNTAX; + } +#ifdef XML_DTD + case XML_ROLE_IGNORE_SECT: + { + enum XML_Error result; + if (defaultHandler) + reportDefault(parser, enc, s, next); + handleDefault = XML_FALSE; + result = doIgnoreSection(parser, enc, &next, end, nextPtr); + if (!next) { + processor = ignoreSectionProcessor; + return result; + } + } + break; +#endif /* XML_DTD */ + case XML_ROLE_GROUP_OPEN: + if (prologState.level >= groupSize) { + if (groupSize) { + char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); + if (temp == NULL) + return XML_ERROR_NO_MEMORY; + groupConnector = temp; + if (dtd.scaffIndex) { + int *temp = (int *)REALLOC(dtd.scaffIndex, groupSize * sizeof(int)); + if (temp == NULL) + return XML_ERROR_NO_MEMORY; + dtd.scaffIndex = temp; + } + } + else { + groupConnector = (char *)MALLOC(groupSize = 32); + if (!groupConnector) + return XML_ERROR_NO_MEMORY; + } + } + groupConnector[prologState.level] = 0; + if (dtd.in_eldecl) { + int myindex = nextScaffoldPart(parser); + if (myindex < 0) + return XML_ERROR_NO_MEMORY; + if(dtd.scaffIndex != NULL) + { + dtd.scaffIndex[dtd.scaffLevel] = myindex; + dtd.scaffLevel++; + dtd.scaffold[myindex].type = XML_CTYPE_SEQ; + if (elementDeclHandler) + handleDefault = XML_FALSE; + } + } + break; + case XML_ROLE_GROUP_SEQUENCE: + if (groupConnector[prologState.level] == '|') + return XML_ERROR_SYNTAX; + groupConnector[prologState.level] = ','; + if (dtd.in_eldecl && elementDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_GROUP_CHOICE: + if (groupConnector[prologState.level] == ',') + return XML_ERROR_SYNTAX; + if (dtd.in_eldecl + && !groupConnector[prologState.level] + && (dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type + != XML_CTYPE_MIXED) + ) { + dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type + = XML_CTYPE_CHOICE; + if (elementDeclHandler) + handleDefault = XML_FALSE; + } + groupConnector[prologState.level] = '|'; + break; + case XML_ROLE_PARAM_ENTITY_REF: +#ifdef XML_DTD + case XML_ROLE_INNER_PARAM_ENTITY_REF: + /* PE references in internal subset are + not allowed within declarations */ + if (prologState.documentEntity && + role == XML_ROLE_INNER_PARAM_ENTITY_REF) + return XML_ERROR_PARAM_ENTITY_REF; + dtd.hasParamEntityRefs = XML_TRUE; + if (!paramEntityParsing) + dtd.keepProcessing = dtd.standalone; + else { + const XML_Char *name; + ENTITY *entity; + name = poolStoreString(&dtd.pool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); + poolDiscard(&dtd.pool); + /* first, determine if a check for an existing declaration is needed; + if yes, check that the entity exists, and that it is internal, + otherwise call the skipped entity handler + */ + if (prologState.documentEntity && + (dtd.standalone + ? !openInternalEntities + : !dtd.hasParamEntityRefs)) { + if (!entity) + return XML_ERROR_UNDEFINED_ENTITY; + else if (!entity->is_internal) + return XML_ERROR_ENTITY_DECLARED_IN_PE; + } + else if (!entity) { + dtd.keepProcessing = dtd.standalone; + /* cannot report skipped entities in declarations */ + if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { + skippedEntityHandler(handlerArg, name, 1); + handleDefault = XML_FALSE; + } + break; + } + if (entity->open) + return XML_ERROR_RECURSIVE_ENTITY_REF; + if (entity->textPtr) { + enum XML_Error result; + result = processInternalParamEntity(parser, entity); + if (result != XML_ERROR_NONE) + return result; + handleDefault = XML_FALSE; + break; + } + if (externalEntityRefHandler) { + dtd.paramEntityRead = XML_FALSE; + entity->open = XML_TRUE; + if (!externalEntityRefHandler(handlerArg, name)) { + entity->open = XML_FALSE; + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + } + entity->open = XML_FALSE; + handleDefault = XML_FALSE; + if (!dtd.paramEntityRead) { + dtd.keepProcessing = dtd.standalone; + break; + } + } + else { + dtd.keepProcessing = dtd.standalone; + break; + } + } +#endif /* XML_DTD */ + if (!dtd.standalone && + notStandaloneHandler && + !notStandaloneHandler(handlerArg)) + return XML_ERROR_NOT_STANDALONE; + break; + + /* Element declaration stuff */ + + case XML_ROLE_ELEMENT_NAME: +#ifndef SYMBIAN_MIN_SIZE + if (elementDeclHandler) { + declElementType = getElementType(parser, enc, s, next); + if (!declElementType) + return XML_ERROR_NO_MEMORY; + dtd.scaffLevel = 0; + dtd.scaffCount = 0; + dtd.in_eldecl = XML_TRUE; + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + break; + + case XML_ROLE_CONTENT_ANY: + case XML_ROLE_CONTENT_EMPTY: + if (dtd.in_eldecl) { +#ifndef SYMBIAN_MIN_SIZE + if (elementDeclHandler) { + XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); + if (!content) + return XML_ERROR_NO_MEMORY; + content->quant = XML_CQUANT_NONE; + content->name = NULL; + content->numchildren = 0; + content->children = NULL; + content->type = ((role == XML_ROLE_CONTENT_ANY) ? + XML_CTYPE_ANY : + XML_CTYPE_EMPTY); + *eventEndPP = s; + elementDeclHandler(handlerArg, declElementType->name, content); + handleDefault = XML_FALSE; + } +#endif // SYMBIAN_MIN_SIZE + dtd.in_eldecl = XML_FALSE; + } + break; + + case XML_ROLE_CONTENT_PCDATA: + if (dtd.in_eldecl) { + dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type + = XML_CTYPE_MIXED; + if (elementDeclHandler) + handleDefault = XML_FALSE; + } + break; + + case XML_ROLE_CONTENT_ELEMENT: + quant = XML_CQUANT_NONE; + goto elementContent; + case XML_ROLE_CONTENT_ELEMENT_OPT: + quant = XML_CQUANT_OPT; + goto elementContent; + case XML_ROLE_CONTENT_ELEMENT_REP: + quant = XML_CQUANT_REP; + goto elementContent; + case XML_ROLE_CONTENT_ELEMENT_PLUS: + quant = XML_CQUANT_PLUS; + elementContent: + if (dtd.in_eldecl) { + ELEMENT_TYPE *el; + const XML_Char *name; + int nameLen; + const char *nxt = (quant == XML_CQUANT_NONE + ? next + : next - enc->minBytesPerChar); + int myindex = nextScaffoldPart(parser); + if (myindex < 0) + return XML_ERROR_NO_MEMORY; + dtd.scaffold[myindex].type = XML_CTYPE_NAME; + dtd.scaffold[myindex].quant = quant; + el = getElementType(parser, enc, s, nxt); + if (!el) + return XML_ERROR_NO_MEMORY; + name = el->name; + dtd.scaffold[myindex].name = name; + nameLen = 0; + for (; name[nameLen++]; ) + ; + dtd.contentStringLen += nameLen; + if (elementDeclHandler) + handleDefault = XML_FALSE; + } + break; + + case XML_ROLE_GROUP_CLOSE: + quant = XML_CQUANT_NONE; + goto closeGroup; + case XML_ROLE_GROUP_CLOSE_OPT: + quant = XML_CQUANT_OPT; + goto closeGroup; + case XML_ROLE_GROUP_CLOSE_REP: + quant = XML_CQUANT_REP; + goto closeGroup; + case XML_ROLE_GROUP_CLOSE_PLUS: + quant = XML_CQUANT_PLUS; + closeGroup: + if (dtd.in_eldecl) { + if (elementDeclHandler) + handleDefault = XML_FALSE; + dtd.scaffLevel--; + dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel]].quant = quant; + if (dtd.scaffLevel == 0) { + if (!handleDefault) { + XML_Content *model = build_model(parser); + if (!model) + return XML_ERROR_NO_MEMORY; + *eventEndPP = s; + elementDeclHandler(handlerArg, declElementType->name, model); + } + dtd.in_eldecl = XML_FALSE; + dtd.contentStringLen = 0; + } + } + break; + /* End element declaration stuff */ + + case XML_ROLE_PI: + if (!reportProcessingInstruction(parser, enc, s, next)) + return XML_ERROR_NO_MEMORY; + handleDefault = XML_FALSE; + break; + case XML_ROLE_COMMENT: + if (!reportComment(parser, enc, s, next)) + return XML_ERROR_NO_MEMORY; + handleDefault = XML_FALSE; + break; + case XML_ROLE_NONE: + switch (tok) { + case XML_TOK_BOM: + handleDefault = XML_FALSE; + break; + } + break; + case XML_ROLE_DOCTYPE_NONE: + if (startDoctypeDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_ENTITY_NONE: + if (dtd.keepProcessing && entityDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_NOTATION_NONE: + if (notationDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_ATTLIST_NONE: + if (dtd.keepProcessing && attlistDeclHandler) + handleDefault = XML_FALSE; + break; + case XML_ROLE_ELEMENT_NONE: + if (elementDeclHandler) + handleDefault = XML_FALSE; + break; + } /* end of big switch */ + + if (handleDefault && defaultHandler) + reportDefault(parser, enc, s, next); + + s = next; + tok = XmlPrologTok(enc, s, end, &next); + } + /* not reached */ +} + +static enum XML_Error FASTCALL +epilogProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + processor = epilogProcessor; + eventPtr = s; + for (;;) { + const char *next = NULL; + int tok = XmlPrologTok(encoding, s, end, &next); + eventEndPtr = next; + switch (tok) { + /* report partial linebreak - it might be the last token */ + case -XML_TOK_PROLOG_S: + if (defaultHandler) { + eventEndPtr = next; + reportDefault(parser, encoding, s, next); + } + if (nextPtr) + *nextPtr = next; + return XML_ERROR_NONE; + case XML_TOK_NONE: + if (nextPtr) + *nextPtr = s; + return XML_ERROR_NONE; + case XML_TOK_PROLOG_S: + if (defaultHandler) + reportDefault(parser, encoding, s, next); + break; + case XML_TOK_PI: + if (!reportProcessingInstruction(parser, encoding, s, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_COMMENT: + if (!reportComment(parser, encoding, s, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_INVALID: + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (nextPtr) { + *nextPtr = s; + return XML_ERROR_NONE; + } + return XML_ERROR_PARTIAL_CHAR; + default: + return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; + } + eventPtr = s = next; + } +} + +#ifdef XML_DTD + +static enum XML_Error FASTCALL +processInternalParamEntity(XML_Parser parser, ENTITY *entity) +{ + const char *s, *end, *next; + int tok; + enum XML_Error result; + OPEN_INTERNAL_ENTITY openEntity; + entity->open = XML_TRUE; + openEntity.next = openInternalEntities; + openInternalEntities = &openEntity; + openEntity.entity = entity; + openEntity.internalEventPtr = NULL; + openEntity.internalEventEndPtr = NULL; + s = (char *)entity->textPtr; + end = (char *)(entity->textPtr + entity->textLen); + tok = XmlPrologTok(internalEncoding, s, end, &next); + result = doProlog(parser, internalEncoding, s, end, tok, next, 0); + entity->open = XML_FALSE; + openInternalEntities = openEntity.next; + return result; +} + +#endif /* XML_DTD */ + +static enum XML_Error FASTCALL +errorProcessor(XML_Parser parser, + const char *s, + const char *end, + const char **nextPtr) +{ + return errorCode; +} + +static enum XML_Error FASTCALL +storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, + const char *ptr, const char *end, + STRING_POOL *pool) +{ + enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, + end, pool); + if (result) + return result; + if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) + poolChop(pool); + if (!poolAppendChar(pool, XML_T('\0'))) + return XML_ERROR_NO_MEMORY; + return XML_ERROR_NONE; +} + +static enum XML_Error FASTCALL +appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, + const char *ptr, const char *end, + STRING_POOL *pool) +{ + for (;;) { + const char *next; + int tok = XmlAttributeValueTok(enc, ptr, end, &next); + switch (tok) { + case XML_TOK_NONE: + return XML_ERROR_NONE; + case XML_TOK_INVALID: + if (enc == encoding) + eventPtr = next; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_PARTIAL: + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_INVALID_TOKEN; + case XML_TOK_CHAR_REF: + { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(enc, ptr); + if (n < 0) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BAD_CHAR_REF; + } + if (!isCdata + && n == 0x20 /* space */ + && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) + break; + n = XmlEncode(n, (ICHAR *)buf); + if (!n) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BAD_CHAR_REF; + } + for (i = 0; i < n; i++) { + if (!poolAppendChar(pool, buf[i])) + return XML_ERROR_NO_MEMORY; + } + } + break; + case XML_TOK_DATA_CHARS: + if (!poolAppend(pool, enc, ptr, next)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_TRAILING_CR: + next = ptr + enc->minBytesPerChar; + /* fall through */ + case XML_TOK_ATTRIBUTE_VALUE_S: + case XML_TOK_DATA_NEWLINE: + if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) + break; + if (!poolAppendChar(pool, 0x20)) + return XML_ERROR_NO_MEMORY; + break; + case XML_TOK_ENTITY_REF: + { + const XML_Char *name; + ENTITY *entity; + char checkEntityDecl; + XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, + ptr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (ch) { + if (!poolAppendChar(pool, ch)) + return XML_ERROR_NO_MEMORY; + break; + } + name = poolStoreString(&temp2Pool, enc, + ptr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); + poolDiscard(&temp2Pool); + /* first, determine if a check for an existing declaration is needed; + if yes, check that the entity exists, and that it is internal, + otherwise call the default handler (if called from content) + */ + if (pool == &dtd.pool) /* are we called from prolog? */ + checkEntityDecl = (char)( +#ifdef XML_DTD + prologState.documentEntity && +#endif /* XML_DTD */ + (dtd.standalone + ? !openInternalEntities + : !dtd.hasParamEntityRefs)); + else /* if (pool == &tempPool): we are called from content */ + checkEntityDecl = (char)(!dtd.hasParamEntityRefs || dtd.standalone); + if (checkEntityDecl) { + if (!entity) + return XML_ERROR_UNDEFINED_ENTITY; + else if (!entity->is_internal) + return XML_ERROR_ENTITY_DECLARED_IN_PE; + } + else if (!entity) { + /* cannot report skipped entity here - see comments on + skippedEntityHandler + if (skippedEntityHandler) + skippedEntityHandler(handlerArg, name, 0); + */ + if ((pool == &tempPool) && defaultHandler) + reportDefault(parser, enc, ptr, next); + break; + } + if (entity->open) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_RECURSIVE_ENTITY_REF; + } + if (entity->notation) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_BINARY_ENTITY_REF; + } + if (!entity->textPtr) { + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; + } + else { + enum XML_Error result; + const XML_Char *textEnd = entity->textPtr + entity->textLen; + entity->open = XML_TRUE; + result = appendAttributeValue(parser, internalEncoding, isCdata, + (char *)entity->textPtr, + (char *)textEnd, pool); + entity->open = XML_FALSE; + if (result) + return result; + } + } + break; + default: + if (enc == encoding) + eventPtr = ptr; + return XML_ERROR_UNEXPECTED_STATE; + } + ptr = next; + } + /* not reached */ +} + +static enum XML_Error FASTCALL +storeEntityValue(XML_Parser parser, + const ENCODING *enc, + const char *entityTextPtr, + const char *entityTextEnd) +{ + STRING_POOL *pool = &(dtd.entityValuePool); + enum XML_Error result = XML_ERROR_NONE; +#ifdef XML_DTD + int oldInEntityValue = prologState.inEntityValue; + prologState.inEntityValue = 1; +#endif /* XML_DTD */ + /* never return Null for the value argument in EntityDeclHandler, + since this would indicate an external entity; therefore we + have to make sure that entityValuePool.start is not null */ + if (!pool->blocks) { + if (!poolGrow(pool)) + return XML_ERROR_NO_MEMORY; + } + + for (;;) { + const char *next; + int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); + switch (tok) { + case XML_TOK_PARAM_ENTITY_REF: +#ifdef XML_DTD + if (isParamEntity || enc != encoding) { + const XML_Char *name; + ENTITY *entity; + name = poolStoreString(&tempPool, enc, + entityTextPtr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (!name) { + result = XML_ERROR_NO_MEMORY; + goto endEntityValue; + } + entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); + poolDiscard(&tempPool); + if (!entity) { + /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ + /* cannot report skipped entity here - see comments on + skippedEntityHandler + if (skippedEntityHandler) + skippedEntityHandler(handlerArg, name, 0); + */ + dtd.keepProcessing = dtd.standalone; + goto endEntityValue; + } + if (entity->open) { + if (enc == encoding) + eventPtr = entityTextPtr; + result = XML_ERROR_RECURSIVE_ENTITY_REF; + goto endEntityValue; + } + if (entity->systemId) { + if (externalEntityRefHandler) { + dtd.paramEntityRead = XML_FALSE; + entity->open = XML_TRUE; + if (!externalEntityRefHandler(handlerArg, name)) { + entity->open = XML_FALSE; + result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; + goto endEntityValue; + } + entity->open = XML_FALSE; + if (!dtd.paramEntityRead) + dtd.keepProcessing = dtd.standalone; + } + else + dtd.keepProcessing = dtd.standalone; + } + else { + entity->open = XML_TRUE; + result = storeEntityValue(parser, + internalEncoding, + (char *)entity->textPtr, + (char *)(entity->textPtr + + entity->textLen)); + entity->open = XML_FALSE; + if (result) + goto endEntityValue; + } + break; + } +#endif /* XML_DTD */ + /* in the internal subset, PE references are not legal + within markup declarations, e.g entity values in this case */ + eventPtr = entityTextPtr; + result = XML_ERROR_PARAM_ENTITY_REF; + goto endEntityValue; + case XML_TOK_NONE: + result = XML_ERROR_NONE; + goto endEntityValue; + case XML_TOK_ENTITY_REF: + case XML_TOK_DATA_CHARS: + if (!poolAppend(pool, enc, entityTextPtr, next)) { + result = XML_ERROR_NO_MEMORY; + goto endEntityValue; + } + break; + case XML_TOK_TRAILING_CR: + next = entityTextPtr + enc->minBytesPerChar; + /* fall through */ + case XML_TOK_DATA_NEWLINE: + if (pool->end == pool->ptr && !poolGrow(pool)) { + result = XML_ERROR_NO_MEMORY; + goto endEntityValue; + } + *(pool->ptr)++ = 0xA; + break; + case XML_TOK_CHAR_REF: + { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(enc, entityTextPtr); + if (n < 0) { + if (enc == encoding) + eventPtr = entityTextPtr; + result = XML_ERROR_BAD_CHAR_REF; + goto endEntityValue; + } + n = XmlEncode(n, (ICHAR *)buf); + if (!n) { + if (enc == encoding) + eventPtr = entityTextPtr; + result = XML_ERROR_BAD_CHAR_REF; + goto endEntityValue; + } + for (i = 0; i < n; i++) { + if (pool->end == pool->ptr && !poolGrow(pool)) { + result = XML_ERROR_NO_MEMORY; + goto endEntityValue; + } + *(pool->ptr)++ = buf[i]; + } + } + break; + case XML_TOK_PARTIAL: + if (enc == encoding) + eventPtr = entityTextPtr; + result = XML_ERROR_INVALID_TOKEN; + goto endEntityValue; + case XML_TOK_INVALID: + if (enc == encoding) + eventPtr = next; + result = XML_ERROR_INVALID_TOKEN; + goto endEntityValue; + default: + if (enc == encoding) + eventPtr = entityTextPtr; + result = XML_ERROR_UNEXPECTED_STATE; + goto endEntityValue; + } + entityTextPtr = next; + } +endEntityValue: +#ifdef XML_DTD + prologState.inEntityValue = oldInEntityValue; +#endif /* XML_DTD */ + return result; +} + +static void FASTCALL +normalizeLines(XML_Char *s) +{ + XML_Char *p; + for (;; s++) { + if (*s == XML_T('\0')) + return; + if (*s == 0xD) + break; + } + p = s; + do { + if (*s == 0xD) { + *p++ = 0xA; + if (*++s == 0xA) + s++; + } + else + *p++ = *s++; + } while (*s); + *p = XML_T('\0'); +} + +static int FASTCALL +reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end) +{ + const XML_Char *target; + XML_Char *data; + const char *tem; + if (!processingInstructionHandler) { + if (defaultHandler) + reportDefault(parser, enc, start, end); + return 1; + } + start += enc->minBytesPerChar * 2; + tem = start + XmlNameLength(enc, start); + target = poolStoreString(&tempPool, enc, start, tem); + if (!target) + return 0; + poolFinish(&tempPool); + data = poolStoreString(&tempPool, enc, + XmlSkipS(enc, tem), + end - enc->minBytesPerChar*2); + if (!data) + return 0; + normalizeLines(data); + processingInstructionHandler(handlerArg, target, data); + poolClear(&tempPool); + return 1; +} + +static int FASTCALL +reportComment(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end) +{ +#ifndef SYMBIAN_MIN_SIZE + XML_Char *data; + if (!commentHandler) { + if (defaultHandler) + reportDefault(parser, enc, start, end); + return 1; + } + data = poolStoreString(&tempPool, + enc, + start + enc->minBytesPerChar * 4, + end - enc->minBytesPerChar * 3); + if (!data) + return 0; + normalizeLines(data); + commentHandler(handlerArg, data); + poolClear(&tempPool); +#endif // SYMBIAN_MIN_SIZE + return 1; +} + +static void FASTCALL +reportDefault(XML_Parser parser, const ENCODING *enc, + const char *s, const char *end) +{ +#ifndef SYMBIAN_MIN_SIZE + if (MUST_CONVERT(enc, s)) { + const char **eventPP; + const char **eventEndPP; + if (enc == encoding) { + eventPP = &eventPtr; + eventEndPP = &eventEndPtr; + } + else { + eventPP = &(openInternalEntities->internalEventPtr); + eventEndPP = &(openInternalEntities->internalEventEndPtr); + } + do { + ICHAR *dataPtr = (ICHAR *)dataBuf; + XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + *eventEndPP = s; + defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + *eventPP = s; + } while (s != end); + } + else + defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); +#endif // SYMBIAN_MIN_SIZE +} + + +static int FASTCALL +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, + XML_Bool isId, const XML_Char *value, XML_Parser parser) +{ + DEFAULT_ATTRIBUTE *att; + if (value || isId) { + /* The handling of default attributes gets messed up if we have + a default which duplicates a non-default. */ + int i; + for (i = 0; i < type->nDefaultAtts; i++) + if (attId == type->defaultAtts[i].id) + return 1; + if (isId && !type->idAtt && !attId->xmlns) + type->idAtt = attId; + } + if (type->nDefaultAtts == type->allocDefaultAtts) { + if (type->allocDefaultAtts == 0) { + type->allocDefaultAtts = 8; + type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts + * sizeof(DEFAULT_ATTRIBUTE)); + if (!type->defaultAtts) + return 0; + } + else { + DEFAULT_ATTRIBUTE *temp; + int count = type->allocDefaultAtts * 2; + temp = (DEFAULT_ATTRIBUTE *)REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); + if (temp == NULL) + return 0; + type->allocDefaultAtts = count; + type->defaultAtts = temp; + } + } + att = type->defaultAtts + type->nDefaultAtts; + att->id = attId; + att->value = value; + att->isCdata = isCdata; + if (!isCdata) + attId->maybeTokenized = XML_TRUE; + type->nDefaultAtts += 1; + return 1; +} + +static int FASTCALL +setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) +{ + const XML_Char *name; + for (name = elementType->name; *name; name++) { + if (*name == XML_T(':')) { + PREFIX *prefix; + const XML_Char *s; + for (s = elementType->name; s != name; s++) { + if (!poolAppendChar(&dtd.pool, *s)) + return 0; + } + if (!poolAppendChar(&dtd.pool, XML_T('\0'))) + return 0; + prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), + sizeof(PREFIX)); + if (!prefix) + return 0; + if (prefix->name == poolStart(&dtd.pool)) + poolFinish(&dtd.pool); + else + poolDiscard(&dtd.pool); + elementType->prefix = prefix; + + } + } + return 1; +} + +static ATTRIBUTE_ID * FASTCALL +getAttributeId(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end) +{ + ATTRIBUTE_ID *id; + const XML_Char *name; + if (!poolAppendChar(&dtd.pool, XML_T('\0'))) + return NULL; + name = poolStoreString(&dtd.pool, enc, start, end); + if (!name) + return NULL; + ++name; + id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID)); + if (!id) + return NULL; + if (id->name != name) + poolDiscard(&dtd.pool); + else { + poolFinish(&dtd.pool); + if (!ns) + ; + else if (name[0] == 'x' + && name[1] == 'm' + && name[2] == 'l' + && name[3] == 'n' + && name[4] == 's' + && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) { + if (name[5] == '\0') + id->prefix = &dtd.defaultPrefix; + else + id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX)); + id->xmlns = XML_TRUE; + } + else { + int i; + for (i = 0; name[i]; i++) { + if (name[i] == XML_T(':')) { + int j; + for (j = 0; j < i; j++) { + if (!poolAppendChar(&dtd.pool, name[j])) + return NULL; + } + if (!poolAppendChar(&dtd.pool, XML_T('\0'))) + return NULL; + id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), + sizeof(PREFIX)); + if (id->prefix && id->prefix->name == poolStart(&dtd.pool)) + poolFinish(&dtd.pool); + else + poolDiscard(&dtd.pool); + break; + } + } + } + } + return id; +} + +#define CONTEXT_SEP XML_T('\f') + +static const XML_Char * FASTCALL +getContext(XML_Parser parser) +{ + HASH_TABLE_ITER iter; + XML_Bool needSep = XML_FALSE; + + if (dtd.defaultPrefix.binding) { + int i; + int len; + if (!poolAppendChar(&tempPool, XML_T('='))) + return NULL; + len = dtd.defaultPrefix.binding->uriLen; + if (namespaceSeparator != XML_T('\0')) + len--; + for (i = 0; i < len; i++) + if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i])) + return NULL; + needSep = XML_TRUE; + } + + hashTableIterInit(&iter, &(dtd.prefixes)); + for (;;) { + int i; + int len; + const XML_Char *s; + PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); + if (!prefix) + break; + if (!prefix->binding) + continue; + if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) + return NULL; + for (s = prefix->name; *s; s++) + if (!poolAppendChar(&tempPool, *s)) + return NULL; + if (!poolAppendChar(&tempPool, XML_T('='))) + return NULL; + len = prefix->binding->uriLen; + if (namespaceSeparator != XML_T('\0')) + len--; + for (i = 0; i < len; i++) + if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) + return NULL; + needSep = XML_TRUE; + } + + + hashTableIterInit(&iter, &(dtd.generalEntities)); + for (;;) { + const XML_Char *s; + ENTITY *e = (ENTITY *)hashTableIterNext(&iter); + if (!e) + break; + if (!e->open) + continue; + if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) + return NULL; + for (s = e->name; *s; s++) + if (!poolAppendChar(&tempPool, *s)) + return 0; + needSep = XML_TRUE; + } + + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return NULL; + return tempPool.start; +} + +static XML_Bool FASTCALL +setContext(XML_Parser parser, const XML_Char *context) +{ + const XML_Char *s = context; + + while (*context != XML_T('\0')) { + if (*s == CONTEXT_SEP || *s == XML_T('\0')) { + ENTITY *e; + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return XML_FALSE; + e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0); + if (e) + e->open = XML_TRUE; + if (*s != XML_T('\0')) + s++; + context = s; + poolDiscard(&tempPool); + } + else if (*s == XML_T('=')) { + PREFIX *prefix; + if (poolLength(&tempPool) == 0) + prefix = &dtd.defaultPrefix; + else { + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return XML_FALSE; + prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), + sizeof(PREFIX)); + if (!prefix) + return XML_FALSE; + if (prefix->name == poolStart(&tempPool)) { + prefix->name = poolCopyString(&dtd.pool, prefix->name); + if (!prefix->name) + return XML_FALSE; + } + poolDiscard(&tempPool); + } + for (context = s + 1; + *context != CONTEXT_SEP && *context != XML_T('\0'); + context++) + if (!poolAppendChar(&tempPool, *context)) + return XML_FALSE; + if (!poolAppendChar(&tempPool, XML_T('\0'))) + return XML_FALSE; + if (!addBinding(parser, prefix, 0, poolStart(&tempPool), + &inheritedBindings)) + return XML_FALSE; + poolDiscard(&tempPool); + if (*context != XML_T('\0')) + ++context; + s = context; + } + else { + if (!poolAppendChar(&tempPool, *s)) + return XML_FALSE; + s++; + } + } + return XML_TRUE; +} + +static void FASTCALL +normalizePublicId(XML_Char *publicId) +{ + XML_Char *p = publicId; + XML_Char *s; + for (s = publicId; *s; s++) { + switch (*s) { + case 0x20: + case 0xD: + case 0xA: + if (p != publicId && p[-1] != 0x20) + *p++ = 0x20; + break; + default: + *p++ = *s; + } + } + if (p != publicId && p[-1] == 0x20) + --p; + *p = XML_T('\0'); +} + +static void FASTCALL +dtdInit(DTD *p, XML_Parser parser) +{ + XML_Memory_Handling_Suite *ms = &parser->m_mem; + poolInit(&(p->pool), ms); + poolInit(&(p->entityValuePool), ms); + hashTableInit(&(p->generalEntities), ms); + hashTableInit(&(p->elementTypes), ms); + hashTableInit(&(p->attributeIds), ms); + hashTableInit(&(p->prefixes), ms); +#ifdef XML_DTD + p->paramEntityRead = XML_FALSE; + hashTableInit(&(p->paramEntities), ms); +#endif /* XML_DTD */ + p->defaultPrefix.name = NULL; + p->defaultPrefix.binding = NULL; + + p->in_eldecl = XML_FALSE; + p->scaffIndex = NULL; + p->scaffold = NULL; + p->scaffLevel = 0; + p->scaffSize = 0; + p->scaffCount = 0; + p->contentStringLen = 0; + + p->keepProcessing = XML_TRUE; + p->hasParamEntityRefs = XML_FALSE; + p->standalone = XML_FALSE; +} + +#ifdef XML_DTD + +static void FASTCALL +dtdSwap(DTD *p1, DTD *p2) +{ + DTD tem; + memcpy(&tem, p1, sizeof(DTD)); + memcpy(p1, p2, sizeof(DTD)); + memcpy(p2, &tem, sizeof(DTD)); +} + +#endif /* XML_DTD */ + +static void FASTCALL +dtdReset(DTD *p, XML_Parser parser) +{ + HASH_TABLE_ITER iter; + hashTableIterInit(&iter, &(p->elementTypes)); + for (;;) { + ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); + if (!e) + break; + if (e->allocDefaultAtts != 0) + FREE(e->defaultAtts); + } + hashTableClear(&(p->generalEntities)); +#ifdef XML_DTD + p->paramEntityRead = XML_FALSE; + hashTableClear(&(p->paramEntities)); +#endif /* XML_DTD */ + hashTableClear(&(p->elementTypes)); + hashTableClear(&(p->attributeIds)); + hashTableClear(&(p->prefixes)); + poolClear(&(p->pool)); + poolClear(&(p->entityValuePool)); + p->defaultPrefix.name = NULL; + p->defaultPrefix.binding = NULL; + + p->in_eldecl = XML_FALSE; + if (p->scaffIndex) { + FREE(p->scaffIndex); + p->scaffIndex = NULL; + } + if (p->scaffold) { + FREE(p->scaffold); + p->scaffold = NULL; + } + p->scaffLevel = 0; + p->scaffSize = 0; + p->scaffCount = 0; + p->contentStringLen = 0; + + p->keepProcessing = XML_TRUE; + p->hasParamEntityRefs = XML_FALSE; + p->standalone = XML_FALSE; +} + +static void FASTCALL +dtdDestroy(DTD *p, XML_Parser parser) +{ + HASH_TABLE_ITER iter; + hashTableIterInit(&iter, &(p->elementTypes)); + for (;;) { + ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); + if (!e) + break; + if (e->allocDefaultAtts != 0) + FREE(e->defaultAtts); + } + hashTableDestroy(&(p->generalEntities)); +#ifdef XML_DTD + hashTableDestroy(&(p->paramEntities)); +#endif /* XML_DTD */ + hashTableDestroy(&(p->elementTypes)); + hashTableDestroy(&(p->attributeIds)); + hashTableDestroy(&(p->prefixes)); + poolDestroy(&(p->pool)); + poolDestroy(&(p->entityValuePool)); + if (!parentParser) { + if (p->scaffIndex) + FREE(p->scaffIndex); + if (p->scaffold) + FREE(p->scaffold); + } +} + +#ifndef SYMBIAN_MIN_SIZE +/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise. + The new DTD has already been initialized. +*/ +static int FASTCALL +dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser) +{ + HASH_TABLE_ITER iter; + + /* Copy the prefix table. */ + + hashTableIterInit(&iter, &(oldDtd->prefixes)); + for (;;) { + const XML_Char *name; + const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); + if (!oldP) + break; + name = poolCopyString(&(newDtd->pool), oldP->name); + if (!name) + return 0; + if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX))) + return 0; + } + + hashTableIterInit(&iter, &(oldDtd->attributeIds)); + + /* Copy the attribute id table. */ + + for (;;) { + ATTRIBUTE_ID *newA; + const XML_Char *name; + const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); + + if (!oldA) + break; + /* Remember to allocate the scratch byte before the name. */ + if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) + return 0; + name = poolCopyString(&(newDtd->pool), oldA->name); + if (!name) + return 0; + ++name; + newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, + sizeof(ATTRIBUTE_ID)); + if (!newA) + return 0; + newA->maybeTokenized = oldA->maybeTokenized; + if (oldA->prefix) { + newA->xmlns = oldA->xmlns; + if (oldA->prefix == &oldDtd->defaultPrefix) + newA->prefix = &newDtd->defaultPrefix; + else + newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), + oldA->prefix->name, 0); + } + } + + /* Copy the element type table. */ + + hashTableIterInit(&iter, &(oldDtd->elementTypes)); + + for (;;) { + int i; + ELEMENT_TYPE *newE; + const XML_Char *name; + const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); + if (!oldE) + break; + name = poolCopyString(&(newDtd->pool), oldE->name); + if (!name) + return 0; + newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, + sizeof(ELEMENT_TYPE)); + if (!newE) + return 0; + if (oldE->nDefaultAtts) { + newE->defaultAtts = (DEFAULT_ATTRIBUTE *) + MALLOC(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); + if (!newE->defaultAtts) { + FREE(newE); + return 0; + } + } + if (oldE->idAtt) + newE->idAtt = (ATTRIBUTE_ID *) + lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0); + newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; + if (oldE->prefix) + newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), + oldE->prefix->name, 0); + for (i = 0; i < newE->nDefaultAtts; i++) { + newE->defaultAtts[i].id = (ATTRIBUTE_ID *) + lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); + newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; + if (oldE->defaultAtts[i].value) { + newE->defaultAtts[i].value + = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); + if (!newE->defaultAtts[i].value) + return 0; + } + else + newE->defaultAtts[i].value = NULL; + } + } + + /* Copy the entity tables. */ + if (!copyEntityTable(&(newDtd->generalEntities), + &(newDtd->pool), + &(oldDtd->generalEntities), parser)) + return 0; + +#ifdef XML_DTD + if (!copyEntityTable(&(newDtd->paramEntities), + &(newDtd->pool), + &(oldDtd->paramEntities), parser)) + return 0; + newDtd->paramEntityRead = oldDtd->paramEntityRead; +#endif /* XML_DTD */ + + newDtd->keepProcessing = oldDtd->keepProcessing; + newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; + newDtd->standalone = oldDtd->standalone; + + /* Don't want deep copying for scaffolding */ + newDtd->in_eldecl = oldDtd->in_eldecl; + newDtd->scaffold = oldDtd->scaffold; + newDtd->contentStringLen = oldDtd->contentStringLen; + newDtd->scaffSize = oldDtd->scaffSize; + newDtd->scaffLevel = oldDtd->scaffLevel; + newDtd->scaffIndex = oldDtd->scaffIndex; + + return 1; +} /* End dtdCopy */ + +static int FASTCALL +copyEntityTable(HASH_TABLE *newTable, + STRING_POOL *newPool, + const HASH_TABLE *oldTable, + XML_Parser parser) +{ + HASH_TABLE_ITER iter; + const XML_Char *cachedOldBase = NULL; + const XML_Char *cachedNewBase = NULL; + + hashTableIterInit(&iter, oldTable); + + for (;;) { + ENTITY *newE; + const XML_Char *name; + const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); + if (!oldE) + break; + name = poolCopyString(newPool, oldE->name); + if (!name) + return 0; + newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY)); + if (!newE) + return 0; + if (oldE->systemId) { + const XML_Char *tem = poolCopyString(newPool, oldE->systemId); + if (!tem) + return 0; + newE->systemId = tem; + if (oldE->base) { + if (oldE->base == cachedOldBase) + newE->base = cachedNewBase; + else { + cachedOldBase = oldE->base; + tem = poolCopyString(newPool, cachedOldBase); + if (!tem) + return 0; + cachedNewBase = newE->base = tem; + } + } + if (oldE->publicId) { + tem = poolCopyString(newPool, oldE->publicId); + if (!tem) + return 0; + newE->publicId = tem; + } + } + else { + const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, + oldE->textLen); + if (!tem) + return 0; + newE->textPtr = tem; + newE->textLen = oldE->textLen; + } + if (oldE->notation) { + const XML_Char *tem = poolCopyString(newPool, oldE->notation); + if (!tem) + return 0; + newE->notation = tem; + } + newE->is_param = oldE->is_param; + newE->is_internal = oldE->is_internal; + } + return 1; +} +#endif // SYMBIAN_MIN_SIZE + +#define INIT_SIZE 64 + +static int FASTCALL +keyeq(KEY s1, KEY s2) +{ + for (; *s1 == *s2; s1++, s2++) + if (*s1 == 0) + return 1; + return 0; +} + +static unsigned long FASTCALL +hash(KEY s) +{ + unsigned long h = 0; + while (*s) + h = (h << 5) + h + (unsigned char)*s++; + return h; +} + +static NAMED * FASTCALL +lookup(HASH_TABLE *table, KEY name, size_t createSize) +{ + size_t i; + if (table->size == 0) { + size_t tsize; + + if (!createSize) + return NULL; + tsize = INIT_SIZE * sizeof(NAMED *); + table->v = (NAMED **)table->mem->malloc_fcn(table->mem->allocData, tsize); + if (!table->v) + return NULL; + memset(table->v, 0, tsize); + table->size = INIT_SIZE; + table->usedLim = INIT_SIZE / 2; + i = hash(name) & (table->size - 1); + } + else { + unsigned long h = hash(name); + for (i = h & (table->size - 1); + table->v[i]; + i == 0 ? i = table->size - 1 : --i) { + if (keyeq(name, table->v[i]->name)) + return table->v[i]; + } + if (!createSize) + return NULL; + if (table->used == table->usedLim) { + /* check for overflow */ + size_t newSize = table->size * 2; + size_t tsize = newSize * sizeof(NAMED *); + NAMED **newV = (NAMED **)table->mem->malloc_fcn(table->mem->allocData, tsize); + if (!newV) + return NULL; + memset(newV, 0, tsize); + for (i = 0; i < table->size; i++) + if (table->v[i]) { + size_t j; + for (j = hash(table->v[i]->name) & (newSize - 1); + newV[j]; + j == 0 ? j = newSize - 1 : --j) + ; + newV[j] = table->v[i]; + } + table->mem->free_fcn(table->mem->allocData, table->v); + table->v = newV; + table->size = newSize; + table->usedLim = newSize/2; + for (i = h & (table->size - 1); + table->v[i]; + i == 0 ? i = table->size - 1 : --i) + ; + } + } + table->v[i] = (NAMED *)table->mem->malloc_fcn(table->mem->allocData, createSize); + if (!table->v[i]) + return NULL; + memset(table->v[i], 0, createSize); + table->v[i]->name = name; + (table->used)++; + return table->v[i]; +} + +static void FASTCALL +hashTableClear(HASH_TABLE *table) +{ + size_t i; + for (i = 0; i < table->size; i++) { + NAMED *p = table->v[i]; + if (p) { + table->mem->free_fcn(table->mem->allocData, p); + table->v[i] = NULL; + } + } + table->usedLim = table->size / 2; + table->used = 0; +} + +static void FASTCALL +hashTableDestroy(HASH_TABLE *table) +{ + size_t i; + for (i = 0; i < table->size; i++) { + NAMED *p = table->v[i]; + if (p) + table->mem->free_fcn(table->mem->allocData, p); + } + if (table->v) + table->mem->free_fcn(table->mem->allocData, table->v); +} + +static void FASTCALL +hashTableInit(HASH_TABLE *p, XML_Memory_Handling_Suite *ms) +{ + p->size = 0; + p->usedLim = 0; + p->used = 0; + p->v = NULL; + p->mem = ms; +} + +static void FASTCALL +hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) +{ + iter->p = table->v; + iter->end = iter->p + table->size; +} + +static NAMED * FASTCALL +hashTableIterNext(HASH_TABLE_ITER *iter) +{ + while (iter->p != iter->end) { + NAMED *tem = *(iter->p)++; + if (tem) + return tem; + } + return NULL; +} + +static void FASTCALL +poolInit(STRING_POOL *pool, XML_Memory_Handling_Suite *ms) +{ + pool->blocks = NULL; + pool->freeBlocks = NULL; + pool->start = NULL; + pool->ptr = NULL; + pool->end = NULL; + pool->mem = ms; +} + +static void FASTCALL +poolClear(STRING_POOL *pool) +{ + if (!pool->freeBlocks) + pool->freeBlocks = pool->blocks; + else { + BLOCK *p = pool->blocks; + while (p) { + BLOCK *tem = p->next; + p->next = pool->freeBlocks; + pool->freeBlocks = p; + p = tem; + } + } + pool->blocks = NULL; + pool->start = NULL; + pool->ptr = NULL; + pool->end = NULL; +} + +static void FASTCALL +poolDestroy(STRING_POOL *pool) +{ + BLOCK *p = pool->blocks; + while (p) { + BLOCK *tem = p->next; + pool->mem->free_fcn(pool->mem->allocData, p); + p = tem; + } + p = pool->freeBlocks; + while (p) { + BLOCK *tem = p->next; + pool->mem->free_fcn(pool->mem->allocData, p); + p = tem; + } +} + +static XML_Char * FASTCALL +poolAppend(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end) +{ + if (!pool->ptr && !poolGrow(pool)) + return NULL; + for (;;) { + XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); + if (ptr == end) + break; + if (!poolGrow(pool)) + return NULL; + } + return pool->start; +} + +static const XML_Char * FASTCALL +poolCopyString(STRING_POOL *pool, const XML_Char *s) +{ + do { + if (!poolAppendChar(pool, *s)) + return NULL; + } while (*s++); + s = pool->start; + poolFinish(pool); + return s; +} + +#ifndef SYMBIAN_MIN_SIZE +static const XML_Char * FASTCALL +poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) +{ + if (!pool->ptr && !poolGrow(pool)) + return NULL; + for (; n > 0; --n, s++) { + if (!poolAppendChar(pool, *s)) + return NULL; + } + s = pool->start; + poolFinish(pool); + return s; +} +#endif // SYMBIAN_MIN_SIZE + +#ifndef SYMBIAN_MIN_SIZE +static const XML_Char * FASTCALL +poolAppendString(STRING_POOL *pool, const XML_Char *s) +{ + while (*s) { + if (!poolAppendChar(pool, *s)) + return NULL; + s++; + } + return pool->start; +} +#endif // SYMBIAN_MIN_SIZE + +static XML_Char * FASTCALL +poolStoreString(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end) +{ + if (!poolAppend(pool, enc, ptr, end)) + return NULL; + if (pool->ptr == pool->end && !poolGrow(pool)) + return NULL; + *(pool->ptr)++ = 0; + return pool->start; +} + +static XML_Bool FASTCALL +poolGrow(STRING_POOL *pool) +{ + if (pool->freeBlocks) { + if (pool->start == 0) { + pool->blocks = pool->freeBlocks; + pool->freeBlocks = pool->freeBlocks->next; + pool->blocks->next = NULL; + pool->start = pool->blocks->s; + pool->end = pool->start + pool->blocks->size; + pool->ptr = pool->start; + return XML_TRUE; + } + if (pool->end - pool->start < pool->freeBlocks->size) { + BLOCK *tem = pool->freeBlocks->next; + pool->freeBlocks->next = pool->blocks; + pool->blocks = pool->freeBlocks; + pool->freeBlocks = tem; + memcpy(pool->blocks->s, pool->start, + (pool->end - pool->start) * sizeof(XML_Char)); + pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->start = pool->blocks->s; + pool->end = pool->start + pool->blocks->size; + return XML_TRUE; + } + } + if (pool->blocks && pool->start == pool->blocks->s) { + int blockSize = (pool->end - pool->start)*2; + pool->blocks = (BLOCK *)pool->mem->realloc_fcn(pool->mem->allocData, pool->blocks, + offsetof(BLOCK, s) + + blockSize * sizeof(XML_Char)); + if (pool->blocks == NULL) + return XML_FALSE; + pool->blocks->size = blockSize; + pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->start = pool->blocks->s; + pool->end = pool->start + blockSize; + } + else { + BLOCK *tem; + int blockSize = pool->end - pool->start; + if (blockSize < INIT_BLOCK_SIZE) + blockSize = INIT_BLOCK_SIZE; + else + blockSize *= 2; + tem = (BLOCK *)pool->mem->malloc_fcn(pool->mem->allocData, offsetof(BLOCK, s) + + blockSize * sizeof(XML_Char)); + if (!tem) + return XML_FALSE; + tem->size = blockSize; + tem->next = pool->blocks; + pool->blocks = tem; + if (pool->ptr != pool->start) + memcpy(tem->s, pool->start, + (pool->ptr - pool->start) * sizeof(XML_Char)); + pool->ptr = tem->s + (pool->ptr - pool->start); + pool->start = tem->s; + pool->end = tem->s + blockSize; + } + return XML_TRUE; +} + +static int FASTCALL +nextScaffoldPart(XML_Parser parser) +{ + CONTENT_SCAFFOLD * me; + int next; + + if (!dtd.scaffIndex) { + dtd.scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); + if (!dtd.scaffIndex) + return -1; + dtd.scaffIndex[0] = 0; + } + + if (dtd.scaffCount >= dtd.scaffSize) { + CONTENT_SCAFFOLD *temp; + if (dtd.scaffold) { + temp = (CONTENT_SCAFFOLD *) + REALLOC(dtd.scaffold, dtd.scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); + if (temp == NULL) + return -1; + dtd.scaffSize *= 2; + } + else { + temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS * sizeof(CONTENT_SCAFFOLD)); + if (temp == NULL) + return -1; + dtd.scaffSize = INIT_SCAFFOLD_ELEMENTS; + } + dtd.scaffold = temp; + } + next = dtd.scaffCount++; + me = &dtd.scaffold[next]; + if (dtd.scaffLevel) { + CONTENT_SCAFFOLD *parent = &dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel-1]]; + if (parent->lastchild) { + dtd.scaffold[parent->lastchild].nextsib = next; + } + if (!parent->childcnt) + parent->firstchild = next; + parent->lastchild = next; + parent->childcnt++; + } + me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; + return next; +} + +static void FASTCALL +build_node(XML_Parser parser, + int src_node, + XML_Content *dest, + XML_Content **contpos, + XML_Char **strpos) +{ + dest->type = dtd.scaffold[src_node].type; + dest->quant = dtd.scaffold[src_node].quant; + if (dest->type == XML_CTYPE_NAME) { + const XML_Char *src; + dest->name = *strpos; + src = dtd.scaffold[src_node].name; + for (;;) { + *(*strpos)++ = *src; + if (!*src) + break; + src++; + } + dest->numchildren = 0; + dest->children = NULL; + } + else { + unsigned int i; + int cn; + dest->numchildren = dtd.scaffold[src_node].childcnt; + dest->children = *contpos; + *contpos += dest->numchildren; + for (i = 0, cn = dtd.scaffold[src_node].firstchild; + i < dest->numchildren; + i++, cn = dtd.scaffold[cn].nextsib) { + build_node(parser, cn, &(dest->children[i]), contpos, strpos); + } + dest->name = NULL; + } +} + +static XML_Content * FASTCALL +build_model (XML_Parser parser) +{ + XML_Content *ret; + XML_Content *cpos; + XML_Char * str; + int allocsize = (dtd.scaffCount * sizeof(XML_Content) + + (dtd.contentStringLen * sizeof(XML_Char))); + + ret = (XML_Content *)MALLOC(allocsize); + if (!ret) + return NULL; + + str = (XML_Char *) (&ret[dtd.scaffCount]); + cpos = &ret[1]; + + build_node(parser, 0, ret, &cpos, &str); + return ret; +} + +static ELEMENT_TYPE * FASTCALL +getElementType(XML_Parser parser, + const ENCODING *enc, + const char *ptr, + const char *end) +{ + const XML_Char *name = poolStoreString(&dtd.pool, enc, ptr, end); + ELEMENT_TYPE *ret; + + if (!name) + return NULL; + ret = (ELEMENT_TYPE *) lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE)); + if (!ret) + return NULL; + if (ret->name != name) + poolDiscard(&dtd.pool); + else { + poolFinish(&dtd.pool); + if (!setElementTypePrefix(parser, ret)) + return NULL; + } + return ret; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmlrole.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmlrole.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1328 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. + Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +*/ + +// This file produces 105 "unreferenced formal parameter" warnings on MS and CW +#if defined(__VC32__) +#pragma warning ( disable : 4100 ) +#elif defined(__CW32__) +#pragma warn_unusedarg off +#endif + +#include "expat_config.h" + +#include "internal.h" +#include "xmlrole.h" +#include "ascii.h" + +/* Doesn't check: + + that ,| are not mixed in a model group + content of literals + +*/ + +static const char KW_ANY[] = { + ASCII_A, ASCII_N, ASCII_Y, '\0' }; +static const char KW_ATTLIST[] = { + ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; +static const char KW_CDATA[] = { + ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; +static const char KW_DOCTYPE[] = { + ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; +static const char KW_ELEMENT[] = { + ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; +static const char KW_EMPTY[] = { + ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; +static const char KW_ENTITIES[] = { + ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, + '\0' }; +static const char KW_ENTITY[] = { + ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; +static const char KW_FIXED[] = { + ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; +static const char KW_ID[] = { + ASCII_I, ASCII_D, '\0' }; +static const char KW_IDREF[] = { + ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; +static const char KW_IDREFS[] = { + ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; +#ifdef XML_DTD +static const char KW_IGNORE[] = { + ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; +#endif /* XML_DTD */ +static const char KW_IMPLIED[] = { + ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; +#ifdef XML_DTD +static const char KW_INCLUDE[] = { + ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; +#endif /* XML_DTD */ +static const char KW_NDATA[] = { + ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; +static const char KW_NMTOKEN[] = { + ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; +static const char KW_NMTOKENS[] = { + ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, + '\0' }; +static const char KW_NOTATION[] = + { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, + '\0' }; +static const char KW_PCDATA[] = { + ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; +static const char KW_PUBLIC[] = { + ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; +static const char KW_REQUIRED[] = { + ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, + '\0' }; +static const char KW_SYSTEM[] = { + ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; + +#ifndef MIN_BYTES_PER_CHAR +#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) +#endif + +#ifdef XML_DTD +#define setTopLevel(state) \ + ((state)->handler = ((state)->documentEntity \ + ? internalSubset \ + : externalSubset1)) +#else /* not XML_DTD */ +#define setTopLevel(state) ((state)->handler = internalSubset) +#endif /* not XML_DTD */ + +typedef int FASTCALL PROLOG_HANDLER(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc); + +static PROLOG_HANDLER + prolog0, prolog1, prolog2, + doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, + internalSubset, + entity0, entity1, entity2, entity3, entity4, entity5, entity6, + entity7, entity8, entity9, entity10, + notation0, notation1, notation2, notation3, notation4, + attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, + attlist7, attlist8, attlist9, + element0, element1, element2, element3, element4, element5, element6, + element7, +#ifdef XML_DTD + externalSubset0, externalSubset1, + condSect0, condSect1, condSect2, +#endif /* XML_DTD */ + declClose, + error; + +static int FASTCALL common(PROLOG_STATE *state, int tok); + +static int FASTCALL +prolog0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + state->handler = prolog1; + return XML_ROLE_NONE; + case XML_TOK_XML_DECL: + state->handler = prolog1; + return XML_ROLE_XML_DECL; + case XML_TOK_PI: + state->handler = prolog1; + return XML_ROLE_PI; + case XML_TOK_COMMENT: + state->handler = prolog1; + return XML_ROLE_COMMENT; + case XML_TOK_BOM: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (!XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_DOCTYPE)) + break; + state->handler = doctype0; + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return common(state, tok); +} + +static int FASTCALL +prolog1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_PI: + return XML_ROLE_PI; + case XML_TOK_COMMENT: + return XML_ROLE_COMMENT; + case XML_TOK_BOM: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (!XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_DOCTYPE)) + break; + state->handler = doctype0; + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return common(state, tok); +} + +static int FASTCALL +prolog2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_PI: + return XML_ROLE_PI; + case XML_TOK_COMMENT: + return XML_ROLE_COMMENT; + case XML_TOK_INSTANCE_START: + state->handler = error; + return XML_ROLE_INSTANCE_START; + } + return common(state, tok); +} + +static int FASTCALL +doctype0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = doctype1; + return XML_ROLE_DOCTYPE_NAME; + } + return common(state, tok); +} + +static int FASTCALL +doctype1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = internalSubset; + return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { + state->handler = doctype3; + return XML_ROLE_DOCTYPE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { + state->handler = doctype2; + return XML_ROLE_DOCTYPE_NONE; + } + break; + } + return common(state, tok); +} + +static int FASTCALL +doctype2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_LITERAL: + state->handler = doctype3; + return XML_ROLE_DOCTYPE_PUBLIC_ID; + } + return common(state, tok); +} + +static int FASTCALL +doctype3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_LITERAL: + state->handler = doctype4; + return XML_ROLE_DOCTYPE_SYSTEM_ID; + } + return common(state, tok); +} + +static int FASTCALL +doctype4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = internalSubset; + return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + } + return common(state, tok); +} + +static int FASTCALL +doctype5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_DOCTYPE_NONE; + case XML_TOK_DECL_CLOSE: + state->handler = prolog2; + return XML_ROLE_DOCTYPE_CLOSE; + } + return common(state, tok); +} + +static int FASTCALL +internalSubset(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_DECL_OPEN: + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_ENTITY)) { + state->handler = entity0; + return XML_ROLE_ENTITY_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_ATTLIST)) { + state->handler = attlist0; + return XML_ROLE_ATTLIST_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_ELEMENT)) { + state->handler = element0; + return XML_ROLE_ELEMENT_NONE; + } + if (XmlNameMatchesAscii(enc, + ptr + 2 * MIN_BYTES_PER_CHAR(enc), + end, + KW_NOTATION)) { + state->handler = notation0; + return XML_ROLE_NOTATION_NONE; + } + break; + case XML_TOK_PI: + return XML_ROLE_PI; + case XML_TOK_COMMENT: + return XML_ROLE_COMMENT; + case XML_TOK_PARAM_ENTITY_REF: + return XML_ROLE_PARAM_ENTITY_REF; + case XML_TOK_CLOSE_BRACKET: + state->handler = doctype5; + return XML_ROLE_DOCTYPE_NONE; + } + return common(state, tok); +} + +#ifdef XML_DTD + +static int FASTCALL +externalSubset0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + state->handler = externalSubset1; + if (tok == XML_TOK_XML_DECL) + return XML_ROLE_TEXT_DECL; + return externalSubset1(state, tok, ptr, end, enc); +} + +static int FASTCALL +externalSubset1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_COND_SECT_OPEN: + state->handler = condSect0; + return XML_ROLE_NONE; + case XML_TOK_COND_SECT_CLOSE: + if (state->includeLevel == 0) + break; + state->includeLevel -= 1; + return XML_ROLE_NONE; + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_CLOSE_BRACKET: + break; + case XML_TOK_NONE: + if (state->includeLevel) + break; + return XML_ROLE_NONE; + default: + return internalSubset(state, tok, ptr, end, enc); + } + return common(state, tok); +} + +#endif /* XML_DTD */ + +static int FASTCALL +entity0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_PERCENT: + state->handler = entity1; + return XML_ROLE_ENTITY_NONE; + case XML_TOK_NAME: + state->handler = entity2; + return XML_ROLE_GENERAL_ENTITY_NAME; + } + return common(state, tok); +} + +static int FASTCALL +entity1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_NAME: + state->handler = entity7; + return XML_ROLE_PARAM_ENTITY_NAME; + } + return common(state, tok); +} + +static int FASTCALL +entity2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { + state->handler = entity4; + return XML_ROLE_ENTITY_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { + state->handler = entity3; + return XML_ROLE_ENTITY_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = declClose; + state->role_none = XML_ROLE_ENTITY_NONE; + return XML_ROLE_ENTITY_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +entity3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_LITERAL: + state->handler = entity4; + return XML_ROLE_ENTITY_PUBLIC_ID; + } + return common(state, tok); +} + +static int FASTCALL +entity4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_LITERAL: + state->handler = entity5; + return XML_ROLE_ENTITY_SYSTEM_ID; + } + return common(state, tok); +} + +static int FASTCALL +entity5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_DECL_CLOSE: + setTopLevel(state); + return XML_ROLE_ENTITY_COMPLETE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { + state->handler = entity6; + return XML_ROLE_ENTITY_NONE; + } + break; + } + return common(state, tok); +} + +static int FASTCALL +entity6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_NAME: + state->handler = declClose; + state->role_none = XML_ROLE_ENTITY_NONE; + return XML_ROLE_ENTITY_NOTATION_NAME; + } + return common(state, tok); +} + +static int FASTCALL +entity7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { + state->handler = entity9; + return XML_ROLE_ENTITY_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { + state->handler = entity8; + return XML_ROLE_ENTITY_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = declClose; + state->role_none = XML_ROLE_ENTITY_NONE; + return XML_ROLE_ENTITY_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +entity8(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_LITERAL: + state->handler = entity9; + return XML_ROLE_ENTITY_PUBLIC_ID; + } + return common(state, tok); +} + +static int FASTCALL +entity9(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_LITERAL: + state->handler = entity10; + return XML_ROLE_ENTITY_SYSTEM_ID; + } + return common(state, tok); +} + +static int FASTCALL +entity10(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ENTITY_NONE; + case XML_TOK_DECL_CLOSE: + setTopLevel(state); + return XML_ROLE_ENTITY_COMPLETE; + } + return common(state, tok); +} + +static int FASTCALL +notation0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NOTATION_NONE; + case XML_TOK_NAME: + state->handler = notation1; + return XML_ROLE_NOTATION_NAME; + } + return common(state, tok); +} + +static int FASTCALL +notation1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NOTATION_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { + state->handler = notation3; + return XML_ROLE_NOTATION_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { + state->handler = notation2; + return XML_ROLE_NOTATION_NONE; + } + break; + } + return common(state, tok); +} + +static int FASTCALL +notation2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NOTATION_NONE; + case XML_TOK_LITERAL: + state->handler = notation4; + return XML_ROLE_NOTATION_PUBLIC_ID; + } + return common(state, tok); +} + +static int FASTCALL +notation3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NOTATION_NONE; + case XML_TOK_LITERAL: + state->handler = declClose; + state->role_none = XML_ROLE_NOTATION_NONE; + return XML_ROLE_NOTATION_SYSTEM_ID; + } + return common(state, tok); +} + +static int FASTCALL +notation4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NOTATION_NONE; + case XML_TOK_LITERAL: + state->handler = declClose; + state->role_none = XML_ROLE_NOTATION_NONE; + return XML_ROLE_NOTATION_SYSTEM_ID; + case XML_TOK_DECL_CLOSE: + setTopLevel(state); + return XML_ROLE_NOTATION_NO_SYSTEM_ID; + } + return common(state, tok); +} + +static int FASTCALL +attlist0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = attlist1; + return XML_ROLE_ATTLIST_ELEMENT_NAME; + } + return common(state, tok); +} + +static int FASTCALL +attlist1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_DECL_CLOSE: + setTopLevel(state); + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = attlist2; + return XML_ROLE_ATTRIBUTE_NAME; + } + return common(state, tok); +} + +static int FASTCALL +attlist2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_NAME: + { + static const char *const types[] = { + KW_CDATA, + KW_ID, + KW_IDREF, + KW_IDREFS, + KW_ENTITY, + KW_ENTITIES, + KW_NMTOKEN, + KW_NMTOKENS, + }; + int i; + for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) + if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { + state->handler = attlist8; + return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; + } + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { + state->handler = attlist5; + return XML_ROLE_ATTLIST_NONE; + } + break; + case XML_TOK_OPEN_PAREN: + state->handler = attlist3; + return XML_ROLE_ATTLIST_NONE; + } + return common(state, tok); +} + +static int FASTCALL +attlist3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_NMTOKEN: + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = attlist4; + return XML_ROLE_ATTRIBUTE_ENUM_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +attlist4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_CLOSE_PAREN: + state->handler = attlist8; + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_OR: + state->handler = attlist3; + return XML_ROLE_ATTLIST_NONE; + } + return common(state, tok); +} + +static int FASTCALL +attlist5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_OPEN_PAREN: + state->handler = attlist6; + return XML_ROLE_ATTLIST_NONE; + } + return common(state, tok); +} + +static int FASTCALL +attlist6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_NAME: + state->handler = attlist7; + return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +attlist7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_CLOSE_PAREN: + state->handler = attlist8; + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_OR: + state->handler = attlist6; + return XML_ROLE_ATTLIST_NONE; + } + return common(state, tok); +} + +/* default value */ +static int FASTCALL +attlist8(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_POUND_NAME: + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + end, + KW_IMPLIED)) { + state->handler = attlist1; + return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; + } + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + end, + KW_REQUIRED)) { + state->handler = attlist1; + return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; + } + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + end, + KW_FIXED)) { + state->handler = attlist9; + return XML_ROLE_ATTLIST_NONE; + } + break; + case XML_TOK_LITERAL: + state->handler = attlist1; + return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +attlist9(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ATTLIST_NONE; + case XML_TOK_LITERAL: + state->handler = attlist1; + return XML_ROLE_FIXED_ATTRIBUTE_VALUE; + } + return common(state, tok); +} + +static int FASTCALL +element0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = element1; + return XML_ROLE_ELEMENT_NAME; + } + return common(state, tok); +} + +static int FASTCALL +element1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + return XML_ROLE_CONTENT_EMPTY; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + return XML_ROLE_CONTENT_ANY; + } + break; + case XML_TOK_OPEN_PAREN: + state->handler = element2; + state->level = 1; + return XML_ROLE_GROUP_OPEN; + } + return common(state, tok); +} + +static int FASTCALL +element2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_POUND_NAME: + if (XmlNameMatchesAscii(enc, + ptr + MIN_BYTES_PER_CHAR(enc), + end, + KW_PCDATA)) { + state->handler = element3; + return XML_ROLE_CONTENT_PCDATA; + } + break; + case XML_TOK_OPEN_PAREN: + state->level = 2; + state->handler = element6; + return XML_ROLE_GROUP_OPEN; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT; + case XML_TOK_NAME_QUESTION: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_OPT; + case XML_TOK_NAME_ASTERISK: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_REP; + case XML_TOK_NAME_PLUS: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_PLUS; + } + return common(state, tok); +} + +static int FASTCALL +element3(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_CLOSE_PAREN: + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + return XML_ROLE_GROUP_CLOSE; + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_OR: + state->handler = element4; + return XML_ROLE_ELEMENT_NONE; + } + return common(state, tok); +} + +static int FASTCALL +element4(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = element5; + return XML_ROLE_CONTENT_ELEMENT; + } + return common(state, tok); +} + +static int FASTCALL +element5(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_OR: + state->handler = element4; + return XML_ROLE_ELEMENT_NONE; + } + return common(state, tok); +} + +static int FASTCALL +element6(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_OPEN_PAREN: + state->level += 1; + return XML_ROLE_GROUP_OPEN; + case XML_TOK_NAME: + case XML_TOK_PREFIXED_NAME: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT; + case XML_TOK_NAME_QUESTION: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_OPT; + case XML_TOK_NAME_ASTERISK: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_REP; + case XML_TOK_NAME_PLUS: + state->handler = element7; + return XML_ROLE_CONTENT_ELEMENT_PLUS; + } + return common(state, tok); +} + +static int FASTCALL +element7(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_ELEMENT_NONE; + case XML_TOK_CLOSE_PAREN: + state->level -= 1; + if (state->level == 0) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + } + return XML_ROLE_GROUP_CLOSE; + case XML_TOK_CLOSE_PAREN_ASTERISK: + state->level -= 1; + if (state->level == 0) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + } + return XML_ROLE_GROUP_CLOSE_REP; + case XML_TOK_CLOSE_PAREN_QUESTION: + state->level -= 1; + if (state->level == 0) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + } + return XML_ROLE_GROUP_CLOSE_OPT; + case XML_TOK_CLOSE_PAREN_PLUS: + state->level -= 1; + if (state->level == 0) { + state->handler = declClose; + state->role_none = XML_ROLE_ELEMENT_NONE; + } + return XML_ROLE_GROUP_CLOSE_PLUS; + case XML_TOK_COMMA: + state->handler = element6; + return XML_ROLE_GROUP_SEQUENCE; + case XML_TOK_OR: + state->handler = element6; + return XML_ROLE_GROUP_CHOICE; + } + return common(state, tok); +} + +#ifdef XML_DTD + +static int FASTCALL +condSect0(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_NAME: + if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { + state->handler = condSect1; + return XML_ROLE_NONE; + } + if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { + state->handler = condSect2; + return XML_ROLE_NONE; + } + break; + } + return common(state, tok); +} + +static int FASTCALL +condSect1(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = externalSubset1; + state->includeLevel += 1; + return XML_ROLE_NONE; + } + return common(state, tok); +} + +static int FASTCALL +condSect2(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return XML_ROLE_NONE; + case XML_TOK_OPEN_BRACKET: + state->handler = externalSubset1; + return XML_ROLE_IGNORE_SECT; + } + return common(state, tok); +} + +#endif /* XML_DTD */ + +static int FASTCALL +declClose(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + switch (tok) { + case XML_TOK_PROLOG_S: + return state->role_none; + case XML_TOK_DECL_CLOSE: + setTopLevel(state); + return state->role_none; + } + return common(state, tok); +} + +static int FASTCALL +error(PROLOG_STATE *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc) +{ + return XML_ROLE_NONE; +} + +static int FASTCALL +common(PROLOG_STATE *state, int tok) +{ +#ifdef XML_DTD + if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) + return XML_ROLE_INNER_PARAM_ENTITY_REF; +#endif + state->handler = error; + return XML_ROLE_ERROR; +} + +void +XmlPrologStateInit(PROLOG_STATE *state) +{ + state->handler = prolog0; +#ifdef XML_DTD + state->documentEntity = 1; + state->includeLevel = 0; + state->inEntityValue = 0; +#endif /* XML_DTD */ +} + +#ifdef XML_DTD + +void +XmlPrologStateInitExternalEntity(PROLOG_STATE *state) +{ + state->handler = externalSubset0; + state->documentEntity = 0; + state->includeLevel = 0; +} + +#endif /* XML_DTD */ + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmlrole.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmlrole.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#ifndef XmlRole_INCLUDED +#define XmlRole_INCLUDED 1 + +#ifdef __VMS +/* 0 1 2 3 0 1 2 3 + 1234567890123456789012345678901 1234567890123456789012345678901 */ +#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt +#endif + +#include "xmltok.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + XML_ROLE_ERROR = -1, + XML_ROLE_NONE = 0, + XML_ROLE_XML_DECL, + XML_ROLE_INSTANCE_START, + XML_ROLE_DOCTYPE_NONE, + XML_ROLE_DOCTYPE_NAME, + XML_ROLE_DOCTYPE_SYSTEM_ID, + XML_ROLE_DOCTYPE_PUBLIC_ID, + XML_ROLE_DOCTYPE_INTERNAL_SUBSET, + XML_ROLE_DOCTYPE_CLOSE, + XML_ROLE_GENERAL_ENTITY_NAME, + XML_ROLE_PARAM_ENTITY_NAME, + XML_ROLE_ENTITY_NONE, + XML_ROLE_ENTITY_VALUE, + XML_ROLE_ENTITY_SYSTEM_ID, + XML_ROLE_ENTITY_PUBLIC_ID, + XML_ROLE_ENTITY_COMPLETE, + XML_ROLE_ENTITY_NOTATION_NAME, + XML_ROLE_NOTATION_NONE, + XML_ROLE_NOTATION_NAME, + XML_ROLE_NOTATION_SYSTEM_ID, + XML_ROLE_NOTATION_NO_SYSTEM_ID, + XML_ROLE_NOTATION_PUBLIC_ID, + XML_ROLE_ATTRIBUTE_NAME, + XML_ROLE_ATTRIBUTE_TYPE_CDATA, + XML_ROLE_ATTRIBUTE_TYPE_ID, + XML_ROLE_ATTRIBUTE_TYPE_IDREF, + XML_ROLE_ATTRIBUTE_TYPE_IDREFS, + XML_ROLE_ATTRIBUTE_TYPE_ENTITY, + XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, + XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, + XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, + XML_ROLE_ATTRIBUTE_ENUM_VALUE, + XML_ROLE_ATTRIBUTE_NOTATION_VALUE, + XML_ROLE_ATTLIST_NONE, + XML_ROLE_ATTLIST_ELEMENT_NAME, + XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, + XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, + XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, + XML_ROLE_FIXED_ATTRIBUTE_VALUE, + XML_ROLE_ELEMENT_NONE, + XML_ROLE_ELEMENT_NAME, + XML_ROLE_CONTENT_ANY, + XML_ROLE_CONTENT_EMPTY, + XML_ROLE_CONTENT_PCDATA, + XML_ROLE_GROUP_OPEN, + XML_ROLE_GROUP_CLOSE, + XML_ROLE_GROUP_CLOSE_REP, + XML_ROLE_GROUP_CLOSE_OPT, + XML_ROLE_GROUP_CLOSE_PLUS, + XML_ROLE_GROUP_CHOICE, + XML_ROLE_GROUP_SEQUENCE, + XML_ROLE_CONTENT_ELEMENT, + XML_ROLE_CONTENT_ELEMENT_REP, + XML_ROLE_CONTENT_ELEMENT_OPT, + XML_ROLE_CONTENT_ELEMENT_PLUS, + XML_ROLE_PI, + XML_ROLE_COMMENT, +#ifdef XML_DTD + XML_ROLE_TEXT_DECL, + XML_ROLE_IGNORE_SECT, + XML_ROLE_INNER_PARAM_ENTITY_REF, +#endif /* XML_DTD */ + XML_ROLE_PARAM_ENTITY_REF +}; + +typedef struct prolog_state { + int (FASTCALL *handler) (struct prolog_state *state, + int tok, + const char *ptr, + const char *end, + const ENCODING *enc); + unsigned level; + int role_none; +#ifdef XML_DTD + unsigned includeLevel; + int documentEntity; + int inEntityValue; +#endif /* XML_DTD */ +} PROLOG_STATE; + +void XmlPrologStateInit(PROLOG_STATE *); +#ifdef XML_DTD +void XmlPrologStateInitExternalEntity(PROLOG_STATE *); +#endif /* XML_DTD */ + +#define XmlTokenRole(state, tok, ptr, end, enc) \ + (((state)->handler)(state, tok, ptr, end, enc)) + +#ifdef __cplusplus +} +#endif + +#endif /* not XmlRole_INCLUDED */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1644 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. + Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +*/ + +// This file produces 33 "unreferenced formal parameter" warnings on MS and CW +// This file produces 195 "conditional expression is constant" warnings on MS due to #defined constants used in conditionals +#if defined(__VC32__) +#pragma warning ( disable : 4100 ) +#pragma warning ( disable : 4127 ) + +#if !defined(_DEBUG) +// This file produces 44 "unreachable code" warnings on MS for UREL builds +#pragma warning ( disable : 4702 ) +#endif // _DEBUG + +#elif defined(__CW32__) +#pragma warn_unusedarg off +#endif + +#include "expat_config.h" + +#include "internal.h" +#include "xmltok.h" +#include "nametab.h" + +#ifdef XML_DTD +#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) +#else +#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ +#endif + +#define VTABLE1 \ + { PREFIX(prologTok), PREFIX(contentTok), \ + PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ + { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ + PREFIX(sameName), \ + PREFIX(nameMatchesAscii), \ + PREFIX(nameLength), \ + PREFIX(skipS), \ + PREFIX(getAtts), \ + PREFIX(charRefNumber), \ + PREFIX(predefinedEntityName), \ + PREFIX(updatePosition), \ + PREFIX(isPublicId) + +#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) + +#define UCS2_GET_NAMING(pages, hi, lo) \ + (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) + +/* A 2 byte UTF-8 representation splits the characters 11 bits between + the bottom 5 and 6 bits of the bytes. We need 8 bits to index into + pages, 3 bits to add to that index and 5 bits to generate the mask. +*/ +#define UTF8_GET_NAMING2(pages, byte) \ + (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + + ((((byte)[0]) & 3) << 1) \ + + ((((byte)[1]) >> 5) & 1)] \ + & (1 << (((byte)[1]) & 0x1F))) + +/* A 3 byte UTF-8 representation splits the characters 16 bits between + the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index + into pages, 3 bits to add to that index and 5 bits to generate the + mask. +*/ +#define UTF8_GET_NAMING3(pages, byte) \ + (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ + + ((((byte)[1]) >> 2) & 0xF)] \ + << 3) \ + + ((((byte)[1]) & 3) << 1) \ + + ((((byte)[2]) >> 5) & 1)] \ + & (1 << (((byte)[2]) & 0x1F))) + +#define UTF8_GET_NAMING(pages, p, n) \ + ((n) == 2 \ + ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ + : ((n) == 3 \ + ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ + : 0)) + +/* Detection of invalid UTF-8 sequences is based on Table 3.1B + of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ + with the additional restriction of not allowing the Unicode + code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). + Implementation details: + (A & 0x80) == 0 means A < 0x80 + and + (A & 0xC0) == 0xC0 means A > 0xBF +*/ + +#define UTF8_INVALID2(p) \ + ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) + +#define UTF8_INVALID3(p) \ + (((p)[2] & 0x80) == 0 \ + || \ + ((*p) == 0xEF && (p)[1] == 0xBF \ + ? \ + (p)[2] > 0xBD \ + : \ + ((p)[2] & 0xC0) == 0xC0) \ + || \ + ((*p) == 0xE0 \ + ? \ + (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ + : \ + ((p)[1] & 0x80) == 0 \ + || \ + ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) + +#define UTF8_INVALID4(p) \ + (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ + || \ + ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ + || \ + ((*p) == 0xF0 \ + ? \ + (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ + : \ + ((p)[1] & 0x80) == 0 \ + || \ + ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) + +static int FASTCALL +isNever(const ENCODING *enc, const char *p) +{ + return 0; +} + +static int FASTCALL +utf8_isName2(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); +} + +static int FASTCALL +utf8_isName3(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); +} + +#define utf8_isName4 isNever + +static int FASTCALL +utf8_isNmstrt2(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); +} + +static int FASTCALL +utf8_isNmstrt3(const ENCODING *enc, const char *p) +{ + return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); +} + +#define utf8_isNmstrt4 isNever + +static int FASTCALL +utf8_isInvalid2(const ENCODING *enc, const char *p) +{ + return UTF8_INVALID2((const unsigned char *)p); +} + +static int FASTCALL +utf8_isInvalid3(const ENCODING *enc, const char *p) +{ + return UTF8_INVALID3((const unsigned char *)p); +} + +static int FASTCALL +utf8_isInvalid4(const ENCODING *enc, const char *p) +{ + return UTF8_INVALID4((const unsigned char *)p); +} + +struct normal_encoding { + ENCODING enc; + unsigned char type[256]; +#ifdef XML_MIN_SIZE + int (FASTCALL *byteType)(const ENCODING *, const char *); + int (FASTCALL *isNameMin)(const ENCODING *, const char *); + int (FASTCALL *isNmstrtMin)(const ENCODING *, const char *); + int (FASTCALL *byteToAscii)(const ENCODING *, const char *); + int (FASTCALL *charMatches)(const ENCODING *, const char *, int); +#endif /* XML_MIN_SIZE */ + int (FASTCALL *isName2)(const ENCODING *, const char *); + int (FASTCALL *isName3)(const ENCODING *, const char *); + int (FASTCALL *isName4)(const ENCODING *, const char *); + int (FASTCALL *isNmstrt2)(const ENCODING *, const char *); + int (FASTCALL *isNmstrt3)(const ENCODING *, const char *); + int (FASTCALL *isNmstrt4)(const ENCODING *, const char *); + int (FASTCALL *isInvalid2)(const ENCODING *, const char *); + int (FASTCALL *isInvalid3)(const ENCODING *, const char *); + int (FASTCALL *isInvalid4)(const ENCODING *, const char *); +}; + +#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) + +#ifdef XML_MIN_SIZE + +#define STANDARD_VTABLE(E) \ + E ## byteType, \ + E ## isNameMin, \ + E ## isNmstrtMin, \ + E ## byteToAscii, \ + E ## charMatches, + +#else + +#define STANDARD_VTABLE(E) /* as nothing */ + +#endif + +#define NORMAL_VTABLE(E) \ + E ## isName2, \ + E ## isName3, \ + E ## isName4, \ + E ## isNmstrt2, \ + E ## isNmstrt3, \ + E ## isNmstrt4, \ + E ## isInvalid2, \ + E ## isInvalid3, \ + E ## isInvalid4 + +static int FASTCALL checkCharRefNumber(int); + +#include "xmltok_impl.h" +#include "ascii.h" + +#ifdef XML_MIN_SIZE +#define sb_isNameMin isNever +#define sb_isNmstrtMin isNever +#endif + +#ifdef XML_MIN_SIZE +#define MINBPC(enc) ((enc)->minBytesPerChar) +#else +/* minimum bytes per character */ +#define MINBPC(enc) 1 +#endif + +#define SB_BYTE_TYPE(enc, p) \ + (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) + +#ifdef XML_MIN_SIZE +static int FASTCALL +sb_byteType(const ENCODING *enc, const char *p) +{ + return SB_BYTE_TYPE(enc, p); +} +#define BYTE_TYPE(enc, p) \ + (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) +#else +#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) +#endif + +#ifdef XML_MIN_SIZE +#define BYTE_TO_ASCII(enc, p) \ + (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) +static int FASTCALL +sb_byteToAscii(const ENCODING *enc, const char *p) +{ + return *p; +} +#else +#define BYTE_TO_ASCII(enc, p) (*(p)) +#endif + +#define IS_NAME_CHAR(enc, p, n) \ + (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) +#define IS_NMSTRT_CHAR(enc, p, n) \ + (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) +#define IS_INVALID_CHAR(enc, p, n) \ + (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) + +#ifdef XML_MIN_SIZE +#define IS_NAME_CHAR_MINBPC(enc, p) \ + (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ + (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) +#else +#define IS_NAME_CHAR_MINBPC(enc, p) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) +#endif + +#ifdef XML_MIN_SIZE +#define CHAR_MATCHES(enc, p, c) \ + (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) +static int FASTCALL +sb_charMatches(const ENCODING *enc, const char *p, int c) +{ + return *p == c; +} +#else +/* c is an ASCII character */ +#define CHAR_MATCHES(enc, p, c) (*(p) == c) +#endif + + +#define PREFIX(ident) normal_ ## ident +#include "xmltok_impl_c.h" + +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ + UTF8_cval1 = 0x00, + UTF8_cval2 = 0xc0, + UTF8_cval3 = 0xe0, + UTF8_cval4 = 0xf0 +}; + +static void FASTCALL +utf8_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + char *to; + const char *from; + if (fromLim - *fromP > toLim - *toP) { + /* Avoid copying partial characters. */ + for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) + if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) + break; + } + for (to = *toP, from = *fromP; from != fromLim; from++, to++) + *to = *from; + *fromP = from; + *toP = to; +} + +static void FASTCALL +utf8_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + unsigned short *to = *toP; + const char *from = *fromP; + while (from != fromLim && to != toLim) { + switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { + case BT_LEAD2: + *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); + from += 2; + break; + case BT_LEAD3: + *to++ = (unsigned short)(((from[0] & 0xf) << 12) + | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); + from += 3; + break; + case BT_LEAD4: + { + unsigned long n; + if (to + 1 == toLim) + goto after; + n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) + | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); + n -= 0x10000; + to[0] = (unsigned short)((n >> 10) | 0xD800); + to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); + to += 2; + from += 4; + } + break; + default: + *to++ = *from++; + break; + } + } +after: + *fromP = from; + *toP = to; +} + +#ifdef XML_NS +static const struct normal_encoding utf8_encoding_ns = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#include "asciitab.h" +#include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) +}; +#endif + +static const struct normal_encoding utf8_encoding = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#define BT_COLON BT_NMSTRT +#include "asciitab.h" +#undef BT_COLON +#include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) +}; + +#ifdef XML_NS + +static const struct normal_encoding internal_utf8_encoding_ns = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#include "iasciitab.h" +#include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) +}; + +#endif + +static const struct normal_encoding internal_utf8_encoding = { + { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, + { +#define BT_COLON BT_NMSTRT +#include "iasciitab.h" +#undef BT_COLON +#include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) +}; + +static void FASTCALL +latin1_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + for (;;) { + unsigned char c; + if (*fromP == fromLim) + break; + c = (unsigned char)**fromP; + if (c & 0x80) { + if (toLim - *toP < 2) + break; + *(*toP)++ = (char)((c >> 6) | UTF8_cval2); + *(*toP)++ = (char)((c & 0x3f) | 0x80); + (*fromP)++; + } + else { + if (*toP == toLim) + break; + *(*toP)++ = *(*fromP)++; + } + } +} + +static void FASTCALL +latin1_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + while (*fromP != fromLim && *toP != toLim) + *(*toP)++ = (unsigned char)*(*fromP)++; +} + +#ifdef XML_NS + +static const struct normal_encoding latin1_encoding_ns = { + { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, + { +#include "asciitab.h" +#include "latin1tab.h" + }, + STANDARD_VTABLE(sb_) +}; + +#endif + +static const struct normal_encoding latin1_encoding = { + { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, + { +#define BT_COLON BT_NMSTRT +#include "asciitab.h" +#undef BT_COLON +#include "latin1tab.h" + }, + STANDARD_VTABLE(sb_) +}; + +static void FASTCALL +ascii_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + while (*fromP != fromLim && *toP != toLim) + *(*toP)++ = *(*fromP)++; +} + +#ifdef XML_NS + +static const struct normal_encoding ascii_encoding_ns = { + { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, + { +#include "asciitab.h" +/* BT_NONXML == 0 */ + }, + STANDARD_VTABLE(sb_) +}; + +#endif + +static const struct normal_encoding ascii_encoding = { + { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, + { +#define BT_COLON BT_NMSTRT +#include "asciitab.h" +#undef BT_COLON +/* BT_NONXML == 0 */ + }, + STANDARD_VTABLE(sb_) +}; + +static int FASTCALL +unicode_byte_type(char hi, char lo) +{ + switch ((unsigned char)hi) { + case 0xD8: case 0xD9: case 0xDA: case 0xDB: + return BT_LEAD4; + case 0xDC: case 0xDD: case 0xDE: case 0xDF: + return BT_TRAIL; + case 0xFF: + switch ((unsigned char)lo) { + case 0xFF: + case 0xFE: + return BT_NONXML; + } + break; + } + return BT_NONASCII; +} + +#define DEFINE_UTF16_TO_UTF8(E) \ +static void FASTCALL \ +E ## toUtf8(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + char **toP, const char *toLim) \ +{ \ + const char *from; \ + for (from = *fromP; from != fromLim; from += 2) { \ + int plane; \ + unsigned char lo2; \ + unsigned char lo = GET_LO(from); \ + unsigned char hi = GET_HI(from); \ + switch (hi) { \ + case 0: \ + if (lo < 0x80) { \ + if (*toP == toLim) { \ + *fromP = from; \ + return; \ + } \ + *(*toP)++ = lo; \ + break; \ + } \ + /* fall through */ \ + case 0x1: case 0x2: case 0x3: \ + case 0x4: case 0x5: case 0x6: case 0x7: \ + if (toLim - *toP < 2) { \ + *fromP = from; \ + return; \ + } \ + *(*toP)++ = (char) ((lo >> 6) | (hi << 2) | UTF8_cval2); \ + *(*toP)++ = (char) ((lo & 0x3f) | 0x80); \ + break; \ + default: \ + if (toLim - *toP < 3) { \ + *fromP = from; \ + return; \ + } \ + /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ + *(*toP)++ = (char) ((hi >> 4) | UTF8_cval3); \ + *(*toP)++ = (char) (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ + *(*toP)++ = (char) ((lo & 0x3f) | 0x80); \ + break; \ + case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ + if (toLim - *toP < 4) { \ + *fromP = from; \ + return; \ + } \ + plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ + *(*toP)++ = (char) ((plane >> 2) | UTF8_cval4); \ + *(*toP)++ = (char) (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ + from += 2; \ + lo2 = GET_LO(from); \ + *(*toP)++ = (char) (((lo & 0x3) << 4) \ + | ((GET_HI(from) & 0x3) << 2) \ + | (lo2 >> 6) \ + | 0x80); \ + *(*toP)++ = (char) ((lo2 & 0x3f) | 0x80); \ + break; \ + } \ + } \ + *fromP = from; \ +} + +#define DEFINE_UTF16_TO_UTF16(E) \ +static void FASTCALL \ +E ## toUtf16(const ENCODING *enc, \ + const char **fromP, const char *fromLim, \ + unsigned short **toP, const unsigned short *toLim) \ +{ \ + /* Avoid copying first half only of surrogate */ \ + if (fromLim - *fromP > ((toLim - *toP) << 1) \ + && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ + fromLim -= 2; \ + for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ + *(*toP)++ = (unsigned short) ((GET_HI(*fromP) << 8) | GET_LO(*fromP)); \ +} + +#define SET2(ptr, ch) \ + (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) +#define GET_LO(ptr) ((unsigned char)(ptr)[0]) +#define GET_HI(ptr) ((unsigned char)(ptr)[1]) + +DEFINE_UTF16_TO_UTF8(little2_) +DEFINE_UTF16_TO_UTF16(little2_) + +#undef SET2 +#undef GET_LO +#undef GET_HI + +#define SET2(ptr, ch) \ + (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) +#define GET_LO(ptr) ((unsigned char)(ptr)[1]) +#define GET_HI(ptr) ((unsigned char)(ptr)[0]) + +DEFINE_UTF16_TO_UTF8(big2_) +DEFINE_UTF16_TO_UTF16(big2_) + +#undef SET2 +#undef GET_LO +#undef GET_HI + +#define LITTLE2_BYTE_TYPE(enc, p) \ + ((p)[1] == 0 \ + ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ + : unicode_byte_type((p)[1], (p)[0])) +#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) +#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) +#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) +#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) + +#ifdef XML_MIN_SIZE + +static int FASTCALL +little2_byteType(const ENCODING *enc, const char *p) +{ + return LITTLE2_BYTE_TYPE(enc, p); +} + +static int FASTCALL +little2_byteToAscii(const ENCODING *enc, const char *p) +{ + return LITTLE2_BYTE_TO_ASCII(enc, p); +} + +static int FASTCALL +little2_charMatches(const ENCODING *enc, const char *p, int c) +{ + return LITTLE2_CHAR_MATCHES(enc, p, c); +} + +static int FASTCALL +little2_isNameMin(const ENCODING *enc, const char *p) +{ + return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); +} + +static int FASTCALL +little2_isNmstrtMin(const ENCODING *enc, const char *p) +{ + return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); +} + +#undef VTABLE +#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 + +#else /* not XML_MIN_SIZE */ + +#undef PREFIX +#define PREFIX(ident) little2_ ## ident +#define MINBPC(enc) 2 +/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ +#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) +#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) +#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) +#define IS_NAME_CHAR(enc, p, n) 0 +#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) +#define IS_NMSTRT_CHAR(enc, p, n) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) + +#include "xmltok_impl_c.h" + +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +#endif /* not XML_MIN_SIZE */ + +#ifdef XML_NS + +static const struct normal_encoding little2_encoding_ns = { + { VTABLE, 2, 0, +#if BYTEORDER == 1234 + 1 +#else + 0 +#endif + }, + { +#include "asciitab.h" +#include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) +}; + +#endif + +static const struct normal_encoding little2_encoding = { + { VTABLE, 2, 0, +#if BYTEORDER == 1234 + 1 +#else + 0 +#endif + }, + { +#define BT_COLON BT_NMSTRT +#include "asciitab.h" +#undef BT_COLON +#include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) +}; + +#if BYTEORDER != 4321 + +#ifdef XML_NS + +static const struct normal_encoding internal_little2_encoding_ns = { + { VTABLE, 2, 0, 1 }, + { +#include "iasciitab.h" +#include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) +}; + +#endif + +static const struct normal_encoding internal_little2_encoding = { + { VTABLE, 2, 0, 1 }, + { +#define BT_COLON BT_NMSTRT +#include "iasciitab.h" +#undef BT_COLON +#include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) +}; + +#endif + +#define BIG2_BYTE_TYPE(enc, p) \ + ((p)[0] == 0 \ + ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ + : unicode_byte_type((p)[0], (p)[1])) +#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) +#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) +#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) +#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ + UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) + +#ifdef XML_MIN_SIZE + +static int FASTCALL +big2_byteType(const ENCODING *enc, const char *p) +{ + return BIG2_BYTE_TYPE(enc, p); +} + +static int FASTCALL +big2_byteToAscii(const ENCODING *enc, const char *p) +{ + return BIG2_BYTE_TO_ASCII(enc, p); +} + +static int FASTCALL +big2_charMatches(const ENCODING *enc, const char *p, int c) +{ + return BIG2_CHAR_MATCHES(enc, p, c); +} + +static int FASTCALL +big2_isNameMin(const ENCODING *enc, const char *p) +{ + return BIG2_IS_NAME_CHAR_MINBPC(enc, p); +} + +static int FASTCALL +big2_isNmstrtMin(const ENCODING *enc, const char *p) +{ + return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); +} + +#undef VTABLE +#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 + +#else /* not XML_MIN_SIZE */ + +#undef PREFIX +#define PREFIX(ident) big2_ ## ident +#define MINBPC(enc) 2 +/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ +#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) +#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) +#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) +#define IS_NAME_CHAR(enc, p, n) 0 +#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) +#define IS_NMSTRT_CHAR(enc, p, n) (0) +#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) + +#include "xmltok_impl_c.h" + +#undef MINBPC +#undef BYTE_TYPE +#undef BYTE_TO_ASCII +#undef CHAR_MATCHES +#undef IS_NAME_CHAR +#undef IS_NAME_CHAR_MINBPC +#undef IS_NMSTRT_CHAR +#undef IS_NMSTRT_CHAR_MINBPC +#undef IS_INVALID_CHAR + +#endif /* not XML_MIN_SIZE */ + +#ifdef XML_NS + +static const struct normal_encoding big2_encoding_ns = { + { VTABLE, 2, 0, +#if BYTEORDER == 4321 + 1 +#else + 0 +#endif + }, + { +#include "asciitab.h" +#include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) +}; + +#endif + +static const struct normal_encoding big2_encoding = { + { VTABLE, 2, 0, +#if BYTEORDER == 4321 + 1 +#else + 0 +#endif + }, + { +#define BT_COLON BT_NMSTRT +#include "asciitab.h" +#undef BT_COLON +#include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) +}; + +#if BYTEORDER != 1234 + +#ifdef XML_NS + +static const struct normal_encoding internal_big2_encoding_ns = { + { VTABLE, 2, 0, 1 }, + { +#include "iasciitab.h" +#include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) +}; + +#endif + +static const struct normal_encoding internal_big2_encoding = { + { VTABLE, 2, 0, 1 }, + { +#define BT_COLON BT_NMSTRT +#include "iasciitab.h" +#undef BT_COLON +#include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) +}; + +#endif + +#undef PREFIX + +static int FASTCALL +streqci(const char *s1, const char *s2) +{ + for (;;) { + char c1 = *s1++; + char c2 = *s2++; + if (ASCII_a <= c1 && c1 <= ASCII_z) + c1 += ASCII_A - ASCII_a; + if (ASCII_a <= c2 && c2 <= ASCII_z) + c2 += ASCII_A - ASCII_a; + if (c1 != c2) + return 0; + if (!c1) + break; + } + return 1; +} + +static void FASTCALL +initUpdatePosition(const ENCODING *enc, const char *ptr, + const char *end, POSITION *pos) +{ + normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); +} + +static int FASTCALL +toAscii(const ENCODING *enc, const char *ptr, const char *end) +{ + char buf[1]; + char *p = buf; + XmlUtf8Convert(enc, &ptr, end, &p, p + 1); + if (p == buf) + return -1; + else + return buf[0]; +} + +static int FASTCALL +isSpace(int c) +{ + switch (c) { + case 0x20: + case 0xD: + case 0xA: + case 0x9: + return 1; + } + return 0; +} + +/* Return 1 if there's just optional white space or there's an S + followed by name=val. +*/ +static int FASTCALL +parsePseudoAttribute(const ENCODING *enc, + const char *ptr, + const char *end, + const char **namePtr, + const char **nameEndPtr, + const char **valPtr, + const char **nextTokPtr) +{ + int c; + char open; + if (ptr == end) { + *namePtr = NULL; + return 1; + } + if (!isSpace(toAscii(enc, ptr, end))) { + *nextTokPtr = ptr; + return 0; + } + do { + ptr += enc->minBytesPerChar; + } while (isSpace(toAscii(enc, ptr, end))); + if (ptr == end) { + *namePtr = NULL; + return 1; + } + *namePtr = ptr; + for (;;) { + c = toAscii(enc, ptr, end); + if (c == -1) { + *nextTokPtr = ptr; + return 0; + } + if (c == ASCII_EQUALS) { + *nameEndPtr = ptr; + break; + } + if (isSpace(c)) { + *nameEndPtr = ptr; + do { + ptr += enc->minBytesPerChar; + } while (isSpace(c = toAscii(enc, ptr, end))); + if (c != ASCII_EQUALS) { + *nextTokPtr = ptr; + return 0; + } + break; + } + ptr += enc->minBytesPerChar; + } + if (ptr == *namePtr) { + *nextTokPtr = ptr; + return 0; + } + ptr += enc->minBytesPerChar; + c = toAscii(enc, ptr, end); + while (isSpace(c)) { + ptr += enc->minBytesPerChar; + c = toAscii(enc, ptr, end); + } + if (c != ASCII_QUOT && c != ASCII_APOS) { + *nextTokPtr = ptr; + return 0; + } + open = (char)c; + ptr += enc->minBytesPerChar; + *valPtr = ptr; + for (;; ptr += enc->minBytesPerChar) { + c = toAscii(enc, ptr, end); + if (c == open) + break; + if (!(ASCII_a <= c && c <= ASCII_z) + && !(ASCII_A <= c && c <= ASCII_Z) + && !(ASCII_0 <= c && c <= ASCII_9) + && c != ASCII_PERIOD + && c != ASCII_MINUS + && c != ASCII_UNDERSCORE) { + *nextTokPtr = ptr; + return 0; + } + } + *nextTokPtr = ptr + enc->minBytesPerChar; + return 1; +} + +static const char KW_version[] = { + ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' +}; + +static const char KW_encoding[] = { + ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' +}; + +static const char KW_standalone[] = { + ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, + ASCII_n, ASCII_e, '\0' +}; + +static const char KW_yes[] = { + ASCII_y, ASCII_e, ASCII_s, '\0' +}; + +static const char KW_no[] = { + ASCII_n, ASCII_o, '\0' +}; + +static int +doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, + const char *, + const char *), + int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **versionEndPtr, + const char **encodingName, + const ENCODING **encoding, + int *standalone) +{ + const char *val = NULL; + const char *name = NULL; + const char *nameEnd = NULL; + ptr += 5 * enc->minBytesPerChar; + end -= 2 * enc->minBytesPerChar; + if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) + || !name) { + *badPtr = ptr; + return 0; + } + if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { + if (!isGeneralTextEntity) { + *badPtr = name; + return 0; + } + } + else { + if (versionPtr) + *versionPtr = val; + if (versionEndPtr) + *versionEndPtr = ptr; + if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { + *badPtr = ptr; + return 0; + } + if (!name) { + if (isGeneralTextEntity) { + /* a TextDecl must have an EncodingDecl */ + *badPtr = ptr; + return 0; + } + return 1; + } + } + if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { + int c = toAscii(enc, val, end); + if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { + *badPtr = val; + return 0; + } + if (encodingName) + *encodingName = val; + if (encoding) + *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); + if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { + *badPtr = ptr; + return 0; + } + if (!name) + return 1; + } + if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) + || isGeneralTextEntity) { + *badPtr = name; + return 0; + } + if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { + if (standalone) + *standalone = 1; + } + else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { + if (standalone) + *standalone = 0; + } + else { + *badPtr = val; + return 0; + } + while (isSpace(toAscii(enc, ptr, end))) + ptr += enc->minBytesPerChar; + if (ptr != end) { + *badPtr = ptr; + return 0; + } + return 1; +} + +static int FASTCALL +checkCharRefNumber(int result) +{ + switch (result >> 8) { + case 0xD8: case 0xD9: case 0xDA: case 0xDB: + case 0xDC: case 0xDD: case 0xDE: case 0xDF: + return -1; + case 0: + if (latin1_encoding.type[result] == BT_NONXML) + return -1; + break; + case 0xFF: + if (result == 0xFFFE || result == 0xFFFF) + return -1; + break; + } + return result; +} + +int +XmlUtf8Encode(int c, char *buf) +{ + enum { + /* minN is minimum legal resulting value for N byte sequence */ + min2 = 0x80, + min3 = 0x800, + min4 = 0x10000 + }; + + if (c < 0) + return 0; + if (c < min2) { + buf[0] = (char)(c | UTF8_cval1); + return 1; + } + if (c < min3) { + buf[0] = (char)((c >> 6) | UTF8_cval2); + buf[1] = (char)((c & 0x3f) | 0x80); + return 2; + } + if (c < min4) { + buf[0] = (char)((c >> 12) | UTF8_cval3); + buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); + buf[2] = (char)((c & 0x3f) | 0x80); + return 3; + } + if (c < 0x110000) { + buf[0] = (char)((c >> 18) | UTF8_cval4); + buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); + buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); + buf[3] = (char)((c & 0x3f) | 0x80); + return 4; + } + return 0; +} + +int +XmlUtf16Encode(int charNum, unsigned short *buf) +{ + if (charNum < 0) + return 0; + if (charNum < 0x10000) { + buf[0] = (unsigned short)charNum; + return 1; + } + if (charNum < 0x110000) { + charNum -= 0x10000; + buf[0] = (unsigned short)((charNum >> 10) + 0xD800); + buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); + return 2; + } + return 0; +} + +#ifndef SYMBIAN_MIN_SIZE +struct unknown_encoding { + struct normal_encoding normal; + int (*convert)(void *userData, const char *p); + void *userData; + unsigned short utf16[256]; + char utf8[256][4]; +}; + +#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) + +int +XmlSizeOfUnknownEncoding(void) +{ + return sizeof(struct unknown_encoding); +} + +static int FASTCALL +unknown_isName(const ENCODING *enc, const char *p) +{ + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); + int c = uenc->convert(uenc->userData, p); + if (c & ~0xFFFF) + return 0; + return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); +} + +static int FASTCALL +unknown_isNmstrt(const ENCODING *enc, const char *p) +{ + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); + int c = uenc->convert(uenc->userData, p); + if (c & ~0xFFFF) + return 0; + return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); +} + +static int FASTCALL +unknown_isInvalid(const ENCODING *enc, const char *p) +{ + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); + int c = uenc->convert(uenc->userData, p); + return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; +} + +static void FASTCALL +unknown_toUtf8(const ENCODING *enc, + const char **fromP, const char *fromLim, + char **toP, const char *toLim) +{ + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); + char buf[XML_UTF8_ENCODE_MAX]; + for (;;) { + const char *utf8; + int n; + if (*fromP == fromLim) + break; + utf8 = uenc->utf8[(unsigned char)**fromP]; + n = *utf8++; + if (n == 0) { + int c = uenc->convert(uenc->userData, *fromP); + n = XmlUtf8Encode(c, buf); + if (n > toLim - *toP) + break; + utf8 = buf; + *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] + - (BT_LEAD2 - 2)); + } + else { + if (n > toLim - *toP) + break; + (*fromP)++; + } + do { + *(*toP)++ = *utf8++; + } while (--n != 0); + } +} + +static void FASTCALL +unknown_toUtf16(const ENCODING *enc, + const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) +{ + const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); + while (*fromP != fromLim && *toP != toLim) { + unsigned short c = uenc->utf16[(unsigned char)**fromP]; + if (c == 0) { + c = (unsigned short) + uenc->convert(uenc->userData, *fromP); + *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] + - (BT_LEAD2 - 2)); + } + else + (*fromP)++; + *(*toP)++ = c; + } +} + +ENCODING * +XmlInitUnknownEncoding(void *mem, + int *table, + int (*convert)(void *userData, const char *p), + void *userData) +{ + int i; + struct unknown_encoding *e = mem; + for (i = 0; i < (int)sizeof(struct normal_encoding); i++) + ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; + for (i = 0; i < 128; i++) + if (latin1_encoding.type[i] != BT_OTHER + && latin1_encoding.type[i] != BT_NONXML + && table[i] != i) + return 0; + for (i = 0; i < 256; i++) { + int c = table[i]; + if (c == -1) { + e->normal.type[i] = BT_MALFORM; + /* This shouldn't really get used. */ + e->utf16[i] = 0xFFFF; + e->utf8[i][0] = 1; + e->utf8[i][1] = 0; + } + else if (c < 0) { + if (c < -4) + return 0; + e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); + e->utf8[i][0] = 0; + e->utf16[i] = 0; + } + else if (c < 0x80) { + if (latin1_encoding.type[c] != BT_OTHER + && latin1_encoding.type[c] != BT_NONXML + && c != i) + return 0; + e->normal.type[i] = latin1_encoding.type[c]; + e->utf8[i][0] = 1; + e->utf8[i][1] = (char)c; + e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); + } + else if (checkCharRefNumber(c) < 0) { + e->normal.type[i] = BT_NONXML; + /* This shouldn't really get used. */ + e->utf16[i] = 0xFFFF; + e->utf8[i][0] = 1; + e->utf8[i][1] = 0; + } + else { + if (c > 0xFFFF) + return 0; + if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) + e->normal.type[i] = BT_NMSTRT; + else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) + e->normal.type[i] = BT_NAME; + else + e->normal.type[i] = BT_OTHER; + e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); + e->utf16[i] = (unsigned short)c; + } + } + e->userData = userData; + e->convert = convert; + if (convert) { + e->normal.isName2 = unknown_isName; + e->normal.isName3 = unknown_isName; + e->normal.isName4 = unknown_isName; + e->normal.isNmstrt2 = unknown_isNmstrt; + e->normal.isNmstrt3 = unknown_isNmstrt; + e->normal.isNmstrt4 = unknown_isNmstrt; + e->normal.isInvalid2 = unknown_isInvalid; + e->normal.isInvalid3 = unknown_isInvalid; + e->normal.isInvalid4 = unknown_isInvalid; + } + e->normal.enc.utf8Convert = unknown_toUtf8; + e->normal.enc.utf16Convert = unknown_toUtf16; + return &(e->normal.enc); +} +#endif // SYMBIAN_MIN_SIZE + +/* If this enumeration is changed, getEncodingIndex and encodings +must also be changed. */ +enum { + UNKNOWN_ENC = -1, + ISO_8859_1_ENC = 0, + US_ASCII_ENC, + UTF_8_ENC, + UTF_16_ENC, + UTF_16BE_ENC, + UTF_16LE_ENC, + /* must match encodingNames up to here */ + NO_ENC +}; + +static const char KW_ISO_8859_1[] = { + ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, + ASCII_MINUS, ASCII_1, '\0' +}; +static const char KW_US_ASCII[] = { + ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, + '\0' +}; +static const char KW_UTF_8[] = { + ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' +}; +static const char KW_UTF_16[] = { + ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' +}; +static const char KW_UTF_16BE[] = { + ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, + '\0' +}; +static const char KW_UTF_16LE[] = { + ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, + '\0' +}; + +static int FASTCALL +getEncodingIndex(const char *name) +{ + static const char *const encodingNames[] = { + KW_ISO_8859_1, + KW_US_ASCII, + KW_UTF_8, + KW_UTF_16, + KW_UTF_16BE, + KW_UTF_16LE, + }; + int i; + if (name == NULL) + return NO_ENC; + for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) + if (streqci(name, encodingNames[i])) + return i; + return UNKNOWN_ENC; +} + +/* For binary compatibility, we store the index of the encoding + specified at initialization in the isUtf16 member. +*/ + +#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) +#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) + +/* This is what detects the encoding. encodingTable maps from + encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of + the external (protocol) specified encoding; state is + XML_CONTENT_STATE if we're parsing an external text entity, and + XML_PROLOG_STATE otherwise. +*/ + +static int FASTCALL +initScan(const ENCODING *const * encodingTable, + const INIT_ENCODING *enc, + int state, + const char *ptr, + const char *end, + const char **nextTokPtr) +{ + const ENCODING **encPtr; + + if (ptr == end) + return XML_TOK_NONE; + encPtr = enc->encPtr; + if (ptr + 1 == end) { + /* only a single byte available for auto-detection */ +#ifndef XML_DTD /* FIXME */ + /* a well-formed document entity must have more than one byte */ + if (state != XML_CONTENT_STATE) + return XML_TOK_PARTIAL; +#endif + /* so we're parsing an external text entity... */ + /* if UTF-16 was externally specified, then we need at least 2 bytes */ + switch (INIT_ENC_INDEX(enc)) { + case UTF_16_ENC: + case UTF_16LE_ENC: + case UTF_16BE_ENC: + return XML_TOK_PARTIAL; + } + switch ((unsigned char)*ptr) { + case 0xFE: + case 0xFF: + case 0xEF: /* possibly first byte of UTF-8 BOM */ + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC + && state == XML_CONTENT_STATE) + break; + /* fall through */ + case 0x00: + case 0x3C: + return XML_TOK_PARTIAL; + } + } + else { + switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { + case 0xFEFF: + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC + && state == XML_CONTENT_STATE) + break; + *nextTokPtr = ptr + 2; + *encPtr = encodingTable[UTF_16BE_ENC]; + return XML_TOK_BOM; + /* 00 3C is handled in the default case */ + case 0x3C00: + if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC + || INIT_ENC_INDEX(enc) == UTF_16_ENC) + && state == XML_CONTENT_STATE) + break; + *encPtr = encodingTable[UTF_16LE_ENC]; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); + case 0xFFFE: + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC + && state == XML_CONTENT_STATE) + break; + *nextTokPtr = ptr + 2; + *encPtr = encodingTable[UTF_16LE_ENC]; + return XML_TOK_BOM; + case 0xEFBB: + /* Maybe a UTF-8 BOM (EF BB BF) */ + /* If there's an explicitly specified (external) encoding + of ISO-8859-1 or some flavour of UTF-16 + and this is an external text entity, + don't look for the BOM, + because it might be a legal data. + */ + if (state == XML_CONTENT_STATE) { + int e = INIT_ENC_INDEX(enc); + if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC + || e == UTF_16LE_ENC || e == UTF_16_ENC) + break; + } + if (ptr + 2 == end) + return XML_TOK_PARTIAL; + if ((unsigned char)ptr[2] == 0xBF) { + *nextTokPtr = ptr + 3; + *encPtr = encodingTable[UTF_8_ENC]; + return XML_TOK_BOM; + } + break; + default: + if (ptr[0] == '\0') { + /* 0 isn't a legal data character. Furthermore a document + entity can only start with ASCII characters. So the only + way this can fail to be big-endian UTF-16 if it it's an + external parsed general entity that's labelled as + UTF-16LE. + */ + if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) + break; + *encPtr = encodingTable[UTF_16BE_ENC]; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); + } + else if (ptr[1] == '\0') { + /* We could recover here in the case: + - parsing an external entity + - second byte is 0 + - no externally specified encoding + - no encoding declaration + by assuming UTF-16LE. But we don't, because this would mean when + presented just with a single byte, we couldn't reliably determine + whether we needed further bytes. + */ + if (state == XML_CONTENT_STATE) + break; + *encPtr = encodingTable[UTF_16LE_ENC]; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); + } + break; + } + } + *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; + return XmlTok(*encPtr, state, ptr, end, nextTokPtr); +} + +#define NS(x) x +#define ns(x) x +#include "xmltok_ns_c.h" +#undef NS +#undef ns + +#ifdef XML_NS + +#define NS(x) x ## NS +#define ns(x) x ## _ns + +#include "xmltok_ns_c.h" + +#undef NS +#undef ns + +#ifndef SYMBIAN_MIN_SIZE +ENCODING * +XmlInitUnknownEncodingNS(void *mem, + int *table, + int (*convert)(void *userData, const char *p), + void *userData) +{ + ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); + if (enc) + ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; + return enc; +} +#endif // SYMBIAN_MIN_SIZE + +#endif /* XML_NS */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,312 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#ifndef XmlTok_INCLUDED +#define XmlTok_INCLUDED 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* The following token may be returned by XmlContentTok */ +#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be + start of illegal ]]> sequence */ +/* The following tokens may be returned by both XmlPrologTok and + XmlContentTok. +*/ +#define XML_TOK_NONE -4 /* The string to be scanned is empty */ +#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; + might be part of CRLF sequence */ +#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ +#define XML_TOK_PARTIAL -1 /* only part of a token */ +#define XML_TOK_INVALID 0 + +/* The following tokens are returned by XmlContentTok; some are also + returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. +*/ +#define XML_TOK_START_TAG_WITH_ATTS 1 +#define XML_TOK_START_TAG_NO_ATTS 2 +#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ +#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 +#define XML_TOK_END_TAG 5 +#define XML_TOK_DATA_CHARS 6 +#define XML_TOK_DATA_NEWLINE 7 +#define XML_TOK_CDATA_SECT_OPEN 8 +#define XML_TOK_ENTITY_REF 9 +#define XML_TOK_CHAR_REF 10 /* numeric character reference */ + +/* The following tokens may be returned by both XmlPrologTok and + XmlContentTok. +*/ +#define XML_TOK_PI 11 /* processing instruction */ +#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ +#define XML_TOK_COMMENT 13 +#define XML_TOK_BOM 14 /* Byte order mark */ + +/* The following tokens are returned only by XmlPrologTok */ +#define XML_TOK_PROLOG_S 15 +#define XML_TOK_DECL_OPEN 16 /* */ +#define XML_TOK_NAME 18 +#define XML_TOK_NMTOKEN 19 +#define XML_TOK_POUND_NAME 20 /* #name */ +#define XML_TOK_OR 21 /* | */ +#define XML_TOK_PERCENT 22 +#define XML_TOK_OPEN_PAREN 23 +#define XML_TOK_CLOSE_PAREN 24 +#define XML_TOK_OPEN_BRACKET 25 +#define XML_TOK_CLOSE_BRACKET 26 +#define XML_TOK_LITERAL 27 +#define XML_TOK_PARAM_ENTITY_REF 28 +#define XML_TOK_INSTANCE_START 29 + +/* The following occur only in element type declarations */ +#define XML_TOK_NAME_QUESTION 30 /* name? */ +#define XML_TOK_NAME_ASTERISK 31 /* name* */ +#define XML_TOK_NAME_PLUS 32 /* name+ */ +#define XML_TOK_COND_SECT_OPEN 33 /* */ +#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ +#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ +#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ +#define XML_TOK_COMMA 38 + +/* The following token is returned only by XmlAttributeValueTok */ +#define XML_TOK_ATTRIBUTE_VALUE_S 39 + +/* The following token is returned only by XmlCdataSectionTok */ +#define XML_TOK_CDATA_SECT_CLOSE 40 + +/* With namespace processing this is returned by XmlPrologTok for a + name with a colon. +*/ +#define XML_TOK_PREFIXED_NAME 41 + +#ifdef XML_DTD +#define XML_TOK_IGNORE_SECT 42 +#endif /* XML_DTD */ + +#ifdef XML_DTD +#define XML_N_STATES 4 +#else /* not XML_DTD */ +#define XML_N_STATES 3 +#endif /* not XML_DTD */ + +#define XML_PROLOG_STATE 0 +#define XML_CONTENT_STATE 1 +#define XML_CDATA_SECTION_STATE 2 +#ifdef XML_DTD +#define XML_IGNORE_SECTION_STATE 3 +#endif /* XML_DTD */ + +#define XML_N_LITERAL_TYPES 2 +#define XML_ATTRIBUTE_VALUE_LITERAL 0 +#define XML_ENTITY_VALUE_LITERAL 1 + +/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ +#define XML_UTF8_ENCODE_MAX 4 +/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ +#define XML_UTF16_ENCODE_MAX 2 + +typedef struct position { + /* first line and first column are 0 not 1 */ + unsigned long lineNumber; + unsigned long columnNumber; +} POSITION; + +typedef struct { + const char *name; + const char *valuePtr; + const char *valueEnd; + char normalized; +} ATTRIBUTE; + +struct encoding; +typedef struct encoding ENCODING; + +typedef int (FASTCALL *SCANNER)(const ENCODING *, + const char *, + const char *, + const char **); + +struct encoding { + SCANNER scanners[XML_N_STATES]; + SCANNER literalScanners[XML_N_LITERAL_TYPES]; + int (FASTCALL *sameName)(const ENCODING *, + const char *, + const char *); + int (FASTCALL *nameMatchesAscii)(const ENCODING *, + const char *, + const char *, + const char *); + int (FASTCALL *nameLength)(const ENCODING *, const char *); + const char *(FASTCALL *skipS)(const ENCODING *, const char *); + int (FASTCALL *getAtts)(const ENCODING *enc, + const char *ptr, + int attsMax, + ATTRIBUTE *atts); + int (FASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); + int (FASTCALL *predefinedEntityName)(const ENCODING *, + const char *, + const char *); + void (FASTCALL *updatePosition)(const ENCODING *, + const char *ptr, + const char *end, + POSITION *); + int (FASTCALL *isPublicId)(const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr); + void (FASTCALL *utf8Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + char **toP, + const char *toLim); + void (FASTCALL *utf16Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + unsigned short **toP, + const unsigned short *toLim); + int minBytesPerChar; + char isUtf8; + char isUtf16; +}; + +/* Scan the string starting at ptr until the end of the next complete + token, but do not scan past eptr. Return an integer giving the + type of token. + + Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. + + Return XML_TOK_PARTIAL when the string does not contain a complete + token; nextTokPtr will not be set. + + Return XML_TOK_INVALID when the string does not start a valid + token; nextTokPtr will be set to point to the character which made + the token invalid. + + Otherwise the string starts with a valid token; nextTokPtr will be + set to point to the character following the end of that token. + + Each data character counts as a single token, but adjacent data + characters may be returned together. Similarly for characters in + the prolog outside literals, comments and processing instructions. +*/ + + +#define XmlTok(enc, state, ptr, end, nextTokPtr) \ + (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) + +#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) + +#define XmlContentTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) + +#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) + +#ifdef XML_DTD + +#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) + +#endif /* XML_DTD */ + +/* This is used for performing a 2nd-level tokenization on the content + of a literal that has already been returned by XmlTok. +*/ +#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ + (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) + +#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) + +#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) + +#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) + +#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ + (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) + +#define XmlNameLength(enc, ptr) \ + (((enc)->nameLength)(enc, ptr)) + +#define XmlSkipS(enc, ptr) \ + (((enc)->skipS)(enc, ptr)) + +#define XmlGetAttributes(enc, ptr, attsMax, atts) \ + (((enc)->getAtts)(enc, ptr, attsMax, atts)) + +#define XmlCharRefNumber(enc, ptr) \ + (((enc)->charRefNumber)(enc, ptr)) + +#define XmlPredefinedEntityName(enc, ptr, end) \ + (((enc)->predefinedEntityName)(enc, ptr, end)) + +#define XmlUpdatePosition(enc, ptr, end, pos) \ + (((enc)->updatePosition)(enc, ptr, end, pos)) + +#define XmlIsPublicId(enc, ptr, end, badPtr) \ + (((enc)->isPublicId)(enc, ptr, end, badPtr)) + +#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ + (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) + +#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ + (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) + +typedef struct { + ENCODING initEnc; + const ENCODING **encPtr; +} INIT_ENCODING; + +int XmlParseXmlDecl(int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **versionEndPtr, + const char **encodingNamePtr, + const ENCODING **namedEncodingPtr, + int *standalonePtr); + +int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); +const ENCODING *XmlGetUtf8InternalEncoding(void); +const ENCODING *XmlGetUtf16InternalEncoding(void); +int XmlUtf8Encode(int charNumber, char *buf); +int XmlUtf16Encode(int charNumber, unsigned short *buf); + +int XmlSizeOfUnknownEncoding(void); +ENCODING * +XmlInitUnknownEncoding(void *mem, + int *table, + int (*conv)(void *userData, const char *p), + void *userData); + +int XmlParseXmlDeclNS(int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **versionEndPtr, + const char **encodingNamePtr, + const ENCODING **namedEncodingPtr, + int *standalonePtr); +int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); +const ENCODING *XmlGetUtf8InternalEncodingNS(void); +const ENCODING *XmlGetUtf16InternalEncodingNS(void); +ENCODING * +XmlInitUnknownEncodingNS(void *mem, + int *table, + int (*conv)(void *userData, const char *p), + void *userData); +#ifdef __cplusplus +} +#endif + +#endif /* not XmlTok_INCLUDED */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_impl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +/* +Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd +See the file COPYING for copying permission. +*/ + +enum { + BT_NONXML, + BT_MALFORM, + BT_LT, + BT_AMP, + BT_RSQB, + BT_LEAD2, + BT_LEAD3, + BT_LEAD4, + BT_TRAIL, + BT_CR, + BT_LF, + BT_GT, + BT_QUOT, + BT_APOS, + BT_EQUALS, + BT_QUEST, + BT_EXCL, + BT_SOL, + BT_SEMI, + BT_NUM, + BT_LSQB, + BT_S, + BT_NMSTRT, + BT_COLON, + BT_HEX, + BT_DIGIT, + BT_NAME, + BT_MINUS, + BT_OTHER, /* known not to be a name or name start character */ + BT_NONASCII, /* might be a name or name start character */ + BT_PERCNT, + BT_LPAR, + BT_RPAR, + BT_AST, + BT_PLUS, + BT_COMMA, + BT_VERBAR +}; + +#include diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_impl_c.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_impl_c.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1778 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#ifndef IS_INVALID_CHAR +#define IS_INVALID_CHAR(enc, ptr, n) (0) +#endif + +#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n)) { \ + *(nextTokPtr) = (ptr); \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define INVALID_CASES(ptr, nextTokPtr) \ + INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ + case BT_NONXML: \ + case BT_MALFORM: \ + case BT_TRAIL: \ + *(nextTokPtr) = (ptr); \ + return XML_TOK_INVALID; + +#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (!IS_NAME_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + case BT_NMSTRT: \ + case BT_HEX: \ + case BT_DIGIT: \ + case BT_NAME: \ + case BT_MINUS: \ + ptr += MINBPC(enc); \ + break; \ + CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) + +#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; + +#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + case BT_NMSTRT: \ + case BT_HEX: \ + ptr += MINBPC(enc); \ + break; \ + CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) + +#ifndef PREFIX +#define PREFIX(ident) ident +#endif + +/* ptr points to character following " */ + switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { + case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + /* fall through */ + case BT_S: case BT_CR: case BT_LF: + *nextTokPtr = ptr; + return XML_TOK_DECL_OPEN; + case BT_NMSTRT: + case BT_HEX: + ptr += MINBPC(enc); + break; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static int FASTCALL +PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, + const char *end, int *tokPtr) +{ + int upper = 0; + *tokPtr = XML_TOK_PI; + if (end - ptr != MINBPC(enc)*3) + return 1; + switch (BYTE_TO_ASCII(enc, ptr)) { + case ASCII_x: + break; + case ASCII_X: + upper = 1; + break; + default: + return 1; + } + ptr += MINBPC(enc); + switch (BYTE_TO_ASCII(enc, ptr)) { + case ASCII_m: + break; + case ASCII_M: + upper = 1; + break; + default: + return 1; + } + ptr += MINBPC(enc); + switch (BYTE_TO_ASCII(enc, ptr)) { + case ASCII_l: + break; + case ASCII_L: + upper = 1; + break; + default: + return 1; + } + if (upper) + return 0; + *tokPtr = XML_TOK_XML_DECL; + return 1; +} + +/* ptr points to character following " 1) { + size_t n = end - ptr; + if (n & (MINBPC(enc) - 1)) { + n &= ~(MINBPC(enc) - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } + switch (BYTE_TYPE(enc, ptr)) { + case BT_RSQB: + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_PARTIAL; + if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) + break; + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_PARTIAL; + if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { + ptr -= MINBPC(enc); + break; + } + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_CDATA_SECT_CLOSE; + case BT_CR: + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_PARTIAL; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + case BT_LF: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_DATA_NEWLINE; + INVALID_CASES(ptr, nextTokPtr) + default: + ptr += MINBPC(enc); + break; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONXML: + case BT_MALFORM: + case BT_TRAIL: + case BT_CR: + case BT_LF: + case BT_RSQB: + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC(enc); + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +/* ptr points to character following " 1) { + size_t n = end - ptr; + if (n & (MINBPC(enc) - 1)) { + n &= ~(MINBPC(enc) - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } + switch (BYTE_TYPE(enc, ptr)) { + case BT_LT: + return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_AMP: + return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_CR: + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + case BT_LF: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_DATA_NEWLINE; + case BT_RSQB: + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_TRAILING_RSQB; + if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) + break; + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_TRAILING_RSQB; + if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { + ptr -= MINBPC(enc); + break; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + INVALID_CASES(ptr, nextTokPtr) + default: + ptr += MINBPC(enc); + break; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_RSQB: + if (ptr + MINBPC(enc) != end) { + if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { + ptr += MINBPC(enc); + break; + } + if (ptr + 2*MINBPC(enc) != end) { + if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { + ptr += MINBPC(enc); + break; + } + *nextTokPtr = ptr + 2*MINBPC(enc); + return XML_TOK_INVALID; + } + } + /* fall through */ + case BT_AMP: + case BT_LT: + case BT_NONXML: + case BT_MALFORM: + case BT_TRAIL: + case BT_CR: + case BT_LF: + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC(enc); + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +/* ptr points to character following "%" */ + +static int FASTCALL +PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: + *nextTokPtr = ptr; + return XML_TOK_PERCENT; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_SEMI: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_PARAM_ENTITY_REF; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return XML_TOK_PARTIAL; +} + +static int FASTCALL +PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_CR: case BT_LF: case BT_S: + case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: + *nextTokPtr = ptr; + return XML_TOK_POUND_NAME; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return -XML_TOK_POUND_NAME; +} + +static int FASTCALL +PREFIX(scanLit)(int open, const ENCODING *enc, + const char *ptr, const char *end, + const char **nextTokPtr) +{ + while (ptr != end) { + int t = BYTE_TYPE(enc, ptr); + switch (t) { + INVALID_CASES(ptr, nextTokPtr) + case BT_QUOT: + case BT_APOS: + ptr += MINBPC(enc); + if (t != open) + break; + if (ptr == end) + return -XML_TOK_LITERAL; + *nextTokPtr = ptr; + switch (BYTE_TYPE(enc, ptr)) { + case BT_S: case BT_CR: case BT_LF: + case BT_GT: case BT_PERCNT: case BT_LSQB: + return XML_TOK_LITERAL; + default: + return XML_TOK_INVALID; + } + default: + ptr += MINBPC(enc); + break; + } + } + return XML_TOK_PARTIAL; +} + +static int FASTCALL +PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + int tok; + if (ptr == end) + return XML_TOK_NONE; + if (MINBPC(enc) > 1) { + size_t n = end - ptr; + if (n & (MINBPC(enc) - 1)) { + n &= ~(MINBPC(enc) - 1); + if (n == 0) + return XML_TOK_PARTIAL; + end = ptr + n; + } + } + switch (BYTE_TYPE(enc, ptr)) { + case BT_QUOT: + return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_APOS: + return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_LT: + { + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_PARTIAL; + switch (BYTE_TYPE(enc, ptr)) { + case BT_EXCL: + return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_QUEST: + return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_NMSTRT: + case BT_HEX: + case BT_NONASCII: + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + *nextTokPtr = ptr - MINBPC(enc); + return XML_TOK_INSTANCE_START; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + case BT_CR: + if (ptr + MINBPC(enc) == end) { + *nextTokPtr = end; + /* indicate that this might be part of a CR/LF pair */ + return -XML_TOK_PROLOG_S; + } + /* fall through */ + case BT_S: case BT_LF: + for (;;) { + ptr += MINBPC(enc); + if (ptr == end) + break; + switch (BYTE_TYPE(enc, ptr)) { + case BT_S: case BT_LF: + break; + case BT_CR: + /* don't split CR/LF pair */ + if (ptr + MINBPC(enc) != end) + break; + /* fall through */ + default: + *nextTokPtr = ptr; + return XML_TOK_PROLOG_S; + } + } + *nextTokPtr = ptr; + return XML_TOK_PROLOG_S; + case BT_PERCNT: + return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_COMMA: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_COMMA; + case BT_LSQB: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_OPEN_BRACKET; + case BT_RSQB: + ptr += MINBPC(enc); + if (ptr == end) + return -XML_TOK_CLOSE_BRACKET; + if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { + if (ptr + MINBPC(enc) == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { + *nextTokPtr = ptr + 2*MINBPC(enc); + return XML_TOK_COND_SECT_CLOSE; + } + } + *nextTokPtr = ptr; + return XML_TOK_CLOSE_BRACKET; + case BT_LPAR: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_OPEN_PAREN; + case BT_RPAR: + ptr += MINBPC(enc); + if (ptr == end) + return -XML_TOK_CLOSE_PAREN; + switch (BYTE_TYPE(enc, ptr)) { + case BT_AST: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_CLOSE_PAREN_ASTERISK; + case BT_QUEST: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_CLOSE_PAREN_QUESTION; + case BT_PLUS: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_CLOSE_PAREN_PLUS; + case BT_CR: case BT_LF: case BT_S: + case BT_GT: case BT_COMMA: case BT_VERBAR: + case BT_RPAR: + *nextTokPtr = ptr; + return XML_TOK_CLOSE_PAREN; + } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + case BT_VERBAR: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_OR; + case BT_GT: + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_DECL_CLOSE; + case BT_NUM: + return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NAME; \ + break; \ + } \ + if (IS_NAME_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NMTOKEN; \ + break; \ + } \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NMSTRT: + case BT_HEX: + tok = XML_TOK_NAME; + ptr += MINBPC(enc); + break; + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: +#ifdef XML_NS + case BT_COLON: +#endif + tok = XML_TOK_NMTOKEN; + ptr += MINBPC(enc); + break; + case BT_NONASCII: + if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { + ptr += MINBPC(enc); + tok = XML_TOK_NAME; + break; + } + if (IS_NAME_CHAR_MINBPC(enc, ptr)) { + ptr += MINBPC(enc); + tok = XML_TOK_NMTOKEN; + break; + } + /* fall through */ + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: case BT_RPAR: case BT_COMMA: + case BT_VERBAR: case BT_LSQB: case BT_PERCNT: + case BT_S: case BT_CR: case BT_LF: + *nextTokPtr = ptr; + return tok; +#ifdef XML_NS + case BT_COLON: + ptr += MINBPC(enc); + switch (tok) { + case XML_TOK_NAME: + if (ptr == end) + return XML_TOK_PARTIAL; + tok = XML_TOK_PREFIXED_NAME; + switch (BYTE_TYPE(enc, ptr)) { + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + default: + tok = XML_TOK_NMTOKEN; + break; + } + break; + case XML_TOK_PREFIXED_NAME: + tok = XML_TOK_NMTOKEN; + break; + } + break; +#endif + case BT_PLUS: + if (tok == XML_TOK_NMTOKEN) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_NAME_PLUS; + case BT_AST: + if (tok == XML_TOK_NMTOKEN) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_NAME_ASTERISK; + case BT_QUEST: + if (tok == XML_TOK_NMTOKEN) { + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_NAME_QUESTION; + default: + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } + } + return -tok; +} + +static int FASTCALL +PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) +{ + const char *start; + if (ptr == end) + return XML_TOK_NONE; + start = ptr; + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_AMP: + if (ptr == start) + return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_LT: + /* this is for inside entity references */ + *nextTokPtr = ptr; + return XML_TOK_INVALID; + case BT_LF: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_CR: + if (ptr == start) { + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_S: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_ATTRIBUTE_VALUE_S; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC(enc); + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +static int FASTCALL +PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) +{ + const char *start; + if (ptr == end) + return XML_TOK_NONE; + start = ptr; + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_AMP: + if (ptr == start) + return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_PERCNT: + if (ptr == start) { + int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), + end, nextTokPtr); + return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_LF: + if (ptr == start) { + *nextTokPtr = ptr + MINBPC(enc); + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + case BT_CR: + if (ptr == start) { + ptr += MINBPC(enc); + if (ptr == end) + return XML_TOK_TRAILING_CR; + if (BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + *nextTokPtr = ptr; + return XML_TOK_DATA_NEWLINE; + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; + default: + ptr += MINBPC(enc); + break; + } + } + *nextTokPtr = ptr; + return XML_TOK_DATA_CHARS; +} + +#ifdef XML_DTD + +static int FASTCALL +PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, + const char *end, const char **nextTokPtr) +{ + int level = 0; + if (MINBPC(enc) > 1) { + size_t n = end - ptr; + if (n & (MINBPC(enc) - 1)) { + n &= ~(MINBPC(enc) - 1); + end = ptr + n; + } + } + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { + INVALID_CASES(ptr, nextTokPtr) + case BT_LT: + if ((ptr += MINBPC(enc)) == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { + if ((ptr += MINBPC(enc)) == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { + ++level; + ptr += MINBPC(enc); + } + } + break; + case BT_RSQB: + if ((ptr += MINBPC(enc)) == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { + if ((ptr += MINBPC(enc)) == end) + return XML_TOK_PARTIAL; + if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { + ptr += MINBPC(enc); + if (level == 0) { + *nextTokPtr = ptr; + return XML_TOK_IGNORE_SECT; + } + --level; + } + } + break; + default: + ptr += MINBPC(enc); + break; + } + } + return XML_TOK_PARTIAL; +} + +#endif /* XML_DTD */ + +static int FASTCALL +PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, + const char **badPtr) +{ + ptr += MINBPC(enc); + end -= MINBPC(enc); + for (; ptr != end; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_DIGIT: + case BT_HEX: + case BT_MINUS: + case BT_APOS: + case BT_LPAR: + case BT_RPAR: + case BT_PLUS: + case BT_COMMA: + case BT_SOL: + case BT_EQUALS: + case BT_QUEST: + case BT_CR: + case BT_LF: + case BT_SEMI: + case BT_EXCL: + case BT_AST: + case BT_PERCNT: + case BT_NUM: +#ifdef XML_NS + case BT_COLON: +#endif + break; + case BT_S: + if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { + *badPtr = ptr; + return 0; + } + break; + case BT_NAME: + case BT_NMSTRT: + if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) + break; + default: + switch (BYTE_TO_ASCII(enc, ptr)) { + case 0x24: /* $ */ + case 0x40: /* @ */ + break; + default: + *badPtr = ptr; + return 0; + } + break; + } + } + return 1; +} + +/* This must only be called for a well-formed start-tag or empty + element tag. Returns the number of attributes. Pointers to the + first attsMax attributes are stored in atts. +*/ + +static int FASTCALL +PREFIX(getAtts)(const ENCODING *enc, const char *ptr, + int attsMax, ATTRIBUTE *atts) +{ + enum { other, inName, inValue } state = inName; + int nAtts = 0; + int open = 0; /* defined when state == inValue; + initialization just to shut up compilers */ + + for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { + switch (BYTE_TYPE(enc, ptr)) { +#define START_NAME \ + if (state == other) { \ + if (nAtts < attsMax) { \ + atts[nAtts].name = ptr; \ + atts[nAtts].normalized = 1; \ + } \ + state = inName; \ + } +#define LEAD_CASE(n) \ + case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONASCII: + case BT_NMSTRT: + case BT_HEX: + START_NAME + break; +#undef START_NAME + case BT_QUOT: + if (state != inValue) { + if (nAtts < attsMax) + atts[nAtts].valuePtr = ptr + MINBPC(enc); + state = inValue; + open = BT_QUOT; + } + else if (open == BT_QUOT) { + state = other; + if (nAtts < attsMax) + atts[nAtts].valueEnd = ptr; + nAtts++; + } + break; + case BT_APOS: + if (state != inValue) { + if (nAtts < attsMax) + atts[nAtts].valuePtr = ptr + MINBPC(enc); + state = inValue; + open = BT_APOS; + } + else if (open == BT_APOS) { + state = other; + if (nAtts < attsMax) + atts[nAtts].valueEnd = ptr; + nAtts++; + } + break; + case BT_AMP: + if (nAtts < attsMax) + atts[nAtts].normalized = 0; + break; + case BT_S: + if (state == inName) + state = other; + else if (state == inValue + && nAtts < attsMax + && atts[nAtts].normalized + && (ptr == atts[nAtts].valuePtr + || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE + || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE + || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) + atts[nAtts].normalized = 0; + break; + case BT_CR: case BT_LF: + /* This case ensures that the first attribute name is counted + Apart from that we could just change state on the quote. */ + if (state == inName) + state = other; + else if (state == inValue && nAtts < attsMax) + atts[nAtts].normalized = 0; + break; + case BT_GT: + case BT_SOL: + if (state != inValue) + return nAtts; + break; + default: + break; + } + } + /* not reached */ +} + +static int FASTCALL +PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) +{ + int result = 0; + /* skip &# */ + ptr += 2*MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_x)) { + for (ptr += MINBPC(enc); + !CHAR_MATCHES(enc, ptr, ASCII_SEMI); + ptr += MINBPC(enc)) { + int c = BYTE_TO_ASCII(enc, ptr); + switch (c) { + case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: + case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: + result <<= 4; + result |= (c - ASCII_0); + break; + case ASCII_A: case ASCII_B: case ASCII_C: + case ASCII_D: case ASCII_E: case ASCII_F: + result <<= 4; + result += 10 + (c - ASCII_A); + break; + case ASCII_a: case ASCII_b: case ASCII_c: + case ASCII_d: case ASCII_e: case ASCII_f: + result <<= 4; + result += 10 + (c - ASCII_a); + break; + } + if (result >= 0x110000) + return -1; + } + } + else { + for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { + int c = BYTE_TO_ASCII(enc, ptr); + result *= 10; + result += (c - ASCII_0); + if (result >= 0x110000) + return -1; + } + } + return checkCharRefNumber(result); +} + +static int FASTCALL +PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, + const char *end) +{ + switch ((end - ptr)/MINBPC(enc)) { + case 2: + if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { + switch (BYTE_TO_ASCII(enc, ptr)) { + case ASCII_l: + return ASCII_LT; + case ASCII_g: + return ASCII_GT; + } + } + break; + case 3: + if (CHAR_MATCHES(enc, ptr, ASCII_a)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_m)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_p)) + return ASCII_AMP; + } + } + break; + case 4: + switch (BYTE_TO_ASCII(enc, ptr)) { + case ASCII_q: + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_u)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_o)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_t)) + return ASCII_QUOT; + } + } + break; + case ASCII_a: + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_p)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_o)) { + ptr += MINBPC(enc); + if (CHAR_MATCHES(enc, ptr, ASCII_s)) + return ASCII_APOS; + } + } + break; + } + } + return 0; +} + +static int FASTCALL +PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) +{ + for (;;) { + switch (BYTE_TYPE(enc, ptr1)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + if (*ptr1++ != *ptr2++) \ + return 0; + LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) +#undef LEAD_CASE + /* fall through */ + if (*ptr1++ != *ptr2++) + return 0; + break; + case BT_NONASCII: + case BT_NMSTRT: +#ifdef XML_NS + case BT_COLON: +#endif + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + if (*ptr2++ != *ptr1++) + return 0; + if (MINBPC(enc) > 1) { + if (*ptr2++ != *ptr1++) + return 0; + if (MINBPC(enc) > 2) { + if (*ptr2++ != *ptr1++) + return 0; + if (MINBPC(enc) > 3) { + if (*ptr2++ != *ptr1++) + return 0; + } + } + } + break; + default: + if (MINBPC(enc) == 1 && *ptr1 == *ptr2) + return 1; + switch (BYTE_TYPE(enc, ptr2)) { + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + case BT_NONASCII: + case BT_NMSTRT: +#ifdef XML_NS + case BT_COLON: +#endif + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + return 0; + default: + return 1; + } + } + } + /* not reached */ +} + +static int FASTCALL +PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, + const char *end1, const char *ptr2) +{ + for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { + if (ptr1 == end1) + return 0; + if (!CHAR_MATCHES(enc, ptr1, *ptr2)) + return 0; + } + return ptr1 == end1; +} + +static int FASTCALL +PREFIX(nameLength)(const ENCODING *enc, const char *ptr) +{ + const char *start = ptr; + for (;;) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: ptr += n; break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_NONASCII: + case BT_NMSTRT: +#ifdef XML_NS + case BT_COLON: +#endif + case BT_HEX: + case BT_DIGIT: + case BT_NAME: + case BT_MINUS: + ptr += MINBPC(enc); + break; + default: + return ptr - start; + } + } +} + +static const char * FASTCALL +PREFIX(skipS)(const ENCODING *enc, const char *ptr) +{ + for (;;) { + switch (BYTE_TYPE(enc, ptr)) { + case BT_LF: + case BT_CR: + case BT_S: + ptr += MINBPC(enc); + break; + default: + return ptr; + } + } +} + +static void FASTCALL +PREFIX(updatePosition)(const ENCODING *enc, + const char *ptr, + const char *end, + POSITION *pos) +{ + while (ptr != end) { + switch (BYTE_TYPE(enc, ptr)) { +#define LEAD_CASE(n) \ + case BT_LEAD ## n: \ + ptr += n; \ + break; + LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) +#undef LEAD_CASE + case BT_LF: + pos->columnNumber = (unsigned)-1; + pos->lineNumber++; + ptr += MINBPC(enc); + break; + case BT_CR: + pos->lineNumber++; + ptr += MINBPC(enc); + if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) + ptr += MINBPC(enc); + pos->columnNumber = (unsigned)-1; + break; + default: + ptr += MINBPC(enc); + break; + } + pos->columnNumber++; + } +} + +#undef DO_LEAD_CASE +#undef MULTIBYTE_CASES +#undef INVALID_CASES +#undef CHECK_NAME_CASE +#undef CHECK_NAME_CASES +#undef CHECK_NMSTRT_CASE +#undef CHECK_NMSTRT_CASES diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_ns_c.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/lib/xmltok_ns_c.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,110 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. + Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +*/ +const ENCODING * +NS(XmlGetUtf8InternalEncoding)(void) +{ + return &ns(internal_utf8_encoding).enc; +} + +const ENCODING * +NS(XmlGetUtf16InternalEncoding)(void) +{ +#if BYTEORDER == 1234 + return &ns(internal_little2_encoding).enc; +#elif BYTEORDER == 4321 + return &ns(internal_big2_encoding).enc; +#else + const short n = 1; + return (*(const char *)&n + ? &ns(internal_little2_encoding).enc + : &ns(internal_big2_encoding).enc); +#endif +} + +static const ENCODING *const NS(encodings)[] = { + &ns(latin1_encoding).enc, + &ns(ascii_encoding).enc, + &ns(utf8_encoding).enc, + &ns(big2_encoding).enc, + &ns(big2_encoding).enc, + &ns(little2_encoding).enc, + &ns(utf8_encoding).enc /* NO_ENC */ +}; + +static int FASTCALL +NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + return initScan(NS(encodings), (const INIT_ENCODING*)enc, + XML_PROLOG_STATE, ptr, end, nextTokPtr); +} + +static int FASTCALL +NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) +{ + return initScan(NS(encodings), (const INIT_ENCODING*)enc, + XML_CONTENT_STATE, ptr, end, nextTokPtr); +} + +int +NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, + const char *name) +{ + int i = getEncodingIndex(name); + if (i == UNKNOWN_ENC) + return 0; + SET_INIT_ENC_INDEX(p, i); + p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); + p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); + p->initEnc.updatePosition = initUpdatePosition; + p->encPtr = encPtr; + *encPtr = &(p->initEnc); + return 1; +} + +static const ENCODING * +NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) +{ +#define ENCODING_MAX 128 + char buf[ENCODING_MAX]; + char *p = buf; + int i; + XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); + if (ptr != end) + return 0; + *p = 0; + if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) + return enc; + i = getEncodingIndex(buf); + if (i == UNKNOWN_ENC) + return 0; + return NS(encodings)[i]; +} + +int +NS(XmlParseXmlDecl)(int isGeneralTextEntity, + const ENCODING *enc, + const char *ptr, + const char *end, + const char **badPtr, + const char **versionPtr, + const char **versionEndPtr, + const char **encodingName, + const ENCODING **encoding, + int *standalone) +{ + return doParseXmlDecl(NS(findEncoding), + isGeneralTextEntity, + enc, + ptr, + end, + badPtr, + versionPtr, + versionEndPtr, + encodingName, + encoding, + standalone); +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/tests/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/tests/README.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ +This directory contains the (fledgling) test suite for Expat. The +tests provide general unit testing and regression coverage. The tests +are not expected to be useful examples of Expat usage; see the +examples/ directory for that. + +The Expat tests use the "Check" unit testing framework for C. More +information on Check can be found at: + + http://check.sourceforge.net/ + +Check 0.8 must be installed before the unit tests can be compiled & run. + +Since both Check and this test suite are young, it can all change in a +later version. diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/tests/chardata.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/tests/chardata.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,125 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +/* chardata.c + * + * + */ + +#include +#include +#include +#include + +#include "chardata.h" + + +static int +xmlstrlen(const XML_Char *s) +{ + int len = 0; + assert(s != NULL); + while (s[len] != 0) + ++len; + return len; +} + + +void +CharData_Init(CharData *storage) +{ + assert(storage != NULL); + storage->count = -1; +} + +void +CharData_AppendString(CharData *storage, const char *s) +{ + int maxchars = sizeof(storage->data) / sizeof(storage->data[0]); + int len; + + assert(s != NULL); + len = strlen(s); + if (storage->count < 0) + storage->count = 0; + if ((len + storage->count) > maxchars) { + len = (maxchars - storage->count); + } + if (len + storage->count < sizeof(storage->data)) { + memcpy(storage->data + storage->count, s, len); + storage->count += len; + } +} + +void +CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) +{ + int maxchars; + + assert(storage != NULL); + assert(s != NULL); + maxchars = sizeof(storage->data) / sizeof(storage->data[0]); + if (storage->count < 0) + storage->count = 0; + if (len < 0) + len = xmlstrlen(s); + if ((len + storage->count) > maxchars) { + len = (maxchars - storage->count); + } + if (len + storage->count < sizeof(storage->data)) { + memcpy(storage->data + storage->count, s, + len * sizeof(storage->data[0])); + storage->count += len; + } +} + +int +CharData_CheckString(CharData *storage, const char *expected) +{ + char buffer[1280]; + int len; + int count; + + assert(storage != NULL); + assert(expected != NULL); + count = (storage->count < 0) ? 0 : storage->count; + len = strlen(expected); + if (len != count) { + if (sizeof(XML_Char) == 1) + sprintf(buffer, "wrong number of data characters:" + " got %d, expected %d:\n%s", count, len, storage->data); + else + sprintf(buffer, + "wrong number of data characters: got %d, expected %d", + count, len); + fail(buffer); + return 0; + } + if (memcmp(expected, storage->data, len) != 0) { + fail("got bad data bytes"); + return 0; + } + return 1; +} + +int +CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) +{ + char buffer[1024]; + int len = xmlstrlen(expected); + int count; + + assert(storage != NULL); + count = (storage->count < 0) ? 0 : storage->count; + if (len != count) { + sprintf(buffer, "wrong number of data characters: got %d, expected %d", + count, len); + fail(buffer); + return 0; + } + if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) { + fail("got bad data bytes"); + return 0; + } + return 1; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/tests/chardata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/tests/chardata.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,35 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +/* chardata.h + + Interface to some helper routines used to accumulate and check text + and attribute content. +*/ + +#ifndef XML_CHARDATA_H +#define XML_CHARDATA_H 1 + +#ifndef XML_VERSION +#include "expat.h" /* need XML_Char */ +#endif + + +typedef struct { + int count; /* # of chars, < 0 if not set */ + XML_Char data[1024]; +} CharData; + + +void CharData_Init(CharData *storage); + +void CharData_AppendString(CharData *storage, const char *s); + +void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); + +int CharData_CheckString(CharData *storage, const char *s); + +int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); + + +#endif /* XML_CHARDATA_H */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/tests/runtests.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/tests/runtests.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,885 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#include +#include +#include +#include +#include + +#include "expat.h" +#include "chardata.h" + + +static XML_Parser parser; + + +static void +basic_setup(void) +{ + parser = XML_ParserCreate(NULL); + if (parser == NULL) + fail("Parser not created."); +} + +static void +basic_teardown(void) +{ + if (parser != NULL) + XML_ParserFree(parser); +} + +/* Generate a failure using the parser state to create an error message; + this should be used when the parser reports an error we weren't + expecting. +*/ +static void +_xml_failure(XML_Parser parser, const char *file, int line) +{ + char buffer[1024]; + sprintf(buffer, + "\n %s (line %d, offset %d)\n reported from %s, line %d", + XML_ErrorString(XML_GetErrorCode(parser)), + XML_GetCurrentLineNumber(parser), + XML_GetCurrentColumnNumber(parser), + file, line); + fail(buffer); +} + +#define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__) + +static void +_expect_failure(char *text, enum XML_Error errorCode, char *errorMessage, + char *file, int lineno) +{ + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_OK) + fail(errorMessage); + if (XML_GetErrorCode(parser) != errorCode) + _xml_failure(parser, file, lineno); +} + +#define expect_failure(text, errorCode, errorMessage) \ + _expect_failure((text), (errorCode), (errorMessage), \ + __FILE__, __LINE__) + + +/* + * Character & encoding tests. + */ + +START_TEST(test_nul_byte) +{ + char text[] = "\0"; + + /* test that a NUL byte (in US-ASCII data) is an error */ + if (XML_Parse(parser, text, sizeof(text) - 1, 1) == XML_STATUS_OK) + fail("Parser did not report error on NUL-byte."); + if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) + xml_failure(parser); +} +END_TEST + + +START_TEST(test_u0000_char) +{ + /* test that a NUL byte (in US-ASCII data) is an error */ + expect_failure("", + XML_ERROR_BAD_CHAR_REF, + "Parser did not report error on NUL-byte."); +} +END_TEST + +START_TEST(test_bom_utf8) +{ + /* This test is really just making sure we don't core on a UTF-8 BOM. */ + char *text = "\357\273\277"; + + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +START_TEST(test_bom_utf16_be) +{ + char text[] = "\376\377\0<\0e\0/\0>"; + + if (XML_Parse(parser, text, sizeof(text) - 1, 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +START_TEST(test_bom_utf16_le) +{ + char text[] = "\377\376<\0e\0/\0>\0"; + + if (XML_Parse(parser, text, sizeof(text) - 1, 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +static void +accumulate_characters(void *userData, const XML_Char *s, int len) +{ + CharData_AppendXMLChars((CharData *)userData, s, len); +} + +static void +accumulate_attribute(void *userData, const XML_Char *name, + const XML_Char **atts) +{ + CharData *storage = (CharData *)userData; + if (storage->count < 0 && atts != NULL && atts[0] != NULL) { + /* "accumulate" the value of the first attribute we see */ + CharData_AppendXMLChars(storage, atts[1], -1); + } +} + + +static void +run_character_check(XML_Char *text, XML_Char *expected) +{ + CharData storage; + + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetCharacterDataHandler(parser, accumulate_characters); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); +} + +static void +run_attribute_check(XML_Char *text, XML_Char *expected) +{ + CharData storage; + + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetStartElementHandler(parser, accumulate_attribute); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); +} + +/* Regression test for SF bug #491986. */ +START_TEST(test_danish_latin1) +{ + char *text = + "\n" + "Jørgen æøåÆØÅ"; + run_character_check(text, + "J\xC3\xB8rgen \xC3\xA6\xC3\xB8\xC3\xA5\xC3\x86\xC3\x98\xC3\x85"); +} +END_TEST + + +/* Regression test for SF bug #514281. */ +START_TEST(test_french_charref_hexidecimal) +{ + char *text = + "\n" + "éèàçêÈ"; + run_character_check(text, + "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); +} +END_TEST + +START_TEST(test_french_charref_decimal) +{ + char *text = + "\n" + "éèàçêÈ"; + run_character_check(text, + "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); +} +END_TEST + +START_TEST(test_french_latin1) +{ + char *text = + "\n" + "\xE9\xE8\xE0\xE7\xEa\xC8"; + run_character_check(text, + "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); +} +END_TEST + +START_TEST(test_french_utf8) +{ + char *text = + "\n" + "\xC3\xA9"; + run_character_check(text, "\xC3\xA9"); +} +END_TEST + +/* Regression test for SF bug #600479. + XXX There should be a test that exercises all legal XML Unicode + characters as PCDATA and attribute value content, and XML Name + characters as part of element and attribute names. +*/ +START_TEST(test_utf8_false_rejection) +{ + char *text = "\xEF\xBA\xBF"; + run_character_check(text, "\xEF\xBA\xBF"); +} +END_TEST + +/* Regression test for SF bug #477667. + This test assures that any 8-bit character followed by a 7-bit + character will not be mistakenly interpreted as a valid UTF-8 + sequence. +*/ +START_TEST(test_illegal_utf8) +{ + char text[100]; + int i; + + for (i = 128; i <= 255; ++i) { + sprintf(text, "%ccd", i); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_OK) { + sprintf(text, + "expected token error for '%c' (ordinal %d) in UTF-8 text", + i, i); + fail(text); + } + else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) + xml_failure(parser); + /* Reset the parser since we use the same parser repeatedly. */ + XML_ParserReset(parser, NULL); + } +} +END_TEST + +START_TEST(test_utf16) +{ + /* + some text + */ + char text[] = + "\000<\000?\000x\000m\000\154\000 \000v\000e\000r\000s\000i\000o" + "\000n\000=\000'\0001\000.\000\060\000'\000 \000e\000n\000c\000o" + "\000d\000i\000n\000g\000=\000'\000U\000T\000F\000-\0001\000\066" + "\000'\000?\000>\000\n" + "\000<\000d\000o\000c\000 \000a\000=\000'\0001\0002\0003\000'" + "\000>\000s\000o\000m\000e\000 \000t\000e\000x\000t\000<\000/" + "\000d\000o\000c\000>"; + if (XML_Parse(parser, text, sizeof(text) - 1, 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +START_TEST(test_utf16_le_epilog_newline) +{ + int first_chunk_bytes = 17; + char text[] = + "\xFF\xFE" /* BOM */ + "<\000e\000/\000>\000" /* document element */ + "\r\000\n\000\r\000\n\000"; /* epilog */ + + if (first_chunk_bytes >= sizeof(text) - 1) + fail("bad value of first_chunk_bytes"); + if (XML_Parse(parser, text, first_chunk_bytes, 0) == XML_STATUS_ERROR) + xml_failure(parser); + else { + enum XML_Status rc; + rc = XML_Parse(parser, text + first_chunk_bytes, + sizeof(text) - first_chunk_bytes - 1, 1); + if (rc == XML_STATUS_ERROR) + xml_failure(parser); + } +} +END_TEST + +/* Regression test for SF bug #481609. */ +START_TEST(test_latin1_umlauts) +{ + char *text = + "\n" + "ä ö ü ä ö ü ä ö ü"; + char *utf8 = + "\xC3\xA4 \xC3\xB6 \xC3\xBC " + "\xC3\xA4 \xC3\xB6 \xC3\xBC " + "\xC3\xA4 \xC3\xB6 \xC3\xBC"; + run_character_check(text, utf8); + XML_ParserReset(parser, NULL); + run_attribute_check(text, utf8); +} +END_TEST + +/* Regression test for SF bug #422239 (maybe). + It's not clear that this reproduces enough of the context + of the reported bug. +*/ +START_TEST(test_line_count) +{ + char *text = + "\n" + " \n" + ""; + int lineno; + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); + lineno = XML_GetCurrentLineNumber(parser); + if (lineno != 3) { + char buffer[100]; + sprintf(buffer, "expected 3 lines, saw %d", lineno); + fail(buffer); + } +} +END_TEST + +/* Regression test for SF bug #478332. */ +START_TEST(test_really_long_lines) +{ + /* This parses an input line longer than INIT_DATA_BUF_SIZE + characters long (defined to be 1024 in xmlparse.c). We take a + really cheesy approach to building the input buffer, because + this avoids writing bugs in buffer-filling code. + */ + char *text = + "" + /* 64 chars */ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + /* until we have at least 1024 characters on the line: */ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + ""; + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + + +/* + * Element event tests. + */ + +static void +end_element_event_handler(void *userData, const XML_Char *name) +{ + CharData *storage = (CharData *) userData; + CharData_AppendString(storage, "/"); + CharData_AppendXMLChars(storage, name, -1); +} + +START_TEST(test_end_element_events) +{ + char *text = ""; + char *expected = "/c/b/f/d/a"; + CharData storage; + + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetEndElementHandler(parser, end_element_event_handler); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, expected); +} +END_TEST + + +/* + * Attribute tests. + */ + +/* Helpers used by the following test; this checks any "attr" and "refs" + attributes to make sure whitespace has been normalized. + + Return true if whitespace has been normalized in a string, using + the rules for attribute value normalization. The 'is_cdata' flag + is needed since CDATA attributes don't need to have multiple + whitespace characters collapsed to a single space, while other + attribute data types do. (Section 3.3.3 of the recommendation.) +*/ +static int +is_whitespace_normalized(const XML_Char *s, int is_cdata) +{ + int blanks = 0; + int at_start = 1; + while (*s) { + if (*s == ' ') + ++blanks; + else if (*s == '\t' || *s == '\n' || *s == '\r') + return 0; + else { + if (at_start) { + at_start = 0; + if (blanks && !is_cdata) + /* illegal leading blanks */ + return 0; + } + else if (blanks > 1 && !is_cdata) + return 0; + blanks = 0; + } + ++s; + } + if (blanks && !is_cdata) + return 0; + return 1; +} + +/* Check the attribute whitespace checker: */ +static void +testhelper_is_whitespace_normalized(void) +{ + assert(is_whitespace_normalized("abc", 0)); + assert(is_whitespace_normalized("abc", 1)); + assert(is_whitespace_normalized("abc def ghi", 0)); + assert(is_whitespace_normalized("abc def ghi", 1)); + assert(!is_whitespace_normalized(" abc def ghi", 0)); + assert(is_whitespace_normalized(" abc def ghi", 1)); + assert(!is_whitespace_normalized("abc def ghi", 0)); + assert(is_whitespace_normalized("abc def ghi", 1)); + assert(!is_whitespace_normalized("abc def ghi ", 0)); + assert(is_whitespace_normalized("abc def ghi ", 1)); + assert(!is_whitespace_normalized(" ", 0)); + assert(is_whitespace_normalized(" ", 1)); + assert(!is_whitespace_normalized("\t", 0)); + assert(!is_whitespace_normalized("\t", 1)); + assert(!is_whitespace_normalized("\n", 0)); + assert(!is_whitespace_normalized("\n", 1)); + assert(!is_whitespace_normalized("\r", 0)); + assert(!is_whitespace_normalized("\r", 1)); + assert(!is_whitespace_normalized("abc\t def", 1)); +} + +static void +check_attr_contains_normalized_whitespace(void *userData, + const XML_Char *name, + const XML_Char **atts) +{ + int i; + for (i = 0; atts[i] != NULL; i += 2) { + const XML_Char *attrname = atts[i]; + const XML_Char *value = atts[i + 1]; + if (strcmp("attr", attrname) == 0 + || strcmp("ents", attrname) == 0 + || strcmp("refs", attrname) == 0) { + if (!is_whitespace_normalized(value, 0)) { + char buffer[256]; + sprintf(buffer, "attribute value not normalized: %s='%s'", + attrname, value); + fail(buffer); + } + } + } +} + +START_TEST(test_attr_whitespace_normalization) +{ + char *text = + "\n" + "]>\n" + "\n" + " \n" + " \n" + ""; + + XML_SetStartElementHandler(parser, + check_attr_contains_normalized_whitespace); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + + +/* + * XML declaration tests. + */ + +START_TEST(test_xmldecl_misplaced) +{ + expect_failure("\n" + "\n" + "", + XML_ERROR_MISPLACED_XML_PI, + "failed to report misplaced XML declaration"); +} +END_TEST + +/* Regression test for SF bug #584832. */ +static int +UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info) +{ + if (strcmp(encoding,"unsupported-encoding") == 0) { + int i; + for (i = 0; i < 256; ++i) + info->map[i] = i; + info->data=NULL; + info->convert=NULL; + info->release=NULL; + return 1; + } + return 0; +} + +START_TEST(test_unknown_encoding_internal_entity) +{ + char *text = + "\n" + "]>\n" + ""; + + XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test that no error is reported for unknown entities if we don't + read an external subset. This was fixed in Expat 1.95.5. +*/ +START_TEST(test_wfc_undeclared_entity_unread_external_subset) { + char *text = + "\n" + "&entity;"; + + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test that an error is reported for unknown entities if we don't + have an external subset. +*/ +START_TEST(test_wfc_undeclared_entity_no_external_subset) { + expect_failure("&entity;", + XML_ERROR_UNDEFINED_ENTITY, + "Parser did not report undefined entity w/out a DTD."); +} +END_TEST + +/* Test that an error is reported for unknown entities if we don't + read an external subset, but have been declared standalone. +*/ +START_TEST(test_wfc_undeclared_entity_standalone) { + char *text = + "\n" + "\n" + "&entity;"; + + expect_failure(text, + XML_ERROR_UNDEFINED_ENTITY, + "Parser did not report undefined entity (standalone)."); +} +END_TEST + +static int +external_entity_loader(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + char *text = (char *)XML_GetUserData(parser); + XML_Parser extparser; + + extparser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (extparser == NULL) + fail("Could not create external entity parser."); + if (XML_Parse(extparser, text, strlen(text), 1) == XML_STATUS_ERROR) { + xml_failure(parser); + return 0; + } + return 1; +} + +/* Test that an error is reported for unknown entities if we have read + an external subset. +*/ +START_TEST(test_wfc_undeclared_entity_with_external_subset) { + char *text = + "\n" + "\n" + "&entity;"; + char *foo_text = + ""; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, foo_text); + XML_SetExternalEntityRefHandler(parser, external_entity_loader); + expect_failure(text, + XML_ERROR_UNDEFINED_ENTITY, + "Parser did not report undefined entity with DTD."); +} +END_TEST + +START_TEST(test_wfc_no_recursive_entity_refs) +{ + char *text = + "\n" + "]>\n" + "&entity;"; + + expect_failure(text, + XML_ERROR_RECURSIVE_ENTITY_REF, + "Parser did not report recursive entity reference."); +} +END_TEST + + +/* + * Namespaces tests. + */ + +static void +namespace_setup(void) +{ + parser = XML_ParserCreateNS(NULL, ' '); + if (parser == NULL) + fail("Parser not created."); +} + +static void +namespace_teardown(void) +{ + basic_teardown(); +} + +/* Check that an element name and attribute name match the expected values. + The expected values are passed as an array reference of string pointers + provided as the userData argument; the first is the expected + element name, and the second is the expected attribute name. +*/ +static void +triplet_start_checker(void *userData, const XML_Char *name, + const XML_Char **atts) +{ + char **elemstr = (char **)userData; + char buffer[1024]; + if (strcmp(elemstr[0], name) != 0) { + sprintf(buffer, "unexpected start string: '%s'", name); + fail(buffer); + } + if (strcmp(elemstr[1], atts[0]) != 0) { + sprintf(buffer, "unexpected attribute string: '%s'", atts[0]); + fail(buffer); + } +} + +/* Check that the element name passed to the end-element handler matches + the expected value. The expected value is passed as the first element + in an array of strings passed as the userData argument. +*/ +static void +triplet_end_checker(void *userData, const XML_Char *name) +{ + char **elemstr = (char **)userData; + if (strcmp(elemstr[0], name) != 0) { + char buffer[1024]; + sprintf(buffer, "unexpected end string: '%s'", name); + fail(buffer); + } +} + +START_TEST(test_return_ns_triplet) +{ + char *text = + ""; + char *elemstr[] = { + "http://expat.sf.net/ e foo", + "http://expat.sf.net/ a bar" + }; + XML_SetReturnNSTriplet(parser, 1); + XML_SetUserData(parser, elemstr); + XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +static void +overwrite_start_checker(void *userData, const XML_Char *name, + const XML_Char **atts) +{ + CharData *storage = (CharData *) userData; + CharData_AppendString(storage, "start "); + CharData_AppendXMLChars(storage, name, -1); + while (*atts != NULL) { + CharData_AppendString(storage, "\nattribute "); + CharData_AppendXMLChars(storage, *atts, -1); + atts += 2; + } + CharData_AppendString(storage, "\n"); +} + +static void +overwrite_end_checker(void *userData, const XML_Char *name) +{ + CharData *storage = (CharData *) userData; + CharData_AppendString(storage, "end "); + CharData_AppendXMLChars(storage, name, -1); + CharData_AppendString(storage, "\n"); +} + +static void +run_ns_tagname_overwrite_test(char *text, char *result) +{ + CharData storage; + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetElementHandler(parser, + overwrite_start_checker, overwrite_end_checker); + if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, result); +} + +/* Regression test for SF bug #566334. */ +START_TEST(test_ns_tagname_overwrite) +{ + char *text = + "\n" + " \n" + " \n" + ""; + char *result = + "start http://xml.libexpat.org/ e\n" + "start http://xml.libexpat.org/ f\n" + "attribute http://xml.libexpat.org/ attr\n" + "end http://xml.libexpat.org/ f\n" + "start http://xml.libexpat.org/ g\n" + "attribute http://xml.libexpat.org/ attr2\n" + "end http://xml.libexpat.org/ g\n" + "end http://xml.libexpat.org/ e\n"; + run_ns_tagname_overwrite_test(text, result); +} +END_TEST + +/* Regression test for SF bug #566334. */ +START_TEST(test_ns_tagname_overwrite_triplet) +{ + char *text = + "\n" + " \n" + " \n" + ""; + char *result = + "start http://xml.libexpat.org/ e n\n" + "start http://xml.libexpat.org/ f n\n" + "attribute http://xml.libexpat.org/ attr n\n" + "end http://xml.libexpat.org/ f n\n" + "start http://xml.libexpat.org/ g n\n" + "attribute http://xml.libexpat.org/ attr2 n\n" + "end http://xml.libexpat.org/ g n\n" + "end http://xml.libexpat.org/ e n\n"; + XML_SetReturnNSTriplet(parser, 1); + run_ns_tagname_overwrite_test(text, result); +} +END_TEST + +static Suite * +make_basic_suite(void) +{ + Suite *s = suite_create("basic"); + TCase *tc_basic = tcase_create("basic tests"); + TCase *tc_namespace = tcase_create("XML namespaces"); + + suite_add_tcase(s, tc_basic); + tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown); + tcase_add_test(tc_basic, test_nul_byte); + tcase_add_test(tc_basic, test_u0000_char); + tcase_add_test(tc_basic, test_bom_utf8); + tcase_add_test(tc_basic, test_bom_utf16_be); + tcase_add_test(tc_basic, test_bom_utf16_le); + tcase_add_test(tc_basic, test_illegal_utf8); + tcase_add_test(tc_basic, test_utf16); + tcase_add_test(tc_basic, test_utf16_le_epilog_newline); + tcase_add_test(tc_basic, test_latin1_umlauts); + /* Regression test for SF bug #491986. */ + tcase_add_test(tc_basic, test_danish_latin1); + /* Regression test for SF bug #514281. */ + tcase_add_test(tc_basic, test_french_charref_hexidecimal); + tcase_add_test(tc_basic, test_french_charref_decimal); + tcase_add_test(tc_basic, test_french_latin1); + tcase_add_test(tc_basic, test_french_utf8); + tcase_add_test(tc_basic, test_utf8_false_rejection); + tcase_add_test(tc_basic, test_line_count); + tcase_add_test(tc_basic, test_really_long_lines); + tcase_add_test(tc_basic, test_end_element_events); + tcase_add_test(tc_basic, test_attr_whitespace_normalization); + tcase_add_test(tc_basic, test_xmldecl_misplaced); + tcase_add_test(tc_basic, test_unknown_encoding_internal_entity); + tcase_add_test(tc_basic, + test_wfc_undeclared_entity_unread_external_subset); + tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset); + tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone); + tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset); + tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs); + + suite_add_tcase(s, tc_namespace); + tcase_add_checked_fixture(tc_namespace, + namespace_setup, namespace_teardown); + tcase_add_test(tc_namespace, test_return_ns_triplet); + tcase_add_test(tc_namespace, test_ns_tagname_overwrite); + tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet); + + return s; +} + + +int +main(int argc, char *argv[]) +{ + int i, nf; + int forking = 0, forking_set = 0; + int verbosity = CK_NORMAL; + Suite *s = make_basic_suite(); + SRunner *sr = srunner_create(s); + + /* run the tests for internal helper functions */ + testhelper_is_whitespace_normalized(); + + for (i = 1; i < argc; ++i) { + char *opt = argv[i]; + if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) + verbosity = CK_VERBOSE; + else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) + verbosity = CK_SILENT; + else if (strcmp(opt, "-f") == 0 || strcmp(opt, "--fork") == 0) { + forking = 1; + forking_set = 1; + } + else if (strcmp(opt, "-n") == 0 || strcmp(opt, "--no-fork") == 0) { + forking = 0; + forking_set = 1; + } + else { + fprintf(stderr, "runtests: unknown option '%s'\n", opt); + return 2; + } + } + if (forking_set) + srunner_set_fork_status(sr, forking ? CK_FORK : CK_NOFORK); + srunner_run_all(sr, verbosity); + nf = srunner_ntests_failed(sr); + srunner_free(sr); + suite_free(s); + + return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/tests/xmltest.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/tests/xmltest.sh Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,137 @@ +#! /bin/sh + +# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE + +# This script can be used to exercise Expat against the +# w3c.org xml test suite, available from +# http://www.w3.org/XML/Test/xmlts20020606.zip. + +# To run this script, first set XMLWF so that xmlwf can be +# found, then set the output directory with OUTPUT. + +# The script lists all test cases where Expat shows a discrepancy +# from the expected result. Test cases where only the canonical +# output differs are prefixed with "Output differs:", and a diff file +# is generated in the appropriate subdirectory under $OUTPUT. + +# If there are output files provided, the script will use +# output from xmlwf and compare the desired output against it. +# However, one has to take into account that the canonical output +# produced by xmlwf conforms to an older definition of canonical XML +# and does not generate notation declarations. + +MYDIR="`dirname \"$0\"`" +cd "$MYDIR" +MYDIR="`pwd`" +XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" +# XMLWF=/usr/local/bin/xmlwf +TS="$MYDIR/XML-Test-Suite" +# OUTPUT must terminate with the directory separator. +OUTPUT="$TS/out/" +# OUTPUT=/home/tmp/xml-testsuite-out/ + + +RunXmlwfNotWF() { + $XMLWF $1 $2 > outfile || return $? + read outdata < outfile + if test "$outdata" = "" ; then + echo "Well formed: $3$2" + return 1 + else + return 0 + fi +} + +RunXmlwfWF() { + $XMLWF $1 -d "$OUTPUT$3" $2 > outfile || return $? + read outdata < outfile + if test "$outdata" = "" ; then + if [ -f out/$2 ] ; then + diff "$OUTPUT$3$2" out/$2 > outfile + if [ -s outfile ] ; then + cp outfile $OUTPUT$3${2}.diff + echo "Output differs: $3$2" + return 1 + fi + fi + return 0 + else + echo "In $3: $outdata" + return 1 + fi +} + +SUCCESS=0 +ERROR=0 + +########################## +# well-formed test cases # +########################## + +cd "$TS/xmlconf" +for xmldir in ibm/valid/P*/ \ + ibm/invalid/P*/ \ + xmltest/valid/ext-sa/ \ + xmltest/valid/not-sa/ \ + xmltest/invalid/ \ + xmltest/invalid/not-sa/ \ + xmltest/valid/sa/ \ + sun/valid/ \ + sun/invalid/ ; do + cd "$TS/xmlconf/$xmldir" + mkdir -p "$OUTPUT$xmldir" + for xmlfile in *.xml ; do + if RunXmlwfWF -p "$xmlfile" "$xmldir" ; then + SUCCESS=`expr $SUCCESS + 1` + else + ERROR=`expr $ERROR + 1` + fi + done + rm outfile +done + +cd "$TS/xmlconf/oasis" +mkdir -p "$OUTPUT"oasis/ +for xmlfile in *pass*.xml ; do + if RunXmlwfWF -p "$xmlfile" "oasis/" ; then + SUCCESS=`expr $SUCCESS + 1` + else + ERROR=`expr $ERROR + 1` + fi +done +rm outfile + +############################## +# not well-formed test cases # +############################## + +cd "$TS/xmlconf" +for xmldir in ibm/not-wf/P*/ \ + ibm/not-wf/misc/ \ + xmltest/not-wf/ext-sa/ \ + xmltest/not-wf/not-sa/ \ + xmltest/not-wf/sa/ \ + sun/not-wf/ ; do + cd "$TS/xmlconf/$xmldir" + for xmlfile in *.xml ; do + if RunXmlwfNotWF -p "$xmlfile" "$xmldir" ; then + SUCCESS=`expr $SUCCESS + 1` + else + ERROR=`expr $ERROR + 1` + fi + done + rm outfile +done + +cd "$TS/xmlconf/oasis" +for xmlfile in *fail*.xml ; do + if RunXmlwfNotWF -p "$xmlfile" "oasis/" ; then + SUCCESS=`expr $SUCCESS + 1` + else + ERROR=`expr $ERROR + 1` + fi +done +rm outfile + +echo "Passed: $SUCCESS" +echo "Failed: $ERROR" diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/vms/README.vms --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/vms/README.vms Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +4-jun-2002 Craig A. Berry + Added rudimentary build procedures for + OpenVMS based on work by Martin Vorlaender. + + +You'll need MMS or its freeware equivalent MMK. Just go to the +top-level directory and type + +$ MMS/DESCRIPTION=[.vms] + + or + +$ MMK/DESCRIPTION=[.vms] + +You'll end up with the object library expat.olb. For now, installation +consists merely of copying the object library, include files, and +documentation to a suitable location. + +To-do list: + + -- create a shareable image + -- build and run the tests and build the xmlwf utility + -- create an install target diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/vms/descrip.mms --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/vms/descrip.mms Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,69 @@ +# Bare bones description file (Makefile) for OpenVMS + +PACKAGE = expat +VERSION = 1.95.3 +EXPAT_MAJOR_VERSION=1 +EXPAT_MINOR_VERSION=95 +EXPAT_EDIT=3 + +O = .obj +OLB = .olb + +LIBRARY = expat$(OLB) +LIBDIR = [.lib] +SOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c +OBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O) + +TEMPLATES = xmltok_impl.c xmltok_ns.c +APIHEADER = $(LIBDIR)expat.h +HEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \ + $(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \ + $(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h + +CONFIG_HEADER = expat_config.h +INCLUDES = /INCLUDE=([],[.lib]) +DEFS = /DEFINE=(PACKAGE="""$(PACKAGE)""",VERSION="""$(PACKAGE)_$(VERSION)""") +LIBREVISION = 0 +LIBCURRENT = 1 +LIBAGE = 0 +# +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +# +# DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) +# +# TAR = gtar +# GZIP_ENV = --best +# +.FIRST : + IF F$SEARCH("$(LIBRARY)") .EQS. "" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY) + +all : $(LIBRARY) + +.SUFFIXES : +.SUFFIXES : $(OLB) $(O) .C .H + +.c$(O) : + $(COMPILE) $(MMS$SOURCE) + +$(O)$(OLB) : + @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" - + THEN LIBRARY/CREATE/LOG $(MMS$TARGET) + @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE) + +clean : + DELETE $(LIBRARY);*,*$(O);* + +$(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) + $(LIBR) /COMPRESS $(MMS$TARGET) + +$(CONFIG_HEADER) : [.vms]expat_config.h + COPY/LOG $(MMS$SOURCE) $(MMS$TARGET) + +xmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER) + +xmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER) + +xmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \ + $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \ + $(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER) + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/vms/expat_config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/vms/expat_config.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,61 @@ +/* Copyright 2000, Clark Cooper + All rights reserved. + + This is free software. You are permitted to copy, distribute, or modify + it under the terms of the MIT/X license (contained in the COPYING file + with this distribution.) +*/ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if your processor stores words with the most significant + byte first (like SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if you have the bcopy function. */ +#undef HAVE_BCOPY + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the memmove function. */ +#define HAVE_MEMMOVE 1 + +/* Define if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +#define XML_NS +#define XML_DTD + +#ifdef WORDS_BIGENDIAN +#define XML_BYTE_ORDER 21 +#else +#define XML_BYTE_ORDER 12 +#endif + +#define XML_CONTEXT_BYTES 1024 + +#ifndef HAVE_MEMMOVE +#ifdef HAVE_BCOPY +#define memmove(d,s,l) bcopy((s),(d),(l)) +#else +#define memmove(d,s,l) ;punting on memmove; +#endif + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/win32/MANIFEST.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/win32/MANIFEST.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ + Overview of the Expat distribution + +The Expat distribution creates several subdirectories on your system. +Some of these directories contain components of interest to all Expat +users, and some contain material of interest to developers who wish to +use Expat in their applications. In the list below, is the +directory you specified to the installer. + + Directory Contents + -------------------------------------------------------------------- + \ The XML well-formedness checker and some general + information files. + + \Doc\ API documentation for developers. + + \Libs\ Pre-compiled dynamic libraries for developers. + + \StaticLibs\ Pre-compiled static libraries for developers. + + \Source\ Source code, which may interest some developers, + including a workspace for Microsft Visual C++. + The source code includes the parser, the well- + formedness checker, and a couple of small sample + applications. + + \Source\bcb5\ Project files for Borland C++ Builder 5 and BCC + 5.5. + + \Unistall\ The uninstaller and its data files. diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/win32/expat.iss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/win32/expat.iss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,60 @@ +; Basic setup script for the Inno Setep installer builder. For more +; information on the free installer builder, see www.jrsoftware.org. +; +; This script was contributed by Tim Peters. +; The current version is used with Inno Setup 2.0.19. + +[Setup] +AppName=expat +AppId=expat +AppVersion=1.95.5 +AppVerName=expat 1.95.5 +AppCopyright=Copyright © 1998-2002 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers +DefaultDirName={sd}\Expat-1.95.5 +AppPublisher=The Expat Developers +AppPublisherURL=http://www.libexpat.org/ +AppSupportURL=http://www.libexpat.org/ +AppUpdatesURL=http://www.libexpat.org/ +UninstallDisplayName=Expat XML Parser (version 1.95.5) +UninstallFilesDir={app}\Uninstall + +Compression=bzip/9 +SourceDir=.. +OutputDir=win32 +DisableStartupPrompt=yes +AllowNoIcons=yes +DisableProgramGroupPage=yes +DisableReadyPage=yes + +[Files] +CopyMode: alwaysoverwrite; Source: xmlwf\Release\*.exe; DestDir: "{app}" +CopyMode: alwaysoverwrite; Source: win32\MANIFEST.txt; DestDir: "{app}" +CopyMode: alwaysoverwrite; Source: Changes; DestDir: "{app}"; DestName: Changes.txt +CopyMode: alwaysoverwrite; Source: COPYING; DestDir: "{app}"; DestName: COPYING.txt +CopyMode: alwaysoverwrite; Source: README; DestDir: "{app}"; DestName: README.txt +CopyMode: alwaysoverwrite; Source: doc\*.html; DestDir: "{app}\Doc" +CopyMode: alwaysoverwrite; Source: doc\*.css; DestDir: "{app}\Doc" +CopyMode: alwaysoverwrite; Source: doc\*.png; DestDir: "{app}\Doc" +CopyMode: alwaysoverwrite; Source: lib\Release\*.dll; DestDir: "{app}\Libs" +CopyMode: alwaysoverwrite; Source: lib\Release\*.lib; DestDir: "{app}\Libs" +CopyMode: alwaysoverwrite; Source: lib\Release-w\*.dll; DestDir: "{app}\Libs" +CopyMode: alwaysoverwrite; Source: lib\Release-w\*.lib; DestDir: "{app}\Libs" +CopyMode: alwaysoverwrite; Source: lib\Release_static\*.lib; DestDir: "{app}\StaticLibs" +CopyMode: alwaysoverwrite; Source: lib\Release-w_static\*.lib; DestDir: "{app}\StaticLibs" +CopyMode: alwaysoverwrite; Source: expat.dsw; DestDir: "{app}\Source" +CopyMode: alwaysoverwrite; Source: bcb5\*.*; DestDir: "{app}\Source\bcb5" +CopyMode: alwaysoverwrite; Source: lib\*.c; DestDir: "{app}\Source\lib" +CopyMode: alwaysoverwrite; Source: lib\*.h; DestDir: "{app}\Source\lib" +CopyMode: alwaysoverwrite; Source: lib\*.dsp; DestDir: "{app}\Source\lib" +CopyMode: alwaysoverwrite; Source: examples\*.c; DestDir: "{app}\Source\examples" +CopyMode: alwaysoverwrite; Source: examples\*.dsp; DestDir: "{app}\Source\examples" +CopyMode: alwaysoverwrite; Source: tests\*.c; DestDir: "{app}\Source\tests" +CopyMode: alwaysoverwrite; Source: tests\*.h; DestDir: "{app}\Source\tests" +CopyMode: alwaysoverwrite; Source: tests\README.txt; DestDir: "{app}\Source\tests" +CopyMode: alwaysoverwrite; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf" +CopyMode: alwaysoverwrite; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf" +CopyMode: alwaysoverwrite; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf" + +[Messages] +WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard +WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process. diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/codepage.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/codepage.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include "codepage.h" + +#ifdef WIN32 +#define STRICT 1 +#define WIN32_LEAN_AND_MEAN 1 + +#include + +int +codepageMap(int cp, int *map) +{ + int i; + CPINFO info; + if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) + return 0; + for (i = 0; i < 256; i++) + map[i] = -1; + if (info.MaxCharSize > 1) { + for (i = 0; i < MAX_LEADBYTES; i++) { + int j, lim; + if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) + break; + lim = info.LeadByte[i + 1]; + for (j = info.LeadByte[i]; j < lim; j++) + map[j] = -2; + } + } + for (i = 0; i < 256; i++) { + if (map[i] == -1) { + char c = (char)i; + unsigned short n; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, + &c, 1, &n, 1) == 1) + map[i] = n; + } + } + return 1; +} + +int +codepageConvert(int cp, const char *p) +{ + unsigned short c; + if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, + p, 2, &c, 1) == 1) + return c; + return -1; +} + +#else /* not WIN32 */ + +int +codepageMap(int cp, int *map) +{ + return 0; +} + +int +codepageConvert(int cp, const char *p) +{ + return -1; +} + +#endif /* not WIN32 */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/codepage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/codepage.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +int codepageMap(int cp, int *map); +int codepageConvert(int cp, const char *p); diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/ct.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/ct.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,150 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#define CHARSET_MAX 41 + +static const char * +getTok(const char **pp) +{ + enum { inAtom, inString, init, inComment }; + int state = init; + const char *tokStart = 0; + for (;;) { + switch (**pp) { + case '\0': + return 0; + case ' ': + case '\r': + case '\t': + case '\n': + if (state == inAtom) + return tokStart; + break; + case '(': + if (state == inAtom) + return tokStart; + if (state != inString) + state++; + break; + case ')': + if (state > init) + --state; + else if (state != inString) + return 0; + break; + case ';': + case '/': + case '=': + if (state == inAtom) + return tokStart; + if (state == init) + return (*pp)++; + break; + case '\\': + ++*pp; + if (**pp == '\0') + return 0; + break; + case '"': + switch (state) { + case inString: + ++*pp; + return tokStart; + case inAtom: + return tokStart; + case init: + tokStart = *pp; + state = inString; + break; + } + break; + default: + if (state == init) { + tokStart = *pp; + state = inAtom; + } + break; + } + ++*pp; + } + /* not reached */ +} + +/* key must be lowercase ASCII */ + +static int +matchkey(const char *start, const char *end, const char *key) +{ + if (!start) + return 0; + for (; start != end; start++, key++) + if (*start != *key && *start != 'A' + (*key - 'a')) + return 0; + return *key == '\0'; +} + +void +getXMLCharset(const char *buf, char *charset) +{ + const char *next, *p; + + charset[0] = '\0'; + next = buf; + p = getTok(&next); + if (matchkey(p, next, "text")) + strcpy(charset, "us-ascii"); + else if (!matchkey(p, next, "application")) + return; + p = getTok(&next); + if (!p || *p != '/') + return; + p = getTok(&next); + if (matchkey(p, next, "xml")) + isXml = 1; + p = getTok(&next); + while (p) { + if (*p == ';') { + p = getTok(&next); + if (matchkey(p, next, "charset")) { + p = getTok(&next); + if (p && *p == '=') { + p = getTok(&next); + if (p) { + char *s = charset; + if (*p == '"') { + while (++p != next - 1) { + if (*p == '\\') + ++p; + if (s == charset + CHARSET_MAX - 1) { + charset[0] = '\0'; + break; + } + *s++ = *p; + } + *s++ = '\0'; + } + else { + if (next - p > CHARSET_MAX - 1) + break; + while (p != next) + *s++ = *p++; + *s = 0; + break; + } + } + } + } + } + else + p = getTok(&next); + } +} + +int +main(int argc, char **argv) +{ + char buf[CHARSET_MAX]; + getXMLCharset(argv[1], buf); + printf("charset = \"%s\"\n", buf); + return 0; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/filemap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/filemap.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include + +#ifdef XML_UNICODE +int filemap(const wchar_t *name, + void (*processor)(const void *, size_t, + const wchar_t *, void *arg), + void *arg); +#else +int filemap(const char *name, + void (*processor)(const void *, size_t, + const char *, void *arg), + void *arg); +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/readfilemap.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/readfilemap.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,76 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include +#include +#include +#include +#include + +#ifndef S_ISREG +#ifndef S_IFREG +#define S_IFREG _S_IFREG +#endif +#ifndef S_IFMT +#define S_IFMT _S_IFMT +#endif +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif /* not S_ISREG */ + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + +#include "filemap.h" + +int +filemap(const char *name, + void (*processor)(const void *, size_t, const char *, void *arg), + void *arg) +{ + size_t nbytes; + int fd; + int n; + struct stat sb; + void *p; + + fd = open(name, O_RDONLY|O_BINARY); + if (fd < 0) { + perror(name); + return 0; + } + if (fstat(fd, &sb) < 0) { + perror(name); + return 0; + } + if (!S_ISREG(sb.st_mode)) { + fprintf(stderr, "%s: not a regular file\n", name); + return 0; + } + nbytes = sb.st_size; + p = malloc(nbytes); + if (!p) { + fprintf(stderr, "%s: out of memory\n", name); + return 0; + } + n = read(fd, p, nbytes); + if (n < 0) { + perror(name); + close(fd); + return 0; + } + if (n != nbytes) { + fprintf(stderr, "%s: read unexpected number of bytes\n", name); + close(fd); + return 0; + } + processor(p, nbytes, name, arg); + free(p); + close(fd); + return 1; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/unixfilemap.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/unixfilemap.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,58 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + +#include "filemap.h" + +int +filemap(const char *name, + void (*processor)(const void *, size_t, const char *, void *arg), + void *arg) +{ + int fd; + size_t nbytes; + struct stat sb; + void *p; + + fd = open(name, O_RDONLY); + if (fd < 0) { + perror(name); + return 0; + } + if (fstat(fd, &sb) < 0) { + perror(name); + close(fd); + return 0; + } + if (!S_ISREG(sb.st_mode)) { + close(fd); + fprintf(stderr, "%s: not a regular file\n", name); + return 0; + } + + nbytes = sb.st_size; + p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, + MAP_FILE|MAP_PRIVATE, fd, (off_t)0); + if (p == (void *)-1) { + perror(name); + close(fd); + return 0; + } + processor(p, nbytes, name, arg); + munmap((caddr_t)p, nbytes); + close(fd); + return 1; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/win32filemap.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/win32filemap.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,96 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#define STRICT 1 +#define WIN32_LEAN_AND_MEAN 1 + +#ifdef XML_UNICODE_WCHAR_T +#ifndef XML_UNICODE +#define XML_UNICODE +#endif +#endif + +#ifdef XML_UNICODE +#define UNICODE +#define _UNICODE +#endif /* XML_UNICODE */ +#include +#include +#include +#include "filemap.h" + +static void win32perror(const TCHAR *); + +int +filemap(const TCHAR *name, + void (*processor)(const void *, size_t, const TCHAR *, void *arg), + void *arg) +{ + HANDLE f; + HANDLE m; + DWORD size; + DWORD sizeHi; + void *p; + + f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if (f == INVALID_HANDLE_VALUE) { + win32perror(name); + return 0; + } + size = GetFileSize(f, &sizeHi); + if (size == (DWORD)-1) { + win32perror(name); + return 0; + } + if (sizeHi) { + _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name); + return 0; + } + /* CreateFileMapping barfs on zero length files */ + if (size == 0) { + static const char c = '\0'; + processor(&c, 0, name, arg); + CloseHandle(f); + return 1; + } + m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL); + if (m == NULL) { + win32perror(name); + CloseHandle(f); + return 0; + } + p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0); + if (p == NULL) { + win32perror(name); + CloseHandle(m); + CloseHandle(f); + return 0; + } + processor(p, size, name, arg); + UnmapViewOfFile(p); + CloseHandle(m); + CloseHandle(f); + return 1; +} + +static void +win32perror(const TCHAR *s) +{ + LPVOID buf; + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &buf, + 0, + NULL)) { + _ftprintf(stderr, _T("%s: %s"), s, buf); + fflush(stderr); + LocalFree(buf); + } + else + _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlfile.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlfile.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,231 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include +#include +#include +#include +#include +#ifdef COMPILED_FROM_DSP +#include "winconfig.h" +#else +#include "expat_config.h" +#endif +#include "expat.h" +#include "xmlfile.h" +#include "xmltchar.h" +#include "filemap.h" + +#ifdef _MSC_VER +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + +#ifdef _DEBUG +#define READ_SIZE 16 +#else +#define READ_SIZE (1024*8) +#endif + + +typedef struct { + XML_Parser parser; + int *retPtr; +} PROCESS_ARGS; + +static void +reportError(XML_Parser parser, const XML_Char *filename) +{ + int code = XML_GetErrorCode(parser); + const XML_Char *message = XML_ErrorString(code); + if (message) + ftprintf(stdout, T("%s:%d:%d: %s\n"), + filename, + XML_GetErrorLineNumber(parser), + XML_GetErrorColumnNumber(parser), + message); + else + ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); +} + +static void +processFile(const void *data, size_t size, + const XML_Char *filename, void *args) +{ + XML_Parser parser = ((PROCESS_ARGS *)args)->parser; + int *retPtr = ((PROCESS_ARGS *)args)->retPtr; + if (XML_Parse(parser, data, size, 1) == XML_STATUS_ERROR) { + reportError(parser, filename); + *retPtr = 0; + } + else + *retPtr = 1; +} + +#ifdef WIN32 + +static int +isAsciiLetter(XML_Char c) +{ + return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); +} + +#endif /* WIN32 */ + +static const XML_Char * +resolveSystemId(const XML_Char *base, const XML_Char *systemId, + XML_Char **toFree) +{ + XML_Char *s; + *toFree = 0; + if (!base + || *systemId == T('/') +#ifdef WIN32 + || *systemId == T('\\') + || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) +#endif + ) + return systemId; + *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) + * sizeof(XML_Char)); + if (!*toFree) + return systemId; + tcscpy(*toFree, base); + s = *toFree; + if (tcsrchr(s, T('/'))) + s = tcsrchr(s, T('/')) + 1; +#ifdef WIN32 + if (tcsrchr(s, T('\\'))) + s = tcsrchr(s, T('\\')) + 1; +#endif + tcscpy(s, systemId); + return *toFree; +} + +static int +externalEntityRefFilemap(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + int result; + XML_Char *s; + const XML_Char *filename; + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); + PROCESS_ARGS args; + args.retPtr = &result; + args.parser = entParser; + filename = resolveSystemId(base, systemId, &s); + XML_SetBase(entParser, filename); + if (!filemap(filename, processFile, &args)) + result = 0; + free(s); + XML_ParserFree(entParser); + return result; +} + +static int +processStream(const XML_Char *filename, XML_Parser parser) +{ + /* passing NULL for filename means read intput from stdin */ + int fd = 0; /* 0 is the fileno for stdin */ + + if (filename != NULL) { + fd = topen(filename, O_BINARY|O_RDONLY); + if (fd < 0) { + tperror(filename); + return 0; + } + } + for (;;) { + int nread; + char *buf = XML_GetBuffer(parser, READ_SIZE); + if (!buf) { + if (filename != NULL) + close(fd); + ftprintf(stderr, T("%s: out of memory\n"), + filename != NULL ? filename : "xmlwf"); + return 0; + } + nread = read(fd, buf, READ_SIZE); + if (nread < 0) { + tperror(filename != NULL ? filename : "STDIN"); + if (filename != NULL) + close(fd); + return 0; + } + if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { + reportError(parser, filename != NULL ? filename : "STDIN"); + if (filename != NULL) + close(fd); + return 0; + } + if (nread == 0) { + if (filename != NULL) + close(fd); + break;; + } + } + return 1; +} + +static int +externalEntityRefStream(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + XML_Char *s; + const XML_Char *filename; + int ret; + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); + filename = resolveSystemId(base, systemId, &s); + XML_SetBase(entParser, filename); + ret = processStream(filename, entParser); + free(s); + XML_ParserFree(entParser); + return ret; +} + +int +XML_ProcessFile(XML_Parser parser, + const XML_Char *filename, + unsigned flags) +{ + int result; + + if (!XML_SetBase(parser, filename)) { + ftprintf(stderr, T("%s: out of memory"), filename); + exit(1); + } + + if (flags & XML_EXTERNAL_ENTITIES) + XML_SetExternalEntityRefHandler(parser, + (flags & XML_MAP_FILE) + ? externalEntityRefFilemap + : externalEntityRefStream); + if (flags & XML_MAP_FILE) { + PROCESS_ARGS args; + args.retPtr = &result; + args.parser = parser; + if (!filemap(filename, processFile, &args)) + result = 0; + } + else + result = processStream(filename, parser); + return result; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlfile.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,10 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#define XML_MAP_FILE 01 +#define XML_EXTERNAL_ENTITIES 02 + +extern int XML_ProcessFile(XML_Parser parser, + const XML_Char *filename, + unsigned flags); diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlmime.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlmime.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,166 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#include +#include "xmlmime.h" + +static const char * +getTok(const char **pp) +{ + /* inComment means one level of nesting; inComment+1 means two levels etc */ + enum { inAtom, inString, init, inComment }; + int state = init; + const char *tokStart = 0; + for (;;) { + switch (**pp) { + case '\0': + if (state == inAtom) + return tokStart; + return 0; + case ' ': + case '\r': + case '\t': + case '\n': + if (state == inAtom) + return tokStart; + break; + case '(': + if (state == inAtom) + return tokStart; + if (state != inString) + state++; + break; + case ')': + if (state > init) + --state; + else if (state != inString) + return 0; + break; + case ';': + case '/': + case '=': + if (state == inAtom) + return tokStart; + if (state == init) + return (*pp)++; + break; + case '\\': + ++*pp; + if (**pp == '\0') + return 0; + break; + case '"': + switch (state) { + case inString: + ++*pp; + return tokStart; + case inAtom: + return tokStart; + case init: + tokStart = *pp; + state = inString; + break; + } + break; + default: + if (state == init) { + tokStart = *pp; + state = inAtom; + } + break; + } + ++*pp; + } + /* not reached */ +} + +/* key must be lowercase ASCII */ + +static int +matchkey(const char *start, const char *end, const char *key) +{ + if (!start) + return 0; + for (; start != end; start++, key++) + if (*start != *key && *start != 'A' + (*key - 'a')) + return 0; + return *key == '\0'; +} + +void +getXMLCharset(const char *buf, char *charset) +{ + const char *next, *p; + + charset[0] = '\0'; + next = buf; + p = getTok(&next); + if (matchkey(p, next, "text")) + strcpy(charset, "us-ascii"); + else if (!matchkey(p, next, "application")) + return; + p = getTok(&next); + if (!p || *p != '/') + return; + p = getTok(&next); +#if 0 + if (!matchkey(p, next, "xml") && charset[0] == '\0') + return; +#endif + p = getTok(&next); + while (p) { + if (*p == ';') { + p = getTok(&next); + if (matchkey(p, next, "charset")) { + p = getTok(&next); + if (p && *p == '=') { + p = getTok(&next); + if (p) { + char *s = charset; + if (*p == '"') { + while (++p != next - 1) { + if (*p == '\\') + ++p; + if (s == charset + CHARSET_MAX - 1) { + charset[0] = '\0'; + break; + } + *s++ = *p; + } + *s++ = '\0'; + } + else { + if (next - p > CHARSET_MAX - 1) + break; + while (p != next) + *s++ = *p++; + *s = 0; + break; + } + } + } + break; + } + } + else + p = getTok(&next); + } +} + +#ifdef TEST + +#include + +int +main(int argc, char *argv[]) +{ + char buf[CHARSET_MAX]; + if (argc <= 1) + return 1; + printf("%s\n", argv[1]); + getXMLCharset(argv[1], buf); + printf("charset=\"%s\"\n", buf); + return 0; +} + +#endif /* TEST */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlmime.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlmime.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,22 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/* Registered charset names are at most 40 characters long. */ + +#define CHARSET_MAX 41 + +/* Figure out the charset to use from the ContentType. + buf contains the body of the header field (the part after "Content-Type:"). + charset gets the charset to use. It must be at least CHARSET_MAX chars + long. charset will be empty if the default charset should be used. +*/ + +void getXMLCharset(const char *buf, char *charset); + +#ifdef __cplusplus +} +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmltchar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmltchar.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,39 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#ifdef XML_UNICODE +#ifndef XML_UNICODE_WCHAR_T +#error xmlwf requires a 16-bit Unicode-compatible wchar_t +#endif +#define T(x) L ## x +#define ftprintf fwprintf +#define tfopen _wfopen +#define fputts fputws +#define puttc putwc +#define tcscmp wcscmp +#define tcscpy wcscpy +#define tcscat wcscat +#define tcschr wcschr +#define tcsrchr wcsrchr +#define tcslen wcslen +#define tperror _wperror +#define topen _wopen +#define tmain wmain +#define tremove _wremove +#else /* not XML_UNICODE */ +#define T(x) x +#define ftprintf fprintf +#define tfopen fopen +#define fputts fputs +#define puttc putc +#define tcscmp strcmp +#define tcscpy strcpy +#define tcscat strcat +#define tcschr strchr +#define tcsrchr strrchr +#define tcslen strlen +#define tperror perror +#define topen open +#define tmain main +#define tremove remove +#endif /* not XML_UNICODE */ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlurl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlurl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +int XML_URLInit(); +void XML_URLUninit(); +int XML_ProcessURL(XML_Parser parser, + const XML_Char *url, + unsigned flags); + +#ifdef __cplusplus +} +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlwf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlwf.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,842 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ + +#include +#include +#include +#include + +#include "expat.h" +#include "codepage.h" +#include "xmlfile.h" +#include "xmltchar.h" + +#ifdef _MSC_VER +#include +#endif + +/* This ensures proper sorting. */ + +#define NSSEP T('\001') + +static void +characterData(void *userData, const XML_Char *s, int len) +{ + FILE *fp = userData; + for (; len > 0; --len, ++s) { + switch (*s) { + case T('&'): + fputts(T("&"), fp); + break; + case T('<'): + fputts(T("<"), fp); + break; + case T('>'): + fputts(T(">"), fp); + break; +#ifdef W3C14N + case 13: + fputts(T(" "), fp); + break; +#else + case T('"'): + fputts(T("""), fp); + break; + case 9: + case 10: + case 13: + ftprintf(fp, T("&#%d;"), *s); + break; +#endif + default: + puttc(*s, fp); + break; + } + } +} + +static void +attributeValue(FILE *fp, const XML_Char *s) +{ + puttc(T('='), fp); + puttc(T('"'), fp); + for (;;) { + switch (*s) { + case 0: + case NSSEP: + puttc(T('"'), fp); + return; + case T('&'): + fputts(T("&"), fp); + break; + case T('<'): + fputts(T("<"), fp); + break; + case T('"'): + fputts(T("""), fp); + break; +#ifdef W3C14N + case 9: + fputts(T(" "), fp); + break; + case 10: + fputts(T(" "), fp); + break; + case 13: + fputts(T(" "), fp); + break; +#else + case T('>'): + fputts(T(">"), fp); + break; + case 9: + case 10: + case 13: + ftprintf(fp, T("&#%d;"), *s); + break; +#endif + default: + puttc(*s, fp); + break; + } + s++; + } +} + +/* Lexicographically comparing UTF-8 encoded attribute values, +is equivalent to lexicographically comparing based on the character number. */ + +static int +attcmp(const void *att1, const void *att2) +{ + return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); +} + +static void +startElement(void *userData, const XML_Char *name, const XML_Char **atts) +{ + int nAtts; + const XML_Char **p; + FILE *fp = userData; + puttc(T('<'), fp); + fputts(name, fp); + + p = atts; + while (*p) + ++p; + nAtts = (p - atts) >> 1; + if (nAtts > 1) + qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); + while (*atts) { + puttc(T(' '), fp); + fputts(*atts++, fp); + attributeValue(fp, *atts); + atts++; + } + puttc(T('>'), fp); +} + +static void +endElement(void *userData, const XML_Char *name) +{ + FILE *fp = userData; + puttc(T('<'), fp); + puttc(T('/'), fp); + fputts(name, fp); + puttc(T('>'), fp); +} + +static int +nsattcmp(const void *p1, const void *p2) +{ + const XML_Char *att1 = *(const XML_Char **)p1; + const XML_Char *att2 = *(const XML_Char **)p2; + int sep1 = (tcsrchr(att1, NSSEP) != 0); + int sep2 = (tcsrchr(att1, NSSEP) != 0); + if (sep1 != sep2) + return sep1 - sep2; + return tcscmp(att1, att2); +} + +static void +startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) +{ + int nAtts; + int nsi; + const XML_Char **p; + FILE *fp = userData; + const XML_Char *sep; + puttc(T('<'), fp); + + sep = tcsrchr(name, NSSEP); + if (sep) { + fputts(T("n1:"), fp); + fputts(sep + 1, fp); + fputts(T(" xmlns:n1"), fp); + attributeValue(fp, name); + nsi = 2; + } + else { + fputts(name, fp); + nsi = 1; + } + + p = atts; + while (*p) + ++p; + nAtts = (p - atts) >> 1; + if (nAtts > 1) + qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); + while (*atts) { + name = *atts++; + sep = tcsrchr(name, NSSEP); + puttc(T(' '), fp); + if (sep) { + ftprintf(fp, T("n%d:"), nsi); + fputts(sep + 1, fp); + } + else + fputts(name, fp); + attributeValue(fp, *atts); + if (sep) { + ftprintf(fp, T(" xmlns:n%d"), nsi++); + attributeValue(fp, name); + } + atts++; + } + puttc(T('>'), fp); +} + +static void +endElementNS(void *userData, const XML_Char *name) +{ + FILE *fp = userData; + const XML_Char *sep; + puttc(T('<'), fp); + puttc(T('/'), fp); + sep = tcsrchr(name, NSSEP); + if (sep) { + fputts(T("n1:"), fp); + fputts(sep + 1, fp); + } + else + fputts(name, fp); + puttc(T('>'), fp); +} + +#ifndef W3C14N + +static void +processingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) +{ + FILE *fp = userData; + puttc(T('<'), fp); + puttc(T('?'), fp); + fputts(target, fp); + puttc(T(' '), fp); + fputts(data, fp); + puttc(T('?'), fp); + puttc(T('>'), fp); +} + +#endif /* not W3C14N */ + +static void +defaultCharacterData(void *userData, const XML_Char *s, int len) +{ + XML_DefaultCurrent((XML_Parser) userData); +} + +static void +defaultStartElement(void *userData, const XML_Char *name, + const XML_Char **atts) +{ + XML_DefaultCurrent((XML_Parser) userData); +} + +static void +defaultEndElement(void *userData, const XML_Char *name) +{ + XML_DefaultCurrent((XML_Parser) userData); +} + +static void +defaultProcessingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) +{ + XML_DefaultCurrent((XML_Parser) userData); +} + +static void +nopCharacterData(void *userData, const XML_Char *s, int len) +{ +} + +static void +nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) +{ +} + +static void +nopEndElement(void *userData, const XML_Char *name) +{ +} + +static void +nopProcessingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) +{ +} + +static void +markup(void *userData, const XML_Char *s, int len) +{ + FILE *fp = XML_GetUserData((XML_Parser) userData); + for (; len > 0; --len, ++s) + puttc(*s, fp); +} + +static void +metaLocation(XML_Parser parser) +{ + const XML_Char *uri = XML_GetBase(parser); + if (uri) + ftprintf(XML_GetUserData(parser), T(" uri=\"%s\""), uri); + ftprintf(XML_GetUserData(parser), + T(" byte=\"%ld\" nbytes=\"%d\" line=\"%d\" col=\"%d\""), + XML_GetCurrentByteIndex(parser), + XML_GetCurrentByteCount(parser), + XML_GetCurrentLineNumber(parser), + XML_GetCurrentColumnNumber(parser)); +} + +static void +metaStartDocument(void *userData) +{ + fputts(T("\n"), XML_GetUserData((XML_Parser) userData)); +} + +static void +metaEndDocument(void *userData) +{ + fputts(T("\n"), XML_GetUserData((XML_Parser) userData)); +} + +static void +metaStartElement(void *userData, const XML_Char *name, + const XML_Char **atts) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + const XML_Char **specifiedAttsEnd + = atts + XML_GetSpecifiedAttributeCount(parser); + const XML_Char **idAttPtr; + int idAttIndex = XML_GetIdAttributeIndex(parser); + if (idAttIndex < 0) + idAttPtr = 0; + else + idAttPtr = atts + idAttIndex; + + ftprintf(fp, T("\n"), fp); + do { + ftprintf(fp, T("= specifiedAttsEnd) + fputts(T("\" defaulted=\"yes\"/>\n"), fp); + else if (atts == idAttPtr) + fputts(T("\" id=\"yes\"/>\n"), fp); + else + fputts(T("\"/>\n"), fp); + } while (*(atts += 2)); + fputts(T("\n"), fp); + } + else + fputts(T("/>\n"), fp); +} + +static void +metaEndElement(void *userData, const XML_Char *name) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static void +metaProcessingInstruction(void *userData, const XML_Char *target, + const XML_Char *data) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static void +metaComment(void *userData, const XML_Char *data) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static void +metaStartCdataSection(void *userData) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static void +metaEndCdataSection(void *userData) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static void +metaCharacterData(void *userData, const XML_Char *s, int len) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static void +metaStartDoctypeDecl(void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + +static void +metaEndDoctypeDecl(void *userData) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); +} + +static void +metaNotationDecl(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + ftprintf(fp, T("\n"), fp); +} + + +static void +metaEntityDecl(void *userData, + const XML_Char *entityName, + int is_param, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + + if (value) { + ftprintf(fp, T("'), fp); + characterData(fp, value, value_length); + fputts(T("\n"), fp); + } + else if (notationName) { + ftprintf(fp, T("\n"), fp); + } + else { + ftprintf(fp, T("\n"), fp); + } +} + +static void +metaStartNamespaceDecl(void *userData, + const XML_Char *prefix, + const XML_Char *uri) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + fputts(T("\n"), fp); + } + else + fputts(T("/>\n"), fp); +} + +static void +metaEndNamespaceDecl(void *userData, const XML_Char *prefix) +{ + XML_Parser parser = (XML_Parser) userData; + FILE *fp = XML_GetUserData(parser); + if (!prefix) + fputts(T("\n"), fp); + else + ftprintf(fp, T("\n"), prefix); +} + +static int +unknownEncodingConvert(void *data, const char *p) +{ + return codepageConvert(*(int *)data, p); +} + +static int +unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) +{ + int cp; + static const XML_Char prefixL[] = T("windows-"); + static const XML_Char prefixU[] = T("WINDOWS-"); + int i; + + for (i = 0; prefixU[i]; i++) + if (name[i] != prefixU[i] && name[i] != prefixL[i]) + return 0; + + cp = 0; + for (; name[i]; i++) { + static const XML_Char digits[] = T("0123456789"); + const XML_Char *s = tcschr(digits, name[i]); + if (!s) + return 0; + cp *= 10; + cp += s - digits; + if (cp >= 0x10000) + return 0; + } + if (!codepageMap(cp, info->map)) + return 0; + info->convert = unknownEncodingConvert; + /* We could just cast the code page integer to a void *, + and avoid the use of release. */ + info->release = free; + info->data = malloc(sizeof(int)); + if (!info->data) + return 0; + *(int *)info->data = cp; + return 1; +} + +static int +notStandalone(void *userData) +{ + return 0; +} + +static void +showVersion(XML_Char *prog) +{ + XML_Char *s = prog; + XML_Char ch; + const XML_Feature *features = XML_GetFeatureList(); + while ((ch = *s) != 0) { + if (ch == '/' +#ifdef WIN32 + || ch == '\\' +#endif + ) + prog = s + 1; + ++s; + } + ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion()); + if (features != NULL && features[0].feature != XML_FEATURE_END) { + int i = 1; + ftprintf(stdout, T("%s"), features[0].name); + if (features[0].value) + ftprintf(stdout, T("=%ld"), features[0].value); + while (features[i].feature != XML_FEATURE_END) { + ftprintf(stdout, T(", %s"), features[i].name); + if (features[i].value) + ftprintf(stdout, T("=%ld"), features[i].value); + ++i; + } + ftprintf(stdout, T("\n")); + } +} + +static void +usage(const XML_Char *prog, int rc) +{ + ftprintf(stderr, + T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] " + "[-e encoding] file ...\n"), prog); + exit(rc); +} + +int +tmain(int argc, XML_Char **argv) +{ + int i, j; + const XML_Char *outputDir = NULL; + const XML_Char *encoding = NULL; + unsigned processFlags = XML_MAP_FILE; + int windowsCodePages = 0; + int outputType = 0; + int useNamespaces = 0; + int requireStandalone = 0; + int paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; + int useStdin = 0; + +#ifdef _MSC_VER + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); +#endif + + i = 1; + j = 0; + while (i < argc) { + if (j == 0) { + if (argv[i][0] != T('-')) + break; + if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { + i++; + break; + } + j++; + } + switch (argv[i][j]) { + case T('r'): + processFlags &= ~XML_MAP_FILE; + j++; + break; + case T('s'): + requireStandalone = 1; + j++; + break; + case T('n'): + useNamespaces = 1; + j++; + break; + case T('p'): + paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS; + /* fall through */ + case T('x'): + processFlags |= XML_EXTERNAL_ENTITIES; + j++; + break; + case T('w'): + windowsCodePages = 1; + j++; + break; + case T('m'): + outputType = 'm'; + j++; + break; + case T('c'): + outputType = 'c'; + useNamespaces = 0; + j++; + break; + case T('t'): + outputType = 't'; + j++; + break; + case T('d'): + if (argv[i][j + 1] == T('\0')) { + if (++i == argc) + usage(argv[0], 2); + outputDir = argv[i]; + } + else + outputDir = argv[i] + j + 1; + i++; + j = 0; + break; + case T('e'): + if (argv[i][j + 1] == T('\0')) { + if (++i == argc) + usage(argv[0], 2); + encoding = argv[i]; + } + else + encoding = argv[i] + j + 1; + i++; + j = 0; + break; + case T('h'): + usage(argv[0], 0); + return 0; + case T('v'): + showVersion(argv[0]); + return 0; + case T('\0'): + if (j > 1) { + i++; + j = 0; + break; + } + /* fall through */ + default: + usage(argv[0], 2); + } + } + if (i == argc) { + useStdin = 1; + processFlags &= ~XML_MAP_FILE; + i--; + } + for (; i < argc; i++) { + FILE *fp = 0; + XML_Char *outName = 0; + int result; + XML_Parser parser; + if (useNamespaces) + parser = XML_ParserCreateNS(encoding, NSSEP); + else + parser = XML_ParserCreate(encoding); + if (requireStandalone) + XML_SetNotStandaloneHandler(parser, notStandalone); + XML_SetParamEntityParsing(parser, paramEntityParsing); + if (outputType == 't') { + /* This is for doing timings; this gives a more realistic estimate of + the parsing time. */ + outputDir = 0; + XML_SetElementHandler(parser, nopStartElement, nopEndElement); + XML_SetCharacterDataHandler(parser, nopCharacterData); + XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); + } + else if (outputDir) { + const XML_Char *file = useStdin ? T("STDIN") : argv[i]; + if (tcsrchr(file, T('/'))) + file = tcsrchr(file, T('/')) + 1; +#ifdef WIN32 + if (tcsrchr(file, T('\\'))) + file = tcsrchr(file, T('\\')) + 1; +#endif + outName = malloc((tcslen(outputDir) + tcslen(file) + 2) + * sizeof(XML_Char)); + tcscpy(outName, outputDir); + tcscat(outName, T("/")); + tcscat(outName, file); + fp = tfopen(outName, T("wb")); + if (!fp) { + tperror(outName); + exit(1); + } + setvbuf(fp, NULL, _IOFBF, 16384); +#ifdef XML_UNICODE + puttc(0xFEFF, fp); +#endif + XML_SetUserData(parser, fp); + switch (outputType) { + case 'm': + XML_UseParserAsHandlerArg(parser); + XML_SetElementHandler(parser, metaStartElement, metaEndElement); + XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction); + XML_SetCommentHandler(parser, metaComment); + XML_SetCdataSectionHandler(parser, metaStartCdataSection, + metaEndCdataSection); + XML_SetCharacterDataHandler(parser, metaCharacterData); + XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, + metaEndDoctypeDecl); + XML_SetEntityDeclHandler(parser, metaEntityDecl); + XML_SetNotationDeclHandler(parser, metaNotationDecl); + XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, + metaEndNamespaceDecl); + metaStartDocument(parser); + break; + case 'c': + XML_UseParserAsHandlerArg(parser); + XML_SetDefaultHandler(parser, markup); + XML_SetElementHandler(parser, defaultStartElement, defaultEndElement); + XML_SetCharacterDataHandler(parser, defaultCharacterData); + XML_SetProcessingInstructionHandler(parser, + defaultProcessingInstruction); + break; + default: + if (useNamespaces) + XML_SetElementHandler(parser, startElementNS, endElementNS); + else + XML_SetElementHandler(parser, startElement, endElement); + XML_SetCharacterDataHandler(parser, characterData); +#ifndef W3C14N + XML_SetProcessingInstructionHandler(parser, processingInstruction); +#endif /* not W3C14N */ + break; + } + } + if (windowsCodePages) + XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0); + result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags); + if (outputDir) { + if (outputType == 'm') + metaEndDocument(parser); + fclose(fp); + if (!result) + tremove(outName); + free(outName); + } + XML_ParserFree(parser); + } + return 0; +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlwin32url.cxx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat-1.95.5/xmlwf/xmlwin32url.cxx Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,398 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + See the file COPYING for copying permission. +*/ +#include "expat.h" +#ifdef XML_UNICODE +#define UNICODE +#endif +#include +#include +#include +#include +#include +#include "xmlurl.h" +#include "xmlmime.h" + +static int +processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url); + +typedef void (*StopHandler)(void *, HRESULT); + +class Callback : public IBindStatusCallback { +public: + // IUnknown methods + STDMETHODIMP QueryInterface(REFIID,void **); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + // IBindStatusCallback methods + STDMETHODIMP OnStartBinding(DWORD, IBinding *); + STDMETHODIMP GetPriority(LONG *); + STDMETHODIMP OnLowResource(DWORD); + STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR); + STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR); + STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *); + STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *); + STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *); + Callback(XML_Parser, IMoniker *, StopHandler, void *); + ~Callback(); + int externalEntityRef(const XML_Char *context, + const XML_Char *systemId, const XML_Char *publicId); +private: + XML_Parser parser_; + IMoniker *baseMoniker_; + DWORD totalRead_; + ULONG ref_; + IBinding *pBinding_; + StopHandler stopHandler_; + void *stopArg_; +}; + +STDMETHODIMP_(ULONG) +Callback::AddRef() +{ + return ref_++; +} + +STDMETHODIMP_(ULONG) +Callback::Release() +{ + if (--ref_ == 0) { + delete this; + return 0; + } + return ref_; +} + +STDMETHODIMP +Callback::QueryInterface(REFIID riid, void** ppv) +{ + if (IsEqualGUID(riid, IID_IUnknown)) + *ppv = (IUnknown *)this; + else if (IsEqualGUID(riid, IID_IBindStatusCallback)) + *ppv = (IBindStatusCallback *)this; + else + return E_NOINTERFACE; + ((LPUNKNOWN)*ppv)->AddRef(); + return S_OK; +} + +STDMETHODIMP +Callback::OnStartBinding(DWORD, IBinding* pBinding) +{ + pBinding_ = pBinding; + pBinding->AddRef(); + return S_OK; +} + +STDMETHODIMP +Callback::GetPriority(LONG *) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +Callback::OnLowResource(DWORD) +{ + return E_NOTIMPL; +} + +STDMETHODIMP +Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR) +{ + return S_OK; +} + +STDMETHODIMP +Callback::OnStopBinding(HRESULT hr, LPCWSTR szError) +{ + if (pBinding_) { + pBinding_->Release(); + pBinding_ = 0; + } + if (baseMoniker_) { + baseMoniker_->Release(); + baseMoniker_ = 0; + } + stopHandler_(stopArg_, hr); + return S_OK; +} + +STDMETHODIMP +Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo) +{ + *pgrfBINDF = BINDF_ASYNCHRONOUS; + return S_OK; +} + +static void +reportError(XML_Parser parser) +{ + int code = XML_GetErrorCode(parser); + const XML_Char *message = XML_ErrorString(code); + if (message) + _ftprintf(stderr, _T("%s:%d:%ld: %s\n"), + XML_GetBase(parser), + XML_GetErrorLineNumber(parser), + XML_GetErrorColumnNumber(parser), + message); + else + _ftprintf(stderr, _T("%s: (unknown message %d)\n"), + XML_GetBase(parser), code); +} + +STDMETHODIMP +Callback::OnDataAvailable(DWORD grfBSCF, + DWORD dwSize, + FORMATETC *pfmtetc, + STGMEDIUM* pstgmed) +{ + if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) { + IWinInetHttpInfo *hp; + HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo, + (void **)&hp); + if (SUCCEEDED(hr)) { + char contentType[1024]; + DWORD bufSize = sizeof(contentType); + DWORD flags = 0; + contentType[0] = 0; + hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType, + &bufSize, 0, NULL); + if (SUCCEEDED(hr)) { + char charset[CHARSET_MAX]; + getXMLCharset(contentType, charset); + if (charset[0]) { +#ifdef XML_UNICODE + XML_Char wcharset[CHARSET_MAX]; + XML_Char *p1 = wcharset; + const char *p2 = charset; + while ((*p1++ = (unsigned char)*p2++) != 0) + ; + XML_SetEncoding(parser_, wcharset); +#else + XML_SetEncoding(parser_, charset); +#endif + } + } + hp->Release(); + } + } + if (!parser_) + return E_ABORT; + if (pstgmed->tymed == TYMED_ISTREAM) { + while (totalRead_ < dwSize) { +#define READ_MAX (64*1024) + DWORD nToRead = dwSize - totalRead_; + if (nToRead > READ_MAX) + nToRead = READ_MAX; + void *buf = XML_GetBuffer(parser_, nToRead); + if (!buf) { + _ftprintf(stderr, _T("out of memory\n")); + return E_ABORT; + } + DWORD nRead; + HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead); + if (SUCCEEDED(hr)) { + totalRead_ += nRead; + if (!XML_ParseBuffer(parser_, + nRead, + (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0 + && totalRead_ == dwSize)) { + reportError(parser_); + return E_ABORT; + } + } + } + } + return S_OK; +} + +STDMETHODIMP +Callback::OnObjectAvailable(REFIID, IUnknown *) +{ + return S_OK; +} + +int +Callback::externalEntityRef(const XML_Char *context, + const XML_Char *systemId, + const XML_Char *publicId) +{ + XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0); + XML_SetBase(entParser, systemId); + int ret = processURL(entParser, baseMoniker_, systemId); + XML_ParserFree(entParser); + return ret; +} + +Callback::Callback(XML_Parser parser, IMoniker *baseMoniker, + StopHandler stopHandler, void *stopArg) +: parser_(parser), + baseMoniker_(baseMoniker), + ref_(0), + pBinding_(0), + totalRead_(0), + stopHandler_(stopHandler), + stopArg_(stopArg) +{ + if (baseMoniker_) + baseMoniker_->AddRef(); +} + +Callback::~Callback() +{ + if (pBinding_) + pBinding_->Release(); + if (baseMoniker_) + baseMoniker_->Release(); +} + +static int +externalEntityRef(void *arg, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId) +{ + return ((Callback *)arg)->externalEntityRef(context, systemId, publicId); +} + + +static HRESULT +openStream(XML_Parser parser, + IMoniker *baseMoniker, + const XML_Char *uri, + StopHandler stopHandler, void *stopArg) +{ + if (!XML_SetBase(parser, uri)) + return E_OUTOFMEMORY; + HRESULT hr; + IMoniker *m; +#ifdef XML_UNICODE + hr = CreateURLMoniker(0, uri, &m); +#else + LPWSTR uriw = new wchar_t[strlen(uri) + 1]; + for (int i = 0;; i++) { + uriw[i] = uri[i]; + if (uriw[i] == 0) + break; + } + hr = CreateURLMoniker(baseMoniker, uriw, &m); + delete [] uriw; +#endif + if (FAILED(hr)) + return hr; + IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg); + XML_SetExternalEntityRefHandler(parser, externalEntityRef); + XML_SetExternalEntityRefHandlerArg(parser, cb); + cb->AddRef(); + IBindCtx *b; + if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) { + cb->Release(); + m->Release(); + return hr; + } + cb->Release(); + IStream *pStream; + hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream); + if (SUCCEEDED(hr)) { + if (pStream) + pStream->Release(); + } + if (hr == MK_S_ASYNCHRONOUS) + hr = S_OK; + m->Release(); + b->Release(); + return hr; +} + +struct QuitInfo { + const XML_Char *url; + HRESULT hr; + int stop; +}; + +static void +winPerror(const XML_Char *url, HRESULT hr) +{ + LPVOID buf; + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_HMODULE, + GetModuleHandleA("urlmon.dll"), + hr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &buf, + 0, + NULL) + || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM, + 0, + hr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &buf, + 0, + NULL)) { + /* The system error messages seem to end with a newline. */ + _ftprintf(stderr, _T("%s: %s"), url, buf); + fflush(stderr); + LocalFree(buf); + } + else + _ftprintf(stderr, _T("%s: error %x\n"), url, hr); +} + +static void +threadQuit(void *p, HRESULT hr) +{ + QuitInfo *qi = (QuitInfo *)p; + qi->hr = hr; + qi->stop = 1; +} + +extern "C" +int +XML_URLInit(void) +{ + return SUCCEEDED(CoInitialize(0)); +} + +extern "C" +void +XML_URLUninit(void) +{ + CoUninitialize(); +} + +static int +processURL(XML_Parser parser, IMoniker *baseMoniker, + const XML_Char *url) +{ + QuitInfo qi; + qi.stop = 0; + qi.url = url; + + XML_SetBase(parser, url); + HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi); + if (FAILED(hr)) { + winPerror(url, hr); + return 0; + } + else if (FAILED(qi.hr)) { + winPerror(url, qi.hr); + return 0; + } + MSG msg; + while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) { + TranslateMessage (&msg); + DispatchMessage (&msg); + } + return 1; +} + +extern "C" +int +XML_ProcessURL(XML_Parser parser, + const XML_Char *url, + unsigned flags) +{ + return processURL(parser, 0, url); +} diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expat_config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expat_config.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef EXPAT_CONFIG_H +#define EXPAT_CONFIG_H + +#define HAVE_MEMMOVE + +#ifndef NULL +#define NULL 0 +#endif + +#define XML_MIN_SIZE +#define SYMBIAN_MIN_SIZE + +// Enable namespace processing +#define XML_NS + +#ifdef _UNICODE +#ifndef XML_UNICODE +#define XML_UNICODE +#endif +#ifdef XML_UNICODE_WCHAR_T +#define XML_UNICODE_WCHAR_T +#endif +#endif // _UNICODE + +#endif // EXPAT_CONFIG_H diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/expatcopyright.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/expatcopyright.txt Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,13 @@ +This product contains Expat - XML Parser Toolkit + +Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + and Clark Cooper +Copyright (c) 2001, 2002 Expat maintainers. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/xmlconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/xmlconstants.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,399 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLCONSTANTS_H__ +#define __XMLCONSTANTS_H__ + +#include + +/** +This file describes useful XML constants. + +The UTF-8 character representation protocol is described here. + +num of bytes| Bits used in encoding | Bit representation + + 1 | 7 | 0vvvvvvv + + 2 | 11 | 110vvvvv 10vvvvvv + + 3 | 16 | 1110vvvv 10vvvvvv 10vvvvvv + + 4 | 21 | 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv + + 5 | 26 | 111110vv 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv + + 6 | 31 | 1111110v 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv 10vvvvvv + +Because each XML entity not accompanied by external encoding information and not in +UTF-8 or UTF-16, encoding must begin with an XML encoding declaration, in which the +first characters must be ') symbol used in xml to close the scope of and element. +@publishedAll +*/ +const TUint8 KXMLEndTag = '>'; + +/** +The quotation (") symbol used in xml. +@publishedAll +*/ +const TUint8 KQuotation = '\"'; + + +enum TParseMode +/** +Lists enumerations used to describe one or more Parse modes. Users can set this information +via the SetParseMode method on the RXmlParser object. +@see RXmlParser +@publishedAll +*/ + { + +/** +This enumeration when set specifies the convertion of elements and attributes to lowercase. +This can be used for case-insensitive HTML so that a tag can be matched to a static +string in the string pool. +@see RStringPool +*/ + EParseModeConvertTagsToLowerCase = 0x0001, + +/** +This enumeration when set reports an error when unrecognised tags are found. +*/ + EParseModeErrorOnUnrecognisedTags = 0x0002, + +/** +This enumeration when set reports unrecognised tags. +*/ + EParseModeReportUnrecognisedTags = 0x0004, + +/** +This enumeration when set reports the namespace. +*/ + EParseModeReportNamespaces = 0x0008, + +/** +This enumeration when set reports the namespace prefix. +*/ + EParseModeReportNamespacePrefixes = 0x0010, + +/** +This enumeration when set sends all content data for an element in one chunk. +*/ + EParseModeSendFullContentInOneChunk = 0x0020, + +/** +This enumeration when set reports namespace mappings via the OnStartPrefixMapping & +OnEndPrefixMapping methods. +@see MMarkupCallback +*/ + EParseModeReportNamespaceMapping = 0x0040, + +/** +This enumeration when set describes the data in the specified encoding, otherwise +it is specified in utf-8. +*/ + EParseModeRawContent = 0x0080, + +/** +This enumeration when set states that all string comparisons be non-folded. +Fold is defined as: The removal of differences between characters that are deemed +unimportant for the purposes of inexact or case-insensitive matching. +As well as ignoring differences of case, folding ignores any accent on a character. +*/ + EParseModeStrict = 0x0100, + +/** +This enumeration is a mask that covers the total enumerations thus far, and as +such should be updated to reflect any new enumerations added. +*/ + EParseModeAllMask = 0x01FF, + + }; + + +enum TEncoding +/** +Lists enumerations used to describe the encoding of an xml document. +The first line of an xml document generally has the encoding described, +however, the data upto this description is specified in the encoding. The actual +description is described in ASCII. +@publishedAll +*/ + { + +// With BOM (Byte Order Mark): + +/** +This enumeration represents a BOM subset with the following values 00 00 FE FF. +Posible encodings include: UCS-4, big-endian machine (1234 order). +*/ + EEncodingUCS_4BEBOM = 0, + +/** +This enumeration represents a BOM subset with the following values FF FE 00 00. +Posible encodings include: UCS-4, little-endian machine (4321 order). +*/ + EEncodingUCS_4LEBOM, + +/** +This enumeration represents a BOM subset with the following values 00 00 FF FE. +Posible encodings include: UCS-4, unusual octet order (2143). +*/ + EEncodingUCS_4UO1BOM, + +/** +This enumeration represents a BOM subset with the following values FE FF 00 00. +Posible encodings include: UCS-4, unusual octet order (3412). +*/ + EEncodingUCS_4UO2BOM, + +/** +This enumeration represents a BOM subset with the following values FE FF ## ##. +Posible encodings include: UTF-16, big-endian. +*/ + EEncodingUTF_16BEBOM, + +/** +This enumeration represents a BOM subset with the following values FF FE ## ##. +Posible encodings include: UTF-16, little-endian. +*/ + EEncodingUTF_16LEBOM, + +/** +This enumeration represents a BOM subset with the following values EF BB BF ##. +Posible encodings include: UTF-8. +*/ + EEncodingUTF_8BOM, + + +// Without a Byte Order Mark: + +/** +This enumeration represents a non BOM subset with the following values 00 00 00 3C. +Posible encodings include: UCS-4 or other encoding with a 32-bit code unit +and ASCII characters encoded as ASCII values, in respectively big-endian (1234), +little-endian (4321) and two unusual byte orders (2143 and 3412). The encoding +declaration must be read to determine which of UCS-4 or other supported 32-bit encodings applies. +*/ + EEncodingUCS_4BE, + +/** +This enumeration represents a non BOM subset with the following values 3C 00 00 00. +Posible encodings include: UCS-4 or other encoding with a 32-bit code unit +and ASCII characters encoded as ASCII values, in respectively big-endian (1234), +little-endian (4321) and two unusual byte orders (2143 and 3412). The encoding +declaration must be read to determine which of UCS-4 or other supported 32-bit encodings applies. +*/ + EEncodingUCS_4LE, + +/** +This enumeration represents a non BOM subset with the following values 00 00 3C 00. +Posible encodings include: UCS-4 or other encoding with a 32-bit code unit +and ASCII characters encoded as ASCII values, in respectively big-endian (1234), +little-endian (4321) and two unusual byte orders (2143 and 3412). The encoding +declaration must be read to determine which of UCS-4 or other supported 32-bit encodings applies. +*/ + EEncodingUCS_4BO1, + +/** +This enumeration represents a non BOM subset with the following values 00 3C 00 00 +Posible encodings include: UCS-4 or other encoding with a 32-bit code unit +and ASCII characters encoded as ASCII values, in respectively big-endian (1234), +little-endian (4321) and two unusual byte orders (2143 and 3412). The encoding +declaration must be read to determine which of UCS-4 or other supported 32-bit encodings applies. +*/ + EEncodingUCS_4BO2, + +/** +This enumeration represents a non BOM subset with the following values 00 3C 00 3F. +Posible encodings include: UTF-16BE or big-endian ISO-10646-UCS-2 or other encoding +with a 16-bit code unit in big-endian order and ASCII characters encoded as ASCII +values (the encoding declaration must be read to determine which). +*/ + EEncodingUTF_16BE, + +/** +This enumeration represents a non BOM subset with the following values 3C 00 3F 00. +Posible encodings include: UTF-16LE or little-endian ISO-10646-UCS-2 or other encoding +with a 16-bit code unit in little-endian order and ASCII characters encoded as ASCII +values (the encoding declaration must be read to determine which). +*/ + EEncodingUTF_16LE, + +/** +This enumeration represents a non BOM subset with the following values 3C 3F 78 6D. +Posible encodings include: UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, +EUC, or any other 7-bit, 8-bit, or mixed-width encoding which ensures that the +characters of ASCII have their normal positions, width, and values; the actual encoding +declaration must be read to detect which of these applies, but since all of these +encodings use the same bit patterns for the relevant ASCII characters, the encoding +declaration itself may be read reliably. +*/ + EEncodingUTF_8, + +/** +This enumeration represents a non BOM subset with the following values 4C 6F A7 94. +Posible encodings include: EBCDIC (in some flavor; the full encoding declaration must +be read to tell which code page is in use). +*/ + + EEncodingEBCDIC, + +/** +This enumeration represents a non BOM subset with a combination of other values. +Posible encodings include: Other UTF-8 without an encoding declaration, or else the data +stream is mislabeled (lacking a required encoding declaration), corrupt, fragmentary, +or enclosed in a wrapper of some kind. +*/ + EEncodingOTHER, + + }; + +#endif // __XMLCONSTANTS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/xmlparserplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/xmlparserplugin.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,203 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include + +#include "xmlparserplugin.h" + +using namespace Xml; + +const TInt KExpatBufferSize = 2048; + +MParser* CXmlParserPlugin::EcomNewL(TAny* aInitParams) + { + // The cast to the MParser interface is a particular to the Xml Framework. Ecom plug-ins usually + // return the pointer to the C class. + return static_cast(CXmlParserPlugin::NewL(aInitParams)); + } + +/* +CXmlParserPlugin::NewL is for testing and can only be accessed by linking directly to XmlParser.o + +aDebugFailCount is used to configure parser heap failure during construction testing - the +usual heap failure macros do not work for our purposes here as it is a private heap. See +CExpat for details. +*/ +CXmlParserPlugin* CXmlParserPlugin::NewL(TAny* aInitParams, TInt aDebugFailCount) + { + TParserInitParams* p = reinterpret_cast(aInitParams); + + CXmlParserPlugin* self = new(ELeave) CXmlParserPlugin(p->iContentHandler); + + CleanupStack::PushL(self); + self->ConstructL(p->iStringDictionaryCollection, p->iCharSetConverter, p->iElementStack, aDebugFailCount); + CleanupStack::Pop(self); + + return self; + } + +CXmlParserPlugin::CXmlParserPlugin(MContentHandler* aContentHandler) : + iContentHandler(*aContentHandler) + { + } + +void CXmlParserPlugin::ConstructL(RStringDictionaryCollection* aStringDictionaryCollection, CCharSetConverter* aCharSetConverter, + RElementStack* aElementStack, TInt aDebugFailCount) + { + iExpat = CExpat::NewL(iContentHandler, aStringDictionaryCollection->StringPool(), *aCharSetConverter, *aElementStack, aDebugFailCount); + } + +/* +Used by framework to delete this object +*/ +void CXmlParserPlugin::Release() + { + delete this; + } + +/* +Private destructor - only accessible from Release method +*/ +CXmlParserPlugin::~CXmlParserPlugin() + { + delete iExpat; + } + + +TInt CXmlParserPlugin::EnableFeature(TInt aParseMode) + { + return iExpat->EnableFeature(aParseMode); + } + +TInt CXmlParserPlugin::DisableFeature(TInt aParseMode) + { + return iExpat->DisableFeature(aParseMode); + } + +TBool CXmlParserPlugin::IsFeatureEnabled(TInt aParseMode) const + { + return iExpat->IsFeatureEnabled(aParseMode); + } + + +void CXmlParserPlugin::ParseChunkL(const TDesC8& aChunk) + { + // If a Reset failed, iExpatResetError will have been set. Here we report it by leaving with the error, + // which will in turn be passed to MContentHandler::OnError. + User::LeaveIfError(iExpatResetError); + ParseChunkInPartsL(aChunk); + } + +void CXmlParserPlugin::ParseLastChunkL(const TDesC8& aFinalChunk) + { + // If a Reset failed, iExpatResetError will have been set. Here we report it by leaving with the error, + // which will in turn be passed to MContentHandler::OnError. + User::LeaveIfError(iExpatResetError); + + // Could be that there is some enourmous piece of data here. + ParseChunkInPartsL(aFinalChunk); + + // We need a buffer even though we have nothing to parse, + // as any previous buffers are destroyed. + // We are just going through the sequence of completing the parsing gracefully. + TDes8& buf = iExpat->GetBufferL(1); + buf = _L8(""); + iExpat->ParseLastL(); + + // TRAP doesn't set its result variable unless a leave occurs - so reset it first. + iExpatResetError = KErrNone; + + // The Reset interface of the Xml Framework provides no mechanism for failure reporting. If iExpat.ResetL + // fails we set iExpatResetError. The error will be reported to MContentHandler::OnError when an attempt + // is made by the client to begin parsing (see RunL). + TRAP(iExpatResetError, iExpat->ResetL()); + } + +void CXmlParserPlugin::ParseChunkInPartsL(const TDesC8& aChunk) + { + // The Expat parser has a buffer of 64k that it stores its state variables in + // and allocates its heap memory from. + // We do this because we may need to upgrade the version of Expat later and this + // makes it easier. + // Beacuse of this we copy the buffer that could have a performance issue, + // we will address this if it later arises. + // We parse the descriptor in parts as we do not want to blow the buffer. + // Even though the descriptor may already be passed in chunks they may be too big. + + if (aChunk.Length() == 0) + { + return; + } + + TPtrC8 part; + TInt offset = 0; + TInt size = aChunk.Size(); + TInt partSize = size; + + do + { + TDes8& buf = iExpat->GetBufferL(KExpatBufferSize); + + if (partSize > KExpatBufferSize) + { + partSize = KExpatBufferSize; + } + + part.Set (aChunk.Mid(offset, partSize)); + + buf = part; + iExpat->ParseL(); + + // The remaining part stats. + offset += part.Length(); + partSize = size - offset; + + } while (partSize); + } + +void CXmlParserPlugin::SetContentSink(class MContentHandler &aContentSink) + { + iExpat->SetContentSink(aContentSink); + } + +RHeap* CXmlParserPlugin::GetInternalHeap() const + { + return iExpat->GetInternalHeap(); + } + +// +// Ecom implementation infrastructure +// + +// KUidXmlParserPlugin is the unique UID for our implementation of the MParser interface. This interface is +// 'published' as KParserInterfaceUid defined in Xml/FrameworkConstants.h. KUidXmlParserPlugin must be +// the same as the value of implementation_uid in the file 101faa0a.rss +const TInt KUidXmlParserPlugin = 0x101FAA0C; + +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(KUidXmlParserPlugin, CXmlParserPlugin::EcomNewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/src/xmlparserplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/src/xmlparserplugin.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,104 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef XMLPARSERPLUGIN_H +#define XMLPARSERPLUGIN_H + +#include +#include + +#include "cexpat.h" + +/* +CXmlParserPlugin class. + +1. +This is the top level class of xmlparserplugin.dll - an Ecom plugin +for use in the Xml framework. + +For full details of the plug-in configuration see the files pmlparser.mmp +and 101faa0a.rss. + +Ecom constructs the plug-in by virtue of a call to the static member +function EcomNewL, a pointer to which is contained in the associated +TImplementationProxy table for the plug-in. + +2. +This class implements the MParser interface defined in xml/parser.h + +3. +The parsing functionality is subcontracted to the Expat parser toolkit, +captured in the class CExpat, see the file cexpat.h. +*/ +class CXmlParserPlugin : public CBase, Xml::MParser + { +public: + + /* + EcomNewL function intended for construction by Ecom of implementation MParser interface. + */ + static Xml::MParser* EcomNewL(TAny* aInitParams); + + /* + This class has a private destructor. The Xml Framework destroys the parser using this Release method. + */ + void Release(); + + /* + Standard NewL function. This function is used by EcomNewL but has been provided separately for + testing purposes. + */ + static CXmlParserPlugin* NewL(TAny* aInitParams, TInt aDebugFailCount=0); + + + /* + Implementation of MParser interface + */ + TInt EnableFeature(TInt aParserFeature); + TInt DisableFeature(TInt aParserFeature); + TBool IsFeatureEnabled(TInt aParserFeature) const; + void ParseChunkL(const TDesC8& aChunk); + void ParseLastChunkL(const TDesC8& aFinalChunk); + + void SetContentSink(Xml::MContentHandler& aContentHandler); + + RStringPool& StringPool(); + + /* + Function used to access internal parser heap for testing + */ + RHeap* GetInternalHeap() const; + +private: + CXmlParserPlugin(Xml::MContentHandler* aContentHandler); + void ConstructL(Xml::RStringDictionaryCollection* aStringDictionaryCollection, Xml::CCharSetConverter* aCharSetConverter, + RElementStack* aElementStack, TInt aDebugFailCount); + void ParseChunkInPartsL(const TDesC8& aChunk); + virtual ~CXmlParserPlugin(); + +private: + /* + References to client-provided objects + */ + Xml::MContentHandler& iContentHandler; + + /* + CExpat is the work horse of the parser + */ + CExpat* iExpat; + TInt iExpatResetError; + }; + +#endif // XMLPARSER_H diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/data/xml.zip Binary file xml/xmlexpatparser/test/rtest/data/xml.zip has changed diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/data/xmldefect.zip Binary file xml/xmlexpatparser/test/rtest/data/xmldefect.zip has changed diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/group/t_xmldefect.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/group/t_xmldefect.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_xmldefect.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../../xmlfw/inc + +SOURCEPATH ../tsrc +SOURCE t_xmldefect.cpp +SOURCE unzip.cpp + +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY ezip.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/group/t_xmlparser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/group/t_xmlparser.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_xmlparser.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../tsrc +USERINCLUDE ../../../../xmlfw/test/rtest/tsrc + +SOURCEPATH ../tsrc +SOURCE t_xmlparser.cpp +SOURCE unzip.cpp + +SOURCEPATH ../../../../xmlfw/test/rtest/tsrc +SOURCE contenthandlers.cpp + +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY ezip.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/group/t_xmlparserheap.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/group/t_xmlparserheap.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_xmlparserheap.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../../../src +USERINCLUDE ../../../src/expat-1.95.5/lib +USERINCLUDE ../../../../xmlfw/test/rtest/tsrc +USERINCLUDE ../../../../xmlfw/inc + +SOURCEPATH ../tsrc +SOURCE t_xmlparserheap.cpp + +SOURCEPATH ../../../../xmlfw/test/rtest/tsrc +SOURCE contenthandlers.cpp + +SOURCEPATH ../../../../xmlfw/src/xmlframework +SOURCE charsetconverter.cpp + +SOURCEPATH ../../../src +SOURCE xmlparserplugin.cpp +SOURCE cexpat.cpp + +SOURCEPATH ../../../src/expat-1.95.5/lib +SOURCE xmlparse.c +SOURCE xmlrole.c +SOURCE xmltok.c + +LIBRARY bafl.lib +LIBRARY charconv.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY estlib.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/group/xmlparsertests.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/group/xmlparsertests.bat Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,19 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +t_xmldefect.exe +t_xmlparser.exe +t_xmlparserheap.exe diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/group/xmlparsertests.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/group/xmlparsertests.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLPARSERTESTS_IBY__ +#define __XMLPARSERTESTS_IBY__ + +REM XML Parser Tests +#include +#include + +file=ABI_DIR\BUILD_DIR\t_xmlparser.exe test\t_xmlparser.exe +file=ABI_DIR\BUILD_DIR\t_xmlparserheap.exe test\t_xmlparserheap.exe +file=ABI_DIR\BUILD_DIR\t_xmldefect.exe test\t_xmldefect.exe + +data=ZSYSTEM\test\xmlparsertests.bat test\xmlparsertests.bat + +data=ZSYSTEM\Data\xml\xml.zip System\data\xml\xml.zip +data=ZSYSTEM\Data\xml\xmldefect.zip System\data\xml\xmldefect.zip + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/t_xmldefect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/t_xmldefect.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,623 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "unzip.h" + +LOCAL_D RTest test(_L("t_xmldefect.exe")); + +LOCAL_D RFs TheFs; + +LOCAL_D CTrapCleanup* TheTrapCleanup = NULL; + +LOCAL_D TBool TheCorruptedXmlFileTest = EFalse; + +LOCAL_D TInt TheCorruptedXmlFileTestErrorCount = 0; + +// Installed via bld.inf test exports +_LIT(KSimpleFile, "c:\\system\\data\\xml\\xml\\another_simple.xml"); +_LIT(KNsAndBindingFile, "c:\\system\\data\\xml\\xml\\default_namespace_and_unbinding.xml"); + +_LIT(KZipTestFile, "z:\\system\\data\\xml\\xmldefect.zip"); +_LIT(KXmlTestDir, "c:\\system\\data\\xml"); + + +_LIT8(KXmlParserDataType, "text/xml"); + + +typedef void (*TestFunc) (void); + + +//---------------------------------------------------------------------------- +// The Content Handler + +using namespace Xml; + +class RDefectTests : public MContentHandler + { +public: + RDefectTests() {/*do nothing*/}; + virtual ~RDefectTests() {/*do nothing*/}; + + void Open() {/*do nothing*/}; + void Close() {/*do nothing*/}; + + // From MContentHandler + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttribute, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) ; + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + + void OnError(TInt aErrorCode); + + }; + + + +// From MContentHandler + +// maps to SAX 2.0 startDocument method. +void RDefectTests::OnStartDocumentL(const RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + + // maps to SAX 2.0 endDocument method. +void RDefectTests::OnEndDocumentL(TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 startElement method. +void RDefectTests::OnStartElementL(const RTagInfo& /*aElement*/, const RAttributeArray& /*aAttribute*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 endElement method. +void RDefectTests::OnEndElementL(const RTagInfo& /*aElement*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 characters method. +void RDefectTests::OnContentL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 startPrefixMapping method. +void RDefectTests::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode) + { + test.Next(_L("Entered OnStartPrefixMappingL")); + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 endPrefixMapping method. +void RDefectTests::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 ignorableWhitespace method. +void RDefectTests::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 skippedEntity method. +void RDefectTests::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// maps to SAX 2.0 processingInstruction method. +void RDefectTests::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode) + { + test(aErrorCode == KErrNone); + } + + +// Note that Oom tests between Xml and Wbxml behave differently. +// Xml has a preallocated block of memory allocated upfront that +// it uses to obtain internal memory allocations from. +// In this manner out of memory allocations happen BEFORE parsing. +// Therefore, OnError() is never called due to KErrNoMemory. However, +// the parser will leave and fall into the oom TRAP block. +// With Wbxml there is no such preallocation so an OnError will occur. +void RDefectTests::OnError(TInt aErrorCode) + { + //This is done for the test DEF101097L which parses 2 corrupted xml file + //in a sequence & thus to check if OnError is called for both the files + //& avoid those errors by checking if the error is not KErrNone. + if(TheCorruptedXmlFileTest) + { + test(aErrorCode != KErrNone); + ++TheCorruptedXmlFileTestErrorCount; + } + else + test (aErrorCode == KErrEof || aErrorCode == KErrNoMemory); + } + + +TAny* RDefectTests::GetExtendedInterface(const TInt32 aUid) +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + { + if (aUid == 0) + { + + } + return 0; + } + + +//---------------------------------------------------------------------------- +// The Defect Tests + +LOCAL_C void SetupL() + { + test.Printf(_L("Unziping test xml files for defects\n")); + + CUnzip* unzip = CUnzip::NewLC(TheFs, KZipTestFile); + unzip->ExtractL(KXmlTestDir); + CleanupStack::PopAndDestroy(unzip); + + //Getch(); + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3750 +@SYMTestCaseDesc OOM Testing. +@SYMTestPriority Medium +@SYMTestActions Runs a set of test in oom conditions. +@SYMTestExpectedResults The component(s) should fucntion as expected and the tests should pass. +@SYMDEF DEF060070 +*/ +LOCAL_C void DoOomTestL(TestFunc testFuncL, const TDesC& /*aDesc*/) + { + test.Printf(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3750 OOM test \n ")); + + TInt err, tryCount = 0; + do + { + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++tryCount); + User::__DbgMarkStart(RHeap::EUser); + TRAP(err, (*testFuncL)()); + User::__DbgMarkEnd(RHeap::EUser, 0); + } while(err==KErrNoMemory); + + if(err==KErrNone) + { + // Reset + User::__DbgSetAllocFail(RHeap::EUser,RHeap::ENone,1); + } + else + { + User::Panic(_L("Unexpected leave reason\n"),err); + } + + test.Printf(_L("- succeeded with rate %i\r\n"), tryCount); + } + + +//---------------------------------------------------------------------------- + + +LOCAL_C void DoTestL(TestFunc aTestFuncL, const TDesC& aDesc) + { + test.Next(aDesc); + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + // Test Starts... + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + (*aTestFuncL)(); + + REComSession::FinalClose(); // Don't want leaks outside the test + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + __UHEAP_MARKEND; + + DoOomTestL(aTestFuncL, aDesc); + + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1571 +@SYMTestCaseDesc Testing Prop: Symbian XML + Framework-MContentHandler::OnStartPrefixMappingL()never called +@SYMTestPriority Medium +@SYMTestActions Parsing a xml file and check whether framework calls + MContentHandler::OnStartPrefixMappingL() function +@SYMTestExpectedResults Test output should show "Entered OnStartPrefixMappingL". +@SYMDEF DEF074797 +*/ + + +LOCAL_C void DEF074797L() + { + + _LIT8 (KXmlNamespace,"\ + \ + \ + prearranged3\ + \ + \ + tr\ + \ + \ + true\ + 10\ + \ + \ + \ + true\ + \ + \ + allow\ + true\ + true\ + true\ + \ + \ + \ + \ + \ + "); + + + TBuf16<128> ucs4_0041; + + // A + // 0x01, 0x04, 0x6A, 0x00, 0x7F, 0x02, 0x80, 0x41, 0x01 + + ucs4_0041.Append(0x01); + ucs4_0041.Append(0x04); + ucs4_0041.Append(0x6A); + ucs4_0041.Append(0x00); + ucs4_0041.Append(0x7F); + ucs4_0041.Append(0x02); + ucs4_0041.Append(0x80); + ucs4_0041.Append(0x41); + ucs4_0041.Append(0x01); + + _LIT8 (KWbxmlParserDataType, "text/wbxml"); + + RDefectTests handler; + CleanupClosePushL (handler); + + CParser* parser = CParser::NewL(KXmlParserDataType, handler); + CleanupStack::PushL (parser); + + User::LeaveIfError( parser->EnableFeature( EReportNamespaces ) ); + User::LeaveIfError( parser->EnableFeature( EReportNamespaceMapping ) ); + User::LeaveIfError( parser->EnableFeature( EReportNamespacePrefixes ) ); + + // Parse the xml document + ParseL(*parser, KXmlNamespace); + + // Now switch to a different parser (wbxml) + parser->ParseBeginL (KWbxmlParserDataType); + + TBuf8<256> buf8; + // Copy will ignore the upper byte if the byte-pair < 256, otherwise the value 1 is used. + buf8.Copy(ucs4_0041); + + parser->ParseL(buf8); + + // Now switch back to the default parser (xml) + ParseL(*parser, KXmlNamespace); + + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3749 +@SYMTestCaseDesc Swapping parsers back and forth between parsing the same document twice. +@SYMTestPriority Medium +@SYMTestActions Parse an xml document, swap to the wbxml parser, then swap back to the xml parser and parse. +@SYMTestExpectedResults The test completes successfully. +@SYMDEF INC063222 +*/ +LOCAL_C void INC063222L() + { + _LIT8 (KXmlNamespace, "\ + \ + \ + \ + \ + \ + \ + "); + + TBuf16<128> ucs4_0041; + + // A + // 0x01, 0x04, 0x6A, 0x00, 0x7F, 0x02, 0x80, 0x41, 0x01 + + ucs4_0041.Append(0x01); + ucs4_0041.Append(0x04); + ucs4_0041.Append(0x6A); + ucs4_0041.Append(0x00); + ucs4_0041.Append(0x7F); + ucs4_0041.Append(0x02); + ucs4_0041.Append(0x80); + ucs4_0041.Append(0x41); + ucs4_0041.Append(0x01); + + _LIT8 (KWbxmlParserDataType, "text/wbxml"); + + RDefectTests handler; + CleanupClosePushL (handler); + + CParser* parser = CParser::NewL(KXmlParserDataType, handler); + CleanupStack::PushL (parser); + + User::LeaveIfError(parser->EnableFeature(EReportNamespaceMapping)); + + // Parse the xml document + ParseL(*parser, KXmlNamespace); + + // Now switch to a different parser (wbxml) + parser->ParseBeginL (KWbxmlParserDataType); + + TBuf8<256> buf8; + // Copy will ignore the upper byte if the byte-pair < 256, otherwise the value 1 is used. + buf8.Copy(ucs4_0041); + + parser->ParseL(buf8); + + // Now switch back to the default parser (xml) + ParseL(*parser, KXmlNamespace); + + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + } + + +//---------------------------------------------------------------------------- + +/** +@SYMTestCaseID SYSLIB-XML-CT-3747 +@SYMTestCaseDesc Parsing a document supplied via a file handle. +@SYMTestPriority Medium +@SYMTestActions Creating a parser and opening file handle to a xml document and then parsing the document. +@SYMTestExpectedResults The document is parsed. +@SYMDEF DEF060070 +*/ +LOCAL_C void DEF060070L() + { + RDefectTests handler; + CleanupClosePushL (handler); + + CParser* parser = CParser::NewLC(KXmlParserDataType, handler); + + RFile handle; + handle.Open(TheFs, KSimpleFile, EFileShareReadersOnly); + CleanupClosePushL (handle); + + ParseL(*parser, handle); + + CleanupStack::PopAndDestroy (&handle); + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + } + + +//---------------------------------------------------------------------------- + +/** +@SYMTestCaseID SYSLIB-XML-CT-3748 +@SYMTestCaseDesc Processing namespaces. +@SYMTestPriority Medium +@SYMTestActions Creating an xml parser and enabling namespace mapping reporting, before parsing a document. +@SYMTestExpectedResults The document is parsed with the namespace mapping reporting enabled. +@SYMDEF INC059062 +*/ +LOCAL_C void INC059062L() + { + RDefectTests handler; + CleanupClosePushL (handler); + + CParser* parser = CParser::NewLC(KXmlParserDataType, handler); + + User::LeaveIfError(parser->EnableFeature(EReportNamespaceMapping)); + + RFile handle; + handle.Open(TheFs, KNsAndBindingFile, EFileShareReadersOnly); + CleanupClosePushL (handle); + + ParseL(*parser, handle); + + CleanupStack::PopAndDestroy (&handle); + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + } + + +//---------------------------------------------------------------------------- + + +/* +@SYMTestCaseID SYSLIB-XML-UT-3366 +@SYMTestCaseDesc DEF101097: The XML parser don't leave twice when it parse several invalid xml files +@SYMTestPriority Low +@SYMTestActions Tests that the xml parser returns an error each time it parses the same corrupted xml file. +@SYMTestExpectedResults Test must not fail +@SYMDEF DEF101097 +*/ +LOCAL_C void DEF101097L() + { + TheCorruptedXmlFileTest = ETrue; + + _LIT (KTestDocument1, "c:\\system\\data\\xml\\xml\\Corruptedbackupreg.xml"); + + RDefectTests handler; + CleanupClosePushL (handler); + + CParser* parser = CParser::NewLC(KXmlParserDataType, handler); + + // Parse the first xml doc. + ParseL(*parser,TheFs, KTestDocument1); + + // Parse the second xml doc i.e. same data. + ParseL(*parser,TheFs, KTestDocument1); + + test(TheCorruptedXmlFileTestErrorCount == 2); + + TheCorruptedXmlFileTest = EFalse; + TheCorruptedXmlFileTestErrorCount = 0; + + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + } + + +//---------------------------------------------------------------------------- + + + +/* +@SYMTestCaseID SYSLIB-XML-UT-4937 +@SYMTestCaseDesc Xml::ParseL() Shouldn't Leave with KErrNoMemory for Non-Well formed Large XML file +@SYMTestPriority Medium +@SYMTestActions Tests that the Xml parser doesn't leave with KErrNoMemory from ParseL each time it parses the same Corrupted Large Xml file. +@SYMTestExpectedResults Test must not fail +@SYMDEF INC134125 +*/ + +LOCAL_C void INC134125L() + { + TheCorruptedXmlFileTest = ETrue; + + _LIT (KTestDocument1, "c:\\system\\data\\xml\\xml\\Corruptbigfile.xml"); + RDefectTests handler; + CleanupClosePushL (handler); + CParser* parser = CParser::NewLC(KXmlParserDataType, handler); + // Parse the Corrupt Big Xml file. + ParseL(*parser,TheFs, KTestDocument1); + test(TheCorruptedXmlFileTestErrorCount == 1); + TheCorruptedXmlFileTest = EFalse; + TheCorruptedXmlFileTestErrorCount = 0; + CleanupStack::PopAndDestroy (parser); + CleanupStack::PopAndDestroy (&handler); + } + + +//---------------------------------------------------------------------------- + +LOCAL_C void DoTestsL() + { + DoTestL(DEF060070L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-3747 DEF060070 - XML parser cannot parse a file supplied by handle...\n ")); + DoTestL(INC059062L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-3748 INC059062 - XML Parser Integration - namespaces not processing properly...\n ")); + DoTestL(INC063222L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-3749 INC063222 - Symbian XML Framework - MContentHandler::OnStartPrefixMappingL() is never called...\n ")); + DoTestL(DEF074797L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1571 DEF074797 - Prop: Symbian XML Framework-MContentHandler::OnStartPrefixMappingL()never called...\n ")); + DoTestL(DEF101097L, _L(" @SYMTestCaseID:SYSLIB-XML-UT-3366 DEF101097 - The XML parser don't leave twice when it parse several invalid xml files...\n ")); + DoTestL(INC134125L, _L("INC134125 - Xml::ParseL() Shouldn't Leave with KErrNoMemory for Non-Well formed Large XML file...\n")); + } + + +//---------------------------------------------------------------------------- + + +TInt E32Main() + { + __UHEAP_MARK; + + test.Printf(_L("\n")); + test.Title(); + test.Start(_L("XML Defect tests\n")); + + // Connect the file server instance + User::LeaveIfError(TheFs.Connect()); + + TheTrapCleanup = CTrapCleanup::New(); + + TRAPD(err, SetupL()); + test(err == KErrNone); + + TRAP(err, DoTestsL()); + test(err == KErrNone); + + delete TheTrapCleanup; + + TheFs.Close(); + + test.End(); + test.Close(); + + __UHEAP_MARKEND; + return (KErrNone); + } + diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/t_xmlparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/t_xmlparser.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,919 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include + +#include "t_xmlparser.h" +#include "unzip.h" + +using namespace Xml; + +RTest test(_L("XML parser tests")); // must be called 'test', as the e32test macros rely on this. + +// Installed via bld.inf test exports +_LIT(KBigTestFile, "c:\\system\\data\\xml\\xml\\networking.xml"); +_LIT(KRefFilename, "c:\\system\\data\\xml\\xml\\ref-networking.xml"); +_LIT(KSimpleTestFile, "c:\\system\\data\\xml\\xml\\simple.xml"); +_LIT(KInvalidTestFile, "c:\\system\\data\\xml\\xml\\invalid.xml"); +_LIT(KNamespaceTestFile, "c:\\system\\data\\xml\\xml\\namespace.xml"); +_LIT(KEntityTestFile, "c:\\system\\data\\xml\\xml\\entity.xml"); +_LIT(KCapsTestFile, "c:\\system\\data\\xml\\xml\\caps.xml"); +_LIT(KEncodingTestFile, "c:\\system\\data\\xml\\xml\\doc_jp_utf.xml"); +_LIT(KEncodingRefFile, "c:\\system\\data\\xml\\xml\\ref_doc_jp_utf.xml"); + +_LIT(KZipTestFile, "z:\\system\\data\\xml\\xml.zip"); +_LIT(KXmlTestDir, "c:\\system\\data\\xml"); + +_LIT8(KIncompleteData, " refBuf; + TBuf8<256> resultBuf; + + while(ref.Read(refBuf)==KErrNone && result.Read(resultBuf)==KErrNone && refBuf.Length()>0) + test(refBuf==resultBuf); + + test(refBuf.Length()==0 && resultBuf.Length()==0); + + CleanupStack::PopAndDestroy(2); + fs.Delete(filename); + CleanupStack::PopAndDestroy(&fs); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1578 +@SYMTestCaseDesc SS31 Symbian XML Framework - Symbian SAX Plugin is not returned by default. +@SYMTestPriority High +@SYMTestActions Create CParser and parse test file. Compare number of elements in output + to determine which parser is selected. Create CParser and parse test file + with CMatchData API with default supplied parameters. Test for selected parser. +@SYMTestExpectedResults Test should not fail. Symbian parser is expected to be selected. +@SYMDEF INC073582 +*/ +LOCAL_C void INC073582L() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + CleanupStack::PushL(handler); + + RFile handle; + User::LeaveIfError(handle.Open(fs, KSimpleTestFile, EFileShareReadersOnly)); + CleanupClosePushL(handle); + + // Test default behaviour of text/xml parser (multiple parsers return Symbian) + + CParser* parser = CParser::NewLC(KParserDataType, *handler); + + ParseL(*parser, handle); + //Expected: handler->iNumElements == 6 + // Production, Symbian parser. + test(handler->iNumElements==6); + + CleanupStack::PopAndDestroy(parser); + + // Test default behaviour with CMatchData supplied version of CParser + + CMatchData *matchData = CMatchData::NewLC(); + + matchData->SetMimeTypeL(KParserDataType); + matchData->SetVariantL(_L8("")); + + parser = CParser::NewLC(*matchData, *handler); + + ParseL(*parser, handle); + //Expected: handler->iNumElements == 6 + // Production, Symbian parser. + test(handler->iNumElements==6); + + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(matchData); + + // Test default behaviour of text/wbxml parser (multiple parsers return Symbian-first) + + parser = CParser::NewLC(KParserDataType2, *handler); + + ParseL(*parser, handle); + //Expected: handler->iNumElements == 6 + // Production, Symbian parser. + test(handler->iNumElements==6); + + CleanupStack::PopAndDestroy(parser); + + // Test default behaviour of text/unique parser (single parser non-Symbian) + + parser = CParser::NewLC(KParserDataType3, *handler); + + ParseL(*parser, handle); + //Expected: handler->iNumElements == 1 + // Test parser1. + test(handler->iNumElements==1); + + CleanupStack::PopAndDestroy(parser); + + // Test default behaviour of text/same parser (multiple parser non-Symbian, return lowest uid) + + parser = CParser::NewLC(KParserDataType4, *handler); + + ParseL(*parser, handle); + //Expected: handler->iNumElements == 1 + // Test parser1. + test(handler->iNumElements==1); + + CleanupStack::PopAndDestroy(parser); + + CleanupStack::PopAndDestroy(&handle); + CleanupStack::PopAndDestroy(handler); + CleanupStack::PopAndDestroy(&fs); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3735 +@SYMTestCaseDesc Parsing a document larger than the Expat internal buffer. +@SYMTestPriority Medium +@SYMTestActions Checks that a descriptor larger than Expats internal buffer can be parsed successfully. +@SYMTestExpectedResults The xml document is parsed correctly. +@SYMDEF DEF056122 +*/ +LOCAL_C void DEF056122L() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile result; + TFileName filename; + User::LeaveIfError(result.Temp(fs, _L("C:\\"), filename, EFileWrite)); + CleanupClosePushL(result); + + TRebuildingContentHandler contentHandler(result); + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + + // Read the test file into a descriptor + + RFile file; + + User::LeaveIfError(file.Open (fs, KBigTestFile(), EFileRead|EFileShareReadersOnly)); + CleanupClosePushL (file); + + TInt size = 0; + file.Size (size); + + HBufC8* rawdocheap = HBufC8::NewLC (size); + TPtr8 rawdoc(rawdocheap->Des ()); + + User::LeaveIfError (file.Read (rawdoc, size)); + + // Parse the descriptor + + ParseL(*parser, rawdoc); + test(contentHandler.iError==KErrNone); + + CleanupStack::PopAndDestroy(4); + + // Test everything worked + + RFile ref; + User::LeaveIfError(ref.Open(fs, KRefFilename, EFileRead)); + CleanupClosePushL(ref); + User::LeaveIfError(result.Open(fs, filename, EFileRead)); + CleanupClosePushL(result); + + TInt resultSize; + User::LeaveIfError(result.Size(resultSize)); + TInt refSize; + User::LeaveIfError(ref.Size(refSize)); + test(resultSize==refSize); + + TBuf8<256> refBuf; + TBuf8<256> resultBuf; + + while(ref.Read(refBuf)==KErrNone && result.Read(resultBuf)==KErrNone && refBuf.Length()>0) + test(refBuf==resultBuf); + + test(refBuf.Length()==0 && resultBuf.Length()==0); + + CleanupStack::PopAndDestroy(2); + fs.Delete(filename); + CleanupStack::PopAndDestroy(&fs); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1598 +@SYMTestCaseDesc Tests to make sure XML parser does not crash when parsing a message that is not complete. +@SYMTestPriority Medium +@SYMTestActions Parses the message that is not complete. +@SYMTestExpectedResults Test must not fail. +@SYMDEF INC073797 +*/ +LOCAL_C void INC073797() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile result; + TFileName filename; + User::LeaveIfError(result.Temp(fs, _L("C:\\"), filename, EFileWrite)); + CleanupClosePushL(result); + + TRebuildingContentHandler contentHandler(result); + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + parser->ParseL(KIncompleteData()); + test(contentHandler.iError==KErrNone); + + CleanupStack::PopAndDestroy(2); + + fs.Delete(filename); + CleanupStack::PopAndDestroy(&fs); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3736 +@SYMTestCaseDesc Parsing an xml file with extended character.. +@SYMTestPriority Medium +@SYMTestActions Checks that the parser can deal with extended characters - locales outside of ascii. + Parses doc_jp_utf.xml, reconstitutes it as xml, and compares with ref_doc_jp_utf.xml. +@SYMTestExpectedResults The reconstructed document is the same as the original document. +@SYMDEF DEF051379 +*/ +LOCAL_C void DEF051379L() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + TInt pos = 0; + + //open a temporary results file + RFile result; + TFileName filename; + User::LeaveIfError(result.Temp(fs, _L("C:\\"), filename, EFileWrite)); + CleanupClosePushL(result); + + //reconstitutes the xml from parser callbacks + TRebuildingContentHandler contentHandler(result); + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + //parse the file + ParseL(*parser, fs, KEncodingTestFile()); + test(contentHandler.iError==KErrNone); + + //open the reference file, and compare with results file + RFile ref; + User::LeaveIfError(ref.Open(fs, KEncodingRefFile, EFileRead)); + CleanupClosePushL(ref); + + User::LeaveIfError(result.Seek(ESeekStart,pos)); + + TInt resultSize; + User::LeaveIfError(result.Size(resultSize)); + TInt refSize; + User::LeaveIfError(ref.Size(refSize)); + test(resultSize==refSize); + + TBuf8<256> refBuf; + TBuf8<256> resultBuf; + + while(ref.Read(refBuf)==KErrNone && result.Read(resultBuf)==KErrNone && refBuf.Length()>0) + test(refBuf==resultBuf); + + //check that RFile::Read has read the entire contents of each file, + //so that length (from cursor position to end of file) == 0 + test(refBuf.Length()==0 && resultBuf.Length()==0); + + + CleanupStack::PopAndDestroy(&ref); + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(&result); + fs.Delete(filename); + CleanupStack::PopAndDestroy(&fs); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3737 +@SYMTestCaseDesc Parsing multiple documents in sequence. +@SYMTestPriority Medium +@SYMTestActions Checks that the parser can be reset after parsing one document and used to parse another. +@SYMTestExpectedResults The contenthandler is able to deal with the parsing of 2 xml documents in sequence. +@SYMPREQ PREQ230 +*/ +LOCAL_C void ResetTestL() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + TSimpleContentHandler contentHandler; + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + ParseL(*parser, fs, KSimpleTestFile()); + + test(contentHandler.iNumElements==6); + test(contentHandler.iError==KErrNone); + + ParseL(*parser, fs, KBigTestFile()); + + test(contentHandler.iNumElements==832); + test(contentHandler.iError==KErrNone); + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3738 +@SYMTestCaseDesc Parser copes with leaving content handler. +@SYMTestPriority Medium +@SYMTestActions Checks that the parser copes with a leave from a content handler callback. +@SYMTestExpectedResults Tests pass. +@SYMPREQ PREQ230 +*/ +LOCAL_C void CallbackLeaveTestL() + { + TSimpleContentHandler contentHandler; + contentHandler.iLeaveOnStartElement = ETrue; + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + TRAPD(err, ParseL(*parser, fs, KSimpleTestFile())); + + User::LeaveIfError(err); // For OOM testing + + test(contentHandler.iNumElements==1); + test(err==TSimpleContentHandler::KExpectedLeaveCode); + + contentHandler.iLeaveOnStartElement = EFalse; + ParseL(*parser, fs, KSimpleTestFile()); + test(contentHandler.iNumElements==6); + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3739 +@SYMTestCaseDesc Well-formedness errors are propagated. +@SYMTestPriority Medium +@SYMTestActions Checks that well-formedness errors generated by the parser are propagated. +@SYMTestExpectedResults content handler reports the error. +@SYMPREQ PREQ230 +*/ +LOCAL_C void InvalidXmlTestL() + { + TSimpleContentHandler contentHandler; + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + ParseL(*parser, fs, KInvalidTestFile()); + if(contentHandler.iError!=EXmlInvalidToken) + User::Leave(contentHandler.iError); // For OOM testing + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3740 +@SYMTestCaseDesc Reporting namespace uri's and prefixes. +@SYMTestPriority Medium +@SYMTestActions Checks that namespace uri's and prefixes are correctly reported. +@SYMTestExpectedResults content handler has no errors. +@SYMPREQ PREQ230 +*/ +LOCAL_C void NamespaceTestL() + { + _LIT8(KDefaultUri, "http://www.symbian.com"); + _LIT8(KElementPrefix, "elprefix"); + _LIT8(KElementUri, "http://element.uri"); + _LIT8(KAttributePrefix, "attprefix"); + _LIT8(KAttributeUri, "http://attribute.uri"); + + TNamespaceContentHandler contentHandler(KDefaultUri, KElementPrefix, KElementUri, KAttributePrefix, KAttributeUri); + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + User::LeaveIfError(parser->EnableFeature(EReportNamespaceMapping)); + + ParseL(*parser, fs, KNamespaceTestFile()); + User::LeaveIfError(contentHandler.iError); // For OOM testing + + test(contentHandler.iError==KErrNone); + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3741 +@SYMTestCaseDesc Converting character set. +@SYMTestPriority Medium +@SYMTestActions Checks that skipped entities are reported. +@SYMTestExpectedResults The expected conversion result and the actual conversion result match. +@SYMPREQ PREQ230 +*/ +LOCAL_C void SkippedEntityTestL() + { + TSimpleContentHandler contentHandler; + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + ParseL(*parser, fs, KEntityTestFile()); + User::LeaveIfError(contentHandler.iError); // For OOM testing + + test(contentHandler.iError==KErrNone); + test(contentHandler.iNumSkippedEntities==2); + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3742 +@SYMTestCaseDesc Testing the Features functions of CParser, to make sure they work correctly. +@SYMTestPriority Medium +@SYMTestActions Create the parser object and enable and disable features, testing if they are allowed or not. +@SYMTestExpectedResults Enabling and Disabling features return the expected result. +@SYMCR CR0000 +*/ +LOCAL_C void ParserFeatureTestL() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + TCapsContentHandler contentHandler; + + CParser* parser = CParser::NewLC(KParserDataType, contentHandler); + + // Use a non-existing feature + test(parser->EnableFeature(0xFFFFFFFF) == KErrNotSupported); + test(parser->DisableFeature(0xFFFFFFFF) == KErrNotSupported); + + // Enable defined but unsupported features + test(parser->EnableFeature(EErrorOnUnrecognisedTags) == KErrNotSupported); + test(parser->EnableFeature(EReportUnrecognisedTags) == KErrNotSupported); + test(parser->EnableFeature(ESendFullContentInOneChunk) == KErrNotSupported); + test(parser->EnableFeature(ERawContent) == KErrNotSupported); + + // Enable supported features + test(parser->EnableFeature(EReportNamespaces) == KErrNone); + test(parser->EnableFeature(EReportNamespacePrefixes) == KErrNone); + test(parser->EnableFeature(EReportNamespaceMapping) == KErrNone); + test(parser->EnableFeature(EConvertTagsToLowerCase) == KErrNone); + + // Disable mandatory features + test(parser->DisableFeature(EReportNamespacePrefixes)==KErrNotSupported); + test(parser->DisableFeature(EReportNamespaces)==KErrNotSupported); + + // Disable optional features + test(parser->DisableFeature(EReportNamespaceMapping) == KErrNone); + test(parser->DisableFeature(EConvertTagsToLowerCase) == KErrNone); + + // Re-enable optional features needed for test + test(parser->EnableFeature(EConvertTagsToLowerCase | EReportNamespaceMapping) + == KErrNone); + + ParseL(*parser, fs, KCapsTestFile()); + + test(contentHandler.iNumElements == 1); + test(contentHandler.iNumPrefixMappings == 2); + test(contentHandler.iNumPrefixUnmappings == 2); + test(contentHandler.iError == KErrNone); + + TSimpleContentHandler contentHandler2; + + CParser* parser2 = CParser::NewLC(KParserDataType, contentHandler2); + + parser2->EnableFeature(EReportNamespaceMapping); + + ParseL(*parser2, fs, KNamespaceTestFile()); + + test(contentHandler2.iNumElements == 5); + test(contentHandler2.iNumPrefixMappings == 3); + test(contentHandler2.iNumPrefixUnmappings == 3); + test(contentHandler2.iError == KErrNone); + + User::LeaveIfError(parser2->DisableFeature(EReportNamespaceMapping)); + test(!parser2->IsFeatureEnabled(EReportNamespaceMapping)); + + ParseL(*parser2, fs, KNamespaceTestFile()); + + test(contentHandler2.iNumElements == 5); + test(contentHandler2.iNumPrefixMappings == 0); + test(contentHandler2.iNumPrefixUnmappings == 0); + test(contentHandler2.iError == KErrNone); + + CleanupStack::PopAndDestroy(3); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3745 +@SYMTestCaseDesc Checks that two parsers can co-exist without interfering with each other. +@SYMTestPriority Medium +@SYMTestActions Creates 2 content handlers and parsers. Each parser parses a document and checks for errors. +@SYMTestExpectedResults The parsers should not affect each other and no errors should be produced. +@SYMPREQ PREQ230 +*/ +LOCAL_C void TwoParserTestL() + { + TSimpleContentHandler contentHandler1, contentHandler2; + + CParser* parser1 = CParser::NewLC(KParserDataType, contentHandler1); + + CParser* parser2 = CParser::NewLC(KParserDataType, contentHandler2); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + // Parse some of the big test file + ParseL(*parser2, fs, KBigTestFile()); + + // Check we've read what we expect + test(contentHandler1.iNumElements==0); + test(contentHandler1.iError==KErrNone); + + test(contentHandler2.iNumElements==832); + test(contentHandler2.iError==KErrNone); + + ParseL(*parser1, fs, KSimpleTestFile()); + + test(contentHandler1.iNumElements==6); + test(contentHandler1.iError==KErrNone); + + // Stats for big test file shouldn't have changed as RunL was never called + test(contentHandler2.iNumElements==832); + test(contentHandler2.iError==KErrNone); + + CleanupStack::PopAndDestroy(&fs); + + CleanupStack::PopAndDestroy(2); + } + + +// --------------------------------------------------- + + +struct TEndHandler : public MContentHandler + { + // From MContentHandler + void OnStartDocumentL(const RDocumentParameters& , TInt ) {}; + void OnEndDocumentL(TInt) {}; + void OnStartElementL(const RTagInfo& , const RAttributeArray& , TInt ) {}; + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + const TDesC8& localPart8 = aElement.LocalName().DesC(); + const TDesC8& prefix8 = aElement.Prefix().DesC(); + + iOut.Append(_L8("")); + }; + void OnContentL(const TDesC8& , TInt ) {}; + void OnStartPrefixMappingL(const RString& , const RString& , TInt ) {}; + void OnEndPrefixMappingL(const RString& , TInt ) {}; + void OnIgnorableWhiteSpaceL(const TDesC8& , TInt ) {}; + void OnSkippedEntityL(const RString& , TInt ) {}; + void OnProcessingInstructionL(const TDesC8& , const TDesC8& , TInt ) {}; + void OnExtensionL(const RString& , TInt , TInt ) {}; + void OnError(TInt aErrorCode) { iError = aErrorCode; }; + TAny* GetExtendedInterface(const TInt32 ) {return 0;}; + + TBuf8<0x100> iOut; + TInt iError; + }; + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3743 +@SYMTestCaseDesc Testing the Expat parser. +@SYMTestPriority Medium +@SYMTestActions Creating a simple content handler and parser. Parsing strings and checking the return error code what is expected. +@SYMTestExpectedResults The results returned by the content handler should be those that are expected. +@SYMCR CR0000 +*/ +LOCAL_C void ExpatTestL() + { + TSimpleContentHandler handler; + + CParser* parser = CParser::NewLC(KParserDataType, handler); + + // Here the string is truncated because of the NULL. + ParseL(*parser, _L8("\0")); + test(handler.iError==EXmlNoElements); + + handler.iError = KErrNone; + ParseL(*parser, _L8("")); + test(handler.iError==EXmlTagMismatch); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\n")); + test(handler.iError==EXmlMisplacedPi); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\r")); + test(handler.iError==EXmlUnknownEncoding); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\r")); + test(handler.iError==KErrNone); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\rhello")); + test(handler.iError==KErrNone); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\r")); + test(handler.iError==EXmlSyntax); + + handler.iError = KErrNone; + ParseL(*parser, _L8("\n\r")); + test(handler.iError==KErrNone); + + TEndHandler end; + end.iError=KErrNone; + CleanupStack::PopAndDestroy(parser); + parser = CParser::NewLC(KParserDataType, end); + + ParseL(*parser, _L8("")); + test(end.iError==KErrNone); + test(end.iOut==_L8("")); + + CleanupStack::PopAndDestroy(parser); + } + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3744 +@SYMTestCaseDesc Function to convert a test into an OOM test. +@SYMTestPriority Medium +@SYMTestActions Creates a low memory situation and runs the set of tests to make sure the component(s) works in such conditions. +@SYMTestExpectedResults Tests continue to pass, even in low memory conditions. +@SYMPREQ PREQ230 +*/ +LOCAL_C void OomTest(void (*testFuncL)()) + { + TInt error; + TInt count = 0; + + do + { + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++count); + User::__DbgMarkStart(RHeap::EUser); + TRAP(error, (testFuncL)()); + User::__DbgMarkEnd(RHeap::EUser, 0); + } while(error == KErrNoMemory); + + _LIT(KTestFailed, "Out of memory test failure on iteration %d\n"); + __ASSERT_ALWAYS(error==KErrNone, test.Panic(error, KTestFailed, count)); + + User::__DbgSetAllocFail(RHeap::EUser, RHeap::ENone, 1); + } + + +// --------------------------------------------------- + + +// RunTestsL +// MainL +// E32Main +// +// Top-level functions + +LOCAL_C void RunTestsL() + { + test.Title(); + + test.Start(_L("Unziping test xml files")); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + CUnzip* unzip = CUnzip::NewLC(fs, KZipTestFile); + unzip->ExtractL(KXmlTestDir); + CleanupStack::PopAndDestroy(unzip); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3734 Basic XML parsing test ")); + BasicParsingTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3735 DEF056122 descriptors greater than 2048 (Expat internal buffer size) ")); + DEF056122L(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3736 DEF051379 parsing encoded characters ")); + DEF051379L(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1598 INC073797: Stack crashes sometimes in XML parsing in 3.0 platform ")); + INC073797(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3737 Reset mechanism ")); + ResetTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3738 Leave from callback ")); + CallbackLeaveTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3739 Invalid XML handling ")); + InvalidXmlTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3740 Namespace testing ")); + NamespaceTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3741 Skipped entity test ")); + SkippedEntityTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3742 Parser features test ")); + ParserFeatureTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1578 INC073582: SS31 Symbian XML Framework - Symbian SAX Plugin is not returned by default ")); + INC073582L(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3743 ")); + ExpatTestL(); + + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3744 Out-of-Memory testing ")); + OomTest(CallbackLeaveTestL); + OomTest(InvalidXmlTestL); + OomTest(NamespaceTestL); + OomTest(SkippedEntityTestL); + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3745 Two-parser test ")); + TwoParserTestL(); + + + test.Next(_L("Finished.")); + + test.End(); + + test.Close(); + + CleanupStack::PopAndDestroy(&fs); + + REComSession::FinalClose(); + } + + + + +LOCAL_C void Main() + { + TRAPD(err, RunTestsL()); + if (err != KErrNone) + User::Panic(_L("Testing failed: "), err); + } + +TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); + if(!cleanup) + return KErrNoMemory; + + Main(); + + delete cleanup; + __UHEAP_MARKEND; + + return 0; + } diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/t_xmlparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/t_xmlparser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef T_XMLPARSER_H +#define T_XMLPARSER_H + +#include + +#include "contenthandlers.h" + +#endif // TXMLPARSER_H diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/t_xmlparserheap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/t_xmlparserheap.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,223 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This tests the failure of CExpat's internal heap. It is a separate test executable +// because it is statically linked to the xml parser object code and bypasses Ecom +// +// + +#include +#include "contenthandlers.h" +#include "xmlparserplugin.h" + +#include +#include + +using namespace Xml; + +GLDEF_D RTest test(_L("Expat heap test")); // must be called test, as the e32test macros rely on this + + +TPtrC8 KNamespaceTest = + _L8("" + "" + "" + "" + " " + " " + " " + " " + " " + " " + ""); + + +// --------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3746 +@SYMTestCaseDesc Creating OOM conditions and parsing. +@SYMTestPriority Medium +@SYMTestActions In OOM conditions, creating a parser and then parsing chunks. +@SYMTestExpectedResults The parser should behave as expected in the OOM conditions. +@SYMPREQ PREQ230 +*/ +LOCAL_C void ExpatOomTestL() + { + // + // Allocate paraphernalia required for CXmlParserPlugin + // + TSimpleContentHandler contentHandler; + + RElementStack elementStack; + CleanupClosePushL(elementStack); + + CCharSetConverter* charSetConverter = CCharSetConverter::NewL(); + CleanupStack::PushL(charSetConverter); + + RStringDictionaryCollection stringDictionaryCollection; + stringDictionaryCollection.OpenL(); + CleanupClosePushL(stringDictionaryCollection); + + TParserInitParams initParams; + initParams.iCharSetConverter = charSetConverter; + initParams.iContentHandler = &contentHandler; + initParams.iStringDictionaryCollection = &stringDictionaryCollection; + initParams.iElementStack = &elementStack; + + + /* + The following fragment forces the internal heap to fail during parser + construction and checks that this causes no leaks from the user heap + */ + TInt error; + TInt count = 0; + CXmlParserPlugin* parser = 0; + User::__DbgMarkStart(RHeap::EUser); + + do + { + User::__DbgMarkEnd(RHeap::EUser,0); + User::__DbgMarkStart(RHeap::EUser); + count++; + TRAP(error, parser=CXmlParserPlugin::NewL(&initParams, count)) + } while(error==KErrNoMemory); + + CleanupReleasePushL(*parser); + + + /* + Next we parse the namespace test file and cause the heap to heap to fail. + + Using the namespace test file ensures Expat is allocating prefixes and uri + bindings internally. + */ + count = 0; + RHeap* heap = parser->GetInternalHeap(); + heap->__DbgMarkStart(); + + TInt err=KErrNone; + do + { + contentHandler.iError = KErrNone; + + heap->__DbgMarkEnd(0); + heap->__DbgSetAllocFail(RHeap::EFailNext, ++count); + heap->__DbgMarkStart(); + TRAP(err, parser->ParseLastChunkL(KNamespaceTest)); + } while(err==KErrNoMemory); + + test(err==KErrNone); + heap->__DbgMarkEnd(0); + + + /* + Now set the user heap to fail on the next allocation and parse the + document again. This causes the CExpat handler function to leave, + in turn causing the parser to be de-allocated. + + This is in preparation for the next test. + */ + contentHandler.iError = KErrNone; + heap->__DbgSetAllocFail(RHeap::ENone,1); // __RHEAP_RESET + heap->__DbgMarkStart(); + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, 1); + TRAP(err, parser->ParseLastChunkL(KNamespaceTest)); + test(err==KErrNoMemory); + heap->__DbgMarkEnd(0); + + + /* + We have a CExpat in an error state with the internal parser deleted. Now + cause systematic heap failure while attempting to reset the parser and + parse a document. + + This will test reset failure and correct handling in CXmlParserPlugin. + */ + count = 0; + heap->__DbgMarkStart(); + + do + { + heap->__DbgMarkEnd(0); + heap->__DbgSetAllocFail(RHeap::EFailNext, ++count); + heap->__DbgMarkStart(); + parser->EnableFeature(EReportNamespaceMapping); + TRAP(err, parser->ParseLastChunkL(KNamespaceTest)); + + } while(err==KErrNoMemory); + + test(err==KErrNone); + heap->__DbgMarkEnd(0); + + CleanupStack::PopAndDestroy(4); + User::__DbgMarkEnd(RHeap::EUser,0); +} + + +// --------------------------------------------------- +// RunTestL +// MainL +// E32Main +// +// Top-level functions + + +LOCAL_C void RunTestL() + { + test.Start(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3746 Expat parser Out-of-Memory test ")); + +// Ridiculous device to get around MSVC6 linker-compiler plot to rule the world +#ifdef _DEBUG + volatile TInt releaseBuild = 0; +#else + volatile TInt releaseBuild = 1; +#endif + + if(releaseBuild) + test.Printf(_L("This test is not supported in UREL builds\n")); + else + ExpatOomTestL(); + + test.End(); + } + +LOCAL_C void MainL() + { + CleanupClosePushL(test); + + TRAPD(error, RunTestL()); + test(error==KErrNone); + + CleanupStack::PopAndDestroy(&test); + } + +TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); + if(!cleanup) + return KErrNoMemory; + + TRAPD(error, MainL()); + + delete cleanup; + __UHEAP_MARKEND; + + return error; + } diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/unzip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/unzip.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,101 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include "unzip.h" + +CUnzip::CUnzip(RFs& aFs, const TDesC& aFileName) : iZipFile(aFileName), iFs(aFs) + { + } + +CUnzip::~CUnzip() + { + delete iZip; + } + +EXPORT_C CUnzip* CUnzip::NewLC(RFs& aFs, const TDesC& aFileName) + { + CUnzip* self = new(ELeave) CUnzip(aFs, aFileName); + CleanupStack::PushL(self); + self->iZip = CZipFile::NewL(self->iFs, self->iZipFile); + return self; + } + + +EXPORT_C void CUnzip::ExtractL(const TDesC& aOutDir) + { + CZipFileMemberIterator* members = iZip->GetMembersL(); + CleanupStack::PushL(members); + + CZipFileMember* member = members->NextL(); + while (member) + { + CleanupStack::PushL(member); + ExtractFileL(member, aOutDir); + CleanupStack::PopAndDestroy(member); + member = members->NextL(); + } + + CleanupStack::PopAndDestroy(members); + } + + +void CUnzip::ExtractFileL(const CZipFileMember* aMember, const TDesC& aOutDir) + { + HBufC* name = aMember->Name()->AllocLC(); + for (TInt i = 0; iLength(); i++) + { + if ((*name)[i] == '/') + { + name->Des()[i] = '\\'; + } + } + + TFileName outFile; + outFile.Append(aOutDir); + outFile.Append('\\'); + outFile.Append(*name); + + RFile out; + CleanupClosePushL(out); + + iFs.MkDirAll(outFile); + TInt retVal = out.Replace(iFs, outFile, EFileShareAny|EFileWrite); + if(retVal != KErrNone) + { + //Could be a directory name which we are planning to write to. + CleanupStack::PopAndDestroy(2,name); //out, name + out.Close(); + return; + } + + RZipFileMemberReaderStream* fileStream; + TInt error = iZip->GetInputStreamL(aMember, fileStream); + if (error != KErrNone) + { + iFs.Delete(outFile); + User::Leave(error); + } + CleanupStack::PushL(fileStream); + + TUint32 size = aMember->UncompressedSize(); + HBufC8* bytes = HBufC8::New(size); + CleanupStack::PushL(bytes); + TPtr8 ptr = bytes->Des(); + User::LeaveIfError(fileStream->Read(ptr,size)); + User::LeaveIfError(out.Write(ptr)); + CleanupStack::PopAndDestroy(4,name); // bytes, fileStream, out and name + } diff -r 000000000000 -r e35f40988205 xml/xmlexpatparser/test/rtest/tsrc/unzip.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlexpatparser/test/rtest/tsrc/unzip.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef UNZIP_H +#define UNZIP_H + +#include + +class RFs; +class CZipFile; +class CZipFileMember; + +class CUnzip : public CBase + { +public: + IMPORT_C static CUnzip* NewLC(RFs& aFs, const TDesC& aFileName); + virtual ~CUnzip(); + + IMPORT_C void ExtractL(const TDesC& aOutDir); +private: + CUnzip(RFs& aFs, const TDesC& aFileName); + void ExtractFileL(const CZipFileMember* aMember, const TDesC& aOutDir); + TFileName iZipFile; + RFs& iFs; + CZipFile* iZip; + }; + + +#endif // UNZIP_H diff -r 000000000000 -r e35f40988205 xml/xmlfw/bwins/xmlframework2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/bwins/xmlframework2U.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,75 @@ +EXPORTS + ??0RAttribute@Xml@@QAE@XZ @ 1 NONAME ; public: __thiscall Xml::RAttribute::RAttribute(void) + ??0RDocumentParameters@Xml@@QAE@XZ @ 2 NONAME ; public: __thiscall Xml::RDocumentParameters::RDocumentParameters(void) + ??0RStringDictionaryCollection@Xml@@QAE@XZ @ 3 NONAME ; public: __thiscall Xml::RStringDictionaryCollection::RStringDictionaryCollection(void) + ??0RTagInfo@Xml@@QAE@XZ @ 4 NONAME ; public: __thiscall Xml::RTagInfo::RTagInfo(void) + ??1CDictionaryCodePage@Xml@@UAE@XZ @ 5 NONAME ; public: virtual __thiscall Xml::CDictionaryCodePage::~CDictionaryCodePage(void) + ?AddPreloadedDictionaryL@CParser@Xml@@QAEXABVTDesC8@@@Z @ 6 NONAME ; public: void __thiscall Xml::CParser::AddPreloadedDictionaryL(class TDesC8 const &) + ?Attribute@RAttribute@Xml@@QBEABVRTagInfo@2@XZ @ 7 NONAME ; public: class Xml::RTagInfo const & __thiscall Xml::RAttribute::Attribute(void)const + ?CharacterSetName@RDocumentParameters@Xml@@QBEABVRString@@XZ @ 8 NONAME ; public: class RString const & __thiscall Xml::RDocumentParameters::CharacterSetName(void)const + ?Close@RAttribute@Xml@@QAEXXZ @ 9 NONAME ; public: void __thiscall Xml::RAttribute::Close(void) + ?Close@RDocumentParameters@Xml@@QAEXXZ @ 10 NONAME ; public: void __thiscall Xml::RDocumentParameters::Close(void) + ?Close@RStringDictionaryCollection@Xml@@QAEXXZ @ 11 NONAME ; public: void __thiscall Xml::RStringDictionaryCollection::Close(void) + ?Close@RTagInfo@Xml@@QAEXXZ @ 12 NONAME ; public: void __thiscall Xml::RTagInfo::Close(void) + ?CodePage@CDictionaryCodePage@Xml@@QBEEXZ @ 13 NONAME ; public: unsigned char __thiscall Xml::CDictionaryCodePage::CodePage(void)const + ?ConstructIndexMappingL@CDictionaryCodePage@Xml@@QAEXPBHW4TStringType@12@@Z @ 14 NONAME ; public: void __thiscall Xml::CDictionaryCodePage::ConstructIndexMappingL(int const *,enum Xml::CDictionaryCodePage::TStringType) + ?ConvertCharacterSetIdentifierToStandardNameL@CCharSetConverter@Xml@@QAEXKAAPAVHBufC8@@@Z @ 15 NONAME ; public: void __thiscall Xml::CCharSetConverter::ConvertCharacterSetIdentifierToStandardNameL(unsigned long,class HBufC8 * &) + ?ConvertFromUnicodeL@CCharSetConverter@Xml@@QAEHABVTDesC16@@KAAPAVHBufC8@@@Z @ 16 NONAME ; public: int __thiscall Xml::CCharSetConverter::ConvertFromUnicodeL(class TDesC16 const &,unsigned long,class HBufC8 * &) + ?ConvertToUnicodeL@CCharSetConverter@Xml@@QAEHKABVTDesC8@@AAPAVHBufC16@@@Z @ 17 NONAME ; public: int __thiscall Xml::CCharSetConverter::ConvertToUnicodeL(unsigned long,class TDesC8 const &,class HBufC16 * &) + ?ConvertUcs4CharactersToEncodingL@CCharSetConverter@Xml@@QAEHPAKHKAAPAVHBufC8@@@Z @ 18 NONAME ; public: int __thiscall Xml::CCharSetConverter::ConvertUcs4CharactersToEncodingL(unsigned long *,int,unsigned long,class HBufC8 * &) + ?Copy@RAttribute@Xml@@QAE?AV12@XZ @ 19 NONAME ; public: class Xml::RAttribute __thiscall Xml::RAttribute::Copy(void) + ?Copy@RTagInfo@Xml@@QAE?AV12@XZ @ 20 NONAME ; public: class Xml::RTagInfo __thiscall Xml::RTagInfo::Copy(void) + ?CurrentDictionaryL@RStringDictionaryCollection@Xml@@QBEAAVMStringDictionary@2@XZ @ 21 NONAME ; public: class Xml::MStringDictionary & __thiscall Xml::RStringDictionaryCollection::CurrentDictionaryL(void)const + ?DisableFeature@CParser@Xml@@QAEHH@Z @ 22 NONAME ; public: int __thiscall Xml::CParser::DisableFeature(int) + ?EnableFeature@CParser@Xml@@QAEHH@Z @ 23 NONAME ; public: int __thiscall Xml::CParser::EnableFeature(int) + ?IsFeatureEnabled@CParser@Xml@@QBEHH@Z @ 24 NONAME ; public: int __thiscall Xml::CParser::IsFeatureEnabled(int)const + ?LocalName@RTagInfo@Xml@@QBEABVRString@@XZ @ 25 NONAME ; public: class RString const & __thiscall Xml::RTagInfo::LocalName(void)const + ?NewL@CDictionaryCodePage@Xml@@SAPAV12@PBUTStringTable@@00E@Z @ 26 NONAME ; public: static class Xml::CDictionaryCodePage * __cdecl Xml::CDictionaryCodePage::NewL(struct TStringTable const *,struct TStringTable const *,struct TStringTable const *,unsigned char) + ?NewL@CParser@Xml@@SAPAV12@ABVTDesC8@@AAVMContentHandler@2@@Z @ 27 NONAME ; public: static class Xml::CParser * __cdecl Xml::CParser::NewL(class TDesC8 const &,class Xml::MContentHandler &) + ?NewLC@CParser@Xml@@SAPAV12@ABVTDesC8@@AAVMContentHandler@2@@Z @ 28 NONAME ; public: static class Xml::CParser * __cdecl Xml::CParser::NewLC(class TDesC8 const &,class Xml::MContentHandler &) + ?Open@RAttribute@Xml@@QAEXABVRString@@000W4TAttributeType@2@@Z @ 29 NONAME ; public: void __thiscall Xml::RAttribute::Open(class RString const &,class RString const &,class RString const &,class RString const &,enum Xml::TAttributeType) + ?Open@RAttribute@Xml@@QAEXABVRString@@00W4TAttributeType@2@@Z @ 30 NONAME ; public: void __thiscall Xml::RAttribute::Open(class RString const &,class RString const &,class RString const &,enum Xml::TAttributeType) + ?Open@RDocumentParameters@Xml@@QAEXABVRString@@@Z @ 31 NONAME ; public: void __thiscall Xml::RDocumentParameters::Open(class RString const &) + ?Open@RTagInfo@Xml@@QAEXABVRString@@00@Z @ 32 NONAME ; public: void __thiscall Xml::RTagInfo::Open(class RString const &,class RString const &,class RString const &) + ?OpenDictionaryL@RStringDictionaryCollection@Xml@@QAEXABVTDesC8@@@Z @ 33 NONAME ; public: void __thiscall Xml::RStringDictionaryCollection::OpenDictionaryL(class TDesC8 const &) + ?OpenL@RStringDictionaryCollection@Xml@@QAEXXZ @ 34 NONAME ; public: void __thiscall Xml::RStringDictionaryCollection::OpenL(void) + ?ParseEndL@CParser@Xml@@QAEXXZ @ 35 NONAME ; public: void __thiscall Xml::CParser::ParseEndL(void) + ?ParseL@CParser@Xml@@QAEXABVTDesC8@@@Z @ 36 NONAME ; public: void __thiscall Xml::CParser::ParseL(class TDesC8 const &) + ?ParseL@Xml@@YAXAAVCParser@1@AAVRFs@@ABVTDesC16@@@Z @ 37 NONAME ; void __cdecl Xml::ParseL(class Xml::CParser &,class RFs &,class TDesC16 const &) + ?ParseL@Xml@@YAXAAVCParser@1@ABVTDesC8@@@Z @ 38 NONAME ; void __cdecl Xml::ParseL(class Xml::CParser &,class TDesC8 const &) + ?Prefix@RTagInfo@Xml@@QBEABVRString@@XZ @ 39 NONAME ; public: class RString const & __thiscall Xml::RTagInfo::Prefix(void)const + ?PrepareCharConvL@CCharSetConverter@Xml@@QAEXAAIABVTDesC8@@@Z @ 40 NONAME ; public: void __thiscall Xml::CCharSetConverter::PrepareCharConvL(unsigned int &,class TDesC8 const &) + ?PrepareCharConvL@CCharSetConverter@Xml@@QAEXAAIH@Z @ 41 NONAME ; public: void __thiscall Xml::CCharSetConverter::PrepareCharConvL(unsigned int &,int) + ?PrepareToConvertToOrFromL@CCharSetConverter@Xml@@QAEXK@Z @ 42 NONAME ; public: void __thiscall Xml::CCharSetConverter::PrepareToConvertToOrFromL(unsigned long) + ?SetProcessorChainL@CParser@Xml@@QAEXABV?$RArray@VTUid@@@@@Z @ 43 NONAME ; public: void __thiscall Xml::CParser::SetProcessorChainL(class RArray const &) + ?SetValue@RAttribute@Xml@@QAEXABVRString@@@Z @ 44 NONAME ; public: void __thiscall Xml::RAttribute::SetValue(class RString const &) + ?StringDictionaryCollection@CParser@Xml@@QAEAAVRStringDictionaryCollection@2@XZ @ 45 NONAME ; public: class Xml::RStringDictionaryCollection & __thiscall Xml::CParser::StringDictionaryCollection(void) + ?StringPool@CParser@Xml@@QAEAAVRStringPool@@XZ @ 46 NONAME ; public: class RStringPool & __thiscall Xml::CParser::StringPool(void) + ?StringPool@RStringDictionaryCollection@Xml@@QAEAAVRStringPool@@XZ @ 47 NONAME ; public: class RStringPool & __thiscall Xml::RStringDictionaryCollection::StringPool(void) + ?StringPoolIndexFromToken@CDictionaryCodePage@Xml@@QBEHHW4TStringType@12@@Z @ 48 NONAME ; public: int __thiscall Xml::CDictionaryCodePage::StringPoolIndexFromToken(int,enum Xml::CDictionaryCodePage::TStringType)const + ?StringTable@CDictionaryCodePage@Xml@@QBEPBUTStringTable@@W4TStringType@12@@Z @ 49 NONAME ; public: struct TStringTable const * __thiscall Xml::CDictionaryCodePage::StringTable(enum Xml::CDictionaryCodePage::TStringType)const + ?TokenFromStringPoolIndex@CDictionaryCodePage@Xml@@QBEHHW4TStringType@12@@Z @ 50 NONAME ; public: int __thiscall Xml::CDictionaryCodePage::TokenFromStringPoolIndex(int,enum Xml::CDictionaryCodePage::TStringType)const + ?Type@RAttribute@Xml@@QBE?AW4TAttributeType@2@XZ @ 51 NONAME ; public: enum Xml::TAttributeType __thiscall Xml::RAttribute::Type(void)const + ?Uri@RTagInfo@Xml@@QBEABVRString@@XZ @ 52 NONAME ; public: class RString const & __thiscall Xml::RTagInfo::Uri(void)const + ?Value@RAttribute@Xml@@QBEABVRString@@XZ @ 53 NONAME ; public: class RString const & __thiscall Xml::RAttribute::Value(void)const + ?ParseBeginL@CParser@Xml@@QAEXABVTDesC8@@@Z @ 54 NONAME ; public: void __thiscall Xml::CParser::ParseBeginL(class TDesC8 const &) + ?ParseBeginL@CParser@Xml@@QAEXXZ @ 55 NONAME ; public: void __thiscall Xml::CParser::ParseBeginL(void) + ?ParseL@Xml@@YAXAAVCParser@1@AAVRFile@@@Z @ 56 NONAME ; void Xml::ParseL(class Xml::CParser &, class RFile &) + ?MimeType@CMatchData@Xml@@QBE?BVTPtrC8@@XZ @ 57 NONAME ; class TPtrC8 const Xml::CMatchData::MimeType(void) const + ?NewL@CMatchData@Xml@@SAPAV12@ABVTDesC8@@@Z @ 58 NONAME ; class Xml::CMatchData * Xml::CMatchData::NewL(class TDesC8 const &) + ?NewL@CMatchData@Xml@@SAPAV12@XZ @ 59 NONAME ; class Xml::CMatchData * Xml::CMatchData::NewL(void) + ?NewL@CParser@Xml@@SAPAV12@ABVCMatchData@2@AAVMContentHandler@2@@Z @ 60 NONAME ; class Xml::CParser * Xml::CParser::NewL(class Xml::CMatchData const &, class Xml::MContentHandler &) + ?NewLC@CMatchData@Xml@@SAPAV12@ABVTDesC8@@@Z @ 61 NONAME ; class Xml::CMatchData * Xml::CMatchData::NewLC(class TDesC8 const &) + ?NewLC@CMatchData@Xml@@SAPAV12@XZ @ 62 NONAME ; class Xml::CMatchData * Xml::CMatchData::NewLC(void) + ?NewLC@CParser@Xml@@SAPAV12@ABVCMatchData@2@AAVMContentHandler@2@@Z @ 63 NONAME ; class Xml::CParser * Xml::CParser::NewLC(class Xml::CMatchData const &, class Xml::MContentHandler &) + ?ParseBeginL@CParser@Xml@@QAEXABVCMatchData@2@@Z @ 64 NONAME ; void Xml::CParser::ParseBeginL(class Xml::CMatchData const &) + ?ResolveL@CMatchData@Xml@@QBE?AVTUid@@AAV?$RArray@PAVCImplementationInformation@@@@@Z @ 65 NONAME ; class TUid Xml::CMatchData::ResolveL(class RArray &) const + ?SetCaseSensitivity@CMatchData@Xml@@QAEXH@Z @ 66 NONAME ; void Xml::CMatchData::SetCaseSensitivity(int) + ?SetLeaveOnMany@CMatchData@Xml@@QAEXH@Z @ 67 NONAME ; void Xml::CMatchData::SetLeaveOnMany(int) + ?SetMimeTypeL@CMatchData@Xml@@QAEXABVTDesC8@@@Z @ 68 NONAME ; void Xml::CMatchData::SetMimeTypeL(class TDesC8 const &) + ?SetRomOnly@CMatchData@Xml@@QAEXH@Z @ 69 NONAME ; void Xml::CMatchData::SetRomOnly(int) + ?SetVariantL@CMatchData@Xml@@QAEXABVTDesC8@@@Z @ 70 NONAME ; void Xml::CMatchData::SetVariantL(class TDesC8 const &) + ?Variant@CMatchData@Xml@@QBE?BVTPtrC8@@XZ @ 71 NONAME ; class TPtrC8 const Xml::CMatchData::Variant(void) const + ?ConvertFromUnicodeL@CCharSetConverter@Xml@@QAEHABVTDesC16@@KAAVTPtr8@@@Z @ 72 NONAME ; int Xml::CCharSetConverter::ConvertFromUnicodeL(class TDesC16 const &, unsigned long, class TPtr8 &) + ?ConvertToUnicodeL@CCharSetConverter@Xml@@QAEHKABVTDesC8@@AAVTPtr16@@@Z @ 73 NONAME ; int Xml::CCharSetConverter::ConvertToUnicodeL(unsigned long, class TDesC8 const &, class TPtr16 &) + diff -r 000000000000 -r e35f40988205 xml/xmlfw/documentation/XmlFramework.mdl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/documentation/XmlFramework.mdl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14816 @@ + +(object Petal + version 43 + _written "Rose 6.5.9232.10" + charSet 0) + +(object Design "Logical View" + is_unit TRUE + is_loaded TRUE + attributes (list Attribute_Set + (object Attribute + tool "Java" + name "IDE" + value "Internal Editor")) + quid "3C4D37270108" + defaults (object defaults + rightMargin 0.250000 + leftMargin 0.500000 + topMargin 0.250000 + bottomMargin 0.250000 + pageOverlap 1.000000 + clipIconLabels TRUE + autoResize TRUE + snapToGrid TRUE + gridX 16 + gridY 16 + defaultFont (object Font + size 16 + face "Arial" + bold FALSE + italics FALSE + underline FALSE + strike FALSE + color 0 + default_color TRUE) + showMessageNum 1 + showClassOfObject TRUE + notation "Unified") + root_usecase_package (object Class_Category "Use Case View" + quid "3C4D3727010A" + exportControl "Public" + global TRUE + logical_models (list unit_reference_list + (object Class "Client" + quid "3C67C4C3035C" + stereotype "Actor" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830E86018C" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E307009E" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4"))) + (object UseCase "Parser" + quid "3C67C4D103CA") + (object UseCase "Generator" + quid "3C67C4DA02E7") + (object Association "$UNNAMED$0" + quid "3C67C4E801A6" + roles (list role_list + (object Role "$UNNAMED$1" + quid "3C67C4EA0037" + supplier "Use Case View::Parser" + quidu "3C67C4D103CA" + is_navigable TRUE) + (object Role "$UNNAMED$2" + quid "3C67C4EA0038" + supplier "Use Case View::Client" + quidu "3C67C4C3035C"))) + (object Association "$UNNAMED$3" + quid "3C67C4EC00D0" + roles (list role_list + (object Role "$UNNAMED$4" + quid "3C67C4ED0199" + supplier "Use Case View::Generator" + quidu "3C67C4DA02E7" + is_navigable TRUE) + (object Role "$UNNAMED$5" + quid "3C67C4ED019A" + supplier "Use Case View::Client" + quidu "3C67C4C3035C")))) + logical_presentations (list unit_reference_list + (object UseCaseDiagram "Main" + quid "3C4D372C0106" + title "Main" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object UseCaseView "Use Case View::Parser" @1 + location (704, 432) + label (object ItemLabel + Parent_View @1 + location (704, 570) + anchor_loc 1 + nlines 2 + max_width 630 + justify 0 + label "Parser") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C67C4D103CA" + height 118) + (object UseCaseView "Use Case View::Generator" @2 + location (704, 1040) + label (object ItemLabel + Parent_View @2 + location (704, 1178) + anchor_loc 1 + nlines 2 + max_width 630 + justify 0 + label "Generator") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C67C4DA02E7" + height 118) + (object ClassView "Class" "Use Case View::Client" @3 + ShowCompartmentStereotypes TRUE + location (272, 432) + label (object ItemLabel + Parent_View @3 + location (272, 592) + anchor_loc 1 + nlines 2 + max_width 327 + justify 0 + label "Client") + icon "Actor" + icon_style "Icon" + line_color 3342489 + quidu "3C67C4C3035C" + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$0" @4 + location (461, 432) + stereotype TRUE + line_color 3342489 + quidu "3C67C4E801A6" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$1" @5 + Parent_View @4 + location (189, 0) + stereotype TRUE + line_color 3342489 + quidu "3C67C4EA0037" + client @4 + supplier @1 + line_style 0) + (object RoleView "$UNNAMED$2" @6 + Parent_View @4 + location (189, 0) + stereotype TRUE + line_color 3342489 + quidu "3C67C4EA0038" + client @4 + supplier @3 + line_style 0))) + (object AssociationViewNew "$UNNAMED$3" @7 + location (494, 746) + stereotype TRUE + line_color 3342489 + quidu "3C67C4EC00D0" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$4" @8 + Parent_View @7 + location (222, 314) + stereotype TRUE + line_color 3342489 + quidu "3C67C4ED0199" + client @7 + supplier @2 + line_style 0) + (object RoleView "$UNNAMED$5" @9 + Parent_View @7 + location (222, 314) + stereotype TRUE + line_color 3342489 + quidu "3C67C4ED019A" + client @7 + supplier @3 + line_style 0))))))) + root_category (object Class_Category "Logical View" + quid "3C4D37270109" + exportControl "Public" + global TRUE + subsystem "Component View" + quidu "3C4D3727010B" + logical_models (list unit_reference_list + (object Class "CXmlParser" + quid "3C4D37890087" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830B370094" + supplier "Logical View::MParser" + quidu "3D830A9C0344")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E3B40283" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Class "CWbxmlParser" + quid "3C4D379A01C1" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830B3B0271" + supplier "Logical View::MParser" + quidu "3D830A9C0344") + (object Inheritance_Relationship + quid "3F2FF24A02E4" + supplier "Logical View::CActive" + quidu "3D830E9B00C4")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E3B101B8" + supplier "Logical View::MParser" + quidu "3D830A9C0344") + (object Realize_Relationship + quid "421B0E39035D" + supplier "Logical View::MWbxmlExtensionHandler" + quidu "3F61B05C0050"))) + (object Class "MContentHandler" + quid "3C4D3A5D02F4" + stereotype "Interface" + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E2F000CD" + supplier "Use Case View::Client" + quidu "3C67C4C3035C")) + operations (list Operations + (object Operation "OnStartDocumentL" + quid "3F2A65FE001F" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnEndDocumentL" + quid "3F2A6608032D" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnStartElementL" + quid "3F2A661300EB" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnEndElementL" + quid "3F2A6619037B" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnContentL" + quid "3F2A662301C5" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnStartPrefixMappingL" + quid "3F2A662903AA" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnEndPrefixMappingL" + quid "3F2A6632035C" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnIgnorableWhiteSpaceL" + quid "3F2A663A0010" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnSkippedEntityL" + quid "3F2A66400262" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnProcessingInstructionL" + quid "3F2A66490196" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnOutOfData" + quid "3F2A6659007D" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "OnError" + quid "3F2A66600196" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "GetExtendedInterfaceL" + quid "3F61B0CC0179" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "CXmlGenerator" + quid "3C4E8DAF0125" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830BC8018D" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E386013B" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4"))) + (object Class "CWbxmlGenerator" + quid "3C4E8DB90101" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830BCB0105" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4") + (object Inheritance_Relationship + quid "3F61B28200CD" + supplier "Logical View::MWbxmlExtensionHandler" + quidu "3F61B05C0050")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E384007F" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4"))) + (object Class "RAttribute" + quid "3C4EA0AA00D2") + (object Class "MStringDictionary" + quid "3C4EC591028F" + documentation +|Container class to hold all the details of a namespace. +| + + stereotype "Interface") + (object Class "RAttributeArray" + quid "3C596B75009E") + (object Class "CValidator" + quid "3C5ACAC701D9" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830DE00057" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E36B03BB" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF") + (object Realize_Relationship + quid "3F61E635039C" + supplier "Logical View::MWbxmlExtensionHandler" + quidu "3F61B05C0050"))) + (object Class "MDataSource" + quid "3C67ADA80234" + stereotype "Interface" + operations (list Operations + (object Operation "GetByteL" + quid "3F2A67BE001F" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "GetBytesL" + quid "3F2A67C5010A" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "GetBytesL" + quid "3F2A67CC0252" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "StartTransactionL" + quid "3F2A67D500FA" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "EndTransactionL" + quid "3F2A67DB0196" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "RollbackL" + quid "3F2A67E20187" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "RollbackPositionL" + quid "3F2A67E9039A" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "Eof" + quid "3F2A67F301E5" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "CAutoCorrector" + quid "3C6B836E0190" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830DE3000C" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E372035D" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF"))) + (object Class "RParser" + quid "3D83093B0288" + operations (list Operations + (object Operation "OpenL" + quid "3D9AE9E10319" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "ElementStack" + quid "3F30DA3602F4" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "Start" + quid "3F30FB9F02A6" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "Stop" + quid "3F30FBA40092" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "SetParseMode" + quid "3F310FA70035" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "iDtorList" + quid "3F2E885C010F") + (object ClassAttribute "iPluginPtrList" + quid "3F2E8865013E") + (object ClassAttribute "iElementStack" + quid "3F30DA4200D1"))) + (object Class "RGenerator" + quid "3D8309470394" + operations (list Operations + (object Operation "OpenL" + quid "3D9AEC2A0053" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "BuildStartElementL" + quid "3D9AED9A0265" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "BuildContentL" + quid "3D9AEE2A0009" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "BuildEndElementL" + quid "3D9AEF2B00B3" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "BuildEndDocumentL" + quid "3D9AEF7E006C" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "iElementStack" + quid "3F2E880D0313"))) + (object Class "MParser" + quid "3D830A9C0344" + stereotype "Interface" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3F2A5CD503D9" + supplier "Logical View::MMarkupRoot" + quidu "3F2A5BB301C5") + (object Inheritance_Relationship + quid "3F2A60170129" + supplier "Logical View::CActive" + quidu "3D830E9B00C4") + (object Inheritance_Relationship + quid "4219F8F703BA" + supplier "Logical View::MContentSource" + quidu "4219F8180290")) + operations (list Operations + (object Operation "SetParseMode" + quid "3F310FB102E4" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "Release" + quid "3F38D4E6001F" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "MGenerator" + quid "3D830AB602D4" + stereotype "Interface" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3F17DCB900AB" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4") + (object Inheritance_Relationship + quid "3F2A5CD801B6" + supplier "Logical View::MMarkupRoot" + quidu "3F2A5BB301C5") + (object Inheritance_Relationship + quid "3F2A601E009C" + supplier "Logical View::CActive" + quidu "3D830E9B00C4")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E34D03BB" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4")) + operations (list Operations + (object Operation "Build..." + quid "3F2FF2B20323" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "SetWriter" + quid "3F30C3F401CB" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "Release" + quid "3F38D4BC03B9" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "MContentProcessor" + quid "3D830D2903CF" + stereotype "Interface" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D830D6F0358" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4") + (object Inheritance_Relationship + quid "3F2A60620129" + supplier "Logical View::CActive" + quidu "3D830E9B00C4") + (object Inheritance_Relationship + quid "4219F8F400EB" + supplier "Logical View::MContentSource" + quidu "4219F8180290")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E3380041" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4")) + operations (list Operations + (object Operation "Release" + quid "3F2E871E0380" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "CActive" + quid "3D830E9B00C4" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3F2A5EC30196" + supplier "Logical View::CBase" + quidu "3F2A5EB902CF"))) + (object Class "MDataSink" + quid "3D8310F9036F" + stereotype "Interface" + operations (list Operations + (object Operation "PutByteL" + quid "3F2A6807031D" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "PutBytesL" + quid "3F2A680D0213" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "CDescriptorDataSupplier" + quid "3D8311AB0108" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D8311FF01B3" + supplier "Logical View::MDataSource" + quidu "3C67ADA80234") + (object Inheritance_Relationship + quid "3D83120200A9" + supplier "Logical View::MDataSink" + quidu "3D8310F9036F")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E4290206" + supplier "Logical View::MDataSource" + quidu "3C67ADA80234") + (object Realize_Relationship + quid "3F61E42C012B" + supplier "Logical View::MDataSink" + quidu "3D8310F9036F"))) + (object Class "RStringDictionaryCollection" + quid "3D84681B018F" + documentation "Contains a collection of namespace tables . This class exposes an API to find a particular namespace given its code page or namespace.") + (object Class "CStringDictionary" + quid "3D98118601D2" + stereotype "ECOM" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "3D98119A0018" + supplier "Logical View::MStringDictionary" + quidu "3C4EC591028F")) + realized_interfaces (list realize_rel_list + (object Realize_Relationship + quid "3F61E5870189" + supplier "Logical View::MStringDictionary" + quidu "3C4EC591028F"))) + (object Class "RDictionaryCodePage" + quid "3D9820B00260") + (object Class "RElementStack" + quid "3D9827CB0143") + (object Class "CCharSetConverter" + quid "3D9ACDCF01D6") + (object Class "MMarkupRoot" + quid "3F2A5BB301C5" + stereotype "Interface") + (object Class "CBase" + quid "3F2A5EB902CF") + (object Class "TParseMode" + quid "3F31085F0219") + (object Class "TStandalone" + quid "3F31164103AF") + (object Class "RDocumentParameters" + quid "3F311673017D") + (object Class "TParserInitParams" + quid "3F31175B03A0") + (object Class "TContentProcessorInitParams" + quid "3F31176700A2") + (object Class "RDtorStringDictionaryPtrMapping" + quid "3F32646800C1") + (object Class "RDtorContentProcessorPtrMapping" + quid "3F33A6F9017D") + (object Class "MWbxmlExtensionHandler" + quid "3F61B05C0050" + stereotype "Interface" + operations (list Operations + (object Operation "OnExtensionL" + quid "3F61B0AA0300" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Class "MContentSource" + quid "4219F8180290" + stereotype "Interface" + operations (list Operations + (object Operation "SetContentSink" + quid "4219F84C031D" + concurrency "Sequential" + opExportControl "Public" + uid 0))) + (object Association "$UNNAMED$6" + quid "3C596D4A0392" + roles (list role_list + (object Role "$UNNAMED$7" + quid "3C596D4B0130" + supplier "Logical View::RAttribute" + quidu "3C4EA0AA00D2" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$8" + quid "3C596D4B0131" + supplier "Logical View::RAttributeArray" + quidu "3C596B75009E" + is_aggregate TRUE))) + (object Association "$UNNAMED$9" + quid "3D8310F4033F" + roles (list role_list + (object Role "$UNNAMED$10" + quid "3D8310F502A1" + supplier "Logical View::MDataSource" + quidu "3C67ADA80234" + is_navigable TRUE) + (object Role "$UNNAMED$11" + quid "3D8310F502AB" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Association "$UNNAMED$12" + quid "3D831135036B" + roles (list role_list + (object Role "$UNNAMED$13" + quid "3D8311360128" + supplier "Logical View::MDataSink" + quidu "3D8310F9036F" + is_navigable TRUE) + (object Role "$UNNAMED$14" + quid "3D8311360132" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4"))) + (object Association "$UNNAMED$15" + quid "3D8465900156" + roles (list role_list + (object Role "$UNNAMED$16" + quid "3D8465910017" + supplier "Logical View::MParser" + quidu "3D830A9C0344" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$17" + quid "3D8465910021" + supplier "Logical View::RParser" + quidu "3D83093B0288" + is_aggregate TRUE))) + (object Association "$UNNAMED$18" + quid "3D84659C00FA" + roles (list role_list + (object Role "$UNNAMED$19" + quid "3D84659D000B" + supplier "Logical View::MGenerator" + quidu "3D830AB602D4" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$20" + quid "3D84659D000D" + supplier "Logical View::RGenerator" + quidu "3D8309470394" + is_aggregate TRUE))) + (object Association "$UNNAMED$21" + quid "3D84683F003C" + roles (list role_list + (object Role "$UNNAMED$22" + quid "3D84683F01F5" + supplier "Logical View::MStringDictionary" + quidu "3C4EC591028F" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$23" + quid "3D84683F01F7" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + Containment "By Value" + is_aggregate TRUE))) + (object Association "$UNNAMED$24" + quid "3D846BA40172" + roles (list role_list + (object Role "$UNNAMED$25" + quid "3D846BA500DD" + supplier "Logical View::CDescriptorDataSupplier" + quidu "3D8311AB0108" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$26" + quid "3D846BA500DF" + supplier "Use Case View::Client" + quidu "3C67C4C3035C" + is_aggregate TRUE))) + (object Association "$UNNAMED$27" + quid "3D846DD101B9" + roles (list role_list + (object Role "$UNNAMED$28" + quid "3D846DD103C2" + supplier "Logical View::RParser" + quidu "3D83093B0288" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$29" + quid "3D846DD103C4" + supplier "Use Case View::Client" + quidu "3C67C4C3035C" + is_aggregate TRUE))) + (object Association "$UNNAMED$30" + quid "3D846DD30338" + roles (list role_list + (object Role "$UNNAMED$31" + quid "3D846DD4034E" + supplier "Logical View::RGenerator" + quidu "3D8309470394" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$32" + quid "3D846DD40350" + supplier "Use Case View::Client" + quidu "3C67C4C3035C" + is_aggregate TRUE))) + (object Association "$UNNAMED$33" + quid "3D8F25600346" + roles (list role_list + (object Role "$UNNAMED$34" + quid "3D8F2561015C" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_navigable TRUE) + (object Role "$UNNAMED$35" + quid "3D8F25610170" + supplier "Use Case View::Client" + quidu "3C67C4C3035C"))) + (object Association "$UNNAMED$36" + quid "3D9820E402C9" + roles (list role_list + (object Role "$UNNAMED$37" + quid "3D9820E502B6" + supplier "Logical View::RDictionaryCodePage" + quidu "3D9820B00260" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$38" + quid "3D9820E502B7" + supplier "Logical View::CStringDictionary" + quidu "3D98118601D2" + is_aggregate TRUE))) + (object Association "$UNNAMED$39" + quid "3D9ACE4D0349" + roles (list role_list + (object Role "$UNNAMED$40" + quid "3D9ACE4E00F2" + supplier "Logical View::CCharSetConverter" + quidu "3D9ACDCF01D6" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$41" + quid "3D9ACE4E00F4" + supplier "Logical View::RParser" + quidu "3D83093B0288" + is_aggregate TRUE))) + (object Association "$UNNAMED$42" + quid "3D9ACE500177" + roles (list role_list + (object Role "$UNNAMED$43" + quid "3D9ACE5003A8" + supplier "Logical View::CCharSetConverter" + quidu "3D9ACDCF01D6" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$44" + quid "3D9ACE5003AA" + supplier "Logical View::RGenerator" + quidu "3D8309470394" + is_aggregate TRUE))) + (object Association "$UNNAMED$45" + quid "3D9ACEC90058" + roles (list role_list + (object Role "$UNNAMED$46" + quid "3D9ACECA03CB" + supplier "Logical View::CCharSetConverter" + quidu "3D9ACDCF01D6" + is_navigable TRUE) + (object Role "$UNNAMED$47" + quid "3D9ACECA03D5" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Association "$UNNAMED$48" + quid "3F2FF1DA019C" + roles (list role_list + (object Role "$UNNAMED$49" + quid "3F2FF1DB00A2" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_navigable TRUE) + (object Role "$UNNAMED$50" + quid "3F2FF1DB00A3" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Association "$UNNAMED$51" + quid "3F2FF1F20064" + roles (list role_list + (object Role "$UNNAMED$52" + quid "3F2FF1F301DB" + supplier "Logical View::RElementStack" + quidu "3D9827CB0143" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$53" + quid "3F2FF1F301DC" + supplier "Logical View::RParser" + quidu "3D83093B0288" + Containment "By Value" + is_aggregate TRUE))) + (object Association "$UNNAMED$54" + quid "3F2FF2730015" + roles (list role_list + (object Role "$UNNAMED$55" + quid "3F2FF2740323" + supplier "Logical View::RAttributeArray" + quidu "3C596B75009E" + is_navigable TRUE) + (object Role "$UNNAMED$56" + quid "3F2FF2740324" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4"))) + (object Association "$UNNAMED$57" + quid "3F30F919010F" + roles (list role_list + (object Role "$UNNAMED$58" + quid "3F30F91A01BB" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_navigable TRUE) + (object Role "$UNNAMED$59" + quid "3F30F91A01BC" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF"))) + (object Association "$UNNAMED$60" + quid "3F30F92701DB" + roles (list role_list + (object Role "$UNNAMED$61" + quid "3F30F929013E" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4" + is_navigable TRUE) + (object Role "child" + quid "3F30F929013F" + label "child" + supplier "Logical View::MContentProcessor" + quidu "3D830D2903CF"))) + (object Association "$UNNAMED$62" + quid "3F30F97E0352" + roles (list role_list + (object Role "$UNNAMED$63" + quid "3F30F97F00B2" + supplier "Logical View::RElementStack" + quidu "3D9827CB0143" + is_navigable TRUE) + (object Role "$UNNAMED$64" + quid "3F30F97F00B3" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Association "$UNNAMED$65" + quid "3F30F9910015" + roles (list role_list + (object Role "$UNNAMED$66" + quid "3F30F9910303" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4" + is_navigable TRUE) + (object Role "child" + quid "3F30F9910304" + label "child" + supplier "Logical View::MParser" + quidu "3D830A9C0344"))) + (object Association "$UNNAMED$67" + quid "3F31088501AC" + roles (list role_list + (object Role "$UNNAMED$68" + quid "3F3108850303" + supplier "Logical View::TParseMode" + quidu "3F31085F0219" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$69" + quid "3F3108850313" + supplier "Logical View::MParser" + quidu "3D830A9C0344" + is_aggregate TRUE))) + (object Association "$UNNAMED$70" + quid "3F31089703A0" + roles (list role_list + (object Role "$UNNAMED$71" + quid "3F310898014E" + supplier "Logical View::TParseMode" + quidu "3F31085F0219" + is_navigable TRUE) + (object Role "$UNNAMED$72" + quid "3F310898014F" + supplier "Logical View::RParser" + quidu "3D83093B0288"))) + (object Association "$UNNAMED$73" + quid "3F31164C011F" + roles (list role_list + (object Role "$UNNAMED$74" + quid "3F31164C02F4" + supplier "Logical View::TStandalone" + quidu "3F31164103AF" + is_navigable TRUE) + (object Role "$UNNAMED$75" + quid "3F31164C02F5" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4"))) + (object Association "$UNNAMED$76" + quid "3F31167802E4" + roles (list role_list + (object Role "$UNNAMED$77" + quid "3F3116790044" + supplier "Logical View::RDocumentParameters" + quidu "3F311673017D" + is_navigable TRUE) + (object Role "$UNNAMED$78" + quid "3F3116790045" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4"))) + (object Association "$UNNAMED$79" + quid "3F31179903AF" + roles (list role_list + (object Role "$UNNAMED$80" + quid "3F31179A011F" + supplier "Logical View::TParserInitParams" + quidu "3F31175B03A0" + is_navigable TRUE) + (object Role "$UNNAMED$81" + quid "3F31179A0120" + supplier "Logical View::RParser" + quidu "3D83093B0288"))) + (object Association "$UNNAMED$82" + quid "3F31179F0361" + roles (list role_list + (object Role "$UNNAMED$83" + quid "3F3117A000C1" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$84" + quid "3F3117A000C2" + supplier "Logical View::RParser" + quidu "3D83093B0288"))) + (object Association "$UNNAMED$85" + quid "3F31261202D5" + roles (list role_list + (object Role "$UNNAMED$86" + quid "3F3126130313" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_navigable TRUE) + (object Role "$UNNAMED$87" + quid "3F3126130314" + supplier "Logical View::RParser" + quidu "3D83093B0288"))) + (object Association "$UNNAMED$88" + quid "3F326481017D" + roles (list role_list + (object Role "$UNNAMED$89" + quid "3F3264810303" + supplier "Logical View::RDtorStringDictionaryPtrMapping" + quidu "3F32646800C1" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$90" + quid "3F3264810313" + supplier "Logical View::RParser" + quidu "3D83093B0288" + client_cardinality (value cardinality "0..n") + is_aggregate TRUE))) + (object Association "$UNNAMED$91" + quid "3F337AA30083" + roles (list role_list + (object Role "$UNNAMED$92" + quid "3F337AA30248" + supplier "Logical View::RDtorStringDictionaryPtrMapping" + quidu "3F32646800C1" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$93" + quid "3F337AA30249" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_aggregate TRUE))) + (object Association "$UNNAMED$94" + quid "3F33A720018C" + roles (list role_list + (object Role "$UNNAMED$95" + quid "3F33A72002F4" + supplier "Logical View::RDtorContentProcessorPtrMapping" + quidu "3F33A6F9017D" + Containment "By Value" + is_navigable TRUE) + (object Role "$UNNAMED$96" + quid "3F33A72002F5" + supplier "Logical View::RParser" + quidu "3D83093B0288" + client_cardinality (value cardinality "0..n") + is_aggregate TRUE))) + (object Association "$UNNAMED$97" + quid "421B0453008E" + roles (list role_list + (object Role "$UNNAMED$98" + quid "421B045501B7" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2") + (object Role "$UNNAMED$99" + quid "421B045501C6" + supplier "Logical View::MContentHandler" + quidu "3C4D3A5D02F4" + is_navigable TRUE))) + (object Association "$UNNAMED$100" + quid "421B0507012B" + roles (list role_list + (object Role "$UNNAMED$101" + quid "421B0507036D" + supplier "Logical View::RStringDictionaryCollection" + quidu "3D84681B018F" + is_navigable TRUE) + (object Role "$UNNAMED$102" + quid "421B0507036E" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2"))) + (object Association "$UNNAMED$103" + quid "421B05370070" + roles (list role_list + (object Role "$UNNAMED$104" + quid "421B05380012" + supplier "Logical View::RElementStack" + quidu "3D9827CB0143" + is_navigable TRUE) + (object Role "$UNNAMED$105" + quid "421B05380013" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2"))) + (object Association "$UNNAMED$106" + quid "421B06010217" + roles (list role_list + (object Role "$UNNAMED$107" + quid "421B060201D9" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$108" + quid "421B060201DA" + supplier "Logical View::CAutoCorrector" + quidu "3C6B836E0190"))) + (object Association "$UNNAMED$109" + quid "421B06050023" + roles (list role_list + (object Role "$UNNAMED$110" + quid "421B0605035F" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$111" + quid "421B06050360" + supplier "Logical View::CValidator" + quidu "3C5ACAC701D9"))) + (object Association "$UNNAMED$112" + quid "421B076500D1" + roles (list role_list + (object Role "$UNNAMED$113" + quid "421B07650371" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$114" + quid "421B07650372" + supplier "Logical View::CWbxmlGenerator" + quidu "3C4E8DB90101"))) + (object Association "$UNNAMED$115" + quid "421B07680064" + roles (list role_list + (object Role "$UNNAMED$116" + quid "421B076802B6" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$117" + quid "421B076802C5" + supplier "Logical View::CXmlGenerator" + quidu "3C4E8DAF0125"))) + (object Association "$UNNAMED$118" + quid "421B099A029A" + roles (list role_list + (object Role "$UNNAMED$119" + quid "421B099B0068" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$120" + quid "421B099B0077" + supplier "Logical View::CXmlParser" + quidu "3C4D37890087"))) + (object Association "$UNNAMED$121" + quid "421B099D0336" + roles (list role_list + (object Role "$UNNAMED$122" + quid "421B099E0162" + supplier "Logical View::TContentProcessorInitParams" + quidu "3F31176700A2" + is_navigable TRUE) + (object Role "$UNNAMED$123" + quid "421B099E0163" + supplier "Logical View::CWbxmlParser" + quidu "3C4D379A01C1"))) + (object Mechanism @10 + logical_models (list unit_reference_list + (object Object "$UNNAMED$124" + quid "3C67C500010B" + collaborators (list link_list + (object Link + quid "3C67C7A600BF" + supplier "$UNNAMED$125" + quidu "3C67C790015E") + (object Link + quid "3C67C7C8035D" + supplier "$UNNAMED$126" + quidu "3C67C7B301A4") + (object Link + quid "3D9AE9040177" + supplier "$UNNAMED$127" + quidu "3C6A4BBC0088") + (object Link + quid "3D9AE9E000F1" + supplier "$UNNAMED$128" + quidu "3D9AE9A703CA" + messages (list Messages + (object Message "OpenL" + quid "3D9AE9F90328" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "1" + ordinal 0 + Operation "OpenL( )" + quidu "3D9AE9E10319") + (object Message " " + quid "3D9AECB50306" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3" + ordinal 4))) + (object Link + quid "3D9AEC28006E" + supplier "$UNNAMED$129" + quidu "3D9AEBF801C4" + messages (list Messages + (object Message "OpenL( )" + quid "3D9AEC28006F" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "2" + ordinal 2 + quidu "3D9AEC2A0053") + (object Message "BuildStartDocumentL" + quid "3D9AED1500AB" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "11" + ordinal 25) + (object Message "BuildStartElementL( )" + quid "3D9AED94032F" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "12" + ordinal 29 + quidu "3D9AED9A0265") + (object Message "BuildContentL( )" + quid "3D9AEE28001A" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "13" + ordinal 33 + quidu "3D9AEE2A0009") + (object Message "BuildEndElementL( )" + quid "3D9AEF260020" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "14" + ordinal 37 + quidu "3D9AEF2B00B3") + (object Message "BuildEndDocumentL( )" + quid "3D9AEF7B0108" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "15" + ordinal 41 + quidu "3D9AEF7E006C")))) + class "Use Case View::Client" + quidu "3C67C4C3035C" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$125" + quid "3C67C790015E" + collaborators (list link_list + (object Link + quid "3C67C9EF01ED" + supplier "$UNNAMED$125" + quidu "3C67C790015E" + messages (list Messages + (object Message "RunL( )" + quid "3C67CA1701B8" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "4" + ordinal 6))) + (object Link + quid "3C6B8E5D01BD" + supplier "$UNNAMED$127" + quidu "3C6A4BBC0088" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B8E630229" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "5" + ordinal 7 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3C6B8E8203AB" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "6" + ordinal 10 + quidu "3F2A661300EB") + (object Message "OnContentL( )" + quid "3C6B8EA30177" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "7" + ordinal 13 + quidu "3F2A662301C5") + (object Message "OnContentL( )" + quid "3C6B8EC8024D" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "8" + ordinal 16 + quidu "3F2A662301C5") + (object Message "OnEndElementL( )" + quid "3C6B8EDE0230" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "9" + ordinal 19 + quidu "3F2A6619037B") + (object Message "OnEndDocumentL( )" + quid "3C6B8F1F02CA" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "10" + ordinal 22 + quidu "3F2A6608032D"))) + (object Link + quid "3C6A49900132" + supplier "$UNNAMED$130" + quidu "3C67CD1C00C0")) + class "Logical View::MParser" + quidu "3D830A9C0344" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$126" + quid "3C67C7B301A4" + collaborators (list link_list + (object Link + quid "3C6A4C6900C3" + supplier "$UNNAMED$127" + quidu "3C6A4BBC0088" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3D9AEDBE00D6" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "11.1.1" + ordinal 27 + quidu "3F2A65FE001F") + (object Message "OnStartDocumentL( )" + quid "3D9AEDDA0090" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "11.1.1.1" + ordinal 28 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3D9AEDF40124" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "12.1.1" + ordinal 31 + quidu "3F2A661300EB") + (object Message "OnStartElementL( )" + quid "3D9AEE0403BC" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "12.1.1.1" + ordinal 32 + quidu "3F2A661300EB") + (object Message "OnContentL( )" + quid "3D9AEE4F00A3" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "13.1.1" + ordinal 35 + quidu "3F2A662301C5") + (object Message "OnContentL( )" + quid "3D9AEE570325" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "13.1.1.1" + ordinal 36 + quidu "3F2A662301C5") + (object Message "OnEndElementL( )" + quid "3D9AEF4E00E5" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "14.1.1" + ordinal 39 + quidu "3F2A6619037B") + (object Message "OnEndElementL( )" + quid "3D9AEF5F0307" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "14.1.1.1" + ordinal 40 + quidu "3F2A6619037B") + (object Message "OnEndDocumentL( )" + quid "3D9AEF90025D" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "15.1.1" + ordinal 43 + quidu "3F2A6608032D") + (object Message "OnEndDocumentL( )" + quid "3D9AEFA1026B" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "15.1.1.1" + ordinal 44 + quidu "3F2A6608032D"))) + (object Link + quid "3C6A4A4C0237" + supplier "$UNNAMED$130" + quidu "3C67CD1C00C0")) + class "Logical View::MGenerator" + quidu "3D830AB602D4" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$127" + quid "3C6A4BBC0088" + collaborators (list link_list + (object Link + quid "3C6B8E6C0088" + supplier "$UNNAMED$130" + quidu "3C67CD1C00C0" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B8E6C0089" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "5.1" + ordinal 8 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3C6B8E8C0002" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "6.1" + ordinal 11 + quidu "3F2A661300EB") + (object Message "OnContentL( )" + quid "3C6B8EA90194" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "7.1" + ordinal 14 + quidu "3F2A662301C5") + (object Message "OnContentL( )" + quid "3C6B8ECD0358" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "8.1" + ordinal 17 + quidu "3F2A662301C5") + (object Message "OnEndElementL" + quid "3C6B8EF50283" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "9.1" + ordinal 20 + Operation "OnEndElementL( )" + quidu "3F2A6619037B") + (object Message "OnEndDocumentL( )" + quid "3C6B8F320119" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "10.1" + ordinal 23 + quidu "3F2A6608032D")))) + class "Logical View::CValidator" + quidu "3C5ACAC701D9" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$128" + quid "3D9AE9A703CA" + collaborators (list link_list + (object Link + quid "3D9AEB1401B2" + supplier "$UNNAMED$125" + quidu "3C67C790015E" + messages (list Messages + (object Message "NewL" + quid "3D9AEB1401B3" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "1.1" + ordinal 1) + (object Message "Start( )" + quid "3D9AECD501D6" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3.1" + ordinal 5 + Operation "Start" + quidu "3F30F6BE012F")))) + class "Logical View::RParser" + quidu "3D83093B0288" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$129" + quid "3D9AEBF801C4" + collaborators (list link_list + (object Link + quid "3D9AEC510186" + supplier "$UNNAMED$126" + quidu "3C67C7B301A4" + messages (list Messages + (object Message "NewL" + quid "3D9AEC510187" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "2.1" + ordinal 3) + (object Message "BuildStartDocumentL( )" + quid "3D9AED340395" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "11.1" + ordinal 26 + Operation "BuildStartDocumentL" + quidu "3D9AED3D01B7") + (object Message "BuildStartElementL( )" + quid "3D9AEDAD010E" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "12.1" + ordinal 30 + Operation "BuildStartElementL" + quidu "3D9AEDB001EF") + (object Message "BuildContentL( )" + quid "3D9AEE38003B" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "13.1" + ordinal 34 + Operation "BuildContentL" + quidu "3D9AEF45034F") + (object Message "BuildEndElementL( )" + quid "3D9AEF320302" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "14.1" + ordinal 38 + Operation "BuildEndElementL" + quidu "3D9AEF3C02F2") + (object Message "BuildEndDocumentL( )" + quid "3D9AEF8702BE" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "15.1" + ordinal 42 + Operation "BuildEndDocumentL" + quidu "3D9AE91001A6"))) + (object Link + quid "3D9AEE310045" + supplier "$UNNAMED$130" + quidu "3C67CD1C00C0")) + class "Logical View::RGenerator" + quidu "3D8309470394" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$130" + quid "3C67CD1C00C0" + collaborators (list link_list + (object Link + quid "3C67CD6702DA" + supplier "$UNNAMED$124" + quidu "3C67C500010B" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B8E7400E3" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "5.1.1" + ordinal 9 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3C6B8E9500EB" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "6.1.1" + ordinal 12 + quidu "3F2A661300EB") + (object Message "OnContentL( )" + quid "3C6B8EB000F4" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "7.1.1" + ordinal 15 + quidu "3F2A662301C5") + (object Message "OnContentL( )" + quid "3C6B8ED5020F" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "8.1.1" + ordinal 18 + quidu "3F2A662301C5") + (object Message "OnEndElementL( )" + quid "3C6B8F0300A3" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "9.1.1" + ordinal 21 + quidu "3F2A6619037B") + (object Message "OnEndDocumentL( )" + quid "3C6B8F3E0044" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "10.1.1" + ordinal 24 + quidu "3F2A6608032D")))) + class "Logical View::CAutoCorrector" + quidu "3C6B836E0190" + persistence "Transient" + multi FALSE))) + (object Mechanism @11 + logical_models (list unit_reference_list + (object Object "$UNNAMED$131" + quid "3C6B975A0284" + collaborators (list link_list + (object Link + quid "3C6B997203B1" + supplier "$UNNAMED$132" + quidu "3C6B979401DD") + (object Link + quid "3D9C33C80213" + supplier "$UNNAMED$133" + quidu "3D9C33A9033B" + messages (list Messages + (object Message "Start( )" + quid "3D9C33C80214" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "1" + ordinal 0 + quidu "3F30FB9F02A6")))) + class "Use Case View::Client" + quidu "3C67C4C3035C" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$134" + quid "3C6B976A0255" + collaborators (list link_list + (object Link + quid "3C6B99B80235" + supplier "$UNNAMED$131" + quidu "3C6B975A0284" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B99B80236" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "2.1.1" + ordinal 4 + quidu "3F2A65FE001F") + (object Message "OnEndElementL( )" + quid "3C6B9EA2022A" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3.1.3" + ordinal 9 + quidu "3F2A6619037B") + (object Message "OnEndElementL( )" + quid "3C6B9EA70385" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3.1.4" + ordinal 10 + quidu "3F2A6619037B") + (object Message "OnStartElementL( )" + quid "3C6B9EB00220" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3.1.5" + ordinal 11 + quidu "3F2A661300EB")))) + class "Logical View::CAutoCorrector" + quidu "3C6B836E0190" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$135" + quid "3C6B97810059" + collaborators (list link_list + (object Link + quid "3C6B99A302F3" + supplier "$UNNAMED$134" + quidu "3C6B976A0255" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B99A302F4" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "2.1" + ordinal 3 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3C6B99E00192" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3.1" + ordinal 6 + quidu "3F2A661300EB") + (object Message "IsChildElementValid( )" + quid "3C6B9B9E020C" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "3.1.1" + ordinal 7 + Operation "IsChildElementValid" + quidu "3F2A7B9402EE") + (object Message "IsChildElementValid( )" + quid "3C6B9CED00E1" + frequency "Aperiodic" + synchronization "Simple" + dir "ToClientFromSupplier" + sequence "3.1.2" + ordinal 8 + Operation "IsChildElementValid" + quidu "3F2A7B9402EE"))) + (object Link + quid "3C6B9E120182" + supplier "$UNNAMED$131" + quidu "3C6B975A0284")) + class "Logical View::CValidator" + quidu "3C5ACAC701D9" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$132" + quid "3C6B979401DD" + collaborators (list link_list + (object Link + quid "3C6B99980185" + supplier "$UNNAMED$135" + quidu "3C6B97810059" + messages (list Messages + (object Message "OnStartDocumentL( )" + quid "3C6B99980186" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "2" + ordinal 2 + quidu "3F2A65FE001F") + (object Message "OnStartElementL( )" + quid "3C6B99CF01D4" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "3" + ordinal 5 + quidu "3F2A661300EB")))) + class "Logical View::MParser" + quidu "3D830A9C0344" + persistence "Transient" + multi FALSE) + (object Object "$UNNAMED$133" + quid "3D9C33A9033B" + collaborators (list link_list + (object Link + quid "3D9C341E0361" + supplier "$UNNAMED$132" + quidu "3C6B979401DD" + messages (list Messages + (object Message "Start( )" + quid "3D9C341E0362" + frequency "Aperiodic" + synchronization "Simple" + dir "FromClientToSupplier" + sequence "1.1" + ordinal 1 + Operation "Start" + quidu "3F30F6BE012F")))) + class "Logical View::RParser" + quidu "3D83093B0288" + persistence "Transient" + multi FALSE)))) + logical_presentations (list unit_reference_list + (object ClassDiagram "Main" + quid "3C4D372C0123" + title "Main" + external_docs (list external_doc_list + (object external_doc + external_doc_path "L:\\TransportAdaptorGuide\\TASequenceDiagram.gif")) + zoom 50 + max_height 28350 + max_width 21600 + origin_x 1376 + origin_y 312 + items (list diagram_item_list + (object ClassView "Class" "Logical View::CStringDictionary" @12 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6016, 4256) + label (object ItemLabel + Parent_View @12 + location (5741, 4216) + fill_color 13434879 + nlines 1 + max_width 550 + justify 0 + label "CStringDictionary") + stereotype (object ItemLabel + Parent_View @12 + location (5741, 4166) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 550 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3D98118601D2" + width 568 + height 216 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RDictionaryCodePage" @13 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6752, 4272) + label (object ItemLabel + Parent_View @13 + location (6406, 4218) + fill_color 13434879 + nlines 1 + max_width 692 + justify 0 + label "RDictionaryCodePage") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9820B00260" + width 710 + height 148 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$36" @14 + location (6348, 4231) + stereotype TRUE + line_color 3342489 + quidu "3D9820E402C9" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$38" @15 + Parent_View @14 + location (6060, 631) + label (object SegLabel @16 + Parent_View @15 + location (6310, 4273) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D9820E502B7" + client @14 + supplier @12 + line_style 3 + origin_attachment (6348, 4231) + terminal_attachment (6300, 4231)) + (object RoleView "$UNNAMED$37" @17 + Parent_View @14 + location (6060, 631) + label (object SegLabel @18 + Parent_View @17 + location (6386, 4273) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D9820E502B6" + client @14 + supplier @13 + line_style 3 + origin_attachment (6348, 4231) + terminal_attachment (6397, 4231)))) + (object ClassView "Class" "Logical View::CDescriptorDataSupplier" @19 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6112, 2864) + label (object ItemLabel + Parent_View @19 + location (5736, 2799) + fill_color 13434879 + nlines 1 + max_width 752 + justify 0 + label "CDescriptorDataSupplier") + icon_style "Icon" + line_color 3342489 + fill_color 16711935 + quidu "3D8311AB0108" + width 770 + height 170 + annotation 8 + autoResize TRUE) + (object NoteView @20 + location (5296, 256) + label (object ItemLabel + Parent_View @20 + location (4607, 186) + fill_color 13434879 + nlines 2 + max_width 1343 + label "XML Parser Framework") + line_color 3342489 + fill_color 13434879 + width 1403 + height 153) + (object ClassView "Class" "Logical View::RAttribute" @21 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2896, 368) + label (object ItemLabel + Parent_View @21 + location (2737, 301) + fill_color 13434879 + nlines 1 + max_width 318 + justify 0 + label "RAttribute") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C4EA0AA00D2" + width 336 + height 170 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RAttributeArray" @22 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2256, 384) + label (object ItemLabel + Parent_View @22 + location (2017, 317) + fill_color 13434879 + nlines 1 + max_width 478 + justify 0 + label "RAttributeArray") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C596B75009E" + width 496 + height 170 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$6" @23 + location (2616, 370) + stereotype TRUE + line_color 3342489 + quidu "3C596D4A0392" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$8" @24 + Parent_View @23 + location (2248, -990) + label (object SegLabel @25 + Parent_View @24 + location (2527, 329) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3C596D4B0131" + client @23 + supplier @22 + line_style 3 + origin_attachment (2616, 370) + terminal_attachment (2504, 370)) + (object RoleView "$UNNAMED$7" @26 + Parent_View @23 + location (2248, -990) + label (object SegLabel @27 + Parent_View @26 + location (2705, 329) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3C596D4B0130" + client @23 + supplier @21 + line_style 3 + origin_attachment (2616, 370) + terminal_attachment (2728, 370)))) + (object ClassView "Class" "Logical View::TStandalone" @28 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2224, 576) + label (object ItemLabel + Parent_View @28 + location (2025, 521) + fill_color 13434879 + nlines 1 + max_width 398 + justify 0 + label "TStandalone") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F31164103AF" + width 416 + height 146 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RDocumentParameters" @29 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2384, 752) + label (object ItemLabel + Parent_View @29 + location (2023, 697) + fill_color 13434879 + nlines 1 + max_width 722 + justify 0 + label "RDocumentParameters") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F311673017D" + width 740 + height 146 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MDataSink" @30 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6432, 2240) + label (object ItemLabel + Parent_View @30 + location (6250, 2150) + fill_color 16777215 + nlines 1 + max_width 364 + justify 0 + label "MDataSink") + stereotype (object ItemLabel + Parent_View @30 + location (6250, 2106) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 364 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3D8310F9036F" + compartment (object Compartment + Parent_View @30 + location (6250, 2236) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 3 + max_width 294) + width 382 + height 304 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RGenerator" @31 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1904, 2112) + label (object ItemLabel + Parent_View @31 + location (1680, 1912) + fill_color 13434879 + nlines 1 + max_width 448 + justify 0 + label "RGenerator") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D8309470394" + compartment (object Compartment + Parent_View @31 + location (1680, 2004) + font (object Font + size 10) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 7 + max_width 453) + width 466 + height 440 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MDataSource" @32 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (5936, 1648) + label (object ItemLabel + Parent_View @32 + location (5715, 1415) + fill_color 16777215 + nlines 1 + max_width 442 + justify 0 + label "MDataSource") + stereotype (object ItemLabel + Parent_View @32 + location (5715, 1384) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 442 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3C67ADA80234" + compartment (object Compartment + Parent_View @32 + location (5715, 1507) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 9 + max_width 413) + width 460 + height 568 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MStringDictionary" @33 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6400, 3920) + label (object ItemLabel + Parent_View @33 + location (6119, 3890) + fill_color 13434879 + nlines 1 + max_width 562 + justify 0 + label "MStringDictionary") + stereotype (object ItemLabel + Parent_View @33 + location (6119, 3846) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 562 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3C4EC591028F" + width 580 + height 188 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MContentProcessor" @34 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1280, 2384) + label (object ItemLabel + Parent_View @34 + location (969, 2315) + fill_color 13434879 + nlines 1 + max_width 622 + justify 0 + label "MContentProcessor") + stereotype (object ItemLabel + Parent_View @34 + location (969, 2271) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 622 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3D830D2903CF" + compartment (object Compartment + Parent_View @34 + location (969, 2407) + font (object Font + size 10) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 2 + max_width 250) + width 640 + height 266 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RDtorStringDictionaryPtrMapping" @35 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6624, 3712) + label (object ItemLabel + Parent_View @35 + location (6119, 3658) + fill_color 13434879 + nlines 1 + max_width 1010 + justify 0 + label "RDtorStringDictionaryPtrMapping") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F32646800C1" + width 1028 + height 148 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Use Case View::Client" @36 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (208, 1600) + label (object ItemLabel + Parent_View @36 + location (208, 1760) + anchor_loc 1 + nlines 2 + max_width 327 + justify 0 + label "Client") + icon "Actor" + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C67C4C3035C" + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$30" @37 + location (816, 1924) + stereotype TRUE + line_color 3342489 + quidu "3D846DD30338" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$32" @38 + Parent_View @37 + location (-2624, 740) + label (object SegLabel @39 + Parent_View @38 + location (386, 1712) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D846DD40350" + client @37 + supplier @36 + vertices (list Points + (816, 1924) + (344, 1924) + (344, 1620) + (265, 1620)) + line_style 3 + origin_attachment (816, 1924) + terminal_attachment (265, 1620)) + (object RoleView "$UNNAMED$31" @40 + Parent_View @37 + location (-2624, 740) + label (object SegLabel @41 + Parent_View @40 + location (1500, 1883) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D846DD4034E" + client @37 + supplier @31 + line_style 3 + origin_attachment (816, 1924) + terminal_attachment (1671, 1924)))) + (object ClassView "Class" "Logical View::CCharSetConverter" @42 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (6000, 3392) + label (object ItemLabel + Parent_View @42 + location (5691, 3299) + fill_color 13434879 + nlines 1 + max_width 619 + justify 0 + label "CCharSetConverter") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9ACDCF01D6" + width 637 + height 227 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$42" @43 + location (3250, 3474) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE500177" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$44" @44 + Parent_View @43 + location (-862, 2754) + label (object SegLabel @45 + Parent_View @44 + location (2261, 2560) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE5003AA" + client @43 + supplier @31 + vertices (list Points + (3250, 3474) + (2219, 3474) + (2219, 2155) + (2137, 2155)) + line_style 3 + origin_attachment (3250, 3474) + terminal_attachment (2137, 2155)) + (object RoleView "$UNNAMED$43" @46 + Parent_View @43 + location (-862, 2754) + label (object SegLabel @47 + Parent_View @46 + location (5195, 3433) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE5003A8" + client @43 + supplier @42 + line_style 3 + origin_attachment (3250, 3474) + terminal_attachment (5682, 3474)))) + (object ClassView "Class" "Logical View::MParser" @48 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4736, 1840) + label (object ItemLabel + Parent_View @48 + location (4553, 1739) + fill_color 13434879 + nlines 1 + max_width 366 + justify 0 + label "MParser") + stereotype (object ItemLabel + Parent_View @48 + location (4553, 1708) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 366 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3D830A9C0344" + compartment (object Compartment + Parent_View @48 + location (4553, 1831) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 3 + max_width 363) + width 384 + height 304 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$9" @49 + location (5317, 1737) + stereotype TRUE + line_color 3342489 + quidu "3D8310F4033F" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$11" @50 + Parent_View @49 + location (4949, -1143) + label (object SegLabel @51 + Parent_View @50 + location (5006, 1779) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D8310F502AB" + client @49 + supplier @48 + line_style 3 + origin_attachment (5317, 1737) + terminal_attachment (4928, 1737)) + (object RoleView "$UNNAMED$10" @52 + Parent_View @49 + location (4949, -1143) + label (object SegLabel @53 + Parent_View @52 + location (5628, 1779) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D8310F502A1" + client @49 + supplier @32 + line_style 3 + origin_attachment (5317, 1737) + terminal_attachment (5706, 1737)))) + (object AssociationViewNew "$UNNAMED$45" @54 + location (5613, 2276) + stereotype TRUE + line_color 3342489 + quidu "3D9ACEC90058" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$47" @55 + Parent_View @54 + location (5181, -892) + label (object SegLabel @56 + Parent_View @55 + location (5159, 1854) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D9ACECA03D5" + client @54 + supplier @48 + vertices (list Points + (5613, 2276) + (5613, 1812) + (4928, 1812)) + line_style 3 + origin_attachment (5613, 2276) + terminal_attachment (4928, 1812)) + (object RoleView "$UNNAMED$46" @57 + Parent_View @54 + location (5181, -892) + label (object SegLabel @58 + Parent_View @57 + location (5572, 3193) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D9ACECA03CB" + client @54 + supplier @42 + vertices (list Points + (5613, 2276) + (5613, 3355) + (5682, 3355)) + line_style 3 + origin_attachment (5613, 2276) + terminal_attachment (5682, 3355)))) + (object ClassView "Class" "Logical View::TParseMode" @59 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (5344, 2096) + label (object ItemLabel + Parent_View @59 + location (5141, 2043) + fill_color 13434879 + nlines 1 + max_width 406 + justify 0 + label "TParseMode") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F31085F0219" + width 424 + height 146 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$67" @60 + location (5082, 1928) + stereotype TRUE + line_color 3342489 + quidu "3F31088501AC" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$68" @61 + Parent_View @60 + location (250, 136) + stereotype TRUE + line_color 3342489 + quidu "3F3108850303" + client @60 + supplier @59 + vertices (list Points + (5082, 1928) + (5082, 2056) + (5132, 2056)) + line_style 3 + origin_attachment (5082, 1928) + terminal_attachment (5132, 2056)) + (object RoleView "$UNNAMED$69" @62 + Parent_View @60 + location (250, 136) + stereotype TRUE + line_color 3342489 + quidu "3F3108850313" + client @60 + supplier @48 + vertices (list Points + (5082, 1928) + (5082, 1868) + (4928, 1868)) + line_style 3 + origin_attachment (5082, 1928) + terminal_attachment (4928, 1868)))) + (object ClassView "Class" "Logical View::TParserInitParams" @63 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4288, 1568) + label (object ItemLabel + Parent_View @63 + location (3999, 1515) + fill_color 13434879 + nlines 1 + max_width 578 + justify 0 + label "TParserInitParams") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F31175B03A0" + width 596 + height 146 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RDtorContentProcessorPtrMapping" @64 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4064, 1168) + label (object ItemLabel + Parent_View @64 + location (3533, 1115) + fill_color 13434879 + nlines 1 + max_width 1062 + justify 0 + label "RDtorContentProcessorPtrMapping") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F33A6F9017D" + width 1080 + height 146 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::RParser" @65 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2944, 1504) + label (object ItemLabel + Parent_View @65 + location (2761, 1260) + fill_color 13434879 + nlines 1 + max_width 366 + justify 0 + label "RParser") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D83093B0288" + compartment (object Compartment + Parent_View @65 + location (2761, 1346) + font (object Font + size 10) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 9 + max_width 363) + width 384 + height 528 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$27" @66 + location (1531, 1469) + stereotype TRUE + line_color 3342489 + quidu "3D846DD101B9" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$29" @67 + Parent_View @66 + location (-1797, -131) + label (object SegLabel @68 + Parent_View @67 + location (538, 1523) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D846DD103C4" + client @66 + supplier @36 + vertices (list Points + (1531, 1469) + (1531, 1566) + (265, 1566)) + line_style 3 + origin_attachment (1531, 1469) + terminal_attachment (265, 1566)) + (object RoleView "$UNNAMED$28" @69 + Parent_View @66 + location (-1797, -131) + label (object SegLabel @70 + Parent_View @69 + location (2479, 1289) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D846DD103C2" + client @66 + supplier @65 + vertices (list Points + (1531, 1469) + (1531, 1330) + (2752, 1330)) + line_style 3 + origin_attachment (1531, 1469) + terminal_attachment (2752, 1330)))) + (object AssociationViewNew "$UNNAMED$39" @71 + location (3626, 3296) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE4D0349" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$41" @72 + Parent_View @71 + location (-486, 2576) + label (object SegLabel @73 + Parent_View @72 + location (3573, 1565) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE4E00F4" + client @71 + supplier @65 + vertices (list Points + (3626, 3296) + (3626, 1606) + (3136, 1606)) + line_style 3 + origin_attachment (3626, 3296) + terminal_attachment (3136, 1606)) + (object RoleView "$UNNAMED$40" @74 + Parent_View @71 + location (-486, 2576) + label (object SegLabel @75 + Parent_View @74 + location (5246, 3378) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D9ACE4E00F2" + client @71 + supplier @42 + vertices (list Points + (3626, 3296) + (3626, 3419) + (5682, 3419)) + line_style 3 + origin_attachment (3626, 3296) + terminal_attachment (5682, 3419)))) + (object AssociationViewNew "$UNNAMED$15" @76 + location (3945, 1708) + stereotype TRUE + line_color 3342489 + quidu "3D8465900156" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$17" @77 + Parent_View @76 + location (2073, -852) + label (object SegLabel @78 + Parent_View @77 + location (3299, 1750) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D8465910021" + client @76 + supplier @65 + line_style 3 + origin_attachment (3945, 1708) + terminal_attachment (3136, 1708)) + (object RoleView "$UNNAMED$16" @79 + Parent_View @76 + location (2073, -852) + label (object SegLabel @80 + Parent_View @79 + location (4381, 1961) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D8465910017" + client @76 + supplier @48 + vertices (list Points + (3945, 1708) + (4269, 1708) + (4269, 1919) + (4544, 1919)) + line_style 3 + origin_attachment (3945, 1708) + terminal_attachment (4544, 1919)))) + (object AssociationViewNew "$UNNAMED$70" @81 + location (4057, 2014) + stereotype TRUE + line_color 3342489 + quidu "3F31089703A0" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$71" @82 + Parent_View @81 + location (457, 302) + stereotype TRUE + line_color 3342489 + quidu "3F310898014E" + client @81 + supplier @59 + vertices (list Points + (4057, 2014) + (4057, 2112) + (5132, 2112)) + line_style 3 + origin_attachment (4057, 2014) + terminal_attachment (5132, 2112)) + (object RoleView "$UNNAMED$72" @83 + Parent_View @81 + location (457, 302) + stereotype TRUE + line_color 3342489 + quidu "3F310898014F" + client @81 + supplier @65 + vertices (list Points + (4057, 2014) + (4057, 1762) + (3136, 1762)) + line_style 3 + origin_attachment (4057, 2014) + terminal_attachment (3136, 1762)))) + (object AssociationViewNew "$UNNAMED$79" @84 + location (3563, 1506) + stereotype TRUE + line_color 3342489 + quidu "3F31179903AF" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$80" @85 + Parent_View @84 + location (-229, -206) + stereotype TRUE + line_color 3342489 + quidu "3F31179A011F" + client @84 + supplier @63 + line_style 3 + origin_attachment (3563, 1506) + terminal_attachment (3990, 1506)) + (object RoleView "$UNNAMED$81" @86 + Parent_View @84 + location (-229, -206) + stereotype TRUE + line_color 3342489 + quidu "3F31179A0120" + client @84 + supplier @65 + line_style 3 + origin_attachment (3563, 1506) + terminal_attachment (3136, 1506)))) + (object AssociationViewNew "$UNNAMED$94" @87 + location (3294, 1203) + stereotype TRUE + line_color 3342489 + quidu "3F33A720018C" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$95" @88 + Parent_View @87 + location (350, -301) + stereotype TRUE + line_color 3342489 + quidu "3F33A72002F4" + client @87 + supplier @64 + vertices (list Points + (3294, 1203) + (3294, 1143) + (3524, 1143)) + line_style 3 + origin_attachment (3294, 1203) + terminal_attachment (3524, 1143)) + (object RoleView "$UNNAMED$96" @89 + Parent_View @87 + location (350, -301) + stereotype TRUE + line_color 3342489 + quidu "3F33A72002F5" + client @87 + supplier @65 + vertices (list Points + (3294, 1203) + (3294, 1294) + (3136, 1294)) + line_style 3 + origin_attachment (3294, 1203) + terminal_attachment (3136, 1294) + label (object SegLabel @90 + Parent_View @89 + location (3178, 1233) + font (object Font + size 10) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "0..*" + pctDist 0.833333 + height 62 + orientation 1)))) + (object ClassView "Class" "Logical View::MWbxmlExtensionHandler" @91 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (720, 272) + label (object ItemLabel + Parent_View @91 + location (321, 201) + fill_color 13434879 + nlines 1 + max_width 798 + justify 0 + label "MWbxmlExtensionHandler") + stereotype (object ItemLabel + Parent_View @91 + location (321, 157) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 798 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3F61B05C0050" + compartment (object Compartment + Parent_View @91 + location (321, 287) + font (object Font + size 10) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 2 + max_width 350) + width 816 + height 270 + annotation 8 + autoResize TRUE) + (object Label @92 + location (2381, 2750) + nlines 1 + max_width 600 + label "") + (object NoteView @93 + location (448, 800) + label (object ItemLabel + Parent_View @93 + location (54, 481) + fill_color 13434879 + nlines 8 + max_width 753 + label +|The relevant MContentProcessor derived class will inherit off this interface to pass along the callback. +|NOTE: All plugins in the chain must inherit off the same interfaces. + ) + line_color 3342489 + fill_color 13434879 + width 813 + height 650) + (object AttachView "" @94 + stereotype TRUE + line_color 3342489 + client @93 + supplier @91 + vertices (list Points + (150, 474) + (150, 281) + (312, 281)) + line_style 3 + origin_attachment (583, 474) + terminal_attachment (583, 407)) + (object RealizeView "" @95 + stereotype TRUE + line_color 3342489 + quidu "3F61E5870189" + client @12 + supplier @33 + line_style 3 + origin_attachment (6188, 4147) + terminal_attachment (6188, 4013)) + (object RealizeView "" @96 + stereotype TRUE + line_color 3342489 + quidu "3F61E4290206" + client @19 + supplier @32 + line_style 3 + origin_attachment (6001, 2779) + terminal_attachment (6001, 1931)) + (object RealizeView "" @97 + stereotype TRUE + line_color 3342489 + quidu "3F61E42C012B" + client @19 + supplier @30 + line_style 3 + origin_attachment (6388, 2778) + terminal_attachment (6388, 2392)) + (object ClassView "Class" "Logical View::MContentSource" @98 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4848, 608) + label (object ItemLabel + Parent_View @98 + location (4583, 524) + fill_color 13434879 + nlines 1 + max_width 530 + justify 0 + label "MContentSource") + stereotype (object ItemLabel + Parent_View @98 + location (4583, 493) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 530 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "4219F8180290" + compartment (object Compartment + Parent_View @98 + location (4583, 610) + font (object Font + size 10) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 2 + max_width 375) + width 548 + height 270 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MContentHandler" @99 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1504, 544) + label (object ItemLabel + Parent_View @99 + location (1236, 188) + fill_color 16777215 + nlines 1 + max_width 536 + justify 0 + label "MContentHandler") + stereotype (object ItemLabel + Parent_View @99 + location (1236, 140) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 536 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3C4D3A5D02F4" + compartment (object Compartment + Parent_View @99 + location (1236, 274) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 14 + max_width 550) + width 554 + height 842 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$54" @100 + location (1894, 368) + stereotype TRUE + line_color 3342489 + quidu "3F2FF2730015" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$55" @101 + Parent_View @100 + location (-138, -1504) + stereotype TRUE + line_color 3342489 + quidu "3F2FF2740323" + client @100 + supplier @22 + line_style 3 + origin_attachment (1894, 368) + terminal_attachment (2008, 368)) + (object RoleView "$UNNAMED$56" @102 + Parent_View @100 + location (-138, -1504) + stereotype TRUE + line_color 3342489 + quidu "3F2FF2740324" + client @100 + supplier @99 + line_style 3 + origin_attachment (1894, 368) + terminal_attachment (1781, 368)))) + (object AssociationViewNew "$UNNAMED$73" @103 + location (1898, 551) + stereotype TRUE + line_color 3342489 + quidu "3F31164C011F" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$74" @104 + Parent_View @103 + location (490, -185) + stereotype TRUE + line_color 3342489 + quidu "3F31164C02F4" + client @103 + supplier @28 + line_style 3 + origin_attachment (1898, 551) + terminal_attachment (2016, 551)) + (object RoleView "$UNNAMED$75" @105 + Parent_View @103 + location (490, -185) + stereotype TRUE + line_color 3342489 + quidu "3F31164C02F5" + client @103 + supplier @99 + line_style 3 + origin_attachment (1898, 551) + terminal_attachment (1781, 551)))) + (object AssociationViewNew "$UNNAMED$76" @106 + location (1897, 739) + stereotype TRUE + line_color 3342489 + quidu "3F31167802E4" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$77" @107 + Parent_View @106 + location (489, 3) + stereotype TRUE + line_color 3342489 + quidu "3F3116790044" + client @106 + supplier @29 + line_style 3 + origin_attachment (1897, 739) + terminal_attachment (2014, 739)) + (object RoleView "$UNNAMED$78" @108 + Parent_View @106 + location (489, 3) + stereotype TRUE + line_color 3342489 + quidu "3F3116790045" + client @106 + supplier @99 + line_style 3 + origin_attachment (1897, 739) + terminal_attachment (1781, 739)))) + (object AssociationViewNew "$UNNAMED$60" @109 + location (1338, 1607) + stereotype TRUE + line_color 3342489 + quidu "3F30F92701DB" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$61" @110 + Parent_View @109 + location (-38, -441) + label (object SegLabel @111 + Parent_View @110 + location (1297, 1093) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 175 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3F30F929013E" + client @109 + supplier @99 + line_style 3 + origin_attachment (1338, 1607) + terminal_attachment (1338, 964)) + (object RoleView "child" @112 + Parent_View @109 + location (-38, -441) + label (object SegLabel @113 + Parent_View @112 + location (1258, 2185) + anchor 1 + anchor_loc 1 + nlines 1 + max_width 175 + justify 0 + label "+child" + pctDist 0.898424 + height 81 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3F30F929013F" + client @109 + supplier @34 + line_style 3 + origin_attachment (1338, 1607) + terminal_attachment (1338, 2250)))) + (object AssociationViewNew "$UNNAMED$65" @114 + location (3622, 905) + stereotype TRUE + line_color 3342489 + quidu "3F30F9910015" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$66" @115 + Parent_View @114 + location (-1210, -887) + stereotype TRUE + line_color 3342489 + quidu "3F30F9910303" + client @114 + supplier @99 + line_style 3 + origin_attachment (3622, 905) + terminal_attachment (1781, 905)) + (object RoleView "child" @116 + Parent_View @114 + location (-1210, -887) + label (object SegLabel @117 + Parent_View @116 + location (4778, 1628) + anchor 1 + anchor_loc 1 + nlines 1 + max_width 175 + justify 0 + label "+child" + pctDist 0.967427 + height 97 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3F30F9910304" + client @114 + supplier @48 + vertices (list Points + (3622, 905) + (4681, 905) + (4681, 1688)) + line_style 3 + origin_attachment (3622, 905) + terminal_attachment (4681, 1688)))) + (object RealizeView "" @118 + stereotype TRUE + line_color 3342489 + quidu "3F61E307009E" + client @36 + supplier @99 + vertices (list Points + (210, 1520) + (210, 1219) + (1275, 1219) + (1275, 965)) + line_style 3 + origin_attachment (210, 1520) + terminal_attachment (1275, 965)) + (object ClassView "Class" "Logical View::RStringDictionaryCollection" @119 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (5536, 3808) + label (object ItemLabel + Parent_View @119 + location (5119, 3681) + fill_color 13434879 + nlines 1 + max_width 834 + justify 0 + label "RStringDictionaryCollection") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D84681B018F" + width 852 + height 295 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$21" @120 + location (6036, 3850) + stereotype TRUE + line_color 3342489 + quidu "3D84683F003C" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$23" @121 + Parent_View @120 + location (2468, 2842) + label (object SegLabel @122 + Parent_View @121 + location (5977, 3892) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D84683F01F7" + client @120 + supplier @119 + line_style 3 + origin_attachment (6036, 3850) + terminal_attachment (5962, 3850)) + (object RoleView "$UNNAMED$22" @123 + Parent_View @120 + location (2468, 2842) + label (object SegLabel @124 + Parent_View @123 + location (6095, 3892) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D84683F01F5" + client @120 + supplier @33 + line_style 3 + origin_attachment (6036, 3850) + terminal_attachment (6110, 3850)))) + (object AssociationViewNew "$UNNAMED$33" @125 + location (1547, 3880) + stereotype TRUE + line_color 3342489 + quidu "3D8F25600346" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$35" @126 + Parent_View @125 + location (-1349, 3624) + label (object SegLabel @127 + Parent_View @126 + location (454, 2166) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D8F25610170" + client @125 + supplier @36 + vertices (list Points + (1547, 3880) + (412, 3880) + (412, 1600) + (265, 1600)) + line_style 3 + origin_attachment (1547, 3880) + terminal_attachment (265, 1600)) + (object RoleView "$UNNAMED$34" @128 + Parent_View @125 + location (-1349, 3624) + label (object SegLabel @129 + Parent_View @128 + location (4396, 3839) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D8F2561015C" + client @125 + supplier @119 + line_style 3 + origin_attachment (1547, 3880) + terminal_attachment (5110, 3880)))) + (object AssociationViewNew "$UNNAMED$48" @130 + location (5031, 2800) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1DA019C" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$49" @131 + Parent_View @130 + location (23, -1360) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1DB00A2" + client @130 + supplier @119 + vertices (list Points + (5031, 2800) + (5031, 3687) + (5110, 3687)) + line_style 3 + origin_attachment (5031, 2800) + terminal_attachment (5110, 3687)) + (object RoleView "$UNNAMED$50" @132 + Parent_View @130 + location (23, -1360) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1DB00A3" + client @130 + supplier @48 + vertices (list Points + (5031, 2800) + (5031, 1937) + (4928, 1937)) + line_style 3 + origin_attachment (5031, 2800) + terminal_attachment (4928, 1937)))) + (object AssociationViewNew "$UNNAMED$91" @133 + location (6036, 3725) + stereotype TRUE + line_color 3342489 + quidu "3F337AA30083" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$92" @134 + Parent_View @133 + location (324, -115) + stereotype TRUE + line_color 3342489 + quidu "3F337AA30248" + client @133 + supplier @35 + line_style 3 + origin_attachment (6036, 3725) + terminal_attachment (6110, 3725)) + (object RoleView "$UNNAMED$93" @135 + Parent_View @133 + location (324, -115) + stereotype TRUE + line_color 3342489 + quidu "3F337AA30249" + client @133 + supplier @119 + line_style 3 + origin_attachment (6036, 3725) + terminal_attachment (5962, 3725)))) + (object AssociationViewNew "$UNNAMED$85" @136 + location (3532, 3321) + stereotype TRUE + line_color 3342489 + quidu "3F31261202D5" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$86" @137 + Parent_View @136 + location (-260, 1609) + stereotype TRUE + line_color 3342489 + quidu "3F3126130313" + client @136 + supplier @119 + vertices (list Points + (3532, 3321) + (3532, 3805) + (5110, 3805)) + line_style 3 + origin_attachment (3532, 3321) + terminal_attachment (5110, 3805)) + (object RoleView "$UNNAMED$87" @138 + Parent_View @136 + location (-260, 1609) + stereotype TRUE + line_color 3342489 + quidu "3F3126130314" + client @136 + supplier @65 + vertices (list Points + (3532, 3321) + (3532, 1655) + (3136, 1655)) + line_style 3 + origin_attachment (3532, 3321) + terminal_attachment (3136, 1655)))) + (object ClassView "Class" "Logical View::RElementStack" @139 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4240, 1376) + label (object ItemLabel + Parent_View @139 + location (3999, 1302) + fill_color 13434879 + nlines 1 + max_width 483 + justify 0 + label "RElementStack") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9827CB0143" + width 501 + height 188 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$62" @140 + location (4625, 1458) + stereotype TRUE + line_color 3342489 + quidu "3F30F97E0352" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$63" @141 + Parent_View @140 + location (-207, -334) + stereotype TRUE + line_color 3342489 + quidu "3F30F97F00B2" + client @140 + supplier @139 + vertices (list Points + (4625, 1458) + (4625, 1362) + (4490, 1362)) + line_style 3 + origin_attachment (4625, 1458) + terminal_attachment (4490, 1362)) + (object RoleView "$UNNAMED$64" @142 + Parent_View @140 + location (-207, -334) + stereotype TRUE + line_color 3342489 + quidu "3F30F97F00B3" + client @140 + supplier @48 + line_style 3 + origin_attachment (4625, 1458) + terminal_attachment (4625, 1688)))) + (object AssociationViewNew "$UNNAMED$51" @143 + location (3563, 1362) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1F20064" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$52" @144 + Parent_View @143 + location (-1445, -2798) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1F301DB" + client @143 + supplier @139 + line_style 3 + origin_attachment (3563, 1362) + terminal_attachment (3990, 1362)) + (object RoleView "$UNNAMED$53" @145 + Parent_View @143 + location (-1445, -2798) + stereotype TRUE + line_color 3342489 + quidu "3F2FF1F301DC" + client @143 + supplier @65 + line_style 3 + origin_attachment (3563, 1362) + terminal_attachment (3136, 1362)))) + (object ClassView "Class" "Logical View::CAutoCorrector" @146 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1424, 2784) + label (object ItemLabel + Parent_View @146 + location (1176, 2747) + fill_color 13434879 + nlines 1 + max_width 496 + justify 0 + label "CAutoCorrector") + stereotype (object ItemLabel + Parent_View @146 + location (1176, 2697) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 496 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C6B836E0190" + width 514 + height 210 + annotation 8 + autoResize TRUE) + (object RealizeView "" @147 + stereotype TRUE + line_color 3342489 + quidu "3F61E372035D" + client @146 + supplier @34 + line_style 3 + origin_attachment (1450, 2679) + terminal_attachment (1450, 2516)) + (object ClassView "Class" "Logical View::CValidator" @148 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (928, 2784) + label (object ItemLabel + Parent_View @148 + location (762, 2747) + fill_color 13434879 + nlines 1 + max_width 332 + justify 0 + label "CValidator") + stereotype (object ItemLabel + Parent_View @148 + location (762, 2697) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 332 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C5ACAC701D9" + width 350 + height 210 + annotation 8 + autoResize TRUE) + (object RealizeView "" @149 + stereotype TRUE + line_color 3342489 + quidu "3F61E36B03BB" + client @148 + supplier @34 + line_style 3 + origin_attachment (1100, 2679) + terminal_attachment (1100, 2516)) + (object RealizeView "" @150 + stereotype TRUE + line_color 3342489 + quidu "3F61E635039C" + client @148 + supplier @91 + line_style 3 + origin_attachment (894, 2678) + terminal_attachment (894, 406)) + (object ClassView "Class" "Logical View::MGenerator" @151 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2816, 2208) + label (object ItemLabel + Parent_View @151 + location (2622, 2078) + fill_color 13434879 + nlines 1 + max_width 388 + justify 0 + label "MGenerator") + stereotype (object ItemLabel + Parent_View @151 + location (2622, 2047) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 388 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3D830AB602D4" + compartment (object Compartment + Parent_View @151 + location (2622, 2170) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 4 + max_width 256) + width 406 + height 362 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$12" @152 + location (4630, 2350) + stereotype TRUE + line_color 3342489 + quidu "3D831135036B" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$14" @153 + Parent_View @152 + location (4470, 174) + label (object SegLabel @154 + Parent_View @153 + location (3341, 2392) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D8311360132" + client @152 + supplier @151 + line_style 3 + origin_attachment (4630, 2350) + terminal_attachment (3019, 2350)) + (object RoleView "$UNNAMED$13" @155 + Parent_View @152 + location (4470, 174) + label (object SegLabel @156 + Parent_View @155 + location (5919, 2392) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D8311360128" + client @152 + supplier @30 + line_style 3 + origin_attachment (4630, 2350) + terminal_attachment (6241, 2350)))) + (object AssociationViewNew "$UNNAMED$18" @157 + location (2375, 2081) + stereotype TRUE + line_color 3342489 + quidu "3D84659C00FA" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$20" @158 + Parent_View @157 + location (503, 1377) + label (object SegLabel @159 + Parent_View @158 + location (2185, 2123) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3D84659D000D" + client @157 + supplier @31 + line_style 3 + origin_attachment (2375, 2081) + terminal_attachment (2137, 2081)) + (object RoleView "$UNNAMED$19" @160 + Parent_View @157 + location (503, 1377) + label (object SegLabel @161 + Parent_View @160 + location (2565, 2123) + hidden TRUE + anchor 1 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "" + pctDist 0.800000 + height 42 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3D84659D000B" + client @157 + supplier @151 + line_style 3 + origin_attachment (2375, 2081) + terminal_attachment (2613, 2081)))) + (object ClassView "Class" "Logical View::CWbxmlGenerator" @162 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2640, 2784) + label (object ItemLabel + Parent_View @162 + location (2350, 2743) + fill_color 13434879 + nlines 1 + max_width 580 + justify 0 + label "CWbxmlGenerator") + stereotype (object ItemLabel + Parent_View @162 + location (2350, 2699) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 580 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C4E8DB90101" + width 598 + height 210 + annotation 8 + autoResize TRUE) + (object RealizeView "" @163 + stereotype TRUE + line_color 3342489 + quidu "3F61E384007F" + client @162 + supplier @151 + line_style 3 + origin_attachment (2764, 2678) + terminal_attachment (2764, 2388)) + (object ClassView "Class" "Logical View::CXmlGenerator" @164 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (3232, 2784) + label (object ItemLabel + Parent_View @164 + location (2988, 2743) + fill_color 13434879 + nlines 1 + max_width 488 + justify 0 + label "CXmlGenerator") + stereotype (object ItemLabel + Parent_View @164 + location (2988, 2699) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 488 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C4E8DAF0125" + width 506 + height 210 + annotation 8 + autoResize TRUE) + (object RealizeView "" @165 + stereotype TRUE + line_color 3342489 + quidu "3F61E386013B" + client @164 + supplier @151 + vertices (list Points + (3064, 2679) + (3064, 2563) + (2933, 2563) + (2933, 2389)) + line_style 3 + origin_attachment (3064, 2679) + terminal_attachment (2933, 2389)) + (object ClassView "Class" "Logical View::CXmlParser" @166 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4736, 2720) + label (object ItemLabel + Parent_View @166 + location (4542, 2677) + fill_color 13434879 + nlines 1 + max_width 388 + justify 0 + label "CXmlParser") + stereotype (object ItemLabel + Parent_View @166 + location (4542, 2646) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 388 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C4D37890087" + width 406 + height 188 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::CWbxmlParser" @167 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4208, 2720) + label (object ItemLabel + Parent_View @167 + location (3969, 2690) + fill_color 13434879 + nlines 1 + max_width 478 + justify 0 + label "CWbxmlParser") + stereotype (object ItemLabel + Parent_View @167 + location (3969, 2646) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 478 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 32768 + quidu "3C4D379A01C1" + width 496 + height 188 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::TContentProcessorInitParams" @168 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (4448, 3200) + label (object ItemLabel + Parent_View @168 + location (3988, 3052) + fill_color 13434879 + nlines 1 + max_width 920 + justify 0 + label "TContentProcessorInitParams") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3F31176700A2" + width 938 + height 337 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$82" @169 + location (3738, 2137) + stereotype TRUE + line_color 3342489 + quidu "3F31179F0361" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$83" @170 + Parent_View @169 + location (-54, 425) + stereotype TRUE + line_color 3342489 + quidu "3F3117A000C1" + client @169 + supplier @168 + vertices (list Points + (3738, 2137) + (3738, 3074) + (3979, 3074)) + line_style 3 + origin_attachment (3738, 2137) + terminal_attachment (3979, 3074)) + (object RoleView "$UNNAMED$84" @171 + Parent_View @169 + location (-54, 425) + stereotype TRUE + line_color 3342489 + quidu "3F3117A000C2" + client @169 + supplier @65 + vertices (list Points + (3738, 2137) + (3738, 1561) + (3136, 1561)) + line_style 3 + origin_attachment (3738, 2137) + terminal_attachment (3136, 1561)))) + (object AssociationViewNew "$UNNAMED$100" @172 + location (4963, 3534) + stereotype TRUE + line_color 3342489 + quidu "421B0507012B" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$101" @173 + Parent_View @172 + location (531, 382) + stereotype TRUE + line_color 3342489 + quidu "421B0507036D" + client @172 + supplier @119 + vertices (list Points + (4963, 3534) + (4963, 3737) + (5110, 3737)) + line_style 3 + origin_attachment (4963, 3534) + terminal_attachment (5110, 3737)) + (object RoleView "$UNNAMED$102" @174 + Parent_View @172 + location (531, 382) + stereotype TRUE + line_color 3342489 + quidu "421B0507036E" + client @172 + supplier @168 + vertices (list Points + (4963, 3534) + (4963, 3231) + (4917, 3231)) + line_style 3 + origin_attachment (4963, 3534) + terminal_attachment (4917, 3231)))) + (object AssociationViewNew "$UNNAMED$103" @175 + location (3844, 2212) + stereotype TRUE + line_color 3342489 + quidu "421B05370070" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$104" @176 + Parent_View @175 + location (-588, -940) + stereotype TRUE + line_color 3342489 + quidu "421B05380012" + client @175 + supplier @139 + vertices (list Points + (3844, 2212) + (3844, 1406) + (3990, 1406)) + line_style 3 + origin_attachment (3844, 2212) + terminal_attachment (3990, 1406)) + (object RoleView "$UNNAMED$105" @177 + Parent_View @175 + location (-588, -940) + stereotype TRUE + line_color 3342489 + quidu "421B05380013" + client @175 + supplier @168 + vertices (list Points + (3844, 2212) + (3844, 3030) + (3979, 3030)) + line_style 3 + origin_attachment (3844, 2212) + terminal_attachment (3979, 3030)))) + (object AssociationViewNew "$UNNAMED$106" @178 + location (2572, 3275) + stereotype TRUE + line_color 3342489 + quidu "421B06010217" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$107" @179 + Parent_View @178 + location (1148, 491) + stereotype TRUE + line_color 3342489 + quidu "421B060201D9" + client @178 + supplier @168 + line_style 3 + origin_attachment (2572, 3275) + terminal_attachment (3979, 3275)) + (object RoleView "$UNNAMED$108" @180 + Parent_View @178 + location (1148, 491) + stereotype TRUE + line_color 3342489 + quidu "421B060201DA" + client @178 + supplier @146 + vertices (list Points + (2572, 3275) + (1551, 3275) + (1551, 2889)) + line_style 3 + origin_attachment (2572, 3275) + terminal_attachment (1551, 2889)))) + (object AssociationViewNew "$UNNAMED$109" @181 + location (2275, 3331) + stereotype TRUE + line_color 3342489 + quidu "421B06050023" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$110" @182 + Parent_View @181 + location (1347, 547) + stereotype TRUE + line_color 3342489 + quidu "421B0605035F" + client @181 + supplier @168 + line_style 3 + origin_attachment (2275, 3331) + terminal_attachment (3979, 3331)) + (object RoleView "$UNNAMED$111" @183 + Parent_View @181 + location (1347, 547) + stereotype TRUE + line_color 3342489 + quidu "421B06050360" + client @181 + supplier @148 + vertices (list Points + (2275, 3331) + (1013, 3331) + (1013, 2889)) + line_style 3 + origin_attachment (2275, 3331) + terminal_attachment (1013, 2889)))) + (object AssociationViewNew "$UNNAMED$115" @184 + location (3554, 3123) + stereotype TRUE + line_color 3342489 + quidu "421B07680064" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$116" @185 + Parent_View @184 + location (386, 339) + stereotype TRUE + line_color 3342489 + quidu "421B076802B6" + client @184 + supplier @168 + line_style 3 + origin_attachment (3554, 3123) + terminal_attachment (3979, 3123)) + (object RoleView "$UNNAMED$117" @186 + Parent_View @184 + location (386, 339) + stereotype TRUE + line_color 3342489 + quidu "421B076802C5" + client @184 + supplier @164 + vertices (list Points + (3554, 3123) + (3363, 3123) + (3363, 2889)) + line_style 3 + origin_attachment (3554, 3123) + terminal_attachment (3427, 2889)))) + (object AssociationViewNew "$UNNAMED$112" @187 + location (3232, 3181) + stereotype TRUE + line_color 3342489 + quidu "421B076500D1" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$113" @188 + Parent_View @187 + location (656, 397) + stereotype TRUE + line_color 3342489 + quidu "421B07650371" + client @187 + supplier @168 + line_style 3 + origin_attachment (3232, 3181) + terminal_attachment (3979, 3181)) + (object RoleView "$UNNAMED$114" @189 + Parent_View @187 + location (656, 397) + stereotype TRUE + line_color 3342489 + quidu "421B07650372" + client @187 + supplier @162 + vertices (list Points + (3232, 3181) + (2776, 3181) + (2776, 2889)) + line_style 3 + origin_attachment (3232, 3181) + terminal_attachment (2840, 2889)))) + (object AssociationViewNew "$UNNAMED$97" @190 + location (2282, 2644) + stereotype TRUE + line_color 3342489 + quidu "421B0453008E" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$98" @191 + Parent_View @190 + location (778, 2100) + stereotype TRUE + line_color 3342489 + quidu "421B045501B7" + client @190 + supplier @168 + vertices (list Points + (2282, 2644) + (2282, 3230) + (3979, 3230)) + line_style 3 + origin_attachment (2282, 2644) + terminal_attachment (3979, 3230)) + (object RoleView "$UNNAMED$99" @192 + Parent_View @190 + location (778, 2100) + stereotype TRUE + line_color 3342489 + quidu "421B045501C6" + client @190 + supplier @99 + vertices (list Points + (2282, 2644) + (2282, 862) + (1781, 862)) + line_style 3 + origin_attachment (2282, 2644) + terminal_attachment (1781, 862)))) + (object AssociationViewNew "$UNNAMED$118" @193 + location (5000, 2969) + stereotype TRUE + line_color 3342489 + quidu "421B099A029A" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$119" @194 + Parent_View @193 + location (280, 281) + stereotype TRUE + line_color 3342489 + quidu "421B099B0068" + client @193 + supplier @168 + vertices (list Points + (5000, 2969) + (5000, 3180) + (4917, 3180)) + line_style 3 + origin_attachment (5000, 2969) + terminal_attachment (4917, 3180)) + (object RoleView "$UNNAMED$120" @195 + Parent_View @193 + location (280, 281) + stereotype TRUE + line_color 3342489 + quidu "421B099B0077" + client @193 + supplier @166 + vertices (list Points + (5000, 2969) + (5000, 2737) + (4939, 2737)) + line_style 3 + origin_attachment (5000, 2969) + terminal_attachment (4939, 2737)))) + (object AssociationViewNew "$UNNAMED$121" @196 + location (4508, 2844) + stereotype TRUE + line_color 3342489 + quidu "421B099D0336" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$122" @197 + Parent_View @196 + location (268, 156) + stereotype TRUE + line_color 3342489 + quidu "421B099E0162" + client @196 + supplier @168 + vertices (list Points + (4508, 2844) + (4957, 2844) + (4957, 3130) + (4917, 3130)) + line_style 3 + origin_attachment (4508, 2844) + terminal_attachment (4917, 3130)) + (object RoleView "$UNNAMED$123" @198 + Parent_View @196 + location (268, 156) + stereotype TRUE + line_color 3342489 + quidu "421B099E0163" + client @196 + supplier @167 + vertices (list Points + (4508, 2844) + (3894, 2844) + (3894, 2749) + (3960, 2749)) + line_style 3 + origin_attachment (4508, 2844) + terminal_attachment (3960, 2749)))) + (object RealizeView "" @199 + stereotype TRUE + line_color 3342489 + quidu "3F61E3B40283" + client @166 + supplier @48 + line_style 3 + origin_attachment (4813, 2626) + terminal_attachment (4813, 1992)) + (object InheritView "" @200 + stereotype TRUE + line_color 3342489 + quidu "4219F8F703BA" + client @48 + supplier @98 + line_style 3 + origin_attachment (4894, 1687) + terminal_attachment (4894, 743)) + (object InheritView "" @201 + stereotype TRUE + line_color 3342489 + quidu "4219F8F400EB" + client @34 + supplier @98 + vertices (list Points + (1487, 2251) + (1487, 1181) + (2994, 1181) + (2994, 844) + (4756, 844) + (4756, 743)) + line_style 3 + origin_attachment (1487, 2251) + terminal_attachment (4756, 743)) + (object InheritView "" @202 + stereotype TRUE + line_color 3342489 + quidu "3D830D6F0358" + client @34 + supplier @99 + line_style 3 + origin_attachment (1388, 2251) + terminal_attachment (1388, 965)) + (object RealizeView "" @203 + stereotype TRUE + line_color 3342489 + quidu "3F61E3B101B8" + client @167 + supplier @48 + vertices (list Points + (4313, 2626) + (4313, 2475) + (4675, 2475) + (4675, 1992)) + line_style 3 + origin_attachment (4313, 2626) + terminal_attachment (4675, 1992)) + (object RealizeView "" @204 + stereotype TRUE + line_color 3342489 + quidu "421B0E39035D" + client @167 + supplier @91 + vertices (list Points + (3981, 2626) + (3981, 1837) + (1013, 1837) + (1013, 407)) + line_style 3 + origin_attachment (3981, 2626) + terminal_attachment (1013, 407)) + (object InheritView "" @205 + stereotype TRUE + line_color 3342489 + quidu "3F17DCB900AB" + client @151 + supplier @99 + vertices (list Points + (2613, 2031) + (2506, 2031) + (2506, 1425) + (1581, 1425) + (1581, 965)) + line_style 3 + origin_attachment (2613, 2031) + terminal_attachment (1581, 965)))) + (object ClassDiagram "WBXML parser class diagram" + quid "3D9C4B2303AB" + title "WBXML parser class diagram" + zoom 65 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::CWbxmlParser" @206 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1680, 1744) + label (object ItemLabel + Parent_View @206 + location (1423, 1725) + fill_color 13434879 + nlines 1 + max_width 514 + justify 0 + label "CWbxmlParser") + stereotype (object ItemLabel + Parent_View @206 + location (1423, 1625) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 514 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 65280 + quidu "3C4D379A01C1" + width 532 + height 274 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::CActive" @207 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1664, 592) + label (object ItemLabel + Parent_View @207 + location (1533, 529) + fill_color 13434879 + nlines 1 + max_width 262 + justify 0 + label "CActive") + icon_style "Icon" + line_color 3342489 + fill_color 16777088 + quidu "3D830E9B00C4" + width 280 + height 164 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MContentHandler" @208 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (880, 960) + label (object ItemLabel + Parent_View @208 + location (72, 818) + fill_color 13434879 + nlines 1 + max_width 1616 + justify 0 + label "MContentHandler") + stereotype (object ItemLabel + Parent_View @208 + location (72, 802) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 1616 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3C4D3A5D02F4" + compartment (object Compartment + Parent_View @208 + location (799, 1034) + font (object Font + size 10) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 14 + max_width 0) + width 1634 + height 352 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::MStringDictionary" @209 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2736, 1296) + label (object ItemLabel + Parent_View @209 + location (2436, 1236) + fill_color 13434879 + nlines 1 + max_width 600 + justify 0 + label "MStringDictionary") + stereotype (object ItemLabel + Parent_View @209 + location (2436, 1220) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 600 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3C4EC591028F" + width 618 + height 188 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::CDescriptorDataSupplier" @210 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (464, 1760) + label (object ItemLabel + Parent_View @210 + location (93, 1686) + fill_color 13434879 + nlines 1 + max_width 743 + justify 0 + label "CDescriptorDataSupplier") + icon_style "Icon" + line_color 3342489 + fill_color 65280 + quidu "3D8311AB0108" + width 761 + height 187 + annotation 8) + (object ClassView "Class" "Logical View::RStringDictionaryCollection" @211 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2736, 880) + label (object ItemLabel + Parent_View @211 + location (2339, 804) + fill_color 13434879 + nlines 1 + max_width 794 + justify 0 + label "RStringDictionaryCollection") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D84681B018F" + width 812 + height 188 + annotation 8) + (object AssociationViewNew "$UNNAMED$21" @212 + location (2736, 1087) + stereotype TRUE + line_color 3342489 + quidu "3D84683F003C" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$22" @213 + Parent_View @212 + location (-304, -1313) + stereotype TRUE + line_color 3342489 + quidu "3D84683F01F5" + client @212 + supplier @209 + line_style 0) + (object RoleView "$UNNAMED$23" @214 + Parent_View @212 + location (-304, -1313) + stereotype TRUE + line_color 3342489 + quidu "3D84683F01F7" + client @212 + supplier @211 + line_style 0))) + (object ClassView "Class" "Logical View::MDataSource" @215 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (528, 1008) + label (object ItemLabel + Parent_View @215 + location (297, 966) + fill_color 13434879 + nlines 1 + max_width 462 + justify 0 + label "MDataSource") + stereotype (object ItemLabel + Parent_View @215 + location (297, 875) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 462 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 65535 + quidu "3C67ADA80234" + width 480 + height 302 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Use Case View::Client" @216 + ShowCompartmentStereotypes TRUE + location (1632, 192) + label (object ItemLabel + Parent_View @216 + location (1632, 352) + anchor_loc 1 + nlines 2 + max_width 678 + justify 0 + label "Client") + icon "Actor" + icon_style "Icon" + line_color 3342489 + quidu "3C67C4C3035C" + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$24" @217 + location (43, 149) + stereotype TRUE + line_color 3342489 + quidu "3D846BA40172" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$25" @218 + Parent_View @217 + location (-1589, -43) + stereotype TRUE + line_color 3342489 + quidu "3D846BA500DD" + client @217 + supplier @210 + vertices (list Points + (43, 149) + (43, 1518) + (300, 1666)) + line_style 0) + (object RoleView "$UNNAMED$26" @219 + Parent_View @217 + location (-1589, -43) + stereotype TRUE + line_color 3342489 + quidu "3D846BA500DF" + client @217 + supplier @216 + vertices (list Points + (43, 149) + (43, 29) + (1014, 29) + (1571, 174)) + line_style 0))) + (object AssociationViewNew "$UNNAMED$33" @220 + location (2137, 505) + stereotype TRUE + line_color 3342489 + quidu "3D8F25600346" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$34" @221 + Parent_View @220 + location (505, 313) + stereotype TRUE + line_color 3342489 + quidu "3D8F2561015C" + client @220 + supplier @211 + line_style 0) + (object RoleView "$UNNAMED$35" @222 + Parent_View @220 + location (505, 313) + stereotype TRUE + line_color 3342489 + quidu "3D8F25610170" + client @220 + supplier @216 + line_style 0))) + (object ClassView "Class" "Logical View::MParser" @223 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1680, 1296) + label (object ItemLabel + Parent_View @223 + location (1286, 1234) + fill_color 13434879 + nlines 1 + max_width 788 + justify 0 + label "MParser") + stereotype (object ItemLabel + Parent_View @223 + location (1286, 1218) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 788 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3D830A9C0344" + width 806 + height 192 + annotation 8 + autoResize TRUE) + (object InheritTreeView "" @224 + location (1680, 1482) + line_color 3342489 + fill_color 13434879 + supplier @223 + vertices (list Points + (1680, 1482) + (1680, 1392))) + (object AssociationViewNew "$UNNAMED$9" @225 + location (1032, 1133) + stereotype TRUE + line_color 3342489 + quidu "3D8310F4033F" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$10" @226 + Parent_View @225 + location (-792, -531) + stereotype TRUE + line_color 3342489 + quidu "3D8310F502A1" + client @225 + supplier @215 + line_style 0) + (object RoleView "$UNNAMED$11" @227 + Parent_View @225 + location (-792, -531) + stereotype TRUE + line_color 3342489 + quidu "3D8310F502AB" + client @225 + supplier @223 + line_style 0))) + (object ClassView "Class" "Logical View::RParser" @228 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + location (3280, 185) + label (object ItemLabel + Parent_View @228 + location (2977, 109) + fill_color 13434879 + nlines 1 + max_width 607 + justify 0 + label "RParser") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D83093B0288" + width 625 + height 188 + annotation 8) + (object AssociationViewNew "$UNNAMED$27" @229 + location (2328, 186) + stereotype TRUE + line_color 3342489 + quidu "3D846DD101B9" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$28" @230 + Parent_View @229 + location (696, -6) + stereotype TRUE + line_color 3342489 + quidu "3D846DD103C2" + client @229 + supplier @228 + line_style 0) + (object RoleView "$UNNAMED$29" @231 + Parent_View @229 + location (696, -6) + stereotype TRUE + line_color 3342489 + quidu "3D846DD103C4" + client @229 + supplier @216 + line_style 0))) + (object AssociationViewNew "$UNNAMED$15" @232 + location (3197, 1855) + stereotype TRUE + line_color 3342489 + quidu "3D8465900156" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$16" @233 + Parent_View @232 + location (1373, 895) + stereotype TRUE + line_color 3342489 + quidu "3D8465910017" + client @232 + supplier @223 + vertices (list Points + (3197, 1855) + (2139, 1855) + (1758, 1392)) + line_style 0) + (object RoleView "$UNNAMED$17" @234 + Parent_View @232 + location (1373, 895) + stereotype TRUE + line_color 3342489 + quidu "3D8465910021" + client @232 + supplier @228 + vertices (list Points + (3197, 1855) + (3278, 1855) + (3279, 279)) + line_style 0))) + (object InheritView "" @235 + stereotype TRUE + line_color 3342489 + quidu "3D830B3B0271" + client @206 + supplier @223 + line_style 3 + origin_attachment (1680, 1607) + terminal_attachment (1680, 1482) + drawSupplier @224) + (object InheritView "" @236 + stereotype TRUE + line_color 3342489 + quidu "3D8311FF01B3" + client @210 + supplier @215 + line_style 0) + (object InheritView "" @237 + stereotype TRUE + line_color 3342489 + quidu "3D830E86018C" + client @216 + supplier @208 + line_style 0))) + (object InteractionDiagram "Seting up parser & generator" + mechanism_ref @10 + quid "3C67C46E007E" + title "Seting up parser & generator" + zoom 55 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 1500 + items (list diagram_item_list + (object InterObjView "$UNNAMED$124" @238 + location (144, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @238 + location (144, 260) + anchor_loc 1 + nlines 2 + max_width 360 + justify 0 + label "") + icon "Actor" + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C67C500010B" + width 336 + height 5733 + icon_height 162 + icon_width 120 + icon_y_offset 1 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @239 + location (144, 608) + line_color 3342489 + InterObjView @238 + height 244 + y_coord 184 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @240 + location (144, 1040) + line_color 3342489 + InterObjView @238 + height 244 + y_coord 184 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @241 + location (144, 1728) + line_color 3342489 + InterObjView @238 + height 320 + y_coord 260 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @242 + location (144, 1968) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @243 + location (144, 2256) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @244 + location (144, 2496) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @245 + location (144, 2752) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @246 + location (144, 3008) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @247 + location (144, 3328) + line_color 3342489 + InterObjView @238 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @248 + location (144, 3696) + line_color 3342489 + InterObjView @238 + height 2172 + y_coord 2112 + Nested FALSE)) + (object InterObjView "$UNNAMED$128" @249 + location (960, 256) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @249 + location (960, 256) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 596 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9AE9A703CA" + width 614 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @250 + location (960, 608) + line_color 3342489 + InterObjView @249 + height 184 + y_coord 124 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @251 + location (960, 1728) + line_color 3342489 + InterObjView @249 + height 260 + y_coord 200 + Nested FALSE)) + (object InterObjView "$UNNAMED$129" @252 + location (1632, 256) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @252 + location (1632, 256) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 814 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9AEBF801C4" + width 832 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @253 + location (1632, 1040) + line_color 3342489 + InterObjView @252 + height 184 + y_coord 124 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @254 + location (1632, 3696) + line_color 3342489 + InterObjView @252 + height 544 + y_coord 484 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @255 + location (1632, 4144) + line_color 3342489 + InterObjView @252 + height 512 + y_coord 452 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @256 + location (1632, 4560) + line_color 3342489 + InterObjView @252 + height 464 + y_coord 404 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @257 + location (1632, 4960) + line_color 3342489 + InterObjView @252 + height 462 + y_coord 402 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @258 + location (1632, 5360) + line_color 3342489 + InterObjView @252 + height 448 + y_coord 388 + Nested TRUE)) + (object InterObjView "$UNNAMED$127" @259 + location (3024, 256) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @259 + location (3024, 256) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 466 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C6A4BBC0088" + width 484 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @260 + location (3024, 1872) + line_color 3342489 + InterObjView @259 + height 276 + y_coord 216 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @261 + location (3024, 2192) + line_color 3342489 + InterObjView @259 + height 244 + y_coord 184 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @262 + location (3024, 2448) + line_color 3342489 + InterObjView @259 + height 228 + y_coord 168 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @263 + location (3024, 2704) + line_color 3342489 + InterObjView @259 + height 228 + y_coord 168 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @264 + location (3024, 2960) + line_color 3342489 + InterObjView @259 + height 228 + y_coord 168 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @265 + location (3024, 3232) + line_color 3342489 + InterObjView @259 + height 276 + y_coord 216 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @266 + location (3024, 3856) + line_color 3342489 + InterObjView @259 + height 264 + y_coord 204 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @267 + location (3024, 4320) + line_color 3342489 + InterObjView @259 + height 216 + y_coord 156 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @268 + location (3024, 4704) + line_color 3342489 + InterObjView @259 + height 200 + y_coord 140 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @269 + location (3024, 5088) + line_color 3342489 + InterObjView @259 + height 214 + y_coord 154 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @270 + location (3024, 5488) + line_color 3342489 + InterObjView @259 + height 200 + y_coord 140 + Nested FALSE)) + (object InterObjView "$UNNAMED$125" @271 + location (3664, 256) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @271 + location (3664, 256) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 705 + justify 0 + label "") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3C67C790015E" + width 723 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @272 + location (3664, 672) + line_color 3342489 + InterObjView @271 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @273 + location (3664, 1776) + line_color 3342489 + InterObjView @271 + height 152 + y_coord 92 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @274 + location (3664, 1808) + line_color 3342489 + InterObjView @271 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @275 + location (3664, 1872) + line_color 3342489 + InterObjView @271 + height 1696 + y_coord 1636 + Nested FALSE)) + (object InterObjView "$UNNAMED$126" @276 + location (4448, 240) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @276 + location (4448, 240) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 824 + justify 0 + label "") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3C67C7B301A4" + width 842 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @277 + location (4448, 1104) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @278 + location (4448, 3712) + line_color 3342489 + InterObjView @276 + height 468 + y_coord 408 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @279 + location (4448, 4000) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @280 + location (4448, 4224) + line_color 3342489 + InterObjView @276 + height 372 + y_coord 312 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @281 + location (4448, 4416) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @282 + location (4448, 4608) + line_color 3342489 + InterObjView @276 + height 356 + y_coord 296 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @283 + location (4448, 4784) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @284 + location (4448, 5008) + line_color 3342489 + InterObjView @276 + height 354 + y_coord 294 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @285 + location (4448, 5182) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @286 + location (4448, 5408) + line_color 3342489 + InterObjView @276 + height 340 + y_coord 280 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @287 + location (4448, 5568) + line_color 3342489 + InterObjView @276 + height 60 + y_coord 0 + Nested TRUE)) + (object SelfMessView "" @288 + location (16, 1808) + label (object SegLabel @289 + Parent_View @288 + location (3959, 1778) + quidu "3C67CA1701B8" + anchor_loc 1 + nlines 1 + max_width 273 + justify 0 + label "RunL( )" + pctDist 1.860000 + height 31 + orientation 0) + line_color 3342489 + client @271 + supplier @271 + Focus_Src @273 + Focus_Entry @274 + origin (3680, 1808) + terminus (3830, 1808) + ordinal 6) + (object NoteView @290 + location (512, 1504) + label (object ItemLabel + Parent_View @290 + location (226, 1419) + fill_color 13434879 + nlines 2 + max_width 536 + label "Parsing begins") + line_color 3342489 + fill_color 13434879 + width 596 + height 183) + (object NoteView @291 + location (480, 3824) + label (object ItemLabel + Parent_View @291 + location (228, 3729) + fill_color 13434879 + nlines 2 + max_width 468 + label "Generate document") + line_color 3342489 + fill_color 13434879 + width 528 + height 202) + (object InterMessView "" @292 + location (16, 1872) + label (object SegLabel @293 + Parent_View @292 + location (3344, 1828) + quidu "3C6B8E630229" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @260 + origin (3648, 1872) + terminus (3040, 1872) + ordinal 7) + (object InterMessView "" @294 + location (16, 2192) + label (object SegLabel @295 + Parent_View @294 + location (3344, 2148) + quidu "3C6B8E8203AB" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @261 + origin (3648, 2192) + terminus (3040, 2192) + ordinal 10) + (object InterMessView "" @296 + location (16, 2448) + label (object SegLabel @297 + Parent_View @296 + location (3344, 2404) + quidu "3C6B8EA30177" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @262 + origin (3648, 2448) + terminus (3040, 2448) + ordinal 13) + (object InterMessView "" @298 + location (16, 2704) + label (object SegLabel @299 + Parent_View @298 + location (3344, 2660) + quidu "3C6B8EC8024D" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @263 + origin (3648, 2704) + terminus (3040, 2704) + ordinal 16) + (object InterMessView "" @300 + location (16, 2960) + label (object SegLabel @301 + Parent_View @300 + location (3344, 2916) + quidu "3C6B8EDE0230" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @264 + origin (3648, 2960) + terminus (3040, 2960) + ordinal 19) + (object InterMessView "" @302 + location (16, 3232) + label (object SegLabel @303 + Parent_View @302 + location (3344, 3188) + quidu "3C6B8F1F02CA" + anchor_loc 1 + nlines 1 + max_width 740 + justify 0 + label "OnEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @271 + supplier @259 + Focus_Src @275 + Focus_Entry @265 + origin (3648, 3232) + terminus (3040, 3232) + ordinal 22) + (object InterMessView "" @304 + location (16, 608) + label (object SegLabel @305 + Parent_View @304 + location (543, 572) + quidu "3D9AE9F90328" + anchor_loc 1 + nlines 1 + max_width 251 + justify 0 + label "OpenL" + pctDist 0.489328 + height 37 + orientation 0) + line_color 3342489 + client @238 + supplier @249 + Focus_Src @239 + Focus_Entry @250 + origin (159, 608) + terminus (944, 608) + ordinal 0) + (object InterMessView "" @306 + location (16, 672) + label (object SegLabel @307 + Parent_View @306 + location (2318, 632) + quidu "3D9AEB1401B3" + anchor_loc 1 + nlines 1 + max_width 217 + justify 0 + label "NewL" + pctDist 0.502564 + height 41 + orientation 0) + line_color 3342489 + client @249 + supplier @271 + Focus_Src @250 + Focus_Entry @272 + origin (975, 672) + terminus (3648, 672) + ordinal 1) + (object InterMessView "" @308 + location (16, 1040) + label (object SegLabel @309 + Parent_View @308 + location (548, 979) + quidu "3D9AEC28006F" + anchor_loc 1 + nlines 1 + max_width 319 + justify 0 + label "OpenL( )" + pctDist 0.266987 + height 62 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @240 + Focus_Entry @253 + origin (159, 1040) + terminus (1616, 1040) + ordinal 2) + (object InterMessView "" @310 + location (16, 1104) + label (object SegLabel @311 + Parent_View @310 + location (2831, 1058) + quidu "3D9AEC510187" + anchor_loc 1 + nlines 1 + max_width 217 + justify 0 + label "NewL" + pctDist 0.425205 + height 47 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @253 + Focus_Entry @277 + origin (1647, 1104) + terminus (4432, 1104) + ordinal 3) + (object InterMessView "" @312 + location (16, 1728) + label (object SegLabel @313 + Parent_View @312 + location (550, 1688) + quidu "3D9AECB50306" + anchor_loc 1 + nlines 1 + max_width 183 + justify 0 + label "" + pctDist 0.499363 + height 41 + orientation 0) + line_color 3342489 + client @238 + supplier @249 + Focus_Src @241 + Focus_Entry @251 + origin (159, 1728) + terminus (944, 1728) + ordinal 4) + (object InterMessView "" @314 + location (16, 1776) + label (object SegLabel @315 + Parent_View @314 + location (2147, 1733) + quidu "3D9AECD501D6" + anchor_loc 1 + nlines 1 + max_width 251 + justify 0 + label "Start( )" + pctDist 0.438817 + height 44 + orientation 0) + line_color 3342489 + client @249 + supplier @271 + Focus_Src @251 + Focus_Entry @273 + origin (975, 1776) + terminus (3648, 1776) + ordinal 5) + (object InterMessView "" @316 + location (16, 3696) + label (object SegLabel @317 + Parent_View @316 + location (1282, 3637) + quidu "3D9AED1500AB" + anchor_loc 1 + nlines 1 + max_width 791 + justify 0 + label "BuildStartDocumentL" + pctDist 0.770762 + height 60 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @248 + Focus_Entry @254 + origin (159, 3696) + terminus (1616, 3696) + ordinal 25) + (object InterMessView "" @318 + location (16, 3712) + label (object SegLabel @319 + Parent_View @318 + location (2971, 3654) + quidu "3D9AED340395" + anchor_loc 1 + nlines 1 + max_width 859 + justify 0 + label "BuildStartDocumentL( )" + pctDist 0.475544 + height 59 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @254 + Focus_Entry @278 + origin (1647, 3712) + terminus (4432, 3712) + ordinal 26) + (object InterObjView "$UNNAMED$130" @320 + location (2352, 256) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @320 + location (2352, 256) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 675 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C67CD1C00C0" + width 693 + height 5733 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @321 + location (2352, 1936) + line_color 3342489 + InterObjView @320 + height 152 + y_coord 92 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @322 + location (2352, 2224) + line_color 3342489 + InterObjView @320 + height 152 + y_coord 92 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @323 + location (2352, 2480) + line_color 3342489 + InterObjView @320 + height 136 + y_coord 76 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @324 + location (2352, 2720) + line_color 3342489 + InterObjView @320 + height 152 + y_coord 92 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @325 + location (2352, 2992) + line_color 3342489 + InterObjView @320 + height 136 + y_coord 76 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @326 + location (2352, 3280) + line_color 3342489 + InterObjView @320 + height 168 + y_coord 108 + Nested FALSE)) + (object InterMessView "" @327 + location (16, 1936) + label (object SegLabel @328 + Parent_View @327 + location (2688, 1892) + quidu "3C6B8E6C0089" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @260 + Focus_Entry @321 + origin (3008, 1936) + terminus (2368, 1936) + ordinal 8) + (object InterMessView "" @329 + location (16, 1968) + label (object SegLabel @330 + Parent_View @329 + location (1248, 1924) + quidu "3C6B8E7400E3" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @321 + Focus_Entry @242 + origin (2336, 1968) + terminus (160, 1968) + ordinal 9) + (object InterMessView "" @331 + location (16, 2224) + label (object SegLabel @332 + Parent_View @331 + location (2688, 2180) + quidu "3C6B8E8C0002" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @261 + Focus_Entry @322 + origin (3008, 2224) + terminus (2368, 2224) + ordinal 11) + (object InterMessView "" @333 + location (16, 2256) + label (object SegLabel @334 + Parent_View @333 + location (1248, 2212) + quidu "3C6B8E9500EB" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @322 + Focus_Entry @243 + origin (2336, 2256) + terminus (160, 2256) + ordinal 12) + (object InterMessView "" @335 + location (16, 2480) + label (object SegLabel @336 + Parent_View @335 + location (2688, 2436) + quidu "3C6B8EA90194" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @262 + Focus_Entry @323 + origin (3008, 2480) + terminus (2368, 2480) + ordinal 14) + (object InterMessView "" @337 + location (16, 2496) + label (object SegLabel @338 + Parent_View @337 + location (1248, 2452) + quidu "3C6B8EB000F4" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @323 + Focus_Entry @244 + origin (2336, 2496) + terminus (160, 2496) + ordinal 15) + (object InterMessView "" @339 + location (16, 2720) + label (object SegLabel @340 + Parent_View @339 + location (2688, 2676) + quidu "3C6B8ECD0358" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @263 + Focus_Entry @324 + origin (3008, 2720) + terminus (2368, 2720) + ordinal 17) + (object InterMessView "" @341 + location (16, 2752) + label (object SegLabel @342 + Parent_View @341 + location (1248, 2708) + quidu "3C6B8ED5020F" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @324 + Focus_Entry @245 + origin (2336, 2752) + terminus (160, 2752) + ordinal 18) + (object InterMessView "" @343 + location (16, 2992) + label (object SegLabel @344 + Parent_View @343 + location (2688, 2948) + quidu "3C6B8EF50283" + anchor_loc 1 + nlines 1 + max_width 603 + justify 0 + label "OnEndElementL" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @264 + Focus_Entry @325 + origin (3008, 2992) + terminus (2368, 2992) + ordinal 20) + (object InterMessView "" @345 + location (16, 3008) + label (object SegLabel @346 + Parent_View @345 + location (1248, 2964) + quidu "3C6B8F0300A3" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @325 + Focus_Entry @246 + origin (2336, 3008) + terminus (160, 3008) + ordinal 21) + (object InterMessView "" @347 + location (16, 3280) + label (object SegLabel @348 + Parent_View @347 + location (2688, 3236) + quidu "3C6B8F320119" + anchor_loc 1 + nlines 1 + max_width 740 + justify 0 + label "OnEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @259 + supplier @320 + Focus_Src @265 + Focus_Entry @326 + origin (3008, 3280) + terminus (2368, 3280) + ordinal 23) + (object InterMessView "" @349 + location (16, 3328) + label (object SegLabel @350 + Parent_View @349 + location (1248, 3284) + quidu "3C6B8F3E0044" + anchor_loc 1 + nlines 1 + max_width 740 + justify 0 + label "OnEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @320 + supplier @238 + Focus_Src @326 + Focus_Entry @247 + origin (2336, 3328) + terminus (160, 3328) + ordinal 24) + (object InterMessView "" @351 + location (896, 4144) + label (object SegLabel @352 + Parent_View @351 + location (887, 4100) + quidu "3D9AED94032F" + anchor_loc 1 + nlines 1 + max_width 791 + justify 0 + label "BuildStartElementL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @248 + Focus_Entry @255 + origin (159, 4144) + terminus (1616, 4144) + ordinal 29) + (object InterMessView "" @353 + location (3056, 4224) + label (object SegLabel @354 + Parent_View @353 + location (3038, 4181) + quidu "3D9AEDAD010E" + anchor_loc 1 + nlines 1 + max_width 791 + justify 0 + label "BuildStartElementL( )" + pctDist 0.499820 + height 44 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @255 + Focus_Entry @280 + origin (1647, 4224) + terminus (4432, 4224) + ordinal 30) + (object InterMessView "" @355 + location (3744, 3856) + label (object SegLabel @356 + Parent_View @355 + location (3736, 3815) + quidu "3D9AEDBE00D6" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 42 + orientation 1) + line_color 3342489 + client @276 + supplier @259 + Focus_Src @278 + Focus_Entry @266 + origin (4432, 3856) + terminus (3040, 3856) + ordinal 27) + (object InterMessView "" @357 + location (3760, 4000) + label (object SegLabel @358 + Parent_View @357 + location (3723, 3957) + quidu "3D9AEDDA0090" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.491744 + height 44 + orientation 0) + line_color 3342489 + client @259 + supplier @276 + Focus_Src @266 + Focus_Entry @279 + origin (3039, 4000) + terminus (4432, 4000) + ordinal 28) + (object InterMessView "" @359 + location (3744, 4320) + label (object SegLabel @360 + Parent_View @359 + location (3736, 4276) + quidu "3D9AEDF40124" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @276 + supplier @259 + Focus_Src @280 + Focus_Entry @267 + origin (4432, 4320) + terminus (3040, 4320) + ordinal 31) + (object InterMessView "" @361 + location (3744, 4416) + label (object SegLabel @362 + Parent_View @361 + location (3735, 4372) + quidu "3D9AEE0403BC" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @259 + supplier @276 + Focus_Src @267 + Focus_Entry @281 + origin (3039, 4416) + terminus (4432, 4416) + ordinal 32) + (object InterMessView "" @363 + location (880, 4560) + label (object SegLabel @364 + Parent_View @363 + location (887, 4516) + quidu "3D9AEE28001A" + anchor_loc 1 + nlines 1 + max_width 597 + justify 0 + label "BuildContentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @248 + Focus_Entry @256 + origin (159, 4560) + terminus (1616, 4560) + ordinal 33) + (object InterMessView "" @365 + location (16, 4608) + label (object SegLabel @366 + Parent_View @365 + location (3039, 4564) + quidu "3D9AEE38003B" + anchor_loc 1 + nlines 1 + max_width 597 + justify 0 + label "BuildContentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @256 + Focus_Entry @282 + origin (1647, 4608) + terminus (4432, 4608) + ordinal 34) + (object InterMessView "" @367 + location (3744, 4704) + label (object SegLabel @368 + Parent_View @367 + location (3736, 4660) + quidu "3D9AEE4F00A3" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @276 + supplier @259 + Focus_Src @282 + Focus_Entry @268 + origin (4432, 4704) + terminus (3040, 4704) + ordinal 35) + (object InterMessView "" @369 + location (3744, 4784) + label (object SegLabel @370 + Parent_View @369 + location (3735, 4740) + quidu "3D9AEE570325" + anchor_loc 1 + nlines 1 + max_width 506 + justify 0 + label "OnContentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @259 + supplier @276 + Focus_Src @268 + Focus_Entry @283 + origin (3039, 4784) + terminus (4432, 4784) + ordinal 36) + (object InterMessView "" @371 + location (16, 4960) + label (object SegLabel @372 + Parent_View @371 + location (887, 4916) + quidu "3D9AEF260020" + anchor_loc 1 + nlines 1 + max_width 762 + justify 0 + label "BuildEndElementL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @248 + Focus_Entry @257 + origin (159, 4960) + terminus (1616, 4960) + ordinal 37) + (object InterMessView "" @373 + location (16, 5008) + label (object SegLabel @374 + Parent_View @373 + location (3039, 4964) + quidu "3D9AEF320302" + anchor_loc 1 + nlines 1 + max_width 762 + justify 0 + label "BuildEndElementL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @257 + Focus_Entry @284 + origin (1647, 5008) + terminus (4432, 5008) + ordinal 38) + (object InterMessView "" @375 + location (3744, 5088) + label (object SegLabel @376 + Parent_View @375 + location (3736, 5044) + quidu "3D9AEF4E00E5" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @276 + supplier @259 + Focus_Src @284 + Focus_Entry @269 + origin (4432, 5088) + terminus (3040, 5088) + ordinal 39) + (object InterMessView "" @377 + location (3735, 5182) + label (object SegLabel @378 + Parent_View @377 + location (3735, 5138) + quidu "3D9AEF5F0307" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @259 + supplier @276 + Focus_Src @269 + Focus_Entry @285 + origin (3039, 5182) + terminus (4432, 5182) + ordinal 40) + (object InterMessView "" @379 + location (16, 5360) + label (object SegLabel @380 + Parent_View @379 + location (887, 5316) + quidu "3D9AEF7B0108" + anchor_loc 1 + nlines 1 + max_width 830 + justify 0 + label "BuildEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @238 + supplier @252 + Focus_Src @248 + Focus_Entry @258 + origin (159, 5360) + terminus (1616, 5360) + ordinal 41) + (object InterMessView "" @381 + location (16, 5408) + label (object SegLabel @382 + Parent_View @381 + location (3039, 5364) + quidu "3D9AEF8702BE" + anchor_loc 1 + nlines 1 + max_width 830 + justify 0 + label "BuildEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @252 + supplier @276 + Focus_Src @258 + Focus_Entry @286 + origin (1647, 5408) + terminus (4432, 5408) + ordinal 42) + (object InterMessView "" @383 + location (3744, 5488) + label (object SegLabel @384 + Parent_View @383 + location (3736, 5444) + quidu "3D9AEF90025D" + anchor_loc 1 + nlines 1 + max_width 740 + justify 0 + label "OnEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @276 + supplier @259 + Focus_Src @286 + Focus_Entry @270 + origin (4432, 5488) + terminus (3040, 5488) + ordinal 43) + (object InterMessView "" @385 + location (3744, 5568) + label (object SegLabel @386 + Parent_View @385 + location (3735, 5524) + quidu "3D9AEFA1026B" + anchor_loc 1 + nlines 1 + max_width 740 + justify 0 + label "OnEndDocumentL( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @259 + supplier @276 + Focus_Src @270 + Focus_Entry @287 + origin (3039, 5568) + terminus (4432, 5568) + ordinal 44))) + (object InteractionDiagram "Validation Error & Correction" + mechanism_ref @11 + quid "3C6B9756033C" + title "Validation Error & Correction" + zoom 55 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object InterObjView "$UNNAMED$131" @387 + location (176, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @387 + location (176, 309) + anchor_loc 1 + nlines 2 + max_width 360 + justify 0 + label "") + icon "Actor" + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C6B975A0284" + width 336 + height 2025 + icon_height 162 + icon_width 120 + icon_y_offset -48 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @388 + location (176, 496) + line_color 3342489 + InterObjView @387 + height 228 + y_coord 168 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @389 + location (176, 784) + line_color 3342489 + InterObjView @387 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @390 + location (176, 1696) + line_color 3342489 + InterObjView @387 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @391 + location (176, 1808) + line_color 3342489 + InterObjView @387 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @392 + location (176, 1920) + line_color 3342489 + InterObjView @387 + height 60 + y_coord 0 + Nested FALSE)) + (object InterObjView "$UNNAMED$134" @393 + location (1664, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @393 + location (1664, 224) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 808 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C6B976A0255" + width 826 + height 2025 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @394 + location (1664, 752) + line_color 3342489 + InterObjView @393 + height 152 + y_coord 92 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @395 + location (1664, 1248) + line_color 3342489 + InterObjView @393 + height 792 + y_coord 732 + Nested FALSE)) + (object InterObjView "$UNNAMED$135" @396 + location (2512, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @396 + location (2512, 224) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 466 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C6B97810059" + width 484 + height 2025 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @397 + location (2512, 720) + line_color 3342489 + InterObjView @396 + height 244 + y_coord 184 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @398 + location (2512, 1216) + line_color 3342489 + InterObjView @396 + height 884 + y_coord 824 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @399 + location (2512, 1424) + line_color 3342489 + InterObjView @396 + height 60 + y_coord 0 + Nested TRUE) + Focus_Of_Control (object Focus_Of_Control "" @400 + location (2512, 1584) + line_color 3342489 + InterObjView @396 + height 60 + y_coord 0 + Nested TRUE)) + (object InterObjView "$UNNAMED$132" @401 + location (3520, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @401 + location (3520, 224) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 706 + justify 0 + label "") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3C6B979401DD" + width 724 + height 2025 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @402 + location (3520, 544) + line_color 3342489 + InterObjView @401 + height 60 + y_coord 0 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @403 + location (3520, 720) + line_color 3342489 + InterObjView @401 + height 304 + y_coord 244 + Nested FALSE) + Focus_Of_Control (object Focus_Of_Control "" @404 + location (3520, 1216) + line_color 3342489 + InterObjView @401 + height 944 + y_coord 884 + Nested FALSE)) + (object InterObjView "$UNNAMED$133" @405 + location (816, 224) + font (object Font + underline TRUE) + label (object ItemLabel + Parent_View @405 + location (816, 224) + fill_color 13434879 + anchor_loc 1 + nlines 2 + max_width 496 + justify 0 + label "") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3D9C33A9033B" + width 514 + height 2025 + icon_height 0 + icon_width 0 + icon_y_offset 0 + annotation 1 + Focus_Of_Control (object Focus_Of_Control "" @406 + location (816, 496) + line_color 3342489 + InterObjView @405 + height 168 + y_coord 108 + Nested FALSE)) + (object InterMessView "" @407 + location (16, 720) + label (object SegLabel @408 + Parent_View @407 + location (3016, 676) + quidu "3C6B99980186" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @401 + supplier @396 + Focus_Src @403 + Focus_Entry @397 + origin (3504, 720) + terminus (2528, 720) + ordinal 2) + (object InterMessView "" @409 + location (16, 752) + label (object SegLabel @410 + Parent_View @409 + location (2088, 708) + quidu "3C6B99A302F4" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @396 + supplier @393 + Focus_Src @397 + Focus_Entry @394 + origin (2496, 752) + terminus (1680, 752) + ordinal 3) + (object InterMessView "" @411 + location (16, 784) + label (object SegLabel @412 + Parent_View @411 + location (920, 740) + quidu "3C6B99B80236" + anchor_loc 1 + nlines 1 + max_width 768 + justify 0 + label "OnStartDocumentL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @393 + supplier @387 + Focus_Src @394 + Focus_Entry @389 + origin (1648, 784) + terminus (192, 784) + ordinal 4) + (object InterMessView "" @413 + location (16, 1216) + label (object SegLabel @414 + Parent_View @413 + location (3015, 1175) + quidu "3C6B99CF01D4" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.501420 + height 42 + orientation 1) + line_color 3342489 + client @401 + supplier @396 + Focus_Src @404 + Focus_Entry @398 + origin (3504, 1216) + terminus (2528, 1216) + ordinal 5) + (object InterMessView "" @415 + location (16, 1248) + label (object SegLabel @416 + Parent_View @415 + location (2088, 1204) + quidu "3C6B99E00192" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @396 + supplier @393 + Focus_Src @398 + Focus_Entry @395 + origin (2496, 1248) + terminus (1680, 1248) + ordinal 6) + (object NoteView @417 + location (3952, 1088) + label (object ItemLabel + Parent_View @417 + location (3686, 1009) + fill_color 13434879 + nlines 2 + max_width 497 + label "Element not valid in this possition") + line_color 3342489 + fill_color 13434879 + width 557 + height 170) + (object InterMessView "" @418 + location (16, 1424) + label (object SegLabel @419 + Parent_View @418 + location (2087, 1380) + quidu "3C6B9B9E020C" + anchor_loc 1 + nlines 1 + max_width 819 + justify 0 + label "IsChildElementValid( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @393 + supplier @396 + Focus_Src @395 + Focus_Entry @399 + origin (1679, 1424) + terminus (2496, 1424) + ordinal 7) + (object NoteView @420 + location (608, 976) + label (object ItemLabel + Parent_View @420 + location (86, 903) + fill_color 13434879 + nlines 2 + max_width 1008 + label "Parse various elements....") + line_color 3342489 + fill_color 13434879 + width 1068 + height 159) + (object InterMessView "" @421 + location (16, 1584) + label (object SegLabel @422 + Parent_View @421 + location (2072, 1555) + quidu "3C6B9CED00E1" + anchor_loc 1 + nlines 1 + max_width 819 + justify 0 + label "IsChildElementValid( )" + pctDist 0.481426 + height 30 + orientation 0) + line_color 3342489 + client @393 + supplier @396 + Focus_Src @395 + Focus_Entry @400 + origin (1679, 1584) + terminus (2496, 1584) + ordinal 8) + (object NoteView @423 + location (2912, 1424) + label (object ItemLabel + Parent_View @423 + location (2589, 1345) + fill_color 13434879 + nlines 2 + max_width 610 + label "EFalse returned so not valid here") + line_color 3342489 + fill_color 13434879 + width 670 + height 171) + (object NoteView @424 + location (2928, 1680) + label (object ItemLabel + Parent_View @424 + location (2594, 1550) + fill_color 13434879 + nlines 3 + max_width 633 + label "Try next level up the stack, ETrue so it is valid here!") + line_color 3342489 + fill_color 13434879 + width 693 + height 272) + (object InterMessView "" @425 + location (16, 1696) + label (object SegLabel @426 + Parent_View @425 + location (920, 1652) + quidu "3C6B9EA2022A" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @393 + supplier @387 + Focus_Src @395 + Focus_Entry @390 + origin (1648, 1696) + terminus (192, 1696) + ordinal 9) + (object InterMessView "" @427 + location (16, 1808) + label (object SegLabel @428 + Parent_View @427 + location (920, 1764) + quidu "3C6B9EA70385" + anchor_loc 1 + nlines 1 + max_width 671 + justify 0 + label "OnEndElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @393 + supplier @387 + Focus_Src @395 + Focus_Entry @391 + origin (1648, 1808) + terminus (192, 1808) + ordinal 10) + (object InterMessView "" @429 + location (16, 1920) + label (object SegLabel @430 + Parent_View @429 + location (920, 1876) + quidu "3C6B9EB00220" + anchor_loc 1 + nlines 1 + max_width 700 + justify 0 + label "OnStartElementL( )" + pctDist 0.500000 + height 45 + orientation 1) + line_color 3342489 + client @393 + supplier @387 + Focus_Src @395 + Focus_Entry @392 + origin (1648, 1920) + terminus (192, 1920) + ordinal 11) + (object InterMessView "" @431 + location (16, 496) + label (object SegLabel @432 + Parent_View @431 + location (495, 452) + quidu "3D9C33C80214" + anchor_loc 1 + nlines 1 + max_width 256 + justify 0 + label "Start( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @387 + supplier @405 + Focus_Src @388 + Focus_Entry @406 + origin (191, 496) + terminus (800, 496) + ordinal 0) + (object InterMessView "" @433 + location (16, 544) + label (object SegLabel @434 + Parent_View @433 + location (2167, 500) + quidu "3D9C341E0362" + anchor_loc 1 + nlines 1 + max_width 251 + justify 0 + label "Start( )" + pctDist 0.500000 + height 45 + orientation 0) + line_color 3342489 + client @405 + supplier @401 + Focus_Src @406 + Focus_Entry @402 + origin (831, 544) + terminus (3504, 544) + ordinal 1))))) + root_subsystem (object SubSystem "Component View" + quid "3C4D3727010B" + physical_models (list unit_reference_list) + physical_presentations (list unit_reference_list + (object Module_Diagram "Main" + quid "3C4D372C0105" + title "Main" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list)))) + process_structure (object Processes + quid "3C4D3727010C" + ProcsNDevs (list + (object Process_Diagram "Deployment View" + quid "3C4D37270126" + title "Deployment View" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list)))) + properties (object Properties + attributes (list Attribute_Set + (object Attribute + tool "DDL" + name "propertyId" + value "809135966") + (object Attribute + tool "DDL" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "DDL" + name "DataBase" + value ("DataBaseSet" 800)) + (object Attribute + tool "DDL" + name "DataBaseSet" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "ANSI" + value 800) + (object Attribute + tool "DDL" + name "Oracle" + value 801) + (object Attribute + tool "DDL" + name "SQLServer" + value 802) + (object Attribute + tool "DDL" + name "Sybase" + value 803) + (object Attribute + tool "DDL" + name "Watcom" + value 804))) + (object Attribute + tool "DDL" + name "PrimaryKeyColumnName" + value "Id") + (object Attribute + tool "DDL" + name "PrimaryKeyColumnType" + value "NUMBER(5)") + (object Attribute + tool "DDL" + name "ViewName" + value "V_") + (object Attribute + tool "DDL" + name "TableName" + value "T_") + (object Attribute + tool "DDL" + name "InheritSuffix" + value "_V") + (object Attribute + tool "DDL" + name "DropClause" + value FALSE) + (object Attribute + tool "DDL" + name "BaseViews" + value FALSE) + (object Attribute + tool "DDL" + name "DDLScriptFilename" + value "DDL1.SQL"))) + (object Attribute + tool "DDL" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "ColumnType" + value "VARCHAR") + (object Attribute + tool "DDL" + name "Length" + value "") + (object Attribute + tool "DDL" + name "NullsOK" + value TRUE) + (object Attribute + tool "DDL" + name "PrimaryKey" + value FALSE) + (object Attribute + tool "DDL" + name "Unique" + value FALSE) + (object Attribute + tool "DDL" + name "CompositeUnique" + value FALSE) + (object Attribute + tool "DDL" + name "CheckConstraint" + value ""))) + (object Attribute + tool "DDL" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Rose Model Integrator" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Version Control" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Cplusplus" + name "propertyId" + value "809135966") + (object Attribute + tool "Cplusplus" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE) + (object Attribute + tool "Cplusplus" + name "CodeName" + value "") + (object Attribute + tool "Cplusplus" + name "Const" + value FALSE) + (object Attribute + tool "Cplusplus" + name "InitialValue" + value ""))) + (object Attribute + tool "Cplusplus" + name "default__Inherit" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE))) + (object Attribute + tool "Cplusplus" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE) + (object Attribute + tool "Cplusplus" + name "Copyright" + value (value Text "")) + (object Attribute + tool "Cplusplus" + name "RootPackage" + value "C++ Reverse Engineered") + (object Attribute + tool "Cplusplus" + name "InitialHeaderIncludes" + value (value Text "")) + (object Attribute + tool "Cplusplus" + name "InitialBodyIncludes" + value (value Text "")))) + (object Attribute + tool "Cplusplus" + name "default__Param" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "CodeName" + value ""))) + (object Attribute + tool "Cplusplus" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE) + (object Attribute + tool "Cplusplus" + name "CodeName" + value ""))) + (object Attribute + tool "Cplusplus" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE) + (object Attribute + tool "Cplusplus" + name "CodeName" + value "") + (object Attribute + tool "Cplusplus" + name "InitialCodeBody" + value "") + (object Attribute + tool "Cplusplus" + name "Inline" + value FALSE))) + (object Attribute + tool "Cplusplus" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "Synchronize" + value TRUE) + (object Attribute + tool "Cplusplus" + name "CodeName" + value "") + (object Attribute + tool "Cplusplus" + name "ImplementationType" + value "") + (object Attribute + tool "Cplusplus" + name "HeaderSourceFile" + value "") + (object Attribute + tool "Cplusplus" + name "BodySourceFile" + value ""))) + (object Attribute + tool "Cplusplus" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "Cplusplus" + name "CodeName" + value "") + (object Attribute + tool "Cplusplus" + name "IsNamespace" + value FALSE))) + (object Attribute + tool "Cplusplus" + name "HiddenTool" + value FALSE) + (object Attribute + tool "ANSI C++ Event Watcher" + name "HiddenTool" + value FALSE) + (object Attribute + tool "ANSIConvert" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Ada83" + name "propertyId" + value "838326200") + (object Attribute + tool "Ada83" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "SpecFileExtension" + value "1.ada") + (object Attribute + tool "Ada83" + name "SpecFileBackupExtension" + value "1.ad~") + (object Attribute + tool "Ada83" + name "SpecFileTemporaryExtension" + value "1.ad#") + (object Attribute + tool "Ada83" + name "BodyFileExtension" + value "2.ada") + (object Attribute + tool "Ada83" + name "BodyFileBackupExtension" + value "2.ad~") + (object Attribute + tool "Ada83" + name "BodyFileTemporaryExtension" + value "2.ad#") + (object Attribute + tool "Ada83" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "Ada83" + name "GenerateBodies" + value TRUE) + (object Attribute + tool "Ada83" + name "GenerateAccessorOperations" + value TRUE) + (object Attribute + tool "Ada83" + name "GenerateStandardOperations" + value TRUE) + (object Attribute + tool "Ada83" + name "DefaultCodeBody" + value "[statement]") + (object Attribute + tool "Ada83" + name "ImplicitParameter" + value TRUE) + (object Attribute + tool "Ada83" + name "CommentWidth" + value 60) + (object Attribute + tool "Ada83" + name "StopOnError" + value FALSE) + (object Attribute + tool "Ada83" + name "ErrorLimit" + value 30) + (object Attribute + tool "Ada83" + name "UseFileName" + value FALSE) + (object Attribute + tool "Ada83" + name "Directory" + value "$ROSEADA83_SOURCE"))) + (object Attribute + tool "Ada83" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "CodeName" + value "") + (object Attribute + tool "Ada83" + name "ClassName" + value "Object") + (object Attribute + tool "Ada83" + name "ClassAccess" + value ("ImplementationSet" 43)) + (object Attribute + tool "Ada83" + name "ImplementationType" + value (value Text "")) + (object Attribute + tool "Ada83" + name "IsSubtype" + value FALSE) + (object Attribute + tool "Ada83" + name "PolymorphicUnit" + value FALSE) + (object Attribute + tool "Ada83" + name "HandleName" + value "Handle") + (object Attribute + tool "Ada83" + name "HandleAccess" + value ("ImplementationSet" 45)) + (object Attribute + tool "Ada83" + name "Discriminant" + value "") + (object Attribute + tool "Ada83" + name "Variant" + value "") + (object Attribute + tool "Ada83" + name "EnumerationLiteralPrefix" + value "A_") + (object Attribute + tool "Ada83" + name "RecordFieldPrefix" + value "The_") + (object Attribute + tool "Ada83" + name "GenerateAccessorOperations" + value TRUE) + (object Attribute + tool "Ada83" + name "GenerateStandardOperations" + value TRUE) + (object Attribute + tool "Ada83" + name "ImplicitParameter" + value TRUE) + (object Attribute + tool "Ada83" + name "ClassParameterName" + value "This") + (object Attribute + tool "Ada83" + name "DefaultConstructorKind" + value ("ConstructorKindSet" 199)) + (object Attribute + tool "Ada83" + name "DefaultConstructorName" + value "Create") + (object Attribute + tool "Ada83" + name "InlineDefaultConstructor" + value FALSE) + (object Attribute + tool "Ada83" + name "CopyConstructorKind" + value ("ConstructorKindSet" 199)) + (object Attribute + tool "Ada83" + name "CopyConstructorName" + value "Copy") + (object Attribute + tool "Ada83" + name "InlineCopyConstructor" + value FALSE) + (object Attribute + tool "Ada83" + name "DestructorName" + value "Free") + (object Attribute + tool "Ada83" + name "InlineDestructor" + value FALSE) + (object Attribute + tool "Ada83" + name "ClassEqualityOperation" + value "") + (object Attribute + tool "Ada83" + name "HandleEqualityOperation" + value "") + (object Attribute + tool "Ada83" + name "InlineEquality" + value FALSE) + (object Attribute + tool "Ada83" + name "IsTask" + value FALSE) + (object Attribute + tool "Ada83" + name "Representation" + value (value Text "")) + (object Attribute + tool "Ada83" + name "ImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Public" + value 45) + (object Attribute + tool "Ada83" + name "Private" + value 43) + (object Attribute + tool "Ada83" + name "LimitedPrivate" + value 200) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada83" + name "ConstructorKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Procedure" + value 202) + (object Attribute + tool "Ada83" + name "Function" + value 199) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada83" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Generate" + value TRUE) + (object Attribute + tool "Ada83" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Ada83" + name "FileName" + value "") + (object Attribute + tool "Ada83" + name "ReturnType" + value "") + (object Attribute + tool "Ada83" + name "GenericFormalParameters" + value (value Text "")) + (object Attribute + tool "Ada83" + name "AdditionalWiths" + value (value Text "")))) + (object Attribute + tool "Ada83" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Generate" + value TRUE) + (object Attribute + tool "Ada83" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Ada83" + name "FileName" + value "") + (object Attribute + tool "Ada83" + name "ReturnType" + value "") + (object Attribute + tool "Ada83" + name "AdditionalWiths" + value (value Text "")) + (object Attribute + tool "Ada83" + name "IsSubunit" + value FALSE))) + (object Attribute + tool "Ada83" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "CodeName" + value "") + (object Attribute + tool "Ada83" + name "SubprogramImplementation" + value ("SubprogramImplementationSet" 2)) + (object Attribute + tool "Ada83" + name "Renames" + value "") + (object Attribute + tool "Ada83" + name "ClassParameterMode" + value ("ParameterModeSet" 203)) + (object Attribute + tool "Ada83" + name "Inline" + value FALSE) + (object Attribute + tool "Ada83" + name "EntryCode" + value (value Text "")) + (object Attribute + tool "Ada83" + name "ExitCode" + value (value Text "")) + (object Attribute + tool "Ada83" + name "InitialCodeBody" + value "${default}") + (object Attribute + tool "Ada83" + name "Representation" + value (value Text "")) + (object Attribute + tool "Ada83" + name "SubprogramImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Spec" + value 224) + (object Attribute + tool "Ada83" + name "Body" + value 2) + (object Attribute + tool "Ada83" + name "Renaming" + value 222) + (object Attribute + tool "Ada83" + name "Separate" + value 223))) + (object Attribute + tool "Ada83" + name "ParameterModeSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "In" + value 204) + (object Attribute + tool "Ada83" + name "Out" + value 205) + (object Attribute + tool "Ada83" + name "InOut" + value 203) + (object Attribute + tool "Ada83" + name "FunctionReturn" + value 206) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada83" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "CodeName" + value "") + (object Attribute + tool "Ada83" + name "NameIfUnlabeled" + value "The_${supplier}") + (object Attribute + tool "Ada83" + name "DataMemberName" + value "${relationship}") + (object Attribute + tool "Ada83" + name "GetName" + value "Get_${relationship}") + (object Attribute + tool "Ada83" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada83" + name "SetName" + value "Set_${relationship}") + (object Attribute + tool "Ada83" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada83" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada83" + name "InitialValue" + value "") + (object Attribute + tool "Ada83" + name "Variant" + value "") + (object Attribute + tool "Ada83" + name "ContainerGeneric" + value "List") + (object Attribute + tool "Ada83" + name "ContainerType" + value "") + (object Attribute + tool "Ada83" + name "ContainerDeclarations" + value (value Text "")) + (object Attribute + tool "Ada83" + name "SelectorName" + value "") + (object Attribute + tool "Ada83" + name "SelectorType" + value ""))) + (object Attribute + tool "Ada83" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "CodeName" + value "") + (object Attribute + tool "Ada83" + name "DataMemberName" + value "${attribute}") + (object Attribute + tool "Ada83" + name "GetName" + value "Get_${attribute}") + (object Attribute + tool "Ada83" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada83" + name "SetName" + value "Set_${attribute}") + (object Attribute + tool "Ada83" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada83" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada83" + name "InitialValue" + value "") + (object Attribute + tool "Ada83" + name "Variant" + value "") + (object Attribute + tool "Ada83" + name "Representation" + value (value Text "")))) + (object Attribute + tool "Ada83" + name "default__Association" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "NameIfUnlabeled" + value "The_${targetClass}") + (object Attribute + tool "Ada83" + name "GetName" + value "Get_${association}") + (object Attribute + tool "Ada83" + name "InlineGet" + value FALSE) + (object Attribute + tool "Ada83" + name "SetName" + value "Set_${association}") + (object Attribute + tool "Ada83" + name "InlineSet" + value FALSE) + (object Attribute + tool "Ada83" + name "GenerateAssociate" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada83" + name "AssociateName" + value "Associate") + (object Attribute + tool "Ada83" + name "InlineAssociate" + value FALSE) + (object Attribute + tool "Ada83" + name "GenerateDissociate" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada83" + name "DissociateName" + value "Dissociate") + (object Attribute + tool "Ada83" + name "InlineDissociate" + value FALSE) + (object Attribute + tool "Ada83" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Procedure" + value 202) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada83" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Function" + value 199) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada83" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "CodeName" + value "") + (object Attribute + tool "Ada83" + name "NameIfUnlabeled" + value "The_${targetClass}") + (object Attribute + tool "Ada83" + name "DataMemberName" + value "${target}") + (object Attribute + tool "Ada83" + name "GetName" + value "Get_${target}") + (object Attribute + tool "Ada83" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada83" + name "SetName" + value "Set_${target}") + (object Attribute + tool "Ada83" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada83" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada83" + name "InitialValue" + value "") + (object Attribute + tool "Ada83" + name "ContainerGeneric" + value "List") + (object Attribute + tool "Ada83" + name "ContainerType" + value "") + (object Attribute + tool "Ada83" + name "ContainerDeclarations" + value (value Text "")) + (object Attribute + tool "Ada83" + name "SelectorName" + value "") + (object Attribute + tool "Ada83" + name "SelectorType" + value "") + (object Attribute + tool "Ada83" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Procedure" + value 202) + (object Attribute + tool "Ada83" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada83" + name "default__Subsystem" + value (list Attribute_Set + (object Attribute + tool "Ada83" + name "Directory" + value "AUTO GENERATE"))) + (object Attribute + tool "Ada83" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Ada95" + name "propertyId" + value "838326200") + (object Attribute + tool "Ada95" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "SpecFileExtension" + value "1.ada") + (object Attribute + tool "Ada95" + name "SpecFileBackupExtension" + value "1.ad~") + (object Attribute + tool "Ada95" + name "SpecFileTemporaryExtension" + value "1.ad#") + (object Attribute + tool "Ada95" + name "BodyFileExtension" + value "2.ada") + (object Attribute + tool "Ada95" + name "BodyFileBackupExtension" + value "2.ad~") + (object Attribute + tool "Ada95" + name "BodyFileTemporaryExtension" + value "2.ad#") + (object Attribute + tool "Ada95" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "Ada95" + name "UseColonNotation" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateBodies" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateAccessorOperations" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateStandardOperations" + value TRUE) + (object Attribute + tool "Ada95" + name "DefaultCodeBody" + value "[statement]") + (object Attribute + tool "Ada95" + name "ImplicitParameter" + value TRUE) + (object Attribute + tool "Ada95" + name "CommentWidth" + value 60) + (object Attribute + tool "Ada95" + name "StopOnError" + value FALSE) + (object Attribute + tool "Ada95" + name "ErrorLimit" + value 30) + (object Attribute + tool "Ada95" + name "UseFileName" + value FALSE) + (object Attribute + tool "Ada95" + name "Directory" + value "$ROSEADA95_SOURCE"))) + (object Attribute + tool "Ada95" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "CodeName" + value "") + (object Attribute + tool "Ada95" + name "TypeName" + value "Object") + (object Attribute + tool "Ada95" + name "TypeVisibility" + value ("TypeVisibilitySet" 43)) + (object Attribute + tool "Ada95" + name "TypeImplementation" + value ("TypeImplementationSet" 208)) + (object Attribute + tool "Ada95" + name "TypeControl" + value ("TypeControlSet" 225)) + (object Attribute + tool "Ada95" + name "TypeControlName" + value "Controlled_${type}") + (object Attribute + tool "Ada95" + name "TypeDefinition" + value (value Text "")) + (object Attribute + tool "Ada95" + name "RecordImplementation" + value ("RecordImplementationSet" 209)) + (object Attribute + tool "Ada95" + name "RecordKindPackageName" + value "${class}_Record_Kinds") + (object Attribute + tool "Ada95" + name "IsLimited" + value FALSE) + (object Attribute + tool "Ada95" + name "IsSubtype" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateAccessType" + value ("GenerateAccessTypeSet" 230)) + (object Attribute + tool "Ada95" + name "AccessTypeName" + value "Handle") + (object Attribute + tool "Ada95" + name "AccessTypeVisibility" + value ("TypeVisibilitySet" 45)) + (object Attribute + tool "Ada95" + name "AccessTypeDefinition" + value (value Text "")) + (object Attribute + tool "Ada95" + name "AccessClassWide" + value TRUE) + (object Attribute + tool "Ada95" + name "MaybeAliased" + value FALSE) + (object Attribute + tool "Ada95" + name "ParameterizedImplementation" + value ("ParameterizedImplementationSet" 11)) + (object Attribute + tool "Ada95" + name "ParentClassName" + value "Superclass") + (object Attribute + tool "Ada95" + name "EnumerationLiteralPrefix" + value "A_") + (object Attribute + tool "Ada95" + name "RecordFieldPrefix" + value "The_") + (object Attribute + tool "Ada95" + name "ArrayOfTypeName" + value "Array_Of_${type}") + (object Attribute + tool "Ada95" + name "AccessArrayOfTypeName" + value "Access_Array_Of_${type}") + (object Attribute + tool "Ada95" + name "ArrayOfAccessTypeName" + value "Array_Of_${access_type}") + (object Attribute + tool "Ada95" + name "AccessArrayOfAccessTypeName" + value "Access_Array_Of_${access_type}") + (object Attribute + tool "Ada95" + name "ArrayIndexDefinition" + value "Positive range <>") + (object Attribute + tool "Ada95" + name "GenerateAccessorOperations" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateStandardOperations" + value TRUE) + (object Attribute + tool "Ada95" + name "ImplicitParameter" + value TRUE) + (object Attribute + tool "Ada95" + name "ImplicitParameterName" + value "This") + (object Attribute + tool "Ada95" + name "GenerateDefaultConstructor" + value ("SubprogramKindSet" 199)) + (object Attribute + tool "Ada95" + name "DefaultConstructorName" + value "Create") + (object Attribute + tool "Ada95" + name "InlineDefaultConstructor" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateCopyConstructor" + value ("SubprogramKindSet" 199)) + (object Attribute + tool "Ada95" + name "CopyConstructorName" + value "Copy") + (object Attribute + tool "Ada95" + name "InlineCopyConstructor" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateDestructor" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "DestructorName" + value "Free") + (object Attribute + tool "Ada95" + name "InlineDestructor" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateTypeEquality" + value ("FunctionKindSet" 201)) + (object Attribute + tool "Ada95" + name "TypeEqualityName" + value "${quote}=${quote}") + (object Attribute + tool "Ada95" + name "InlineEquality" + value FALSE) + (object Attribute + tool "Ada95" + name "Representation" + value (value Text "")) + (object Attribute + tool "Ada95" + name "TypeImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Tagged" + value 208) + (object Attribute + tool "Ada95" + name "Record" + value 210) + (object Attribute + tool "Ada95" + name "Mixin" + value 211) + (object Attribute + tool "Ada95" + name "Protected" + value 44) + (object Attribute + tool "Ada95" + name "Task" + value 212))) + (object Attribute + tool "Ada95" + name "RecordImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "SingleType" + value 209) + (object Attribute + tool "Ada95" + name "MultipleTypes" + value 213))) + (object Attribute + tool "Ada95" + name "ParameterizedImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Generic" + value 11) + (object Attribute + tool "Ada95" + name "Unconstrained" + value 214))) + (object Attribute + tool "Ada95" + name "TypeVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Public" + value 45) + (object Attribute + tool "Ada95" + name "Private" + value 43))) + (object Attribute + tool "Ada95" + name "SubprogramKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "TypeControlSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "None" + value 225) + (object Attribute + tool "Ada95" + name "InitializationOnly" + value 226) + (object Attribute + tool "Ada95" + name "AssignmentFinalizationOnly" + value 227) + (object Attribute + tool "Ada95" + name "All" + value 228))) + (object Attribute + tool "Ada95" + name "GenerateAccessTypeSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Always" + value 229) + (object Attribute + tool "Ada95" + name "Auto" + value 230))))) + (object Attribute + tool "Ada95" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Generate" + value TRUE) + (object Attribute + tool "Ada95" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Ada95" + name "FileName" + value "") + (object Attribute + tool "Ada95" + name "ReturnType" + value "") + (object Attribute + tool "Ada95" + name "GenericFormalParameters" + value (value Text "")) + (object Attribute + tool "Ada95" + name "AdditionalWiths" + value (value Text "")) + (object Attribute + tool "Ada95" + name "IsPrivate" + value FALSE))) + (object Attribute + tool "Ada95" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Generate" + value TRUE) + (object Attribute + tool "Ada95" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Ada95" + name "FileName" + value "") + (object Attribute + tool "Ada95" + name "ReturnType" + value "") + (object Attribute + tool "Ada95" + name "AdditionalWiths" + value (value Text "")) + (object Attribute + tool "Ada95" + name "IsSubunit" + value FALSE))) + (object Attribute + tool "Ada95" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "CodeName" + value "") + (object Attribute + tool "Ada95" + name "SubprogramImplementation" + value ("SubprogramImplementationSet" 2)) + (object Attribute + tool "Ada95" + name "Renames" + value "") + (object Attribute + tool "Ada95" + name "GenerateOverriding" + value TRUE) + (object Attribute + tool "Ada95" + name "ImplicitParameterMode" + value ("ParameterModeSet" 203)) + (object Attribute + tool "Ada95" + name "ImplicitParameterClassWide" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateAccessOperation" + value FALSE) + (object Attribute + tool "Ada95" + name "Inline" + value FALSE) + (object Attribute + tool "Ada95" + name "EntryCode" + value (value Text "")) + (object Attribute + tool "Ada95" + name "ExitCode" + value (value Text "")) + (object Attribute + tool "Ada95" + name "InitialCodeBody" + value "${default}") + (object Attribute + tool "Ada95" + name "EntryBarrierCondition" + value "True") + (object Attribute + tool "Ada95" + name "Representation" + value (value Text "")) + (object Attribute + tool "Ada95" + name "SubprogramImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Spec" + value 224) + (object Attribute + tool "Ada95" + name "Body" + value 2) + (object Attribute + tool "Ada95" + name "Abstract" + value 221) + (object Attribute + tool "Ada95" + name "Renaming" + value 222) + (object Attribute + tool "Ada95" + name "RenamingAsBody" + value 231) + (object Attribute + tool "Ada95" + name "Separate" + value 223))) + (object Attribute + tool "Ada95" + name "ParameterModeSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "In" + value 204) + (object Attribute + tool "Ada95" + name "Out" + value 205) + (object Attribute + tool "Ada95" + name "InOut" + value 203) + (object Attribute + tool "Ada95" + name "Access" + value 220) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada95" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "CodeName" + value "") + (object Attribute + tool "Ada95" + name "NameIfUnlabeled" + value "The_${supplier}") + (object Attribute + tool "Ada95" + name "RecordFieldImplementation" + value ("RecordFieldImplementationSet" 216)) + (object Attribute + tool "Ada95" + name "RecordFieldName" + value "${relationship}") + (object Attribute + tool "Ada95" + name "GenerateGet" + value ("FunctionKindSet" 199)) + (object Attribute + tool "Ada95" + name "GenerateAccessGet" + value ("FunctionKindSet" 201)) + (object Attribute + tool "Ada95" + name "GetName" + value "Get_${relationship}") + (object Attribute + tool "Ada95" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateSet" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "GenerateAccessSet" + value ("ProcedureKindSet" 201)) + (object Attribute + tool "Ada95" + name "SetName" + value "Set_${relationship}") + (object Attribute + tool "Ada95" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada95" + name "IsAliased" + value FALSE) + (object Attribute + tool "Ada95" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada95" + name "InitialValue" + value "") + (object Attribute + tool "Ada95" + name "ContainerImplementation" + value ("ContainerImplementationSet" 217)) + (object Attribute + tool "Ada95" + name "ContainerGeneric" + value "List") + (object Attribute + tool "Ada95" + name "ContainerType" + value "") + (object Attribute + tool "Ada95" + name "ContainerDeclarations" + value (value Text "")) + (object Attribute + tool "Ada95" + name "SelectorName" + value "") + (object Attribute + tool "Ada95" + name "SelectorType" + value "") + (object Attribute + tool "Ada95" + name "RecordFieldImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Component" + value 216) + (object Attribute + tool "Ada95" + name "Discriminant" + value 218) + (object Attribute + tool "Ada95" + name "AccessDiscriminant" + value 219))) + (object Attribute + tool "Ada95" + name "ContainerImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Array" + value 217) + (object Attribute + tool "Ada95" + name "Generic" + value 11))) + (object Attribute + tool "Ada95" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada95" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "CodeName" + value "") + (object Attribute + tool "Ada95" + name "RecordFieldImplementation" + value ("RecordFieldImplementationSet" 216)) + (object Attribute + tool "Ada95" + name "RecordFieldName" + value "${attribute}") + (object Attribute + tool "Ada95" + name "GenerateGet" + value ("FunctionKindSet" 199)) + (object Attribute + tool "Ada95" + name "GenerateAccessGet" + value ("FunctionKindSet" 201)) + (object Attribute + tool "Ada95" + name "GetName" + value "Get_${attribute}") + (object Attribute + tool "Ada95" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateSet" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "GenerateAccessSet" + value ("ProcedureKindSet" 201)) + (object Attribute + tool "Ada95" + name "SetName" + value "Set_${attribute}") + (object Attribute + tool "Ada95" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada95" + name "IsAliased" + value FALSE) + (object Attribute + tool "Ada95" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada95" + name "InitialValue" + value "") + (object Attribute + tool "Ada95" + name "Representation" + value (value Text "")) + (object Attribute + tool "Ada95" + name "RecordFieldImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Component" + value 216) + (object Attribute + tool "Ada95" + name "Discriminant" + value 218) + (object Attribute + tool "Ada95" + name "AccessDiscriminant" + value 219))) + (object Attribute + tool "Ada95" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada95" + name "default__Association" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "NameIfUnlabeled" + value "The_${targetClass}") + (object Attribute + tool "Ada95" + name "GenerateGet" + value ("FunctionKindSet" 199)) + (object Attribute + tool "Ada95" + name "GetName" + value "Get_${association}") + (object Attribute + tool "Ada95" + name "InlineGet" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateSet" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "SetName" + value "Set_${association}") + (object Attribute + tool "Ada95" + name "InlineSet" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateAssociate" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "AssociateName" + value "Associate") + (object Attribute + tool "Ada95" + name "InlineAssociate" + value FALSE) + (object Attribute + tool "Ada95" + name "GenerateDissociate" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "DissociateName" + value "Dissociate") + (object Attribute + tool "Ada95" + name "InlineDissociate" + value FALSE) + (object Attribute + tool "Ada95" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada95" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "CodeName" + value "") + (object Attribute + tool "Ada95" + name "NameIfUnlabeled" + value "The_${targetClass}") + (object Attribute + tool "Ada95" + name "RecordFieldImplementation" + value ("RecordFieldImplementationSet" 216)) + (object Attribute + tool "Ada95" + name "RecordFieldName" + value "${target}") + (object Attribute + tool "Ada95" + name "GenerateGet" + value ("FunctionKindSet" 199)) + (object Attribute + tool "Ada95" + name "GenerateAccessGet" + value ("FunctionKindSet" 201)) + (object Attribute + tool "Ada95" + name "GetName" + value "Get_${target}") + (object Attribute + tool "Ada95" + name "InlineGet" + value TRUE) + (object Attribute + tool "Ada95" + name "GenerateSet" + value ("ProcedureKindSet" 202)) + (object Attribute + tool "Ada95" + name "GenerateAccessSet" + value ("ProcedureKindSet" 201)) + (object Attribute + tool "Ada95" + name "SetName" + value "Set_${target}") + (object Attribute + tool "Ada95" + name "InlineSet" + value TRUE) + (object Attribute + tool "Ada95" + name "IsAliased" + value FALSE) + (object Attribute + tool "Ada95" + name "IsConstant" + value FALSE) + (object Attribute + tool "Ada95" + name "InitialValue" + value "") + (object Attribute + tool "Ada95" + name "ContainerImplementation" + value ("ContainerImplementationSet" 217)) + (object Attribute + tool "Ada95" + name "ContainerGeneric" + value "List") + (object Attribute + tool "Ada95" + name "ContainerType" + value "") + (object Attribute + tool "Ada95" + name "ContainerDeclarations" + value (value Text "")) + (object Attribute + tool "Ada95" + name "SelectorName" + value "") + (object Attribute + tool "Ada95" + name "SelectorType" + value "") + (object Attribute + tool "Ada95" + name "ProcedureKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Procedure" + value 202) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))) + (object Attribute + tool "Ada95" + name "RecordFieldImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Component" + value 216) + (object Attribute + tool "Ada95" + name "Discriminant" + value 218) + (object Attribute + tool "Ada95" + name "AccessDiscriminant" + value 219))) + (object Attribute + tool "Ada95" + name "ContainerImplementationSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Array" + value 217) + (object Attribute + tool "Ada95" + name "Generic" + value 11))) + (object Attribute + tool "Ada95" + name "FunctionKindSet" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Function" + value 199) + (object Attribute + tool "Ada95" + name "DoNotCreate" + value 201))))) + (object Attribute + tool "Ada95" + name "default__Subsystem" + value (list Attribute_Set + (object Attribute + tool "Ada95" + name "Directory" + value "AUTO GENERATE"))) + (object Attribute + tool "Ada95" + name "HiddenTool" + value FALSE) + (object Attribute + tool "CORBA" + name "propertyId" + value "809135966") + (object Attribute + tool "CORBA" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "CORBA" + name "Editor" + value ("EditorType" 100)) + (object Attribute + tool "CORBA" + name "IncludePath" + value "") + (object Attribute + tool "CORBA" + name "StopOnError" + value TRUE) + (object Attribute + tool "CORBA" + name "EditorType" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "BuiltIn" + value 100) + (object Attribute + tool "CORBA" + name "WindowsShell" + value 101))) + (object Attribute + tool "CORBA" + name "PathSeparator" + value ""))) + (object Attribute + tool "CORBA" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "ArrayDimensions" + value "") + (object Attribute + tool "CORBA" + name "ConstValue" + value "") + (object Attribute + tool "CORBA" + name "ImplementationType" + value ""))) + (object Attribute + tool "CORBA" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "CORBA" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "CORBA" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "CORBA" + name "InclusionProtectionSymbol" + value "AUTO GENERATE"))) + (object Attribute + tool "CORBA" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "CORBA" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "CORBA" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "CORBA" + name "InclusionProtectionSymbol" + value "AUTO GENERATE"))) + (object Attribute + tool "CORBA" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "Context" + value "") + (object Attribute + tool "CORBA" + name "OperationIsOneWay" + value FALSE))) + (object Attribute + tool "CORBA" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "ArrayDimensions" + value "") + (object Attribute + tool "CORBA" + name "CaseSpecifier" + value "") + (object Attribute + tool "CORBA" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "CORBA" + name "Order" + value ""))) + (object Attribute + tool "CORBA" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "ArrayDimensions" + value "") + (object Attribute + tool "CORBA" + name "CaseSpecifier" + value "") + (object Attribute + tool "CORBA" + name "GenerateForwardReference" + value FALSE) + (object Attribute + tool "CORBA" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "CORBA" + name "Order" + value "") + (object Attribute + tool "CORBA" + name "BoundedRoleType" + value ("AssocTypeSet" 47)) + (object Attribute + tool "CORBA" + name "AssocTypeSet" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "Array" + value 24) + (object Attribute + tool "CORBA" + name "Sequence" + value 47))))) + (object Attribute + tool "CORBA" + name "default__Uses" + value (list Attribute_Set + (object Attribute + tool "CORBA" + name "GenerateForwardReference" + value FALSE))) + (object Attribute + tool "CORBA" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Data Modeler" + name "propertyId" + value "809135966") + (object Attribute + tool "Data Modeler" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "project" + value "") + (object Attribute + tool "Data Modeler" + name "TableCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "ViewCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "DomainCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "SPPackageCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "TriggerCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "IndexCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "ConstraintCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "StoreProcedureCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "PrimaryKeyCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "ForeignKeyCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "JoinCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "TableSpaceCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "cONTAINERCounter" + value 0) + (object Attribute + tool "Data Modeler" + name "TablePrefix" + value "") + (object Attribute + tool "Data Modeler" + name "ViewPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "DomainPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "TriggerPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "IndexPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "ConstraintPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "StoreProcedurePrefix" + value "") + (object Attribute + tool "Data Modeler" + name "PrimaryKeyPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "ForeignKeyPrefix" + value "") + (object Attribute + tool "Data Modeler" + name "TableSpacePrefix" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "IsDatabase" + value FALSE) + (object Attribute + tool "Data Modeler" + name "TargetDatabase" + value "") + (object Attribute + tool "Data Modeler" + name "Location" + value "") + (object Attribute + tool "Data Modeler" + name "IsTableSpace" + value FALSE) + (object Attribute + tool "Data Modeler" + name "TableSpaceType" + value "") + (object Attribute + tool "Data Modeler" + name "IsDeault" + value FALSE) + (object Attribute + tool "Data Modeler" + name "BufferPool" + value "") + (object Attribute + tool "Data Modeler" + name "ExtentSize" + value 1) + (object Attribute + tool "Data Modeler" + name "PrefetchSize" + value 1) + (object Attribute + tool "Data Modeler" + name "PageSize" + value 4) + (object Attribute + tool "Data Modeler" + name "ManagedBy" + value "") + (object Attribute + tool "Data Modeler" + name "ContainerList" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "dmSchema" + value "") + (object Attribute + tool "Data Modeler" + name "dmDomainPackage" + value "") + (object Attribute + tool "Data Modeler" + name "IsSchema" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsDomainPackage" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsRootSchema" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsRootDomainPackage" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsSchemaPackage" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DatabaseID" + value "") + (object Attribute + tool "Data Modeler" + name "DBMS" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "IsTable" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsView" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsDomain" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsSPPackage" + value FALSE) + (object Attribute + tool "Data Modeler" + name "Synonymns" + value "") + (object Attribute + tool "Data Modeler" + name "TableSpaceID" + value "") + (object Attribute + tool "Data Modeler" + name "SourceId" + value "") + (object Attribute + tool "Data Modeler" + name "SourceType" + value "") + (object Attribute + tool "Data Modeler" + name "CorrelationName" + value "") + (object Attribute + tool "Data Modeler" + name "SelectClause" + value "") + (object Attribute + tool "Data Modeler" + name "IsUpdateable" + value TRUE) + (object Attribute + tool "Data Modeler" + name "CheckOption" + value "None") + (object Attribute + tool "Data Modeler" + name "IsSnapShot" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsDistinct" + value FALSE) + (object Attribute + tool "Data Modeler" + name "PersistToServer" + value "") + (object Attribute + tool "Data Modeler" + name "IsPackage" + value FALSE))) + (object Attribute + tool "Data Modeler" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "Ordinal" + value 0) + (object Attribute + tool "Data Modeler" + name "IsIdentity" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsUnique" + value FALSE) + (object Attribute + tool "Data Modeler" + name "NullsAllowed" + value FALSE) + (object Attribute + tool "Data Modeler" + name "Length" + value 0) + (object Attribute + tool "Data Modeler" + name "Scale" + value 0) + (object Attribute + tool "Data Modeler" + name "ColumnType" + value "Native") + (object Attribute + tool "Data Modeler" + name "ForBitData" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DefaultValueType" + value "") + (object Attribute + tool "Data Modeler" + name "DefaultValue" + value "") + (object Attribute + tool "Data Modeler" + name "SourceId" + value "") + (object Attribute + tool "Data Modeler" + name "SourceType" + value "") + (object Attribute + tool "Data Modeler" + name "OID" + value FALSE))) + (object Attribute + tool "Data Modeler" + name "default__Association" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "IsRelationship" + value FALSE) + (object Attribute + tool "Data Modeler" + name "SourceId" + value "") + (object Attribute + tool "Data Modeler" + name "SourceType" + value "") + (object Attribute + tool "Data Modeler" + name "RIMethod" + value "") + (object Attribute + tool "Data Modeler" + name "ParentUpdateRule" + value "") + (object Attribute + tool "Data Modeler" + name "ParentUpdateRuleName" + value "") + (object Attribute + tool "Data Modeler" + name "ParentDeleteRule" + value "") + (object Attribute + tool "Data Modeler" + name "ParentDeleteRuleName" + value "") + (object Attribute + tool "Data Modeler" + name "ChildInsertRestrict" + value FALSE) + (object Attribute + tool "Data Modeler" + name "ChildInsertRestrictName" + value "") + (object Attribute + tool "Data Modeler" + name "ChildMultiplicity" + value FALSE) + (object Attribute + tool "Data Modeler" + name "ChildMultiplicityName" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "ConstraintName" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "IsConstraint" + value FALSE) + (object Attribute + tool "Data Modeler" + name "ConstraintType" + value "") + (object Attribute + tool "Data Modeler" + name "IsIndex" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsTrigger" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsStoredProcedure" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsCluster" + value FALSE) + (object Attribute + tool "Data Modeler" + name "TableSpace" + value "") + (object Attribute + tool "Data Modeler" + name "FillFactor" + value 0) + (object Attribute + tool "Data Modeler" + name "KeyList" + value "") + (object Attribute + tool "Data Modeler" + name "CheckPredicate" + value "") + (object Attribute + tool "Data Modeler" + name "IsUnique" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DeferalMode" + value "") + (object Attribute + tool "Data Modeler" + name "InitialCheckTime" + value "") + (object Attribute + tool "Data Modeler" + name "TriggerType" + value "") + (object Attribute + tool "Data Modeler" + name "IsInsertEvent" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsUpdateEvent" + value FALSE) + (object Attribute + tool "Data Modeler" + name "IsDeleteEvent" + value FALSE) + (object Attribute + tool "Data Modeler" + name "RefOldTable" + value "") + (object Attribute + tool "Data Modeler" + name "RefNewTable" + value "") + (object Attribute + tool "Data Modeler" + name "RefOldRow" + value "") + (object Attribute + tool "Data Modeler" + name "RefNewRow" + value "") + (object Attribute + tool "Data Modeler" + name "IsRow" + value FALSE) + (object Attribute + tool "Data Modeler" + name "WhenClause" + value "") + (object Attribute + tool "Data Modeler" + name "Language" + value "SQL") + (object Attribute + tool "Data Modeler" + name "ProcType" + value "Procedure") + (object Attribute + tool "Data Modeler" + name "IsDeterministic" + value FALSE) + (object Attribute + tool "Data Modeler" + name "ParameterStyle" + value "") + (object Attribute + tool "Data Modeler" + name "ReturnedNull" + value FALSE) + (object Attribute + tool "Data Modeler" + name "ExternalName" + value "") + (object Attribute + tool "Data Modeler" + name "Length" + value "") + (object Attribute + tool "Data Modeler" + name "Scale" + value "") + (object Attribute + tool "Data Modeler" + name "ForBitData" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DefaultValue" + value "") + (object Attribute + tool "Data Modeler" + name "DefaultValueType" + value ""))) + (object Attribute + tool "Data Modeler" + name "default__Parameter" + value (list Attribute_Set + (object Attribute + tool "Data Modeler" + name "dmItem" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DMName" + value "") + (object Attribute + tool "Data Modeler" + name "IsInParameter" + value TRUE) + (object Attribute + tool "Data Modeler" + name "IsOutParameter" + value FALSE) + (object Attribute + tool "Data Modeler" + name "Ordinal" + value "") + (object Attribute + tool "Data Modeler" + name "Length" + value "") + (object Attribute + tool "Data Modeler" + name "Scale" + value "") + (object Attribute + tool "Data Modeler" + name "ForBitData" + value FALSE) + (object Attribute + tool "Data Modeler" + name "DefaultValueType" + value "") + (object Attribute + tool "Data Modeler" + name "DefaultValue" + value "") + (object Attribute + tool "Data Modeler" + name "OperationID" + value ""))) + (object Attribute + tool "Data Modeler" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Data Modeler Communicator" + name "HiddenTool" + value FALSE) + (object Attribute + tool "framework" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Java" + name "propertyId" + value "809135966") + (object Attribute + tool "Java" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Java" + name "RootDir" + value "") + (object Attribute + tool "Java" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "Java" + name "StopOnError" + value FALSE) + (object Attribute + tool "Java" + name "UsePrefixes" + value FALSE) + (object Attribute + tool "Java" + name "AutoSync" + value FALSE) + (object Attribute + tool "Java" + name "NotShowRoseIDDlg" + value FALSE) + (object Attribute + tool "Java" + name "ShowCodegenDlg" + value FALSE) + (object Attribute + tool "Java" + name "GenerateRoseID" + value TRUE) + (object Attribute + tool "Java" + name "GenerateDefaultReturnLine" + value TRUE) + (object Attribute + tool "Java" + name "JavadocDefaultAuthor" + value "") + (object Attribute + tool "Java" + name "JavadocDefaultVersion" + value "") + (object Attribute + tool "Java" + name "JavadocDefaultSince" + value "") + (object Attribute + tool "Java" + name "UserDefineTagName1" + value "") + (object Attribute + tool "Java" + name "UserDefineTagApply1" + value "") + (object Attribute + tool "Java" + name "UserDefineTagText1" + value "") + (object Attribute + tool "Java" + name "UserDefineTagName2" + value "") + (object Attribute + tool "Java" + name "UserDefineTagApply2" + value "") + (object Attribute + tool "Java" + name "UserDefineTagText2" + value "") + (object Attribute + tool "Java" + name "UserDefineTagName3" + value "") + (object Attribute + tool "Java" + name "UserDefineTagApply3" + value "") + (object Attribute + tool "Java" + name "UserDefineTagText3" + value "") + (object Attribute + tool "Java" + name "JavadocNumAsterisks" + value 0) + (object Attribute + tool "Java" + name "MaxNumChars" + value 80) + (object Attribute + tool "Java" + name "Editor" + value ("EditorType" 100)) + (object Attribute + tool "Java" + name "VM" + value ("VMType" 200)) + (object Attribute + tool "Java" + name "ClassPath" + value ";d:\\program files\\jdk1.3.1\\src.jar;d:\\program files\\jdk1.3.1\\jre\\lib\\i18n.jar;d:\\program files\\jdk1.3.1\\jre\\lib\\jaws.jar;d:\\program files\\jdk1.3.1\\jre\\lib\\rt.jar;d:\\program files\\jdk1.3.1\\lib\\dt.jar;d:\\program files\\jdk1.3.1\\lib\\tools.jar;d:\\program files\\jdk1.3.1\\jre\\lib\\sunrsasign.jar") + (object Attribute + tool "Java" + name "ReferenceClasspath" + value "") + (object Attribute + tool "Java" + name "EditorType" + value (list Attribute_Set + (object Attribute + tool "Java" + name "BuiltIn" + value 100) + (object Attribute + tool "Java" + name "WindowsShell" + value 101))) + (object Attribute + tool "Java" + name "VMType" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Sun" + value 200))) + (object Attribute + tool "Java" + name "VAJavaWorkingFolder" + value "") + (object Attribute + tool "Java" + name "InstanceVariablePrefix" + value "") + (object Attribute + tool "Java" + name "ClassVariablePrefix" + value "") + (object Attribute + tool "Java" + name "DefaultAttributeDataType" + value "int") + (object Attribute + tool "Java" + name "DefaultOperationReturnType" + value "void") + (object Attribute + tool "Java" + name "NoClassCustomDlg" + value FALSE) + (object Attribute + tool "Java" + name "GlobalImports" + value (value Text "")) + (object Attribute + tool "Java" + name "OpenBraceClassStyle" + value TRUE) + (object Attribute + tool "Java" + name "OpenBraceMethodStyle" + value TRUE) + (object Attribute + tool "Java" + name "UseTabs" + value FALSE) + (object Attribute + tool "Java" + name "UseSpaces" + value TRUE) + (object Attribute + tool "Java" + name "SpacingItems" + value 3) + (object Attribute + tool "Java" + name "RoseDefaultCommentStyle" + value TRUE) + (object Attribute + tool "Java" + name "AsteriskCommentStyle" + value TRUE) + (object Attribute + tool "Java" + name "JavaCommentStyle" + value TRUE) + (object Attribute + tool "Java" + name "JavadocAuthor" + value FALSE) + (object Attribute + tool "Java" + name "JavadocSince" + value FALSE) + (object Attribute + tool "Java" + name "JavadocVersion" + value FALSE) + (object Attribute + tool "Java" + name "BeanPrefix" + value "") + (object Attribute + tool "Java" + name "BeanSuffix" + value "") + (object Attribute + tool "Java" + name "RemotePrefix" + value "") + (object Attribute + tool "Java" + name "RemoteSuffix" + value "") + (object Attribute + tool "Java" + name "HomePrefix" + value "") + (object Attribute + tool "Java" + name "HomeSuffix" + value "") + (object Attribute + tool "Java" + name "PrimaryKeyPrefix" + value "") + (object Attribute + tool "Java" + name "PrimaryKeySuffix" + value "") + (object Attribute + tool "Java" + name "EJBDTDLocation" + value "") + (object Attribute + tool "Java" + name "ServletDTDLocation" + value "") + (object Attribute + tool "Java" + name "DefaultEJBVersion" + value "") + (object Attribute + tool "Java" + name "DefaultServletVersion" + value ""))) + (object Attribute + tool "Java" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Static" + value FALSE) + (object Attribute + tool "Java" + name "GenerateDefaultConstructor" + value TRUE) + (object Attribute + tool "Java" + name "ConstructorIs" + value ("Ctor_Set" 62)) + (object Attribute + tool "Java" + name "Ctor_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "public" + value 62) + (object Attribute + tool "Java" + name "protected" + value 63) + (object Attribute + tool "Java" + name "private" + value 64) + (object Attribute + tool "Java" + name "package" + value 65))) + (object Attribute + tool "Java" + name "GenerateFinalizer" + value FALSE) + (object Attribute + tool "Java" + name "GenerateStaticInitializer" + value FALSE) + (object Attribute + tool "Java" + name "GenerateInstanceInitializer" + value FALSE) + (object Attribute + tool "Java" + name "GenerateCode" + value TRUE) + (object Attribute + tool "Java" + name "DisableAutoSync" + value FALSE) + (object Attribute + tool "Java" + name "ReadOnly" + value FALSE))) + (object Attribute + tool "Java" + name "Default_Servlet__Class" + value (list Attribute_Set + (object Attribute + tool "Java" + name "ServletName" + value "") + (object Attribute + tool "Java" + name "ServletContextRef" + value FALSE) + (object Attribute + tool "Java" + name "IsSingleThread" + value FALSE) + (object Attribute + tool "Java" + name "ServletInitParameter" + value "") + (object Attribute + tool "Java" + name "ServletInitParameterNames" + value FALSE) + (object Attribute + tool "Java" + name "ServletIsSecure" + value FALSE) + (object Attribute + tool "Java" + name "ServletRequestDispatcher" + value FALSE) + (object Attribute + tool "Java" + name "ServletRequestDispatcherPath" + value "") + (object Attribute + tool "Java" + name "DispatcherInclude" + value FALSE) + (object Attribute + tool "Java" + name "DispatcherForward" + value FALSE) + (object Attribute + tool "Java" + name "ServletSecurityRoles" + value "") + (object Attribute + tool "Java" + name "ServletgetInfo" + value "") + (object Attribute + tool "Java" + name "ServletXMLFilePath" + value ""))) + (object Attribute + tool "Java" + name "Http_Servlet__Class" + value (list Attribute_Set + (object Attribute + tool "Java" + name "ServletRequestAttribute" + value "") + (object Attribute + tool "Java" + name "ServletRequestAttributesNames" + value FALSE) + (object Attribute + tool "Java" + name "MethodForRequestAttributes" + value "") + (object Attribute + tool "Java" + name "ServletRequestParameter" + value "") + (object Attribute + tool "Java" + name "ServletRequestParameterNames" + value FALSE) + (object Attribute + tool "Java" + name "MethodForRequestParameters" + value "") + (object Attribute + tool "Java" + name "ServletHeader" + value "") + (object Attribute + tool "Java" + name "ServletHeaderNames" + value FALSE) + (object Attribute + tool "Java" + name "MethodForHeaders" + value "") + (object Attribute + tool "Java" + name "ServletIntHeader" + value FALSE) + (object Attribute + tool "Java" + name "ServletDateHeader" + value FALSE) + (object Attribute + tool "Java" + name "ServletCookie" + value FALSE) + (object Attribute + tool "Java" + name "MethodForCookie" + value "") + (object Attribute + tool "Java" + name "ServletContentType" + value "") + (object Attribute + tool "Java" + name "GenerateHTML" + value FALSE))) + (object Attribute + tool "Java" + name "Default_EJB__Class" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Generate_XML_DD" + value TRUE) + (object Attribute + tool "Java" + name "EJBCmpField" + value "") + (object Attribute + tool "Java" + name "EJBEnvironmentProperties" + value "") + (object Attribute + tool "Java" + name "EJBCnxFactory" + value "") + (object Attribute + tool "Java" + name "EJBReferences" + value "") + (object Attribute + tool "Java" + name "EJBSecurityRoles" + value "") + (object Attribute + tool "Java" + name "EJBNameInJAR" + value "") + (object Attribute + tool "Java" + name "EJBSessionType" + value ("EJBSessionType_Set" 200)) + (object Attribute + tool "Java" + name "EJBSessionType_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "" + value 200) + (object Attribute + tool "Java" + name "Stateless" + value 201) + (object Attribute + tool "Java" + name "Stateful" + value 202))) + (object Attribute + tool "Java" + name "EJBTransactionType" + value ("EJBTransactionType_Set" 211)) + (object Attribute + tool "Java" + name "EJBTransactionType_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Container" + value 211) + (object Attribute + tool "Java" + name "Bean" + value 212))) + (object Attribute + tool "Java" + name "EJBPersistenceType" + value ("EJBPersistenceType_Set" 220)) + (object Attribute + tool "Java" + name "EJBPersistenceType_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "" + value 220) + (object Attribute + tool "Java" + name "Bean" + value 221) + (object Attribute + tool "Java" + name "Container" + value 222))) + (object Attribute + tool "Java" + name "EJBReentrant" + value FALSE) + (object Attribute + tool "Java" + name "EJBSessionSync" + value FALSE) + (object Attribute + tool "Java" + name "EJBVersion" + value ("EJBVersion_Set" 230)) + (object Attribute + tool "Java" + name "EJBVersion_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "2.0" + value 230) + (object Attribute + tool "Java" + name "1.x" + value 231))) + (object Attribute + tool "Java" + name "EJBXMLFilePath" + value ""))) + (object Attribute + tool "Java" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Java" + name "CmIdentification" + value (value Text "")) + (object Attribute + tool "Java" + name "CopyrightNotice" + value (value Text "")))) + (object Attribute + tool "Java" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "Java" + name "CmIdentification" + value (value Text "")) + (object Attribute + tool "Java" + name "CopyrightNotice" + value (value Text "")))) + (object Attribute + tool "Java" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Abstract" + value FALSE) + (object Attribute + tool "Java" + name "Static" + value FALSE) + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Native" + value FALSE) + (object Attribute + tool "Java" + name "Synchronized" + value FALSE) + (object Attribute + tool "Java" + name "GenerateFullyQualifiedReturn" + value FALSE) + (object Attribute + tool "Java" + name "ReplaceExistingCode" + value TRUE))) + (object Attribute + tool "Java" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Transient" + value FALSE) + (object Attribute + tool "Java" + name "Volatile" + value FALSE) + (object Attribute + tool "Java" + name "PropertyType" + value ("BeanProperty_Set" 71)) + (object Attribute + tool "Java" + name "BeanProperty_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Not A Property" + value 71) + (object Attribute + tool "Java" + name "Simple" + value 72) + (object Attribute + tool "Java" + name "Bound" + value 73) + (object Attribute + tool "Java" + name "Constrained" + value 74))) + (object Attribute + tool "Java" + name "IndividualChangeMgt" + value FALSE) + (object Attribute + tool "Java" + name "Read/Write" + value ("Read/Write_Set" 81)) + (object Attribute + tool "Java" + name "Read/Write_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Read & Write" + value 81) + (object Attribute + tool "Java" + name "Read Only" + value 82) + (object Attribute + tool "Java" + name "Write Only" + value 83))) + (object Attribute + tool "Java" + name "GenerateFullyQualifiedTypes" + value FALSE))) + (object Attribute + tool "Java" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Java" + name "ContainerClass" + value "") + (object Attribute + tool "Java" + name "InitialValue" + value "") + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Transient" + value FALSE) + (object Attribute + tool "Java" + name "Volatile" + value FALSE) + (object Attribute + tool "Java" + name "PropertyType" + value ("BeanProperty_Set" 71)) + (object Attribute + tool "Java" + name "BeanProperty_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Not A Property" + value 71) + (object Attribute + tool "Java" + name "Simple" + value 72) + (object Attribute + tool "Java" + name "Bound" + value 73) + (object Attribute + tool "Java" + name "Constrained" + value 74))) + (object Attribute + tool "Java" + name "IndividualChangeMgt" + value FALSE) + (object Attribute + tool "Java" + name "Read/Write" + value ("Read/Write_Set" 81)) + (object Attribute + tool "Java" + name "Read/Write_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Read & Write" + value 81) + (object Attribute + tool "Java" + name "Read Only" + value 82) + (object Attribute + tool "Java" + name "Write Only" + value 83))) + (object Attribute + tool "Java" + name "GenerateFullyQualifiedTypes" + value FALSE) + (object Attribute + tool "Java" + name "IsNavigable" + value TRUE))) + (object Attribute + tool "Java" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Oracle8" + name "propertyId" + value "360000002") + (object Attribute + tool "Oracle8" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "DDLScriptFilename" + value "DDL1.SQL") + (object Attribute + tool "Oracle8" + name "DropClause" + value FALSE) + (object Attribute + tool "Oracle8" + name "PrimaryKeyColumnName" + value "_ID") + (object Attribute + tool "Oracle8" + name "PrimaryKeyColumnType" + value "NUMBER(5,0)") + (object Attribute + tool "Oracle8" + name "SchemaNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "SchemaNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "TableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "TableNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "TypeNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "TypeNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "ViewNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "ViewNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "VarrayNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "VarrayNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "NestedTableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "NestedTableNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "ObjectTableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "ObjectTableNameSuffix" + value ""))) + (object Attribute + tool "Oracle8" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "IsSchema" + value FALSE))) + (object Attribute + tool "Oracle8" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OID" + value "") + (object Attribute + tool "Oracle8" + name "WhereClause" + value "") + (object Attribute + tool "Oracle8" + name "CheckConstraint" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypeLength" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypePrecision" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypeScale" + value "") + (object Attribute + tool "Oracle8" + name "CollectionOfREFS" + value FALSE))) + (object Attribute + tool "Oracle8" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "MethodKind" + value ("MethodKindSet" 1903)) + (object Attribute + tool "Oracle8" + name "OverloadID" + value "") + (object Attribute + tool "Oracle8" + name "OrderNumber" + value "") + (object Attribute + tool "Oracle8" + name "IsReadNoDataState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsReadNoProcessState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsWriteNoDataState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsWriteNoProcessState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsSelfish" + value FALSE) + (object Attribute + tool "Oracle8" + name "TriggerType" + value ("TriggerTypeSet" 1801)) + (object Attribute + tool "Oracle8" + name "TriggerEvent" + value ("TriggerEventSet" 1601)) + (object Attribute + tool "Oracle8" + name "TriggerText" + value "") + (object Attribute + tool "Oracle8" + name "TriggerReferencingNames" + value "") + (object Attribute + tool "Oracle8" + name "TriggerForEach" + value ("TriggerForEachSet" 1701)) + (object Attribute + tool "Oracle8" + name "TriggerWhenClause" + value "") + (object Attribute + tool "Oracle8" + name "MethodKindSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "MapMethod" + value 1901) + (object Attribute + tool "Oracle8" + name "OrderMethod" + value 1902) + (object Attribute + tool "Oracle8" + name "Function" + value 1903) + (object Attribute + tool "Oracle8" + name "Procedure" + value 1904) + (object Attribute + tool "Oracle8" + name "Operator" + value 1905) + (object Attribute + tool "Oracle8" + name "Constructor" + value 1906) + (object Attribute + tool "Oracle8" + name "Destructor" + value 1907) + (object Attribute + tool "Oracle8" + name "Trigger" + value 1908) + (object Attribute + tool "Oracle8" + name "Calculated" + value 1909))) + (object Attribute + tool "Oracle8" + name "TriggerTypeSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "AFTER" + value 1801) + (object Attribute + tool "Oracle8" + name "BEFORE" + value 1802) + (object Attribute + tool "Oracle8" + name "INSTEAD OF" + value 1803))) + (object Attribute + tool "Oracle8" + name "TriggerForEachSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "ROW" + value 1701) + (object Attribute + tool "Oracle8" + name "STATEMENT" + value 1702))) + (object Attribute + tool "Oracle8" + name "TriggerEventSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "INSERT" + value 1601) + (object Attribute + tool "Oracle8" + name "UPDATE" + value 1602) + (object Attribute + tool "Oracle8" + name "DELETE" + value 1603) + (object Attribute + tool "Oracle8" + name "INSERT OR UPDATE" + value 1604) + (object Attribute + tool "Oracle8" + name "INSERT OR DELETE" + value 1605) + (object Attribute + tool "Oracle8" + name "UPDATE OR DELETE" + value 1606) + (object Attribute + tool "Oracle8" + name "INSERT OR UPDATE OR DELETE" + value 1607))))) + (object Attribute + tool "Oracle8" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OrderNumber" + value ""))) + (object Attribute + tool "Oracle8" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OrderNumber" + value "") + (object Attribute + tool "Oracle8" + name "IsUnique" + value FALSE) + (object Attribute + tool "Oracle8" + name "NullsAllowed" + value TRUE) + (object Attribute + tool "Oracle8" + name "Length" + value "") + (object Attribute + tool "Oracle8" + name "Precision" + value "2") + (object Attribute + tool "Oracle8" + name "Scale" + value "6") + (object Attribute + tool "Oracle8" + name "IsIndex" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsPrimaryKey" + value FALSE) + (object Attribute + tool "Oracle8" + name "CompositeUnique" + value FALSE) + (object Attribute + tool "Oracle8" + name "CheckConstraint" + value ""))) + (object Attribute + tool "Oracle8" + name "HiddenTool" + value FALSE) + (object Attribute + tool "ComponentTest" + name "HiddenTool" + value FALSE) + (object Attribute + tool "cg" + name "propertyId" + value "809135966") + (object Attribute + tool "cg" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "cg" + name "AllowGenerateOverNewerAnnotations" + value FALSE) + (object Attribute + tool "cg" + name "AllowGenerateOverNewerVersion" + value FALSE) + (object Attribute + tool "cg" + name "UseMSVC" + value FALSE) + (object Attribute + tool "cg" + name "HeaderFileExtension" + value "h") + (object Attribute + tool "cg" + name "HeaderFileBackupExtension" + value "h~") + (object Attribute + tool "cg" + name "HeaderFileTemporaryExtension" + value "h#") + (object Attribute + tool "cg" + name "CodeFileExtension" + value "cpp") + (object Attribute + tool "cg" + name "CodeFileBackupExtension" + value "cp~") + (object Attribute + tool "cg" + name "CodeFileTemporaryExtension" + value "cp#") + (object Attribute + tool "cg" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "cg" + name "StopOnError" + value FALSE) + (object Attribute + tool "cg" + name "ErrorLimit" + value 30) + (object Attribute + tool "cg" + name "Directory" + value "$ROSECPP_SOURCE") + (object Attribute + tool "cg" + name "PathSeparator" + value "") + (object Attribute + tool "cg" + name "FileNameFormat" + value "128vx_b") + (object Attribute + tool "cg" + name "BooleanType" + value "int") + (object Attribute + tool "cg" + name "AllowTemplates" + value TRUE) + (object Attribute + tool "cg" + name "AllowExplicitInstantiations" + value FALSE) + (object Attribute + tool "cg" + name "AllowProtectedInheritance" + value TRUE) + (object Attribute + tool "cg" + name "CommentWidth" + value 60) + (object Attribute + tool "cg" + name "OneByValueContainer" + value "$targetClass") + (object Attribute + tool "cg" + name "OneByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "OptionalByValueContainer" + value "OptionalByValue<$targetClass>") + (object Attribute + tool "cg" + name "OptionalByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "FixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "FixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "BoundedByValueContainer" + value "BoundedListByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByValueContainer" + value "BoundedSetByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "BoundedByReferenceContainer" + value "BoundedListByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByReferenceContainer" + value "BoundedSetByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnboundedByValueContainer" + value "UnboundedListByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByValueContainer" + value "UnboundedSetByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnboundedByReferenceContainer" + value "UnboundedListByReference<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByReferenceContainer" + value "UnboundedSetByReference<$targetClass>") + (object Attribute + tool "cg" + name "QualifiedByValueContainer" + value "AssociationByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByValueContainer" + value "DictionaryByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "QualifiedByReferenceContainer" + value "AssociationByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByReferenceContainer" + value "DictionaryByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "AlwaysKeepOrphanedCode" + value FALSE))) + (object Attribute + tool "cg" + name "compiler2.1__Project" + value (list Attribute_Set + (object Attribute + tool "cg" + name "AllowGenerateOverNewerAnnotations" + value FALSE) + (object Attribute + tool "cg" + name "AllowGenerateOverNewerVersion" + value FALSE) + (object Attribute + tool "cg" + name "HeaderFileExtension" + value "h") + (object Attribute + tool "cg" + name "HeaderFileBackupExtension" + value "h~") + (object Attribute + tool "cg" + name "HeaderFileTemporaryExtension" + value "h#") + (object Attribute + tool "cg" + name "CodeFileExtension" + value "cpp") + (object Attribute + tool "cg" + name "CodeFileBackupExtension" + value "cp~") + (object Attribute + tool "cg" + name "CodeFileTemporaryExtension" + value "cp#") + (object Attribute + tool "cg" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "cg" + name "StopOnError" + value FALSE) + (object Attribute + tool "cg" + name "ErrorLimit" + value 30) + (object Attribute + tool "cg" + name "Directory" + value "$ROSECPP_SOURCE") + (object Attribute + tool "cg" + name "BooleanType" + value "int") + (object Attribute + tool "cg" + name "AllowTemplates" + value FALSE) + (object Attribute + tool "cg" + name "AllowExplicitInstantiations" + value FALSE) + (object Attribute + tool "cg" + name "AllowProtectedInheritance" + value FALSE) + (object Attribute + tool "cg" + name "OneByValueContainer" + value "$targetClass") + (object Attribute + tool "cg" + name "OneByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "OptionalByValueContainer" + value "OptionalByValue(sizeof($targetClass))") + (object Attribute + tool "cg" + name "OptionalByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "FixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "FixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "BoundedByValueContainer" + value "BoundedListByValue(sizeof($targetClass),$limit)") + (object Attribute + tool "cg" + name "UnorderedBoundedByValueContainer" + value "BoundedSetByValue(sizeof($targetClass),$limit)") + (object Attribute + tool "cg" + name "BoundedByReferenceContainer" + value "BoundedListByReference($limit)") + (object Attribute + tool "cg" + name "UnorderedBoundedByReferenceContainer" + value "BoundedSetByReference($limit)") + (object Attribute + tool "cg" + name "UnboundedByValueContainer" + value "UnboundedListByValue(sizeof($targetClass))") + (object Attribute + tool "cg" + name "UnorderedUnboundedByValueContainer" + value "UnboundedSetByValue(sizeof($targetClass))") + (object Attribute + tool "cg" + name "UnboundedByReferenceContainer" + value "UnboundedListByReference") + (object Attribute + tool "cg" + name "UnorderedUnboundedByReferenceContainer" + value "UnboundedSetByReference") + (object Attribute + tool "cg" + name "QualifiedByValueContainer" + value "AssociationByValue(sizeof($qualtype), sizeof($qualcont))") + (object Attribute + tool "cg" + name "UnorderedQualifiedByValueContainer" + value "DictionaryByValue(sizeof($qualtype), sizeof($qualcont))") + (object Attribute + tool "cg" + name "QualifiedByReferenceContainer" + value "AssociationByReference(sizeof($qualtype), sizeof($qualcont))") + (object Attribute + tool "cg" + name "UnorderedQualifiedByReferenceContainer" + value "DictionaryByReference(sizeof($qualtype), sizeof($qualcont))") + (object Attribute + tool "cg" + name "PathSeparator" + value "") + (object Attribute + tool "cg" + name "FileNameFormat" + value "128vx_b") + (object Attribute + tool "cg" + name "AlwaysKeepOrphanedCode" + value FALSE))) + (object Attribute + tool "cg" + name "compiler3.0__Project" + value (list Attribute_Set + (object Attribute + tool "cg" + name "AllowGenerateOverNewerAnnotations" + value FALSE) + (object Attribute + tool "cg" + name "AllowGenerateOverNewerVersion" + value FALSE) + (object Attribute + tool "cg" + name "HeaderFileExtension" + value "h") + (object Attribute + tool "cg" + name "HeaderFileBackupExtension" + value "h~") + (object Attribute + tool "cg" + name "HeaderFileTemporaryExtension" + value "h#") + (object Attribute + tool "cg" + name "CodeFileExtension" + value "cpp") + (object Attribute + tool "cg" + name "CodeFileBackupExtension" + value "cp~") + (object Attribute + tool "cg" + name "CodeFileTemporaryExtension" + value "cp#") + (object Attribute + tool "cg" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "cg" + name "StopOnError" + value FALSE) + (object Attribute + tool "cg" + name "ErrorLimit" + value 30) + (object Attribute + tool "cg" + name "Directory" + value "$ROSECPP_SOURCE") + (object Attribute + tool "cg" + name "BooleanType" + value "int") + (object Attribute + tool "cg" + name "AllowTemplates" + value TRUE) + (object Attribute + tool "cg" + name "AllowExplicitInstantiations" + value FALSE) + (object Attribute + tool "cg" + name "AllowProtectedInheritance" + value TRUE) + (object Attribute + tool "cg" + name "OneByValueContainer" + value "$targetClass") + (object Attribute + tool "cg" + name "OneByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "OptionalByValueContainer" + value "OptionalByValue<$targetClass>") + (object Attribute + tool "cg" + name "OptionalByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "FixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "FixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "BoundedByValueContainer" + value "BoundedListByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByValueContainer" + value "BoundedSetByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "BoundedByReferenceContainer" + value "BoundedListByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByReferenceContainer" + value "BoundedSetByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnboundedByValueContainer" + value "UnboundedListByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByValueContainer" + value "UnboundedSetByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnboundedByReferenceContainer" + value "UnboundedListByReference<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByReferenceContainer" + value "UnboundedSetByReference<$targetClass>") + (object Attribute + tool "cg" + name "QualifiedByValueContainer" + value "AssociationByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByValueContainer" + value "DictionaryByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "QualifiedByReferenceContainer" + value "AssociationByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByReferenceContainer" + value "DictionaryByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "PathSeparator" + value "") + (object Attribute + tool "cg" + name "FileNameFormat" + value "128vx_b") + (object Attribute + tool "cg" + name "AlwaysKeepOrphanedCode" + value FALSE))) + (object Attribute + tool "cg" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "ImplementationType" + value "") + (object Attribute + tool "cg" + name "ClassKey" + value "class") + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "PutBodiesInSpec" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDefaultConstructor" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "DefaultConstructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineDefaultConstructor" + value FALSE) + (object Attribute + tool "cg" + name "ExplicitDefaultConstructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateCopyConstructor" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "CopyConstructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineCopyConstructor" + value FALSE) + (object Attribute + tool "cg" + name "ExplicitCopyConstructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDestructor" + value TRUE) + (object Attribute + tool "cg" + name "DestructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "DestructorKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "InlineDestructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateAssignmentOperation" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "AssignmentVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "AssignmentKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "InlineAssignmentOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateEqualityOperations" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "EqualityVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "EqualityKind" + value ("FriendKindSet" 200)) + (object Attribute + tool "cg" + name "InlineEqualityOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateRelationalOperations" + value FALSE) + (object Attribute + tool "cg" + name "RelationalVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "RelationalKind" + value ("FriendKindSet" 200)) + (object Attribute + tool "cg" + name "InlineRelationalOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateStorageMgmtOperations" + value FALSE) + (object Attribute + tool "cg" + name "StorageMgmtVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineStorageMgmtOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateSubscriptOperation" + value FALSE) + (object Attribute + tool "cg" + name "SubscriptVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "SubscriptKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "SubscriptResultType" + value "") + (object Attribute + tool "cg" + name "InlineSubscriptOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDereferenceOperation" + value FALSE) + (object Attribute + tool "cg" + name "DereferenceVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "DereferenceKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "DereferenceResultType" + value "") + (object Attribute + tool "cg" + name "InlineDereferenceOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateIndirectionOperation" + value FALSE) + (object Attribute + tool "cg" + name "IndirectionVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "IndirectionKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "IndirectionResultType" + value "") + (object Attribute + tool "cg" + name "InlineIndirectionOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateStreamOperations" + value FALSE) + (object Attribute + tool "cg" + name "StreamVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineStreamOperations" + value FALSE) + (object Attribute + tool "cg" + name "ThreeKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202))) + (object Attribute + tool "cg" + name "KindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203))) + (object Attribute + tool "cg" + name "FriendKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GenerateSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "DeclareAndDefine" + value 199) + (object Attribute + tool "cg" + name "DeclareOnly" + value 205) + (object Attribute + tool "cg" + name "DoNotDeclare" + value 206))) + (object Attribute + tool "cg" + name "VisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14))))) + (object Attribute + tool "cg" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Generate" + value TRUE) + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "cg" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "cg" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "AllowExtensionlessFileName" + value FALSE) + (object Attribute + tool "cg" + name "InclusionProtectionSymbol" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "IncludeFormat" + value (value Text +|// $package +|#include "$file" +| + )) + (object Attribute + tool "cg" + name "IncludeBySimpleName" + value FALSE) + (object Attribute + tool "cg" + name "IncludePrecompiledHeader" + value FALSE) + (object Attribute + tool "cg" + name "IncludeOrder" + value "AMIR") + (object Attribute + tool "cg" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "cg" + name "InliningStyle" + value ("InliningStyleSet" 207)) + (object Attribute + tool "cg" + name "InliningStyleSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InClassDeclaration" + value 208) + (object Attribute + tool "cg" + name "FollowingClassDeclaration" + value 207))) + (object Attribute + tool "cg" + name "TypesDefined" + value (value Text "")) + (object Attribute + tool "cg" + name "IncludeClosure" + value (value Text "")))) + (object Attribute + tool "cg" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Generate" + value TRUE) + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "cg" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "cg" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "AllowExtensionlessFileName" + value FALSE) + (object Attribute + tool "cg" + name "IncludeFormat" + value (value Text +|// $package +|#include "$file" +| + )) + (object Attribute + tool "cg" + name "IncludeBySimpleName" + value FALSE) + (object Attribute + tool "cg" + name "IncludePrecompiledHeader" + value TRUE) + (object Attribute + tool "cg" + name "IncludeOrder" + value "AMIR") + (object Attribute + tool "cg" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "cg" + name "InliningStyle" + value ("InliningStyleSet" 207)) + (object Attribute + tool "cg" + name "InliningStyleSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InClassDeclaration" + value 208) + (object Attribute + tool "cg" + name "FollowingClassDeclaration" + value 207))) + (object Attribute + tool "cg" + name "TypesDefined" + value (value Text "")) + (object Attribute + tool "cg" + name "IncludeClosure" + value (value Text "")))) + (object Attribute + tool "cg" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "OperationKind" + value ("OperationKindSet" 200)) + (object Attribute + tool "cg" + name "OperationKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GenerateAbstractBody" + value FALSE) + (object Attribute + tool "cg" + name "GenerateFriendBody" + value FALSE) + (object Attribute + tool "cg" + name "GenerateFriendDecl" + value FALSE) + (object Attribute + tool "cg" + name "SpecialDeclReturnType" + value "") + (object Attribute + tool "cg" + name "OperationIsConst" + value FALSE) + (object Attribute + tool "cg" + name "OperationIsExplicit" + value FALSE) + (object Attribute + tool "cg" + name "Inline" + value FALSE) + (object Attribute + tool "cg" + name "EntryCode" + value (value Text "")) + (object Attribute + tool "cg" + name "ExitCode" + value (value Text "")) + (object Attribute + tool "cg" + name "CCRegion" + value "") + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "BodyAnnotations" + value ""))) + (object Attribute + tool "cg" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "Ordered" + value TRUE) + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$supplier") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "InitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$relationship") + (object Attribute + tool "cg" + name "SetName" + value "set_$relationship") + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "ContainerClass" + value "") + (object Attribute + tool "cg" + name "SelectorName" + value "") + (object Attribute + tool "cg" + name "SelectorType" + value "") + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "HasRelTypeSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Array" + value 24) + (object Attribute + tool "cg" + name "Sequence" + value 47))))) + (object Attribute + tool "cg" + name "default__Association" + value (list Attribute_Set + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$targetClass"))) + (object Attribute + tool "cg" + name "default__Inherit" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InstanceArguments" + value ""))) + (object Attribute + tool "cg" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$targetClass") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$target") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "InitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "ContainerClass" + value "") + (object Attribute + tool "cg" + name "ContainerGet" + value "$data.get($keys)") + (object Attribute + tool "cg" + name "ContainerSet" + value "$data.set($keys,$value)") + (object Attribute + tool "cg" + name "QualifiedContainer" + value "") + (object Attribute + tool "cg" + name "AssocClassContainer" + value "$supplier *") + (object Attribute + tool "cg" + name "AssocClassInitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$target") + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "SetName" + value "set_$target") + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetSetByReference" + value ("QualifiedGetSetByReferenceSet" 2)) + (object Attribute + tool "cg" + name "QualifiedGetSetByReferenceSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_GetSetByReference" + value 2))) + (object Attribute + tool "cg" + name "GenerateQualifiedGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetName" + value "get_$target") + (object Attribute + tool "cg" + name "QualifiedGetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "InlineQualifiedGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateQualifiedSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedSetName" + value "set_$target") + (object Attribute + tool "cg" + name "QualifiedSetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineQualifiedSet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateAssocClassDataMember" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassDataMemberName" + value "$target") + (object Attribute + tool "cg" + name "AssocClassDataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "AssocClassDataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "AssocClassDataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "AssocClassGetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GenerateAssocClassGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassGetName" + value "get_$target") + (object Attribute + tool "cg" + name "AssocClassGetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassGetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "InlineAssocClassGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateAssocClassSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassSetName" + value "set_$target") + (object Attribute + tool "cg" + name "AssocClassSetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineAssocClassSet" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassForwardReferenceOnly" + value TRUE) + (object Attribute + tool "cg" + name "AssocTypeSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Array" + value 24) + (object Attribute + tool "cg" + name "Sequence" + value 47))))) + (object Attribute + tool "cg" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$attribute") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtAttributeVisibility" + value 211))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$attribute") + (object Attribute + tool "cg" + name "SetName" + value "set_$attribute") + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "CCRegion" + value ""))) + (object Attribute + tool "cg" + name "default__Uses" + value (list Attribute_Set + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "BodyReferenceOnly" + value FALSE))) + (object Attribute + tool "cg" + name "default__Subsystem" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "DirectoryIsOnSearchList" + value FALSE) + (object Attribute + tool "cg" + name "PrecompiledHeader" + value ""))) + (object Attribute + tool "cg" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "cg" + name "IsNamespace" + value FALSE) + (object Attribute + tool "cg" + name "Indent" + value 2) + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))))) + (object Attribute + tool "MSVC" + name "propertyId" + value "809135966") + (object Attribute + tool "MSVC" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Version" + value "5.0"))) + (object Attribute + tool "MSVC" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCClassTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCClassTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Interface_Part" + value 1) + (object Attribute + tool "MSVC" + name "Connection_Part" + value 2) + (object Attribute + tool "MSVC" + name "Class_Factory" + value 3))) + (object Attribute + tool "MSVC" + name "CObjectFunctionality" + value ("CObjectFunctionalitySet" 0)) + (object Attribute + tool "MSVC" + name "CObjectFunctionalitySet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "None" + value 0) + (object Attribute + tool "MSVC" + name "Dynamic" + value 1) + (object Attribute + tool "MSVC" + name "Dyncreate" + value 2) + (object Attribute + tool "MSVC" + name "Serial" + value 3))) + (object Attribute + tool "MSVC" + name "GenerateOverrideGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "GenerateDataGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DATA_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateFieldGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_FIELD_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateMessageGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "GenerateMessageMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MESSAGE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "OLEFactory" + value ("OLEFactorySet" 0)) + (object Attribute + tool "MSVC" + name "OLEFactorySet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "None" + value 0) + (object Attribute + tool "MSVC" + name "Built_in" + value 1) + (object Attribute + tool "MSVC" + name "Simple" + value 2) + (object Attribute + tool "MSVC" + name "Licensed" + value 3))) + (object Attribute + tool "MSVC" + name "OLEName" + value "") + (object Attribute + tool "MSVC" + name "OLEClassID" + value "") + (object Attribute + tool "MSVC" + name "GenerateOLECtlType" + value FALSE) + (object Attribute + tool "MSVC" + name "OLECtlType" + value "") + (object Attribute + tool "MSVC" + name "GenerateOLETypeLib" + value FALSE) + (object Attribute + tool "MSVC" + name "OLETypeLibID" + value "") + (object Attribute + tool "MSVC" + name "OLETypeLibMajor" + value "") + (object Attribute + tool "MSVC" + name "OLETypeLibMinor" + value "") + (object Attribute + tool "MSVC" + name "GeneratePropPageIDs" + value FALSE) + (object Attribute + tool "MSVC" + name "OLEPropPageIDs" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateDispatchMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockProperties" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockFunctions" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DispatchDefValue" + value "") + (object Attribute + tool "MSVC" + name "GenerateDispIdEnum" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DISP_ID_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInterfaceMap" + value FALSE) + (object Attribute + tool "MSVC" + name "INTERFACE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "InitInterface" + value "") + (object Attribute + tool "MSVC" + name "GenerateEventMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_EVENT_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockEvents" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateEventSinkMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "PropNotifySinks" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateConnectionMap" + value FALSE) + (object Attribute + tool "MSVC" + name "CONNECTION_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "ConnectionPointIID" + value "") + (object Attribute + tool "MSVC" + name "InheritanceType" + value "") + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "OLECommands" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MFCDeclares" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MFCImplements" + value (value Text "")) + (object Attribute + tool "MSVC" + name "ATL_Declares" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateCOMMap" + value FALSE) + (object Attribute + tool "MSVC" + name "COM_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateConnectionPointMap" + value FALSE) + (object Attribute + tool "MSVC" + name "CONNECTION_POINT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateMsgMap" + value FALSE) + (object Attribute + tool "MSVC" + name "MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GeneratePropertyMap" + value FALSE) + (object Attribute + tool "MSVC" + name "PROPERTY_MAP_Entries" + value (value Text "")))) + (object Attribute + tool "MSVC" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCOperationTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCOperationTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Virtual_Override" + value 1) + (object Attribute + tool "MSVC" + name "Message_Handler" + value 2) + (object Attribute + tool "MSVC" + name "Dispatch_Handler" + value 3) + (object Attribute + tool "MSVC" + name "Event_Firing_Function" + value 4) + (object Attribute + tool "MSVC" + name "Event_Sink_Handler" + value 5) + (object Attribute + tool "MSVC" + name "Std_OLE_Method" + value 6) + (object Attribute + tool "MSVC" + name "Command_Parser" + value 7) + (object Attribute + tool "MSVC" + name "Property_Get_Function" + value 8) + (object Attribute + tool "MSVC" + name "Property_Set_Function" + value 9) + (object Attribute + tool "MSVC" + name "Property_Notify_Function" + value 10) + (object Attribute + tool "MSVC" + name "Macro_Generated_Function" + value 11))) + (object Attribute + tool "MSVC" + name "AFX_MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MESSAGE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "BodyImage" + value (value Text "")))) + (object Attribute + tool "MSVC" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "GenerateIncludesGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_INCLUDES_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInsertLocation" + value FALSE))) + (object Attribute + tool "MSVC" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "GenerateIncludesGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_INCLUDES_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInsertLocation" + value FALSE))) + (object Attribute + tool "cg" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Rose Web Publisher" + name "HiddenTool" + value FALSE) + (object Attribute + tool "TopLink" + name "HiddenTool" + value FALSE) + (object Attribute + tool "COM" + name "propertyId" + value "783606378") + (object Attribute + tool "COM" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "COM" + name "TypeKinds" + value (list Attribute_Set + (object Attribute + tool "COM" + name "enum" + value 100) + (object Attribute + tool "COM" + name "record" + value 101) + (object Attribute + tool "COM" + name "module" + value 102) + (object Attribute + tool "COM" + name "interface" + value 103) + (object Attribute + tool "COM" + name "dispinterface" + value 104) + (object Attribute + tool "COM" + name "coclass" + value 105) + (object Attribute + tool "COM" + name "alias" + value 106) + (object Attribute + tool "COM" + name "union" + value 107) + (object Attribute + tool "COM" + name "max" + value 108) + (object Attribute + tool "COM" + name "(none)" + value 109))) + (object Attribute + tool "COM" + name "Generate" + value TRUE) + (object Attribute + tool "COM" + name "kind" + value ("TypeKinds" 109)) + (object Attribute + tool "COM" + name "uuid" + value "") + (object Attribute + tool "COM" + name "version" + value "") + (object Attribute + tool "COM" + name "helpstring" + value "") + (object Attribute + tool "COM" + name "helpcontext" + value "") + (object Attribute + tool "COM" + name "attributes" + value "") + (object Attribute + tool "COM" + name "dllname" + value "") + (object Attribute + tool "COM" + name "alias" + value ""))) + (object Attribute + tool "COM" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "COM" + name "Generate" + value TRUE) + (object Attribute + tool "COM" + name "id" + value "") + (object Attribute + tool "COM" + name "helpstring" + value "") + (object Attribute + tool "COM" + name "attributes" + value ""))) + (object Attribute + tool "COM" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "COM" + name "Generate" + value TRUE) + (object Attribute + tool "COM" + name "id" + value "") + (object Attribute + tool "COM" + name "helpstring" + value "") + (object Attribute + tool "COM" + name "attributes" + value ""))) + (object Attribute + tool "COM" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "COM" + name "Generate" + value TRUE) + (object Attribute + tool "COM" + name "filename" + value "") + (object Attribute + tool "COM" + name "library" + value "") + (object Attribute + tool "COM" + name "uuid" + value "") + (object Attribute + tool "COM" + name "version" + value "") + (object Attribute + tool "COM" + name "helpstring" + value "") + (object Attribute + tool "COM" + name "helpfile" + value "") + (object Attribute + tool "COM" + name "helpcontext" + value "") + (object Attribute + tool "COM" + name "lcid" + value "") + (object Attribute + tool "COM" + name "attributes" + value ""))) + (object Attribute + tool "COM" + name "default__Param" + value (list Attribute_Set + (object Attribute + tool "COM" + name "attributes" + value ""))) + (object Attribute + tool "COM" + name "HiddenTool" + value FALSE) + (object Attribute + tool "VC++" + name "propertyId" + value "809135966") + (object Attribute + tool "VC++" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "UpdateATL" + value TRUE) + (object Attribute + tool "VC++" + name "SmartPointersOnAssoc" + value TRUE) + (object Attribute + tool "VC++" + name "GenerateImports" + value TRUE) + (object Attribute + tool "VC++" + name "PutImportsIn" + value "stdafx.h") + (object Attribute + tool "VC++" + name "FullPathInImports" + value TRUE) + (object Attribute + tool "VC++" + name "UseImportAttributes" + value TRUE) + (object Attribute + tool "VC++" + name "ImportAttributes" + value "no_namespace named_guids") + (object Attribute + tool "VC++" + name "ImportProjTypeLib" + value TRUE) + (object Attribute + tool "VC++" + name "DefaultTypeLib" + value TRUE) + (object Attribute + tool "VC++" + name "TypeLibLocation" + value "") + (object Attribute + tool "VC++" + name "CompileProjTypeLib" + value TRUE) + (object Attribute + tool "VC++" + name "IdlInterfaceAttributes" + value (value Text +|endpoint("") +|local +|object +|pointer_default() +|uuid("") +|version("") +|encode +|decode +|auto_handle +|implicit_handle("") +|code +|nocode + )) + (object Attribute + tool "VC++" + name "IdlCoClassAttributes" + value (value Text +|uuid("") +|helpstring("") +|helpcontext("") +|licensed +|version("") +|control +|hidden +|appobject + )) + (object Attribute + tool "VC++" + name "IdlCoClassInterfaceAttributes" + value (value Text +|default +|source + )) + (object Attribute + tool "VC++" + name "IdlParameterAttributes" + value (value Text +|in +|out +|retval + )) + (object Attribute + tool "VC++" + name "IdlMethodAttributes" + value (value Text +|id(1) +|helpstring("") +|call_as("") +|callback +|helpcontext("") +|hidden +|local +|restricted +|source +|vararg + )) + (object Attribute + tool "VC++" + name "IdlPropertyAttributes" + value (value Text +|id() +|helpstring("") +|call_as("") +|helpcontext("") +|hidden +|local +|restricted +|source +|vararg +|bindable +|defaultbind +|defaultcallelem +|displaybind +|immediatebind +|nonbrowseable +|requestedit + )) + (object Attribute + tool "VC++" + name "RvcPtyVersion" + value "1.4") + (object Attribute + tool "VC++" + name "ModelIDStyle" + value 2) + (object Attribute + tool "VC++" + name "DocStyle" + value 1) + (object Attribute + tool "VC++" + name "GenerateIncludes" + value TRUE) + (object Attribute + tool "VC++" + name "ApplyPattern" + value FALSE) + (object Attribute + tool "VC++" + name "CreateBackupFiles" + value TRUE) + (object Attribute + tool "VC++" + name "SupportCodeName" + value FALSE) + (object Attribute + tool "VC++" + name "DocRevEngineer" + value TRUE) + (object Attribute + tool "VC++" + name "CreateOverviewDiagrams" + value TRUE) + (object Attribute + tool "VC++" + name "UpdateModelIDsInCode" + value TRUE) + (object Attribute + tool "VC++" + name "AttributeTypes" + value (value Text +|attr1=bool +|attr2=short +|attr3=int +|attr4=long +|attr5=char +|attr6=float +|attr7=double +|attr8=void +|attr9=clock_t +|attr10=_complex +|attr11=_dev_t +|attr12=div_t +|attr13=_exception +|attr14=FILE +|attr15=_finddata_t +|attr16=_FPIEEE_RECORD +|attr17=fpos_t +|attr18=_HEAPINFO +|attr19=jmp_buf +|attr20=lconv +|attr21=ldiv_t +|attr22=_off_t +|attr23=_onexit_t +|attr24=_PNH +|attr25=ptrdiff_t +|attr26=sig_atomic_t +|attr27=size_t +|attr28=_stat +|attr29=time_t +|attr30=_timeb +|attr31=tm +|attr32=_utimbuf +|attr33=va_list +|attr34=wchar_t +|attr35=wctrans_t +|attr36=wctype_t +|attr37=_wfinddata_t +|attr38=_wfinddatai64_t +|attr39=wint_t +|attr40=ABORTPROC +|attr41=ACMDRIVERENUMCB +|attr42=ACMDRIVERPROC +|attr43=ACMFILTERCHOOSEHOOKPROC +|attr44=ACMFILTERENUMCB +|attr45=ACMFILTERTAGENUMCB +|attr46=ACMFORMATCHOOSEHOOKPROC +|attr47=ACMFORMATENUMCB +|attr48=ACMFORMATTAGENUMCB +|attr49=APPLET_PROC +|attr50=ATOM +|attr51=BOOL +|attr52=BOOLEAN +|attr53=BYTE +|attr54=CALINFO_ENUMPROC +|attr55=CALLBACK +|attr56=CHAR +|attr57=COLORREF +|attr58=CONST +|attr59=CRITICAL_SECTION +|attr60=CTRYID +|attr61=DATEFMT_ENUMPROC +|attr62=DESKTOPENUMPROC +|attr63=DLGPROC +|attr64=DRAWSTATEPROC +|attr65=DWORD +|attr66=EDITWORDBREAKPROC +|attr67=ENHMFENUMPROC +|attr68=ENUMRESLANGPROC +|attr69=ENUMRESNAMEPROC +|attr70=ENUMRESTYPEPROC +|attr71=FARPROC +|attr72=FILE_SEGMENT_ELEMENT +|attr73=FLOAT +|attr74=FONTENUMPROC +|attr75=GOBJENUMPROC +|attr76=GRAYSTRINGPROC +|attr77=HACCEL +|attr78=HANDLE +|attr79=HBITMAP +|attr80=HBRUSH +|attr81=HCOLORSPACE +|attr82=HCONV +|attr83=HCONVLIST +|attr84=HCURSOR +|attr85=HDC +|attr86=HDDEDATA +|attr87=HDESK +|attr88=HDROP +|attr89=HDWP +|attr90=HENHMETAFILE +|attr91=HFILE +|attr92=HFONT +|attr93=HGDIOBJ +|attr94=HGLOBAL +|attr95=HHOOK +|attr96=HICON +|attr97=HIMAGELIST +|attr98=HIMC +|attr99=HINSTANCE +|attr100=HKEY +|attr101=HKL +|attr102=HLOCAL +|attr103=HMENU +|attr104=HMETAFILE +|attr105=HMODULE +|attr106=HMONITOR +|attr107=HOOKPROC +|attr108=HPALETTE +|attr109=HPEN +|attr110=HRGN +|attr111=HRSRC +|attr112=HSZ +|attr113=HTREEITEM +|attr114=HWINSTA +|attr115=HWND +|attr116=INT +|attr117=IPADDR +|attr118=LANGID +|attr119=LCID +|attr120=LCSCSTYPE +|attr121=LCSGAMUTMATCH +|attr122=LCTYPE +|attr123=LINEDDAPROC +|attr124=LOCALE_ENUMPROC +|attr125=LONG +|attr126=LONGLONG +|attr127=LPARAM +|attr128=LPBOOL +|attr129=LPBYTE +|attr130=LPCCHOOKPROC +|attr131=LPCFHOOKPROC +|attr132=LPCOLORREF +|attr133=LPCRITICAL_SECTION +|attr134=LPCSTR +|attr135=LPCTSTR +|attr136=LPCVOID +|attr137=LPCWSTR +|attr138=LPDWORD +|attr139=LPFIBER_START_ROUTINE +|attr140=LPFRHOOKPROC +|attr141=LPHANDLE +|attr142=LPHANDLER_FUNCTION +|attr143=LPINT +|attr144=LPLONG +|attr145=LPOFNHOOKPROC +|attr146=LPPAGEPAINTHOOK +|attr147=LPPAGESETUPHOOK +|attr148=LPPRINTHOOKPROC +|attr149=LPPROGRESS_ROUTINE +|attr150=LPSETUPHOOKPROC +|attr151=LPSTR +|attr152=LPSTREAM +|attr153=LPTHREAD_START_ROUTINE +|attr154=LPTSTR +|attr155=LPVOID +|attr156=LPWORD +|attr157=LPWSTR +|attr158=LRESULT +|attr159=LUID +|attr160=PBOOL +|attr161=PBOOLEAN +|attr162=PBYTE +|attr163=PCHAR +|attr164=PCRITICAL_SECTION +|attr165=PCSTR +|attr166=PCTSTR +|attr167=PCWCH +|attr168=PCWSTR +|attr169=PDWORD +|attr170=PFLOAT +|attr171=PFNCALLBACK +|attr172=PHANDLE +|attr173=PHANDLER_ROUTINE +|attr174=PHKEY +|attr175=PINT +|attr176=PLCID +|attr177=PLONG +|attr178=PLUID +|attr179=PROPENUMPROC +|attr180=PROPENUMPROCEX +|attr181=PSHORT +|attr182=PSTR +|attr183=PTBYTE +|attr184=PTCHAR +|attr185=PTIMERAPCROUTINE +|attr186=PTSTR +|attr187=PUCHAR +|attr188=PUINT +|attr189=PULONG +|attr190=PUSHORT +|attr191=PVOID +|attr192=PWCHAR +|attr193=PWORD +|attr194=PWSTR +|attr195=REGISTERWORDENUMPROC +|attr196=REGSAM +|attr197=SC_HANDLE +|attr198=SC_LOCK +|attr199=SENDASYNCPROC +|attr200=SERVICE_STATUS_HANDLE +|attr201=SHORT +|attr202=TBYTE +|attr203=TCHAR +|attr204=TIMEFMT_ENUMPROC +|attr205=TIMERPROC +|attr206=UCHAR +|attr207=UINT +|attr208=ULONG +|attr209=ULONGLONG +|attr210=UNSIGNED +|attr211=USHORT +|attr212=VOID +|attr213=WCHAR +|attr214=WINAPI +|attr215=WINSTAENUMPROC +|attr216=WNDENUMPROC +|attr217=WNDPROC +|attr218=WORD +|attr219=WPARAM +|attr220=YIELDPROC +|attr221=CPoint +|attr222=CRect +|attr223=CSize +|attr224=CString +|attr225=CTime +|attr226=CTimeSpan +|attr227=CCreateContext +|attr228=CMemoryState +|attr229=COleSafeArray +|attr230=CPrintInfo +|attr231=HRESULT + )) + (object Attribute + tool "VC++" + name "Containers" + value (value Text +|cont1=CArray<$TYPE, $TYPE&> +|cont2=CByteArray +|cont3=CDWordArray +|cont4=CObArray +|cont5=CPtrArray +|cont6=CStringArray +|cont7=CUIntArray +|cont8=CWordArray +|cont9=CList<$TYPE, $TYPE&> +|cont10=CPtrList +|cont11=CObList +|cont12=CStringList +|cont13=CMapWordToPtr +|cont14=CMapPtrToWord +|cont15=CMapPtrToPtr +|cont16=CMapWordToOb +|cont17=CMapStringToPtr +|cont18=CMapStringToOb +|cont19=CMapStringToString +|cont20=CTypedPtrArray +|cont21=CTypedPtrArray +|cont22=CTypedPtrList +|cont23=CTypedPtrList +|cont24=CComObject<$TYPE> +|cont25=CComPtr<$TYPE> +|cont26=CComQIPtr<$TYPE> +|cont27=CComQIPtr<$TYPE, IID*> + )) + (object Attribute + tool "VC++" + name "ClassMethods" + value (value Text +|*_body=// ToDo: Add your specialized code here and/or call the base class +|cm1=$NAME() +|cm2=$NAME(orig:const $NAME&) +|cm3=<> ~$NAME() +|cm4=operator=(rhs:$NAME&):$NAME& +|cm4_body=// ToDo: Add your specialized code here and/or call the base class||return rhs; +|cm5=<> operator==(rhs:const $NAME&):bool +|cm5_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm6=<> operator!=(rhs:$NAME&):bool +|cm6_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm7=<> operator<(rhs:$NAME&):bool +|cm7_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm8=<> operator>(rhs:$NAME&):bool +|cm8_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm9=<> operator<=(rhs:$NAME&):bool +|cm9_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm10=<> operator>=(rhs:$NAME&):bool +|cm10_body=// ToDo: Add your specialized code here and/or call the base class||return false; +|cm11=<> operator>>(i:istream&, rhs:$NAME&):istream& +|cm11_body=// ToDo: Add your specialized code here and/or call the base class||return i; +|cm12=<> operator<<(o:ostream&, rhs:const $NAME&):ostream& +|cm12_body=// ToDo: Add your specialized code here and/or call the base class||return o; + )) + (object Attribute + tool "VC++" + name "Accessors" + value (value Text +|agf=<> get_$BASICNAME():const $TYPE +|agf_body=return $NAME; +|asf=set_$BASICNAME(value:$TYPE):void +|asf_body=$NAME = value;|return; +|agv=<> get_$BASICNAME():const $TYPE& +|agv_body=return $NAME; +|asv=set_$BASICNAME(value:$TYPE&):void +|asv_body=$NAME = value;|return; +|agp=<> get_$BASICNAME():const $TYPE +|agp_body=return $NAME; +|asp=set_$BASICNAME(value:$TYPE):void +|asp_body=$NAME = value;|return; +|agr=<> get_$BASICNAME():const $TYPE +|agr_body=return $NAME; +|asr=set_$BASICNAME(value:$TYPE):void +|asr_body=$NAME = value;|return; +|aga=<> get_$BASICNAME(index:int):const $TYPE +|aga_body=return $NAME[index]; +|asa=set_$BASICNAME(index:int, value:$TYPE):void +|asa_body=$NAME[index] = value;|return; + )) + (object Attribute + tool "VC++" + name "Conditionals" + value (value Text +|*_decl=#ifdef _DEBUG +|*_base=CObject +|cond1=<> AssertValid():void +|cond1_body=$SUPERNAME::AssertValid(); +|cond2=<> Dump(dc:CDumpContext&):void +|cond2_body=$SUPERNAME::Dump(dc); + )) + (object Attribute + tool "VC++" + name "Patterns" + value (value Text +|patrn1=cm1,cm3,cond1,cond2 +|Patrn1_name=Default + )) + (object Attribute + tool "VC++" + name "AtlClassPrefix" + value "C") + (object Attribute + tool "VC++" + name "AtlInterfacePrefix" + value "I") + (object Attribute + tool "VC++" + name "AtlTypeDescription" + value "Class") + (object Attribute + tool "VC++" + name "DefaultLogicalPackage" + value "$language Reverse Engineered/$component") + (object Attribute + tool "VC++" + name "DefaultComponentPackage" + value ""))) + (object Attribute + tool "VC++" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "Generate" + value TRUE) + (object Attribute + tool "VC++" + name "HeaderFileName" + value "") + (object Attribute + tool "VC++" + name "CodeFileName" + value ""))) + (object Attribute + tool "VC++" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "InternalMap" + value (value Text +|*:AUTO:AUTO +| + )) + (object Attribute + tool "VC++" + name "ExportMap" + value (value Text +|*:AUTO:AUTO +| + )) + (object Attribute + tool "VC++" + name "InitialSourceIncludes" + value (value Text +|"stdafx.h" + )) + (object Attribute + tool "VC++" + name "InitialHeaderIncludes" + value (value Text "")) + (object Attribute + tool "VC++" + name "Copyright" + value (value Text "Copyright (C) 1991 - 1999 Rational Software Corporation")) + (object Attribute + tool "VC++" + name "KindSet" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "(none)" + value 300) + (object Attribute + tool "VC++" + name "DLL" + value 301) + (object Attribute + tool "VC++" + name "EXE" + value 302) + (object Attribute + tool "VC++" + name "MIDL" + value 303))) + (object Attribute + tool "VC++" + name "Kind" + value ("KindSet" 300)) + (object Attribute + tool "VC++" + name "BodyExtensions" + value (value Text +|.cpp +|.cxx +|.inl + )) + (object Attribute + tool "VC++" + name "HeaderExtensions" + value (value Text +|.h +|.hpp +|.hxx +|inl + )) + (object Attribute + tool "VC++" + name "ProjectFolders" + value (value Text +|Source Files +|Header Files + )) + (object Attribute + tool "VC++" + name "UsePathMap" + value FALSE))) + (object Attribute + tool "VC++" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "Const" + value FALSE) + (object Attribute + tool "VC++" + name "Generate" + value TRUE) + (object Attribute + tool "VC++" + name "InitialValue" + value ""))) + (object Attribute + tool "VC++" + name "default__Uses" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "Generate" + value TRUE))) + (object Attribute + tool "VC++" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "IsDirectory" + value FALSE) + (object Attribute + tool "VC++" + name "Directory" + value ""))) + (object Attribute + tool "VC++" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "Generate" + value TRUE))) + (object Attribute + tool "VC++" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "VC++" + name "Generate" + value TRUE) + (object Attribute + tool "VC++" + name "Inline" + value FALSE) + (object Attribute + tool "VC++" + name "DefaultBody" + value (value Text "")))) + (object Attribute + tool "VC++" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Visual Basic" + name "propertyId" + value "783606378") + (object Attribute + tool "Visual Basic" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "UpdateCode" + value TRUE) + (object Attribute + tool "Visual Basic" + name "UpdateModel" + value TRUE) + (object Attribute + tool "Visual Basic" + name "InstancingSet" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "Private" + value 221) + (object Attribute + tool "Visual Basic" + name "PublicNotCreatable" + value 213) + (object Attribute + tool "Visual Basic" + name "SingleUse" + value 214) + (object Attribute + tool "Visual Basic" + name "GlobalSingleUse" + value 215) + (object Attribute + tool "Visual Basic" + name "MultiUse" + value 219) + (object Attribute + tool "Visual Basic" + name "GlobalMultiUse" + value 220))) + (object Attribute + tool "Visual Basic" + name "BaseSet" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "(none)" + value 222) + (object Attribute + tool "Visual Basic" + name "0" + value 223) + (object Attribute + tool "Visual Basic" + name "1" + value 224))) + (object Attribute + tool "Visual Basic" + name "OptionBase" + value ("BaseSet" 222)) + (object Attribute + tool "Visual Basic" + name "OptionExplicit" + value TRUE) + (object Attribute + tool "Visual Basic" + name "OptionCompare" + value ("CompareSet" 202)) + (object Attribute + tool "Visual Basic" + name "Instancing" + value ("InstancingSet" 219)) + (object Attribute + tool "Visual Basic" + name "CompareSet" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "(none)" + value 202) + (object Attribute + tool "Visual Basic" + name "Binary" + value 203) + (object Attribute + tool "Visual Basic" + name "Text" + value 204))))) + (object Attribute + tool "Visual Basic" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "LibraryName" + value "") + (object Attribute + tool "Visual Basic" + name "AliasName" + value "") + (object Attribute + tool "Visual Basic" + name "IsStatic" + value FALSE) + (object Attribute + tool "Visual Basic" + name "ProcedureID" + value "") + (object Attribute + tool "Visual Basic" + name "ReplaceExistingBody" + value FALSE) + (object Attribute + tool "Visual Basic" + name "DefaultBody" + value (value Text "")))) + (object Attribute + tool "Visual Basic" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "New" + value FALSE) + (object Attribute + tool "Visual Basic" + name "WithEvents" + value FALSE) + (object Attribute + tool "Visual Basic" + name "ProcedureID" + value "") + (object Attribute + tool "Visual Basic" + name "PropertyName" + value "") + (object Attribute + tool "Visual Basic" + name "Subscript" + value ""))) + (object Attribute + tool "Visual Basic" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "UpdateCode" + value TRUE) + (object Attribute + tool "Visual Basic" + name "New" + value FALSE) + (object Attribute + tool "Visual Basic" + name "WithEvents" + value FALSE) + (object Attribute + tool "Visual Basic" + name "FullName" + value FALSE) + (object Attribute + tool "Visual Basic" + name "ProcedureID" + value "") + (object Attribute + tool "Visual Basic" + name "PropertyName" + value "") + (object Attribute + tool "Visual Basic" + name "Subscript" + value ""))) + (object Attribute + tool "Visual Basic" + name "default__Inherit" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "ImplementsDelegation" + value TRUE) + (object Attribute + tool "Visual Basic" + name "FullName" + value FALSE))) + (object Attribute + tool "Visual Basic" + name "default__Param" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "ByVal" + value FALSE) + (object Attribute + tool "Visual Basic" + name "ByRef" + value FALSE) + (object Attribute + tool "Visual Basic" + name "Optional" + value FALSE) + (object Attribute + tool "Visual Basic" + name "ParamArray" + value FALSE))) + (object Attribute + tool "Visual Basic" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "ProjectFile" + value "") + (object Attribute + tool "Visual Basic" + name "UpdateCode" + value TRUE) + (object Attribute + tool "Visual Basic" + name "UpdateModel" + value TRUE) + (object Attribute + tool "Visual Basic" + name "ImportReferences" + value TRUE) + (object Attribute + tool "Visual Basic" + name "QuickImport" + value TRUE) + (object Attribute + tool "Visual Basic" + name "ImportBinary" + value FALSE))) + (object Attribute + tool "Visual Basic" + name "HiddenTool" + value FALSE) + (object Attribute + tool "VisualStudio" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Web Modeler" + name "HiddenTool" + value FALSE) + (object Attribute + tool "XML_DTD" + name "propertyId" + value "809135966") + (object Attribute + tool "XML_DTD" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "XML_DTD" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "XML_DTD" + name "Editor" + value ("EditorType" 100)) + (object Attribute + tool "XML_DTD" + name "StopOnError" + value TRUE) + (object Attribute + tool "XML_DTD" + name "EditorType" + value (list Attribute_Set + (object Attribute + tool "XML_DTD" + name "BuiltIn" + value 100) + (object Attribute + tool "XML_DTD" + name "WindowsShell" + value 101))))) + (object Attribute + tool "XML_DTD" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "XML_DTD" + name "Entity_SystemID" + value "") + (object Attribute + tool "XML_DTD" + name "Entity_PublicID" + value "") + (object Attribute + tool "XML_DTD" + name "NotationValue" + value "") + (object Attribute + tool "XML_DTD" + name "InternalValue" + value "") + (object Attribute + tool "XML_DTD" + name "ParameterEntity" + value FALSE) + (object Attribute + tool "XML_DTD" + name "ExternalEntity" + value FALSE) + (object Attribute + tool "XML_DTD" + name "Notation_SystemID" + value "") + (object Attribute + tool "XML_DTD" + name "Notation_PublicID" + value ""))) + (object Attribute + tool "XML_DTD" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "XML_DTD" + name "DefaultDeclType" + value ""))) + (object Attribute + tool "XML_DTD" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "XML_DTD" + name "Assign All" + value FALSE) + (object Attribute + tool "XML_DTD" + name "ComponentPath" + value ""))) + (object Attribute + tool "XML_DTD" + name "HiddenTool" + value FALSE) + (object Attribute + tool "RequisitePro" + name "HiddenTool" + value FALSE)) + quid "3C4D3727010D")) diff -r 000000000000 -r e35f40988205 xml/xmlfw/eabi/xmlframework2U.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/eabi/xmlframework2U.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,87 @@ +EXPORTS + _ZN3Xml10RAttribute4CopyEv @ 1 NONAME + _ZN3Xml10RAttribute4OpenERK7RStringS3_S3_NS_14TAttributeTypeE @ 2 NONAME + _ZN3Xml10RAttribute4OpenERK7RStringS3_S3_S3_NS_14TAttributeTypeE @ 3 NONAME + _ZN3Xml10RAttribute5CloseEv @ 4 NONAME + _ZN3Xml10RAttribute8SetValueERK7RString @ 5 NONAME + _ZN3Xml10RAttributeC1Ev @ 6 NONAME + _ZN3Xml10RAttributeC2Ev @ 7 NONAME + _ZN3Xml17CCharSetConverter16PrepareCharConvLERjRK6TDesC8 @ 8 NONAME + _ZN3Xml17CCharSetConverter16PrepareCharConvLERji @ 9 NONAME + _ZN3Xml17CCharSetConverter17ConvertToUnicodeLEmRK6TDesC8RP7HBufC16 @ 10 NONAME + _ZN3Xml17CCharSetConverter19ConvertFromUnicodeLERK7TDesC16mRP6HBufC8 @ 11 NONAME + _ZN3Xml17CCharSetConverter25PrepareToConvertToOrFromLEm @ 12 NONAME + _ZN3Xml17CCharSetConverter32ConvertUcs4CharactersToEncodingLEPmimRP6HBufC8 @ 13 NONAME + _ZN3Xml17CCharSetConverter44ConvertCharacterSetIdentifierToStandardNameLEmRP6HBufC8 @ 14 NONAME + _ZN3Xml19CDictionaryCodePage22ConstructIndexMappingLEPKiNS0_11TStringTypeE @ 15 NONAME + _ZN3Xml19CDictionaryCodePage4NewLEPK12TStringTableS3_S3_h @ 16 NONAME + _ZN3Xml19CDictionaryCodePageD0Ev @ 17 NONAME + _ZN3Xml19CDictionaryCodePageD1Ev @ 18 NONAME + _ZN3Xml19CDictionaryCodePageD2Ev @ 19 NONAME + _ZN3Xml19RDocumentParameters4OpenERK7RString @ 20 NONAME + _ZN3Xml19RDocumentParameters5CloseEv @ 21 NONAME + _ZN3Xml19RDocumentParametersC1Ev @ 22 NONAME + _ZN3Xml19RDocumentParametersC2Ev @ 23 NONAME + _ZN3Xml27RStringDictionaryCollection10StringPoolEv @ 24 NONAME + _ZN3Xml27RStringDictionaryCollection15OpenDictionaryLERK6TDesC8 @ 25 NONAME + _ZN3Xml27RStringDictionaryCollection5CloseEv @ 26 NONAME + _ZN3Xml27RStringDictionaryCollection5OpenLEv @ 27 NONAME + _ZN3Xml27RStringDictionaryCollectionC1Ev @ 28 NONAME + _ZN3Xml27RStringDictionaryCollectionC2Ev @ 29 NONAME + _ZN3Xml6ParseLERNS_7CParserER3RFsRK7TDesC16 @ 30 NONAME + _ZN3Xml6ParseLERNS_7CParserERK6TDesC8 @ 31 NONAME + _ZN3Xml7CParser10StringPoolEv @ 32 NONAME + _ZN3Xml7CParser11ParseBeginLERK6TDesC8 @ 33 NONAME + _ZN3Xml7CParser11ParseBeginLEv @ 34 NONAME + _ZN3Xml7CParser13EnableFeatureEi @ 35 NONAME + _ZN3Xml7CParser14DisableFeatureEi @ 36 NONAME + _ZN3Xml7CParser18SetProcessorChainLERK6RArrayI4TUidE @ 37 NONAME + _ZN3Xml7CParser23AddPreloadedDictionaryLERK6TDesC8 @ 38 NONAME + _ZN3Xml7CParser26StringDictionaryCollectionEv @ 39 NONAME + _ZN3Xml7CParser4NewLERK6TDesC8RNS_15MContentHandlerE @ 40 NONAME + _ZN3Xml7CParser5NewLCERK6TDesC8RNS_15MContentHandlerE @ 41 NONAME + _ZN3Xml7CParser6ParseLERK6TDesC8 @ 42 NONAME + _ZN3Xml7CParser9ParseEndLEv @ 43 NONAME + _ZN3Xml8RTagInfo4CopyEv @ 44 NONAME + _ZN3Xml8RTagInfo4OpenERK7RStringS3_S3_ @ 45 NONAME + _ZN3Xml8RTagInfo5CloseEv @ 46 NONAME + _ZN3Xml8RTagInfoC1Ev @ 47 NONAME + _ZN3Xml8RTagInfoC2Ev @ 48 NONAME + _ZNK3Xml10RAttribute4TypeEv @ 49 NONAME + _ZNK3Xml10RAttribute5ValueEv @ 50 NONAME + _ZNK3Xml10RAttribute9AttributeEv @ 51 NONAME + _ZNK3Xml19CDictionaryCodePage11StringTableENS0_11TStringTypeE @ 52 NONAME + _ZNK3Xml19CDictionaryCodePage24StringPoolIndexFromTokenEiNS0_11TStringTypeE @ 53 NONAME + _ZNK3Xml19CDictionaryCodePage24TokenFromStringPoolIndexEiNS0_11TStringTypeE @ 54 NONAME + _ZNK3Xml19CDictionaryCodePage8CodePageEv @ 55 NONAME + _ZNK3Xml19RDocumentParameters16CharacterSetNameEv @ 56 NONAME + _ZNK3Xml27RStringDictionaryCollection18CurrentDictionaryLEv @ 57 NONAME + _ZNK3Xml7CParser16IsFeatureEnabledEi @ 58 NONAME + _ZNK3Xml8RTagInfo3UriEv @ 59 NONAME + _ZNK3Xml8RTagInfo6PrefixEv @ 60 NONAME + _ZNK3Xml8RTagInfo9LocalNameEv @ 61 NONAME + _ZTIN3Xml19CDictionaryCodePageE @ 62 NONAME ; ## + _ZTVN3Xml19CDictionaryCodePageE @ 63 NONAME ; ## + _ZTIN3Xml17CCharSetConverterE @ 64 NONAME ; ## + _ZTIN3Xml7CParserE @ 65 NONAME ; ## + _ZTVN3Xml17CCharSetConverterE @ 66 NONAME ; ## + _ZTVN3Xml7CParserE @ 67 NONAME ; ## + _ZN3Xml6ParseLERNS_7CParserER5RFile @ 68 NONAME + _ZN3Xml10CMatchData10SetRomOnlyEi @ 69 NONAME + _ZN3Xml10CMatchData11SetVariantLERK6TDesC8 @ 70 NONAME + _ZN3Xml10CMatchData12SetMimeTypeLERK6TDesC8 @ 71 NONAME + _ZN3Xml10CMatchData14SetLeaveOnManyEi @ 72 NONAME + _ZN3Xml10CMatchData18SetCaseSensitivityEi @ 73 NONAME + _ZN3Xml10CMatchData4NewLERK6TDesC8 @ 74 NONAME + _ZN3Xml10CMatchData4NewLEv @ 75 NONAME + _ZN3Xml10CMatchData5NewLCERK6TDesC8 @ 76 NONAME + _ZN3Xml10CMatchData5NewLCEv @ 77 NONAME + _ZN3Xml7CParser11ParseBeginLERKNS_10CMatchDataE @ 78 NONAME + _ZN3Xml7CParser4NewLERKNS_10CMatchDataERNS_15MContentHandlerE @ 79 NONAME + _ZN3Xml7CParser5NewLCERKNS_10CMatchDataERNS_15MContentHandlerE @ 80 NONAME + _ZNK3Xml10CMatchData7VariantEv @ 81 NONAME + _ZNK3Xml10CMatchData8MimeTypeEv @ 82 NONAME + _ZNK3Xml10CMatchData8ResolveLER6RArrayIP26CImplementationInformationE @ 83 NONAME + _ZN3Xml17CCharSetConverter17ConvertToUnicodeLEmRK6TDesC8R6TPtr16 @ 84 NONAME + _ZN3Xml17CCharSetConverter19ConvertFromUnicodeLERK7TDesC16mR5TPtr8 @ 85 NONAME + diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,80 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Framework build information +// +// + +PRJ_EXPORTS +// Clients of the Framework +../inc/attribute.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/attribute.h) +../inc/contenthandler.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/contenthandler.h) +../inc/contentprocessor.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/contentprocessor.h) +../inc/contentprocessoruids.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/contentprocessoruids.h) +../inc/contentsource.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/contentsource.h) +../inc/documentparameters.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/documentparameters.h) +../inc/extension.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/extension.h) +../inc/matchdata.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/matchdata.h) +../inc/parser.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/parser.h) +../inc/parserfeature.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/parserfeature.h) +../inc/stringdictionarycollection.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/stringdictionarycollection.h) +../inc/taginfo.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/taginfo.h) +../inc/wbxmlextensionhandler.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/wbxmlextensionhandler.h) +../inc/xmlframeworkconstants.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/xmlframeworkconstants.h) +../inc/xmlframeworkerrors.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(xml/xmlframeworkerrors.h) + + +// Creators of Plugins for the Framework +../inc/plugins/charsetconverter.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/charsetconverter.h) +../inc/plugins/contentprocessorinitparams.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/contentprocessorinitparams.h) +../inc/plugins/dictionarycodepage.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/dictionarycodepage.h) +../inc/plugins/elementstack.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/elementstack.h) +../inc/plugins/parserinitparams.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/parserinitparams.h) +../inc/plugins/parserinterface.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/parserinterface.h) +../inc/plugins/stringdictionary.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(xml/plugins/stringdictionary.h) + +xmlframework.iby /epoc32/rom/include/xmlframework.iby +xml.iby /epoc32/rom/include/xml.iby + +PRJ_MMPFILES +xmlframework.mmp + +// Customer Resolver bldmake file +#include "xmlcustomresolver.inf" + +PRJ_TESTEXTENSIONS +// Must be run before t_stringdictionary00.mmp +start extension syslibs/test/xml_stringdictionary00tagtable +end + +PRJ_TESTMMPFILES +../test/rtest/group/t_stringdictionary00.mmp support +../test/rtest/group/t_parser.mmp support +../test/rtest/group/t_parserucs4test.mmp +../test/rtest/group/t_processfilemancopyfile.mmp support +../test/rtest/group/t_validator.mmp support +../test/rtest/group/t_xmlcore.mmp +../test/rtest/group/t_xmlmisc.mmp +../test/rtest/group/tp_xmlframeworkperftests.mmp +../test/rtest/group/tu_xmlcmatchdataunittests.mmp +../test/rtest/group/tu_xmlramparserplugins.mmp support +../test/rtest/group/tu_xmlromparserplugins.mmp support + +PRJ_TESTEXTENSIONS +// Must be run after plugins/tu_xmlramparserplugins.mmp +start extension syslibs/test/xml_xmlcmatchdatapostbuild +end + +PRJ_TESTEXPORTS +../test/rtest/group/xmlframeworktests.bat /epoc32/data/z/system/test/xmlframeworktests.bat +../test/rtest/group/xmlframeworktests.iby /epoc32/rom/include/xmlframeworktests.iby diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/syslibs_xml.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/syslibs_xml.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ + + + + + XML parsing framework with a SAX like API, parsers are implemented as Ecom plugins into the framework creating an extensible architecture. + + + + The listed files are now being exported to proper locations. + + + + Removed the workaround to generate rsc files that included generating dummy.exe + + + + xmlframework : Used temporary variables of type TPtr16. + + + + "SMPSAFE" keyword added as part of Preq2051 submission to all .mmp files + + + Updated xmlframeworkerrors.h + + + updated CParser comments to accurately reflect the encodings that are supported + + + + re-implementation of CMatchData::SortOrder() function. + + + + + Splitting the XML syslibs_xml CBR package into 3 CBR packages (syslibs_xml, syslibs_wbxmlparser, syslibs_xmlparser). + + + + + + String Dictionary How -To document is incorrect. Prapagation from v9.3 + + + + + Migrating the makefiles to Template Extension Makefiles. + + + + + + Update String Dictionary How To document by changing the method of building static string table + + + + Changed WbxmlParsertests.iby back to using charconv_all_plugins.iby instead of charconv_all_plugins_test.iby version, as Test plugins defaults are now inline with production plugin defaults + + + + + + Updating the component source files to comply with the Symbian filename policy. + + + + + XML parser now leaves everytime it processes invalid xml files + + + + Symbian OS v9.3 component branched from common codeline + + + + Distinguished Shift-JIS plugin file names for licencees + + + + Prevent a panic when parsing a corrupt DRM rights object + + + + Update to in-source documentation + + + + + Splitting Mixed Header files for Base Services API + + + + + + + Relocating Header files for XML API + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/syslibs_xml.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/syslibs_xml.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ +component syslibs_xml + +source \sf\os\xmlsrv\xml\xmlfw + +exports \sf\os\xmlsrv\xml\xmlfw\group +binary \sf\os\xmlsrv\xml\xmlfw\group all + +# disown dummy.exe +-binary \sf\os\buildtools\packaging\dummy all + +notes_source \component_defs\release.src + +ipr E +ipr T \sf\os\xmlsrv\xml\xmlfw\test diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xml.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xml.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This file contains the xml iby files (framework and parsers) to be built as part of the xml component in the ROM. +// +// + +#ifndef __XML_IBY__ +#define __XML_IBY__ + +// xml framework +#include "xmlframework.iby" + +// xml parser +#include "xmlparserplugin.iby" +// wbxml parser +#include "wbxmlparser.iby" + +//Libxml2 feature entry +#ifdef SYMBIAN_EXCLUDE_LIBXML2 + +//If either SAX Plugin or DOM/XPath are included, Libxml2 must be too +#if !defined(SYMBIAN_EXCLUDE_LIBXML2_SAX_CPARSER_PLUGIN) || !defined(SYMBIAN_EXCLUDE_LIBXML2_DOM_XPATH_API) +#error Libxml2 feature cannot be excluded if Libxml2SAXParser or Libxml2DOMXPathAPI is included. +#endif + +EXCLUDE_FEATURE Libxml2 +#else +FEATURE Libxml2 +#include +#endif + +//Libxml2 SAX Parser feature entry +#ifdef SYMBIAN_EXCLUDE_LIBXML2_SAX_CPARSER_PLUGIN +EXCLUDE_FEATURE Libxml2SAXParser +#else +FEATURE Libxml2SAXParser +// IBYs for SAX +// This iby includes libxml2.iby & xmlengineutils.iby +#include +#endif + +//Libxml2 DOM Parser feature entry +#ifdef SYMBIAN_EXCLUDE_LIBXML2_DOM_XPATH_API +EXCLUDE_FEATURE Libxml2DOMXPathAPI +#else +FEATURE Libxml2DOMXPathAPI +// IBYs for DOM +#include +// This iby includes libxml2.iby , xmlengineutils.iby & xmlenginedom.iby +#include +#endif + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xmlcustomresolver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xmlcustomresolver.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef XMLCUSTOMRESOLVER_IBY +#define XMLCUSTOMRESOLVER_IBY + +// Customer Parser plugin implementation resouce +ECOM_PLUGIN(xmlcustomresolver.dll,10273861.rsc) + + +#endif // XMLCUSTOMRESOLVER_IBY diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xmlcustomresolver.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xmlcustomresolver.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_EXPORTS +xmlcustomresolver.iby /epoc32/rom/include/xmlcustomresolver.iby + +PRJ_MMPFILES +xmlcustomresolver.mmp + +PRJ_TESTEXPORTS +../test/rtest/group/xmlcustomresolvertests.iby /epoc32/rom/include/xmlcustomresolvertests.iby + +//xml test data +../test/rtest/data/simple.xml z:/system/xmltest/resolver/simple.xml + +PRJ_TESTMMPFILES +../test/rtest/group/tc_xmlcustomresolvercomptests.mmp +../test/rtest/group/t_testxmlparserplugin1.mmp support +../test/rtest/group/t_testxmlparserplugin2.mmp support diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xmlcustomresolver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xmlcustomresolver.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// xmlcustomresolver.dll generic xml parser framework +// +// + +/** + @file +*/ + +TARGET xmlcustomresolver.dll +CAPABILITY ProtServ +TARGETTYPE plugin + +// XML Framework DLL +UID 0x10009D8D 0x10273861 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../src/customresolver +USERINCLUDE ../inc + +SOURCEPATH ../src/customresolver +SOURCE customresolver.cpp +SOURCE customresolverproxy.cpp + +START RESOURCE 10273861.rss +TARGET xmlcustomresolver.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY xmlframework.lib + + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xmlframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xmlframework.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,27 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLFRAMEWORK_IBY__ +#define __XMLFRAMEWORK_IBY__ + +#include + +REM XML Framework +file=ABI_DIR\BUILD_DIR\xmlframework.dll system\libs\xmlframework.dll + +REM Error strings +data=MULTI_LINGUIFY(RSC ZRESOURCE\Errors\XmlFrameworkErr resource\errors\XmlFrameworkErr) + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlfw/group/xmlframework.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/group/xmlframework.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// xmlframework.dll generic xml parser framework +// +// + +/** + @file +*/ + +TARGET xmlframework.dll +CAPABILITY All -Tcb +TARGETTYPE dll + +DEFFILE xmlframework2.def + +// XML Framework DLL +UID 0x101FADCB 0x101FADCC +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../src/xmlframework +USERINCLUDE ../inc + +SOURCEPATH ../src/xmlframework +SOURCE attribute.cpp +SOURCE charsetconverter.cpp +SOURCE dictionarycodepage.cpp +SOURCE documentparameters.cpp +SOURCE matchdata.cpp +SOURCE parser.cpp +SOURCE parserimpl.cpp +SOURCE stringdictionarycollection.cpp +SOURCE stringdictionarycollectionimpl.cpp +SOURCE taginfo.cpp +SOURCE xmlframeworkerrors.cpp +SOURCE xmlframeworkmain.cpp + +SOURCEPATH ../src/xmlframeworkerrors + +// The resource file containing XML Framework error messages +// Must eventually end up in Z\resource\errors +START RESOURCE xmlframeworkerr.rss +TARGETPATH /resource/errors +HEADER +LANG 01 +END + +LIBRARY euser.lib +LIBRARY bafl.lib // for RStringPool +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY charconv.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/XmlFrameworkPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/XmlFrameworkPanics.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,146 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). + +// All rights reserved. + +// This component and the accompanying materials are made available + +// under the terms of "Eclipse Public License v1.0" + +// which accompanies this distribution, and is available + +// at the URL "http://www.eclipse.org/legal/epl-v10.html". + +// + +// Initial Contributors: + +// Nokia Corporation - initial contribution. + +// + +// Contributors: + +// + +// Description: + +// + + + +#ifndef XMLFRAMEWORKPANICS_H_ + +#define XMLFRAMEWORKPANICS_H_ + + + +namespace Xml + +{ + + + + + +// Panic Codes + + + +/** + +Indicates various Panic error conditions within the framework. + + + +@internalTechnology + +*/ + +enum TXmlFrameworkPanic + + { + + /** + + Indicates that a leave code other than that expected was received. + + */ + + EXmlFrameworkPanicUnexpectedLeaveCode = 0, + + + + /** + + Indicates that a state other than that expected was reached. + + */ + + EXmlFrameworkPanicUnexpectedState = 1, + + + + /** + + Indicates that logic other than that expected was reached. + + */ + + EXmlFrameworkPanicUnexpectedLogic = 2, + + + + /** + + Indicates that internal document positioning has gone beyond EOF and has failed. + + */ + + EXmlFrameworkPanicPositionMisallignment = 3, + + + + /** + + Indicates that a reference count has reached a negative value. + + */ + + EXmlFrameworkPanicReferenceCountNegative = 4, + + + + /** + + Pointer is null, cannot dereference. + + */ + + EXmlFrameworkPanicNullPointer = 5, + + + + }; + + + +/** + +This method panics the thread + + + +@param aError The reason for the panic + +@internalTechnology + +*/ + +void Panic(TXmlFrameworkPanic aError); + + + +} + +#endif /*XMLFRAMEWORKPANICS_H_*/ + diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/attribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/attribute.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,174 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __ATTRIBUTE_H__ +#define __ATTRIBUTE_H__ + +#include + +namespace Xml +{ + +enum TAttributeType +/** +Specifies the type of this attribute object. +These values are defined in the xml specification. +For other specifications they may also be used or 'none'. +@see http://www.w3.org/TR/REC-xml#sec-attribute-types + +@publishedAll +@released +*/ + { +/** +Specifies a string type. +*/ + EAttributeType_CDATA, + +/** +Specifies a tokenized type. +*/ + EAttributeType_ID, + +/** +Specifies a tokenized type. +*/ + EAttributeType_IDREF, + +/** +Specifies a tokenized type. +*/ + EAttributeType_IDREFS, + +/** +Specifies a tokenized type. +*/ + EAttributeType_NMTOKEN, + +/** +Specifies a tokenized type. +*/ + EAttributeType_NMTOKENS, + +/** +Specifies a tokenized type. +*/ + EAttributeType_ENTITY, + +/** +Specifies a tokenized type. +*/ + EAttributeType_ENTITIES, + +/** +Specifies a tokenized type. +*/ + EAttributeType_NOTATION, + +/** +Specifies no type, or unsupported. +*/ + EAttributeType_NONE, + + }; + + + + +class RAttribute +/** +The RAttribute class holds an attribute's description belonging to an element. +@see RAttributeArray + +@publishedAll +@released +*/ + { +public: + +/** +@publishedPartner +@released +*/ + IMPORT_C RAttribute(); + +/** +@publishedPartner +@released +*/ + IMPORT_C RAttribute Copy(); + +/** +@publishedPartner +@released +*/ + IMPORT_C void Close(); + +/** +@publishedPartner +@released +*/ + IMPORT_C void Open(const RString& aUri, const RString& aPrefix, const RString& aLocalName, + const TAttributeType aType = EAttributeType_NONE); + +/** +@publishedPartner +@released +*/ + IMPORT_C void Open(const RString& aUri, const RString& aPrefix, const RString& aLocalName, + const RString& aValue, const TAttributeType aType = EAttributeType_NONE); + + IMPORT_C const RTagInfo& Attribute() const; + IMPORT_C const RString& Value() const; + IMPORT_C TAttributeType Type() const; + +/** +@publishedPartner +@released +*/ + IMPORT_C void SetValue(const RString& aValue); + +private: + +/** +Holds information about the attribute. +*/ + RTagInfo iAttribute; + +/** +Holds the attribute's value. +*/ + RString iValue; + +/** +Holds the attribute's type. +*/ + TAttributeType iType; + + }; + + +/** +Defines a list of attributes for an element. +@see MContentHandler + +@publishedAll +@released +*/ +typedef RArray RAttributeArray; + +} + +#endif //__ATTRIBUTE_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/contenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/contenthandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,170 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __CONTENTHANDLER_H__ +#define __CONTENTHANDLER_H__ + + +#include // needed for RAttributeArray + +class RString; + +namespace Xml +{ + +class RDocumentParameters; +class RTagInfo; + + +class MContentHandler +/** +This class defines the interface required by a client of the xml framework. +It allows a client to be placed in a chain with other clients, i.e. a Parser, a Validator, +or a User, and therefore allows the flow of information between these links. +It provides callbacks analogous to that of the SAX 2.0 interface. +@see http://www.saxproject.org/apidoc/ + +@publishedAll +@released +*/ + { +public: + +/** +This method is a callback to indicate the start of the document. +@param aDocParam Specifies the various parameters of the document. +@param aDocParam.iCharacterSetName The character encoding of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) = 0; + + +/** +This method is a callback to indicate the end of the document. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnEndDocumentL(TInt aErrorCode) = 0; + + +/** +This method is a callback to indicate an element has been parsed. +@param aElement is a handle to the element's details. +@param aAttributes contains the attributes for the element. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, + TInt aErrorCode) = 0; + + +/** +This method is a callback to indicate the end of the element has been reached. +@param aElement is a handle to the element's details. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) = 0; + + +/** +This method is a callback that sends the content of the element. +Not all the content may be returned in one go. The data may be sent in chunks. +When an OnEndElementL is received this means there is no more content to be sent. +@param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode) = 0; + + +/** +This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. +This method is always called before the corresponding OnStartElementL method. +@param aPrefix is the Namespace prefix being declared. +@param aUri is the Namespace URI the prefix is mapped to. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode) = 0; + + +/** +This method is a notification of the end of the scope of a prefix-URI mapping. +This method is called after the corresponding DoEndElementL method. +@param aPrefix is the Namespace prefix that was mapped. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) = 0; + + +/** +This method is a notification of ignorable whitespace in element content. +@param aBytes are the ignored bytes from the document being parsed. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) = 0; + + +/** +This method is a notification of a skipped entity. If the parser encounters an +external entity it does not need to expand it - it can return the entity as aName +for the client to deal with. +@param aName is the name of the skipped entity. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode) = 0; + + +/** +This method is a receive notification of a processing instruction. +@param aTarget is the processing instruction target. +@param aData is the processing instruction data. If empty none was supplied. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, + TInt aErrorCode) = 0; + + +/** +This method indicates an error has occurred. +@param aErrorCode is the error code +*/ + virtual void OnError(TInt aErrorCode) = 0; + + +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + virtual TAny* GetExtendedInterface(const TInt32 aUid) = 0; + + }; + +} + + +#endif //__CONTENTHANDLER_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/contentprocessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/contentprocessor.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,57 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + +#ifndef __CONTENTPROCESSOR_H__ +#define __CONTENTPROCESSOR_H__ + +#include +#include + +namespace Xml +{ + +class MContentProcessor : public MContentHandler, public MContentSource +/** +This interface class provides an interface to plugins of the xml framework wishing +to receive and pass on data as part of a chain of plugins. +This class is not used directly, but via a derived class the user provides. +This will allow it to receive data, and pass data onto +other MContentProcessor derivations. Examples of such classes include Validator's and +AutoCorrector's. +@see MContentHandler +@see ECom + + +@publishedPartner +@released +*/ + { +public: + +/** +This method allows for the correct destrution of the plugin. + +@post the objects memory is cleaned up. + +*/ + virtual void Release() = 0; + + }; + +} + +#endif //__CONTENTPROCESSOR_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/contentprocessoruids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/contentprocessoruids.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __CONTENTPROCESSORUIDS_H__ +#define __CONTENTPROCESSORUIDS_H__ + +#include + + +/** +Definition to represent a chain of plugins. + +@publishedAll +@released +*/ +typedef RArray RContentProcessorUids; + + +#endif //__CONTENTPROCESSORUIDS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/contentsource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/contentsource.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + +#ifndef __CONTENTSOURCE_H__ +#define __CONTENTSOURCE_H__ + +namespace Xml +{ + +class MContentHandler; + +class MContentSource +/** This interface must be implemented by xml framework plugins wishing +to pass data as part of a chain of plugins. + +@publishedPartner +@released +*/ + { +public: +/** This method tells us what's the next content handler in the chain. */ + virtual void SetContentSink (MContentHandler& aContentHandler) = 0; + }; + +} + +#endif //__CONTENTSOURCE_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/documentparameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/documentparameters.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __DOCUMENTPARAMETERS_H__ +#define __DOCUMENTPARAMETERS_H__ + + +#include + +namespace Xml +{ + +class RDocumentParameters +/** +The RDocumentParameters class contains information about the document to be passed to the client. + +@publishedAll +@released +*/ + { +public: + +/** +@publishedAll +@released +*/ + IMPORT_C RDocumentParameters(); + +/** +@publishedAll +@released +*/ + IMPORT_C void Close(); + +/** +@publishedAll +@released +*/ + IMPORT_C void Open(const RString& aCharacterSetName); + + IMPORT_C const RString& CharacterSetName() const; + +private: + + +/** +@publishedAll +@released +*/ + RDocumentParameters(const RDocumentParameters& aOriginal); + +/** +@publishedAll +@released +*/ + RDocumentParameters &operator=(const RDocumentParameters& aRhs); + +private: + +/** +The character encoding of the document. +The Internet-standard name of a character set, which is identified in Symbian OS by its UID +*/ + RString iCharacterSetName; + + }; + +} + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/extension.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/extension.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,98 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __EXTENSION_H__ +#define __EXTENSION_H__ + +#include + + +// +// This file describes version 1.3 WBXML Extension enumerations. +// + +enum TExtensionToken +/** +Lists enumerations used to describe the global unambiguous wbxml tokens +@see CParser +@see http://www.w3.org/TR/wbxml/ + +@publishedPartner +@released +*/ + { + +/** +Enumeration with a token value that represents +an inline string document-type-specific extension token. +Token is followed by a termstr. +*/ + EExtensionTokenEXT_I_0 = 0x40, + +/** +Enumeration with a token value that represents +an inline string document-type-specific extension token. +Token is followed by a termstr. +*/ + EExtensionTokenEXT_I_1 = 0x41, + +/** +Enumeration with a token value that represents +an inline string document-type-specific extension token. +Token is followed by a termstr. +*/ + EExtensionTokenEXT_I_2 = 0x42, + +/** +Enumeration with a token value that represents +an inline integer document-type-specific extension token. +Token is followed by a mb_u_int32. +*/ + EExtensionTokenEXT_T_0 = 0x80, +/** +Enumeration with a token value that represents +an inline integer document-type-specific extension token. +Token is followed by a mb_u_int32. +*/ + EExtensionTokenEXT_T_1 = 0x81, + +/** +Enumeration with a token value that represents +an inline integer document-type-specific extension token. +Token is followed by a mb_u_int32. +*/ + EExtensionTokenEXT_T_2 = 0x82, + +/** +Enumeration with a token value that represents +a single -byte document-type-specific extension token. +*/ + EExtensionTokenEXT_0 = 0xC0, + +/** +Enumeration with a token value that represents +a single -byte document-type-specific extension token. +*/ + EExtensionTokenEXT_1 = 0xC1, + +/** +Enumeration with a token value that represents +a single -byte document-type-specific extension token. +*/ + EExtensionTokenEXT_2 = 0xC2, + + }; + +#endif // __EXTENSION_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/matchdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/matchdata.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,122 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Detailed parser information for resolution criteria in XML framework +// +// + +/** + @file + @publishedAll + @released +*/ + + +#ifndef MATCHDATA_H +#define MATCHDATA_H + +#include +#include +#include +#include + +namespace Xml +{ + +/** +The plugin variant string of the default Symbian-provided XML parser plugins. +@publishedAll +@released +*/ +_LIT8(KXmlSymbianPluginVariant, "Symbian"); + +/** +CMatchData class provides detailed parser information for XML framework. +Client application should use this class to precisely specify the plugin, +which should be used as a parsing engine in XML framework. + +@publishedAll +@released +*/ + +NONSHARABLE_CLASS(CMatchData) : public CBase +{ + +public: + CMatchData(); + ~CMatchData(); + + IMPORT_C static CMatchData* NewL(); + IMPORT_C static CMatchData* NewL(const TDesC8& aPackage); + IMPORT_C static CMatchData* NewLC(); + IMPORT_C static CMatchData* NewLC(const TDesC8& aPackage); + + IMPORT_C void SetMimeTypeL(const TDesC8& aData); + IMPORT_C const TPtrC8 MimeType() const; + + IMPORT_C void SetVariantL(const TDesC8& aVariant); + IMPORT_C const TPtrC8 Variant() const; + + IMPORT_C void SetLeaveOnMany(TBool aSetting); + IMPORT_C void SetRomOnly(TBool aSetting); + IMPORT_C void SetCaseSensitivity(TBool aSetting); + + IMPORT_C TUid ResolveL(RImplInfoArray& aImplList) const; + +public: + CMatchData& operator=(const CMatchData & aMatchData); + TBool operator==(const CMatchData & aMatchData) const; + HBufC8* PackToBufferL() const; + +private: + void ConstructL(const TDesC8& aPackage); + + TBool VariantMatch(const TDesC8& aOpaqueField) const; + TBool MimeTypeMatch(const TDesC8& aDataField) const; + TBool MatchField(const TDesC8& aField, const TDesC8& aMatchString, const TDesC8& aSeparator) const; + + TBool CaseSensitivity() const; + TBool LeaveOnMany() const; + TBool RomOnly() const; + + void ExternalizeL(RWriteStream& aStream) const; + void InternalizeL(RReadStream& aStream); + + TUid SelectSingleParserL(RImplInfoPtrArray& aImplList) const; + TBool IsInvalidVariant() const; + + static TInt SortOrder(const CImplementationInformation &aImpInfo1, + const CImplementationInformation &aImpInfo2); +private: + /** + Mime type requested by client + Is matched against one of entries of data_type field in resoure information file + */ + HBufC8* iMimeType; + + /** + Variant requested by client + Is matched against first entry in opaque_data field of resource information file + */ + HBufC8* iVariant; + + /** + Additional information for resolution constrains. Bitmap. + */ + TUint32 iAddInfo; +}; + +} +#endif // MATCHDATA_H + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/parser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/parser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,98 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __PARSER_H__ +#define __PARSER_H__ + +/** +@file + +XML Framework CParser API header file. + +@publishedAll +@released +*/ + +#include +#include // needed for the typedef + + +class RFs; +class RFile; + +namespace Xml +{ + +class MContentHandler; +class RStringDictionaryCollection; +class TParserImpl; +class CMatchData; + +/** +If you need to parse xml this is the class you need to use. + +Default plain-text XML parser plug-in supports following character set encodings: + +ISO_8859_1 +US_ASCII +UTF_8 +UTF_16 +UTF_16BE +UTF_16LE + +@publishedAll +@released +*/ +class CParser : public CBase + { +public: + static IMPORT_C CParser* NewL(const TDesC8& aParserMimeType, MContentHandler& aCallback); + static IMPORT_C CParser* NewLC(const TDesC8& aParserMimeType, MContentHandler& aCallback); + + static IMPORT_C CParser* NewL(const CMatchData& aCriteria, MContentHandler& aCallback); + static IMPORT_C CParser* NewLC(const CMatchData& aCriteria, MContentHandler& aCallback); + + virtual ~CParser(); + + IMPORT_C void ParseBeginL(); + IMPORT_C void ParseBeginL(const TDesC8& aDocumentMimeType); + IMPORT_C void ParseBeginL(const CMatchData& aCriteria); + IMPORT_C void ParseL(const TDesC8& aFragment); + IMPORT_C void ParseEndL(); + + IMPORT_C void SetProcessorChainL(const RContentProcessorUids& aPlugins); + + IMPORT_C TInt EnableFeature(TInt aParserFeature); + IMPORT_C TInt DisableFeature(TInt aParserFeature); + IMPORT_C TBool IsFeatureEnabled(TInt aParserFeature) const; + + IMPORT_C void AddPreloadedDictionaryL(const TDesC8& aPublicId); + + IMPORT_C RStringPool& StringPool(); + IMPORT_C RStringDictionaryCollection& StringDictionaryCollection(); + +private: + CParser(); + void ConstructL(const TDesC8& aParserMimeType, MContentHandler& aCallback); + void ConstructL(const CMatchData& aMatchData, MContentHandler& aCallback); + TParserImpl* iImpl; + }; + +IMPORT_C void ParseL(CParser& aParser, const TDesC8& aDocument); +IMPORT_C void ParseL(CParser& aParser, RFs& aFs, const TDesC& aFilename); +IMPORT_C void ParseL(CParser& aParser, RFile& aFile); +} + +#endif //__PARSER_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/parserfeature.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/parserfeature.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,88 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef PARSERFEATURE_H +#define PARSERFEATURE_H + +/** +@file +@SYMPurpose Declares XML Framework parser features +@publishedAll +@released +*/ + + +namespace Xml +{ + +/** Features defined for XML Framework parser plug-ins. + +Every parser has a set of optional features that it may implement. This +enumeration is the set of all features known to the framework and its +plug-ins. Each feature is assigned a flag bit from the 32 possible. + +@see Xml::CParser::EnableFeature +*/ +enum TParserFeature + { + /** Convert elements and attributes to lowercase. This can be used for + case-insensitive HTML so that a tag can be matched to a static string in + the string pool. + @see RStringPool */ + EConvertTagsToLowerCase = 0x0001, + + /** Report an error when unrecognised tags are found. */ + EErrorOnUnrecognisedTags = 0x0002, + + /** Reports unrecognised tags. */ + EReportUnrecognisedTags = 0x0004, + + /** Report the namespace. */ + EReportNamespaces = 0x0008, + + /** Report the namespace prefix. */ + EReportNamespacePrefixes = 0x0010, + + /** Send all content data for an element in one chunk. */ + ESendFullContentInOneChunk = 0x0020, + + /** Report namespace mappings via the OnStartPrefixMapping & + OnEndPrefixMapping methods. + @see MContentHandler */ + EReportNamespaceMapping = 0x0040, + + /** Describe the data in the specified encoding, otherwise use utf-8. */ + ERawContent = 0x0080, + + /** When this feature is enabled the parser will allow (not generate an + error) entities from external subsets to appear in element attribute + values. When the replacement text of such entities are not known the + parser will return the entity reference as it appears in the document + e.g. "&ext_ref;" */ + EReplaceIntEntityFromExtSubsetByRef = 0x0100, + + /** When this feature is not supported the parser is an XML 1.0 parser. + When set parser can handle both XML 1.1 & 1.0 documents, otherwise just + XML 1.0. Equivalent to the standard SAX2 feature "xml-1.1" */ + EXmlVersion_1_1 = 0x0200, + + /** Used to mark the highest flag in use. + Update to reflect any new enumerations added. */ + ELastFeature = EXmlVersion_1_1, + }; + +} + +#endif // PARSERFEATURE_H diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/charsetconverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/charsetconverter.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,95 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __CHARSETCONVERTER_H__ +#define __CHARSETCONVERTER_H__ + +#include + +class CCnvCharacterSetConverter; + +namespace Xml +{ + +/** +The CCharSetConverter class supplies algorithms for character conversion +between a chosen character set and unicode. Memory management +needed to hold the converted data is also handled. + +@see CCnvCharacterSetConverter +@see CnvUtfConverter +@see MParser + +@publishedPartner +@released +*/ +class CCharSetConverter : public CBase + { +public: + + static CCharSetConverter* NewL(); + virtual ~CCharSetConverter(); + + IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, const TDesC8& aEncoding); + IMPORT_C void PrepareCharConvL(TUint& aCharSetUid, TInt aMibEnum); + + IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, + HBufC16*& aUnicodeConversion); + IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, + HBufC8*& aOutputBuffer); + IMPORT_C void PrepareToConvertToOrFromL(TUint32 aCharSetUid); + IMPORT_C TInt ConvertUcs4CharactersToEncodingL(TUint32* aUcs4Src, TInt aUcs4Count, + TUint32 aDestCharset, HBufC8*& aConversion); + IMPORT_C void ConvertCharacterSetIdentifierToStandardNameL(TUint32 aCharSetUid, HBufC8*& aCharSet); + + IMPORT_C TInt ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, TPtr16& aOutput); + IMPORT_C TInt ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, TUint32 aDestCharset, TPtr8& aOutput); + +private: + + CCharSetConverter(); + CCharSetConverter(const CCharSetConverter& aOriginal); + CCharSetConverter& operator=(const CCharSetConverter& aRhs); + + void ConstructL(); + + TText16* Utf32ToUtf16(TText16* aUtf16Out, TUint32 aUtf32); + +private: + +/** +The CharConv instance that we use to help in the character conversions. +*/ + CCnvCharacterSetConverter* iCnvCharacterSetConverter; + +/** +The File Server session handle. +*/ + RFs iFs; + +/** +The buffer used to store the unicode conversion output. +*/ + TAny* iConversionBuffer; + +/** +The size of the unicode conversion buffer. +*/ + TUint32 iConversionBufferSize; + }; +} + + +#endif //__CHARSETCONVERTER_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/contentprocessorinitparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/contentprocessorinitparams.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,59 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __CONTENTPROCESSORINITPARAMS_H__ +#define __CONTENTPROCESSORINITPARAMS_H__ + +#include +#include // needed for the typedef + + +namespace Xml +{ + +class RStringDictionaryCollection; + +struct TContentProcessorInitParams +/** +A structure for passing initialisation parameters to the derived class being instantiated. + +@publishedPartner +@released +*/ + { +/** +The client callback to pass the data to. +We do not own this. +*/ + MContentHandler* iContentHandler; + +/** +The collection of string dictionaries that can be loaded by the user or by the framework at runtime. +We do not own this. +*/ + RStringDictionaryCollection* iStringDictionaryCollection; + +/** +The Element stack that allows checking on tag ordering. +An object may want to check this in associating with validation. +We do not own this. +*/ + RElementStack* iElementStack; + + }; + +} + +#endif //__CONTENTPROCESSORINITPARAMS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/dictionarycodepage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/dictionarycodepage.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,158 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __DICTIONARYCODEPAGE_H__ +#define __DICTIONARYCODEPAGE_H__ + +#include +#include + + +namespace Xml +{ + +class CDictionaryCodePage : public CBase +/** +The CDictionaryCodePage, represents a single numeric code page for Elements, Attributes, and +AttributeValues. + +This object refers to the appropriate string pool tables, and creates mappings between +strings in these tables and their token values. + +Used mainly for wbxml document parsing, and allows for the quick comparison of strings. + +This object is associated with a string dictionary via a user defined class. + +@see RStringPool +@see CStringDictionary + +@publishedPartner +@released +*/ + { + +public: + + enum TStringType +/** +A structure for describing the types of string pool table associated with this class. +*/ + { + EStringTypeElement, + EStringTypeAttribute, + EStringTypeAttributeValue + }; + + +public: + + IMPORT_C static CDictionaryCodePage* NewL(const TStringTable* aElementTable, + const TStringTable* aAttributeTable, + const TStringTable* aValueTable, + TUint8 aCodePage); + + IMPORT_C virtual ~CDictionaryCodePage(); + + IMPORT_C const TStringTable* StringTable(TStringType aType) const; + IMPORT_C TUint8 CodePage() const; + + IMPORT_C TInt StringPoolIndexFromToken(TInt aToken, TStringType aType) const; + IMPORT_C TInt TokenFromStringPoolIndex(TInt aIndex, TStringType aType) const; + + IMPORT_C void ConstructIndexMappingL(const TInt* aStringPoolToTokenMapping, TStringType aType); + +private: + + CDictionaryCodePage(const TStringTable* aElementTable, const TStringTable* aAttributeTable, + const TStringTable* aValueTable, TUint8 aCodePage); + + CDictionaryCodePage(const CDictionaryCodePage& aOriginal); + CDictionaryCodePage& operator=(const CDictionaryCodePage& aRhs); + +private: + + struct TStringPoolTokenMapping +/** +The TStringPoolTokenMapping struct stores a mapping between table index and +token values for a single string entry. +*/ + { + TInt iTokenValue; + TInt iTableIndex; + }; + + static TInt CompareStringPoolTokenMappingTable(const TStringPoolTokenMapping& aFirst, + const TStringPoolTokenMapping& aSecond); +private: + +/** +Pointer to the static Element string pool table. +We do not own this. +*/ + const TStringTable* iElementTable; + +/** +Pointer to the static Attribute string pool table. +We do not own this. +*/ + const TStringTable* iAttributeTable; + +/** +Pointer to the static AttributeValue string pool table. +We do not own this. +*/ + const TStringTable* iValueTable; + +/** +Array to obtain a Element Token from String Pool index. +*/ + RArray iElementStringPoolIndexToToken; + +/** +Array to obtain a Element String Pool Index from a token. +*/ + RArray iElementTokenToStringPoolIndex; + +/** +Array to obtain a Attribute Token from String Pool index. +*/ + RArray iAttributeStringPoolIndexToToken; + +/** +Array to obtain a Attribute String Pool Index from a token. +*/ + RArray iAttributeTokenToStringPoolIndex; + +/** +Array to obtain a Value Token from String Pool index. +*/ + RArray iValueStringPoolIndexToToken; + +/** +Array to obtain a Value String Pool Index from a token. +*/ + RArray iValueTokenToStringPoolIndex; + + +/** +The numeric codepage this object represents. +*/ + TUint8 iCodePage; + + }; + +} + +#endif // __DICTIONARYCODEPAGE_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/elementstack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/elementstack.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __ELEMENTSTACK_H__ +#define __ELEMENTSTACK_H__ + +#include + + +/** +Allows for the stacking of element names that represents the order they are encountered. + +@publishedPartner +@released +*/ +typedef RArray RElementStack; + +#endif //__ELEMENTSTACK_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/parserinitparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/parserinitparams.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,67 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __PARSERINITPARAMS_H__ +#define __PARSERINITPARAMS_H__ + +#include // needed for the typedef + +namespace Xml +{ + +class CCharSetConverter; +class MContentHandler; +class RStringDictionaryCollection; + + +struct TParserInitParams +/** +A structure for passing initialisation parameters to the derived class being instantiated. + +@publishedPartner +@released +*/ + { + +/** +The helper class for character conversions and encoding resolution. +We do not own this. +*/ + CCharSetConverter* iCharSetConverter; + +/** +The client callback to pass the data to. +We do not own this. +*/ + MContentHandler* iContentHandler; + +/** +The collection of string dictionaries that can be loaded by the user or by the framework at runtime. +We do not own this. +*/ + RStringDictionaryCollection* iStringDictionaryCollection; + +/** +The Element stack that allows checking on tag ordering. +An object may want to check this in associating with validation. +We do not own this. +*/ + RElementStack* iElementStack; + + }; + +} + +#endif //__PARSERINITPARAMS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/parserinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/parserinterface.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +#ifndef __PARSERINTERFACE_H__ +#define __PARSERINTERFACE_H__ + +/** +@file +@publishedPartner +@released +*/ + +#include +#include + +namespace Xml +{ + +/** A parser ECOM plugin for the XML Framework must implement this interface. */ +class MParser : public MContentSource + { +public: + /** Enable a feature. */ + virtual TInt EnableFeature(TInt aParserFeature) = 0; + /** Disable a feature. */ + virtual TInt DisableFeature(TInt aParserFeature) = 0; + /** See if a feature is enabled. */ + virtual TBool IsFeatureEnabled(TInt aParserFeature) const = 0; + + /** Parses a descriptor that contains part of a document. */ + virtual void ParseChunkL(const TDesC8& aChunk) = 0; + + /** Parses a descriptor that contains the last part of a document. */ + virtual void ParseLastChunkL(const TDesC8& aFinalChunk) = 0; + + /** Interfaces don't have a destructor, so we have an explicit method instead. */ + virtual void Release() = 0; + }; + +} + +#endif //__PARSERINTERFACE_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/plugins/stringdictionary.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/plugins/stringdictionary.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,138 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + + +#ifndef __STRINGDICTIONARY_H__ +#define __STRINGDICTIONARY_H__ + +#include + + +class RString; + +namespace Xml +{ + +class MStringDictionary +/** +This interface defines the API of a single string dictionary. +This class is not used directly, but via a derived class the user provides. +Derived classes must add all elements, attributes names, and attribute values that belong +to this string dictionary as static string tables to the StringPool. WBXML token mappings between +strings and WBXML tokens should also be maintained. +@see RStringPool + +@publishedPartner +@released +*/ + { +public: + +/** +This method allows for the correct destrution of the string dictionary plugin. + +@post the objects memory is cleaned up. + +*/ + virtual void Release() = 0; + +/** +This method returns the element string associated with the given token. + +@param aToken the element token. +@param aElement On return reflects the string corresponding to the token. +@leave KErrXmlUnsupportedElement, if the token doesn't correspond to an element. +*/ + virtual void ElementL(TInt aToken, RString& aElement) const = 0; + +/** +This method returns the attribute string associated with the given token. + +@param aToken the attribute token. +@param aAttribute On return reflects the string corresponding to the token. +@leave KErrXmlUnsupportedAttribute, if the token doesn't correspond to an attribute. +*/ + virtual void AttributeL(TInt aToken, RString& aAttribute) const = 0; + +/** +This method returns the attribute and value string associated with the given token. + +@param aToken the attribute token. +@param aAttribute On return reflects the string corresponding to the token. +@param aValue On return reflects the string corresponding to the value + for this attibute. +@leave KErrXmlUnsupportedAttribute, if the token doesn't correspond to an attribute +@leave KErrXmlUnsupportedAttributeValue, if the token doesn't correspond to a value +*/ + virtual void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const = 0; + +/** +This method returns the value string associated with the given token. + +@param aToken the attribute token. +@param aValue On return reflects the string corresponding to the value + for this attibute. +@leave KErrXmlUnsupportedAttributeValue, if the token doesn't correspond to value. +*/ + virtual void AttributeValueL(TInt aToken, RString& aValue) const = 0; + + +/** +This method compares the Dictionary description with that provided. + +@return ETrue if this is the same Dictionary (i.e. a match), EFalse otherwise. + +@param aDictionaryDescription The description we want to compare. +*/ + virtual TBool CompareThisDictionary(const RString& aDictionaryDescription) const = 0; + +/** +This method switches the dictionary to use the specified codepage. + +@return The codepage switched to, or KErrXmlMissingStringDictionary if it is not supported. + +@param aCodePage The code page to switch to. +*/ + virtual TInt SwitchCodePage(TInt aCodePage) = 0; + +/** +This method obtains the public identifier from the StringTable. +Either the formal or non formal public id will do. +The stringDictionary .rss files must list both these as wbxml +documents have one or the other. + +@param aPubId The public identifier for this string + dictionary. +*/ + + virtual void PublicIdentifier(RString& aPubId) = 0; + +/** +The element types in the Device Information DTD are defined within +a namespace associated with the Uri/Urn available from the StringTable. +The RString need not be closed, but closing is harmless. + +@param aUri The associated namespace for this string + dictionary. +*/ + + virtual void NamespaceUri(RString& aUri) = 0; + }; + +} + +#endif //__STRINGDICTIONARY_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/stringdictionarycollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/stringdictionarycollection.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __STRINGDICTIONARYCOLLECTION_H__ +#define __STRINGDICTIONARYCOLLECTION_H__ + +#include + +class RStringPool; +class RString; +class TDesC8; + +namespace Xml +{ + +class MStringDictionary; +class RStringDictionaryCollectionImpl; + + +class RStringDictionaryCollection +/** +The RStringDictionaryCollection class holds a collection of Dictionaries requested by the user. + +@publishedAll +@released +*/ + { +public: + IMPORT_C void OpenL(); + IMPORT_C void Close(); + + IMPORT_C RStringDictionaryCollection(); + + IMPORT_C void OpenDictionaryL(const TDesC8& aDictionaryDescription); + + IMPORT_C RStringPool& StringPool(); + + IMPORT_C MStringDictionary& CurrentDictionaryL() const; + +private: + + RStringDictionaryCollection(const RStringDictionaryCollection& aOriginal); + RStringDictionaryCollection& operator=(const RStringDictionaryCollection& aRhs); + void CreateImplL(); + +private: + +/** +Hide the implementation details. +*/ + RStringDictionaryCollectionImpl* iImpl; + }; + +} + +#endif //__STRINGDICTIONARYCOLLECTION_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/taginfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/taginfo.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __TAGINFO_H__ +#define __TAGINFO_H__ + +#include + + +namespace Xml +{ + +class RTagInfo +/** +The RTagInfo class holds information that describes an element or attribute. +@see MContentHandler +@see RAttribute + +@publishedAll +@released +*/ + { +public: + +/** +@publishedAll +@released +*/ + IMPORT_C RTagInfo(); + +/** +@publishedAll +@released +*/ + IMPORT_C RTagInfo Copy(); + +/** +@publishedAll +@released +*/ + IMPORT_C void Close(); + +/** +@publishedAll +@released +*/ + IMPORT_C void Open(const RString& aUri, const RString& aPrefix, const RString& aLocalName); + + IMPORT_C const RString& Uri() const; + IMPORT_C const RString& LocalName() const; + IMPORT_C const RString& Prefix() const; + +private: + +/** +Holds the namespace uri of the object it represents. +*/ + RString iUri; + +/** +Holds the namespace prefix of the object it represents. +*/ + RString iPrefix; + +/** +Holds the local name of the object it represents. +*/ + RString iLocalName; + + }; + +} + +#endif //__TAGINFO_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/wbxmlextensionhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/wbxmlextensionhandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,61 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + +#ifndef __WBXMLEXTENSIONHANDLER_H__ +#define __WBXMLEXTENSIONHANDLER_H__ + +#include + + +class RString; + +namespace Xml +{ + +class MWbxmlExtensionHandler +/** +The Wbxml api extension class. +Inherited by classes wishing to cater for this interface, e.g. WbxmlParser. + +@publishedAll +@released +*/ + { +public: + +/** +The uid identifying this extension interface. +*/ + enum TExtInterfaceUid {EExtInterfaceUid = 0x101FE212}; + +/** +This method is a receive notification of an extension instruction. +The type of extension is specified in aToken and is based on the global tokens +specified in WBXML documents. +@see http://www.w3.org/TR/wbxml/ +@param aData is the extension data. +@param aToken is the global unambiguous token value. +@param aErrorCode is the error code. + If this is not KErrNone then special action may be required. +*/ + virtual void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode) = 0; + + }; + +} + +#endif //__WBXMLEXTENSIONHANDLER_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/xmlframeworkconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/xmlframeworkconstants.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLFRAMEWORKCONSTANTS_H__ +#define __XMLFRAMEWORKCONSTANTS_H__ + +#include + +namespace Xml +{ +/** +Indicates the String Dictionary interface uid that ECom uses to locate the appropriate plugin. +@publishedPartner +@released +*/ +const TUid KStringDictionaryInterfaceUid = {0x101FA94F}; + +/** +Indicates the Parser interface uid that ECom uses to locate the appropriate plugin. + +@publishedPartner +@released +*/ +const TUid KParserInterfaceUid = {0x101FAA0B}; + +/** +Indicates the Generator interface uid that ECom uses to locate the appropriate plugin. + +@publishedPartner +@released +*/ +const TUid KGeneratorInterfaceUid = {0x101FD284}; + +} + +#endif //__XMLFRAMEWORKCONSTANTS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/inc/xmlframeworkerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/inc/xmlframeworkerrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLFRAMEWORKERRORS_H__ +#define __XMLFRAMEWORKERRORS_H__ + +/** +@file + +This file contains allocated error codes and +generic Panic error messages and the Panic function. +The XmlFramework has been allocated error codes in the range: -17550 to -17599 + +@publishedAll +@released +*/ + +#include + +namespace Xml +{ + +// Leave Codes + +// ECom related + +const TInt KErrXmlStringDictionaryPluginNotFound = -17550; +const TInt KErrXmlParserPluginNotFound = -17551; +const TInt KErrXmlGeneratorPluginNotFound = -17552; +const TInt KErrXmlPluginNotFound = -17553; + +// CCharSetConverter + +const TInt KErrXmlBadCharacterConversion = -17554; +const TInt KErrXmlUnsupportedCharacterSet = -17555; +const TInt KErrXmlUnavailableCharacterSet = -17556; + +// MStringDictionary + +const TInt KErrXmlUnsupportedElement = -17557; +const TInt KErrXmlUnsupportedAttribute = -17558; +const TInt KErrXmlUnsupportedAttributeValue = -17559; +const TInt KErrXmlMissingStringDictionary = -17560; + +// General + +const TInt KErrXmlUnsupportedDocumentVersion = -17561; +const TInt KErrXmlDocumentCorrupt = -17562; +const TInt KErrXmlStringPoolTableNotFound = -17563; +const TInt KErrXmlBadIndex = -17564; +const TInt KErrXmlUnsupportedExtInterface = -17566; + +// Custom resolver related +/** +Indicates the parser query is matched to more than one parser. +This error can be returned only if the request is to leave in such a case - LeaveOnMany flag is set. +*/ +const TInt KErrXmlMoreThanOneParserMatched = -17567; +const TInt KErrXmlStringTooBig = -17568; +const TInt KErrXmlFirst = -17550; +const TInt KErrXmlLast = -17599; + + + + +} + + + +#endif // __XMLFRAMEWORKERRORS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/customresolver/10273861.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/customresolver/10273861.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Custom Resolver for XML framework +// Pairs to xmlcustomresolver.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO parserInfo + { + dll_uid = 0x10273861; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10009D90; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273862; + version_no = 1; + display_name = "XML Framework Custom Resolver"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/customresolver/customresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/customresolver/customresolver.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,128 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Customized ECOM resolver for XML plugin parsers +// +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include +#include +#include + +#include "customresolver.h" + +using namespace Xml; + +/** +Class constructor. + +@param aRegistry Gives the resolver access to a list of implementations of an interface. +*/ +CCustomResolver::CCustomResolver(MPublicRegistry& aRegistry) + :CResolver(aRegistry) +{ + +} + +/** +Creates the instance of CCustomResolver class. + +@param aRegistry Gives the resolver access to a list of implementations of an interface. + +@leave KErrNoMemory If there is not enough memory to create an object +*/ + +CCustomResolver* CCustomResolver::NewL(MPublicRegistry& aRegistry) +{ + return new (ELeave) CCustomResolver(aRegistry); +} + +/** +Object destructor. +*/ +CCustomResolver::~CCustomResolver() +{ + +} + +/** +Identifies required parsers. + +@param aInterfaceUid Interface UID of required parser +@param aAdditionalParameters Additional parameters for parser resolver + +@return Parser's Uid or KNullUid if parser isn't found. + +@leave KErrNoMemory If there is not enough memory to create + necessary objects + +@leave KErrArgument If incorrect or partial information is provided + for parser resolution + +@leave KErrXmlMoreThanOneParserMatched + If Xml framework narrowed down the query + to many parsers and a user requested to leave + in such case (LeaveOnMany flag set). + +*/ +TUid CCustomResolver::IdentifyImplementationL(TUid aInterfaceUid, const TEComResolverParams& aAdditionalParameters) const + +{ + // Unpack user matching criteria. + // Externalized CMatchData object is stored in a heap based buffer as a stream. + // Buffer pointer is stored in data type attribute of aAdditionalParameters + // Specialized NewL method creates a CMatchData object based on that pointer. + CMatchData* criteria = CMatchData::NewL(aAdditionalParameters.DataType()); + CleanupStack::PushL(criteria); + + // Verify input data + // Mime type string is a mandatory field for parser resolution + if (criteria->MimeType().Length() == 0 ) + User::Leave(KErrArgument); + + // This method is designed for plugin parser resolution only + if (aInterfaceUid != KParserInterfaceUid) + User::Leave(KErrArgument); + + // Use the CResolver method to create an array, so that we get proper cleanup behaviour + RImplInfoArray& implInfo = CResolver::ListAllL(aInterfaceUid); + + // Run the resolution process + TUid uid = criteria->ResolveL(implInfo); + + //clean up + CleanupStack::PopAndDestroy(criteria); + implInfo.Close(); + return uid; +} + + +/** +The ListAllL method is not supported by this customized resolver. + +@leave KErrNotSupported +*/ +RImplInfoArray* CCustomResolver::ListAllL(TUid /*aInterfaceUid*/, const TEComResolverParams& /*aAdditionalParameters */) const +{ + User::Leave(KErrNotSupported); + return NULL; +} + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/customresolver/customresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/customresolver/customresolver.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,64 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Customized ECOM resolver for XML plugin parsers +// +// + +/** + @file + @internalComponent +*/ + +#ifndef XMLCUSTOMRESOLVER_H +#define XMLCUSTOMRESOLVER_H + +#include + +#include +#include +#include + +namespace Xml +{ +class CMatchData; + +/** +Implements the functionality of XML customized resovler. +This is used as a plugin resolver for ECOM. + +Plugin resource file: 10273861.rss. + +@internalComponent +*/ +class CCustomResolver: public CResolver +{ + +public: + static CCustomResolver* NewL(MPublicRegistry& aRegistry); + ~CCustomResolver(); + +public: + // CResolver derivied methods + virtual TUid IdentifyImplementationL(TUid aInterfaceUid, const TEComResolverParams& aAdditionalParameters) const; + virtual RImplInfoArray* ListAllL(TUid aInterfaceUid, const TEComResolverParams& aAdditionalParameters) const; + +private: + CCustomResolver(MPublicRegistry& aRegistry); +}; + +} + +#endif // XMLCUSTOMRESOLVER_H + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/customresolver/customresolverproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/customresolver/customresolverproxy.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,47 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Proxy methods implementation for ECOM +// +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "customresolver.h" + + +GLDEF_C TInt E32Dll() + { + return KErrNone; + } + +// Exported proxy for instantiation method resolution + +// Define the Implementation UIDs for XmlCustomResolver +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x10273862, Xml::CCustomResolver::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/attribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/attribute.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,164 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +using namespace Xml; + + +EXPORT_C RAttribute::RAttribute() +/** +Default constructor + +*/ + { + // do nothing; + } + + +EXPORT_C RAttribute RAttribute::Copy() +/** +Copy method. The original and copy must be closed seperately. + +*/ + { + RAttribute copy; + RTagInfo tagCopy = iAttribute.Copy(); + copy.Open(const_cast (tagCopy.Uri()), + const_cast (tagCopy.Prefix()), + const_cast (tagCopy.LocalName()), + iValue.Copy(), + iType); + return copy; + } + + + +EXPORT_C void RAttribute::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +@post This object may be allowed to go out of scope. + +*/ + { + iAttribute.Close(); + iValue.Close(); + } + + + +EXPORT_C void RAttribute::Open(const RString& aUri, const RString& aPrefix, + const RString& aLocalName, + const RString& aValue, const TAttributeType aType) +/** +This method sets all the attribute's contents, taking ownership of the RStrings. + +@pre The object has just been constructed and no other values have been set. +@post The objects members have been set to the values given. + +@param aUri The URI of the namespace. +@param aPrefix The prefix of the qualified name. +@param aLocalName The local name of the qualified name. +@param aValue The value associated with this attribute. +@param aType The type associated with this attribute. +*/ + { + iAttribute.Open(aUri, aPrefix, aLocalName); + iValue = aValue; + iType = aType; + } + + + +EXPORT_C void RAttribute::Open(const RString& aUri, const RString& aPrefix, + const RString& aLocalName, const TAttributeType aType) +/** +This method sets the attribute's contents, taking ownership of the RStrings. + +@pre The object has just been constructed and no other values have been set. +@post The objects members have been set to the values given. + +@param aUri The URI of the namespace. +@param aPrefix The prefix of the qualified name. +@param aLocalName The local name of the qualified name. +@param aType The type associated with this attribute. +*/ + { + iAttribute.Open(aUri, aPrefix, aLocalName); + iType = aType; + } + + + +EXPORT_C const RTagInfo& RAttribute::Attribute() const +/** +This method returns a handle to the attribute's name details. + +@return The attribute's name details. + +@pre The objects members have been pre-set accordingly. + +*/ + { + return iAttribute; + } + + + +EXPORT_C const RString& RAttribute::Value() const +/** +This method returns a handle to the attribute value. +If the attribute value is a list of tokens (IDREFS, ENTITIES or NMTOKENS), +the tokens will be concatenated into a single RString with each token separated +by a single space. + +@return A handle to the attribute value. + +@pre The objects members have been pre-set accordingly. + +*/ + { + return iValue; + } + + + +EXPORT_C TAttributeType RAttribute::Type() const +/** +This method returns the attribute's type. + +@return The attribute's type. + +@pre The objects members have been pre-set accordingly. + +*/ + { + return iType; + } + + + +EXPORT_C void RAttribute::SetValue(const RString& aValue) +/** +This method sets the attribute's value, taking ownership of the RString. + +@param aValue The attributes value. +*/ + { + iValue.Close(); + iValue = aValue; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/charsetconverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/charsetconverter.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,657 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include + +#include +#include + +using namespace Xml; + +/** +The maximum number of bytes used for conversion at any time. +This is also used to size the necessary buffers used in the conversions. + +@internalTechnology +*/ +const TInt KMaxReadableBytes = 512; + + + +LOCAL_C void DestroyHBufC16(TAny* aHBufC) +/** +This method is used when pointer reallocation is needed and the pointer needs to be +cleaned via the cleanup stack. + +@param aHBufC the wide buffer. +@internalTechnology + +*/ + { + delete *static_cast(aHBufC); + } + + + +LOCAL_C void DestroyHBufC8(TAny* aHBufC) +/** +This method is used when pointer reallocation is needed and the pointer needs to be +cleaned via the cleanup stack. + +@param aHBufC the narrow buffer. +@internalTechnology + +*/ + { + delete *static_cast(aHBufC); + } + + + +CCharSetConverter::CCharSetConverter() +/** +Default Constructor + +*/ + { + // do nothing; + } + + + +/** +This method creates an instance of this class. +The framework is responsible for creating this object. + +@leave ... One of the system wide error codes e.g. KErrNoMemory +@return The new'ed object. +@internalTechnology +*/ +CCharSetConverter* CCharSetConverter::NewL() + { + CCharSetConverter* self = new(ELeave) CCharSetConverter(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return(self); + } + + + +void CCharSetConverter::ConstructL() +/** +This method provides some construction of this object. + +*/ + { + iCnvCharacterSetConverter = CCnvCharacterSetConverter::NewL(); + User::LeaveIfError(iFs.Connect()); + iConversionBuffer = User::Heap().AllocL(KMaxReadableBytes); + iConversionBufferSize = KMaxReadableBytes; + } + + + +CCharSetConverter::~CCharSetConverter() +/** +Destructor. +The framework is responsible for destroying this object. + +@post This object is properly destroyed. + +*/ + { + iFs.Close(); + delete iCnvCharacterSetConverter; + delete iConversionBuffer; + } + + + +EXPORT_C void CCharSetConverter::PrepareCharConvL(TUint& aCharSetUid, const TDesC8& aEncoding) +/** +This method prepares CharConv to encode from the standard name. + +@post CharConv has been prepared. + +@leave KErrXmlUnsupportedCharacterSet - Charset not supported. +@leave KErrXmlUnavailableCharacterSet - Charset not available + +@param aCharSetUid On return, contains the character set identifier + of the encoding. +@param aEncoding the encoding to prepare for. +*/ + { + // Get the charset uid + if ((aCharSetUid = + iCnvCharacterSetConverter->ConvertStandardNameOfCharacterSetToIdentifierL(aEncoding, iFs)) == 0) + { + User::Leave(KErrXmlUnsupportedCharacterSet); + } + + + // Prepare charconv to use this charset + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aCharSetUid, iFs) == + CCnvCharacterSetConverter::ENotAvailable ) + { + User::Leave(KErrXmlUnavailableCharacterSet); // Unavailable + } + } + + + +EXPORT_C void CCharSetConverter::PrepareCharConvL(TUint& aCharSetUid, TInt aMibEnum) +/** +This method prepares CharConv to encode from the mib enum. + +@post CharConv has been prepared. + +@leave KErrXmlUnsupportedCharacterSet - Charset not supported. +@leave KErrXmlUnavailableCharacterSet - Charset not available + +@param aCharSetUid On return, contains the character set identifier + of the encoding. +@param aMibEnum The IANA specified mib enum for this encoding + +@see http://www.iana.org/assignments/character-sets +*/ + { + // Get the charset uid + if ((aCharSetUid = + iCnvCharacterSetConverter->ConvertMibEnumOfCharacterSetToIdentifierL(aMibEnum, iFs)) == 0) + { + User::Leave(KErrXmlUnsupportedCharacterSet); // May want to try something else? + } + + + // Prepare charconv to use this charset + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aCharSetUid, iFs) == + CCnvCharacterSetConverter::ENotAvailable ) + { + User::Leave(KErrXmlUnavailableCharacterSet); // Unavailable + } + } + + + +EXPORT_C TInt CCharSetConverter::ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInputBuffer, + HBufC16*& aUnicodeConversion) +/** +This method converts the given bytes to unicode. +If this function leaves, memory is cleaned up. +This overload allocates memory for the output itself. + +@return KErrNone if the conversion was succesfull + or one of the error values defined in TError. + +@leave KErrXmlUnavailableCharacterSet - CharSet not available. + +@param aSrcCharset The character set encoding to convert from. +@param aInputBuffer The characters to be converted. +@param aUnicodeConversion On return, contains the unicode conversion. +*/ + { + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aSrcCharset, iFs) == + CCnvCharacterSetConverter::ENotAvailable) + { + User::Leave(KErrXmlUnavailableCharacterSet); + } + + TInt maxLength = KMaxReadableBytes; + aUnicodeConversion = HBufC16::NewL(maxLength); + CleanupStack::PushL(TCleanupItem(DestroyHBufC16, &aUnicodeConversion));//push buffer's address + + + TInt state = CCnvCharacterSetConverter::KStateDefault; + TPtr16 remainingOutput(aUnicodeConversion->Des()); + TInt unconverted = iCnvCharacterSetConverter->ConvertToUnicode(remainingOutput, aInputBuffer, state); + + // While there is still more data to convert + while (0 < unconverted) + { + // Resize the buffer to hold more data + maxLength += KMaxReadableBytes; + aUnicodeConversion = aUnicodeConversion->ReAllocL(maxLength); + + // Segment the writable area + TInt outputLength = aUnicodeConversion->Length(); + TPtr16 remainingOutput1(&(aUnicodeConversion->Des())[0] + outputLength, 0, maxLength - outputLength); + remainingOutput.Set(remainingOutput1); + + // Convert the data + unconverted = iCnvCharacterSetConverter->ConvertToUnicode(remainingOutput, aInputBuffer.Right(unconverted), state); + aUnicodeConversion->Des().SetLength(outputLength + remainingOutput.Length()); + } + + // Reallocate to a minimally-sized buffer + if (unconverted == 0) + { + aUnicodeConversion = aUnicodeConversion->ReAllocL(aUnicodeConversion->Length()); + } + + CleanupStack::Pop(&aUnicodeConversion);//destroy the object pointed by the buffer wherever it is since we have got hold of the pointer (buffer)'s address + return unconverted; // return error value if there is one. + } + + +EXPORT_C TInt CCharSetConverter::ConvertToUnicodeL(TUint32 aSrcCharset, + const TDesC8& aInput, + TPtr16& aOutput) +/** +This method converts the given bytes to unicode. +If this function leaves, memory is cleaned up. +This overload stores the conversion output in memory already allocated, for the sole use +of the TPtr versions of overloaded ConvertToUnicodeL and ConvertFromUnicodeL functions. You must make sure you +have finished with the output from a previous call to either (TPtr overload of) ConvertToUnicodeL +or ConvertFromUnicodeL before calling either again, as the previous output will be overwritten with +the new output. +This version is more efficient than the HBufC alternative and so should be used whenever possible. + +@return KErrNone if the conversion was succesfull + or one of the error values defined in TError. + +@leave KErrXmlUnavailableCharacterSet - CharSet not available. + +@param aSrcCharset The character set encoding to convert from. +@param aInput The characters to be converted. +@param aOutput On return, contains the unicode conversion. +*/ + { + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aSrcCharset, iFs) == + CCnvCharacterSetConverter::ENotAvailable) + { + User::Leave(KErrXmlUnavailableCharacterSet); + } + + TInt state = CCnvCharacterSetConverter::KStateDefault; + + // Set up output descriptor reference: "Payload" is iConversionBuffer (a TAny *), it's initial + // length is zero (because it's empty) and it's initial maximum length is the maximum number of + // unicode characters which will fit into the current size of iConversion buffer + aOutput.Set((TUint16*)iConversionBuffer, 0, iConversionBufferSize/sizeof(TUint16)); + + // Convert the data, returning the amount of characters that are unconverted, due to the output buffer being full + TInt unconverted = iCnvCharacterSetConverter->ConvertToUnicode(aOutput, aInput, state); + + // While there is still more data to convert + while (0 < unconverted) + { + TInt outputLength = aOutput.Length(); + + // Resize the buffer to hold more data + iConversionBufferSize += KMaxReadableBytes; + + iConversionBuffer = User::Heap().ReAllocL(iConversionBuffer,iConversionBufferSize); + if (iConversionBuffer == NULL) + User::Leave(KErrNoMemory); + + // Reconstruct the output descriptor to point to the new buffer, setting current + // length (the number of characters we've converted so far) and maximum length + // (the number of unicode characters which will fit into the newly extended + // iConversionBuffer) appropriately. + aOutput.Set((TUint16*)iConversionBuffer, outputLength, iConversionBufferSize/sizeof(TUint16)); + + // Construct a modifiable pointer descriptor pointing to the the writable area of + // iConversionBuffer + TPtr16 remainingOutput(((TUint16*)iConversionBuffer)+outputLength, 0, aOutput.MaxLength() - outputLength); + + // Try to convert another chunk of data + unconverted = iCnvCharacterSetConverter->ConvertToUnicode(remainingOutput, aInput.Right(unconverted), state); + + // Update the length of the output buffer to include the data we just converted. + aOutput.SetLength(remainingOutput.Length()+outputLength); + } + + return unconverted; // return error value if there is one. + } + + + +EXPORT_C TInt CCharSetConverter::ConvertFromUnicodeL(const TDesC16& aUnicodeConversion, + TUint32 aDestCharset, HBufC8*& aOutputBuffer) +/** +This method converts the given unicode to the specified encoding. +If this function leaves, memory is cleaned up. +This overload allocates memory for the output itself. + +@return KErrNone if the conversion was succesfull + or one of the error values defined in TError. + +@leave KErrXmlUnavailableCharacterSet - Charset not available. + +@param aUnicodeConversion The unicode to convert. +@param aDestCharset The character set encoding to convert to. +@param aOutputBuffer On return, contains the specified conversion. +*/ + { + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aDestCharset, iFs) == + CCnvCharacterSetConverter::ENotAvailable) + { + User::Leave(KErrXmlUnavailableCharacterSet); + } + + TInt maxLength = KMaxReadableBytes; + aOutputBuffer = HBufC8::NewL(maxLength); + CleanupStack::PushL(TCleanupItem(DestroyHBufC8, &aOutputBuffer));//push buffer's address + + TPtr8 remainingOutput(aOutputBuffer->Des()); + TInt unconverted = iCnvCharacterSetConverter->ConvertFromUnicode(remainingOutput, aUnicodeConversion); + + // While there is still more data to convert + while (0 < unconverted) + { + // Resize the buffer to hold more data + maxLength += KMaxReadableBytes; + aOutputBuffer = aOutputBuffer->ReAllocL(maxLength); + + // Segment the writable area + TInt outputLength = aOutputBuffer->Length(); + TPtr8 remainingOutput1(&(aOutputBuffer->Des())[0] + outputLength, 0, maxLength - outputLength); + remainingOutput.Set(remainingOutput1); + + // Convert the data + unconverted = iCnvCharacterSetConverter->ConvertFromUnicode(remainingOutput, aUnicodeConversion.Right(unconverted)); + aOutputBuffer->Des().SetLength(outputLength + remainingOutput.Length()); + } + + // Reallocate to a minimally-sized buffer + if (unconverted == 0) + { + aOutputBuffer = aOutputBuffer->ReAllocL(aOutputBuffer->Length()); + } + + CleanupStack::Pop(&aOutputBuffer);//destroy the object pointed by the buffer wherever it is since we have got hold of the pointer (buffer)'s address + + return unconverted; // return error value if there is one. + } + + +EXPORT_C TInt CCharSetConverter::ConvertFromUnicodeL(const TDesC16& aInput, + TUint32 aDestCharset, + TPtr8& aOutput) +/** +This method converts the given unicode to the specified encoding. +If this function leaves, memory is cleaned up. +This overload stores the conversion output in memory already allocated, for the sole use +of the TPtr versions of overloaded ConvertToUnicodeL and ConvertFromUnicodeL functions. You must make sure you +have finished with the output from a previous call to either (TPtr overload of) ConvertToUnicodeL +or ConvertFromUnicodeL before calling either again, as the previous output will be overwritten with +the new output. +This version is more efficient than the HBufC alternative and so should be used whenever possible. + +@return KErrNone if the conversion was succesfull + or one of the error values defined in TError. + +@leave KErrXmlUnavailableCharacterSet - Charset not available. + +@param aInput The unicode to convert. +@param aDestCharset The character set encoding to convert to. +@param aOutput The characters after conversion. +*/ + { + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aDestCharset, iFs) == + CCnvCharacterSetConverter::ENotAvailable) + { + User::Leave(KErrXmlUnavailableCharacterSet); + } + // Set up output descriptor reference: "Payload" is iConversionBuffer (a TAny *), it's initial + // length is zero (because it's empty). + aOutput.Set((TUint8*)iConversionBuffer, 0, iConversionBufferSize); + + // Convert the data, returning the amount of characters that are unconverted, due to the output buffer being full + TInt unconverted = iCnvCharacterSetConverter->ConvertFromUnicode(aOutput, aInput); + + // While there is still more data to convert + while (0 < unconverted) + { + TInt outputLength = aOutput.Length(); + + // Resize the buffer to hold the remaining data + iConversionBufferSize += KMaxReadableBytes; + + iConversionBuffer = User::Heap().ReAllocL(iConversionBuffer,iConversionBufferSize); + if (iConversionBuffer == NULL) + User::Leave(KErrNoMemory); + aOutput.Set((TUint8*)iConversionBuffer,iConversionBufferSize,iConversionBufferSize); + + // Construct a modifiable pointer descriptor pointing to the the writable area of + // iConversionBuffer + TPtr8 remainingOutput(((TUint8*)iConversionBuffer) + outputLength, 0, iConversionBufferSize - outputLength); + + // Try to convert another chunk of data + unconverted = iCnvCharacterSetConverter->ConvertFromUnicode(remainingOutput, aInput.Right(unconverted)); + + // Update the length of the output buffer to include the data we just converted. + aOutput.SetLength(remainingOutput.Length()+outputLength); + } + + return unconverted; // return error value if there is one. + } + + +EXPORT_C void CCharSetConverter::PrepareToConvertToOrFromL(TUint32 aCharSetUid) +/** +This method is a helper function that prepares CharConv for a conversion. + +@see CCnvCharacterSetConverter::PrepareToConvertToOrFromL +@post CharConv is ready for the conversion or not. + +@leave KErrXmlUnavailableCharacterSet - Charset not available. + +@param aCharSetUid The character set encoding to convert to. +*/ + { + if (iCnvCharacterSetConverter->PrepareToConvertToOrFromL(aCharSetUid, iFs) == + CCnvCharacterSetConverter::ENotAvailable ) + { + User::Leave(KErrXmlUnavailableCharacterSet); + } + } + + + +EXPORT_C void CCharSetConverter::ConvertCharacterSetIdentifierToStandardNameL(TUint32 aCharSetUid, + HBufC8*& aCharSet) +/** +This method is a helper function that obtains a standand character +encoding name from a character set identifer. + +@see CCnvCharacterSetConverter::ConvertCharacterSetIdentifierToStandardNameL + +@leave KErrXmlUnsupportedCharacterSet If the character set is not known. + +@param aCharSetUid The character set to obtain the name for. +@param aCharSet On return holds the Internet-standard name + or MIME name of the character set. + The name is encoded in 8 bit ASCII. +*/ + { + if ((aCharSet = + iCnvCharacterSetConverter-> + ConvertCharacterSetIdentifierToStandardNameL(aCharSetUid, iFs)) == NULL) + { + User::Leave(KErrXmlUnsupportedCharacterSet); + } + } + + + +EXPORT_C TInt CCharSetConverter::ConvertUcs4CharactersToEncodingL(TUint32* aUcs4Src, + TInt aUcs4Count, + TUint32 aDestCharset, + HBufC8*& aConversion) +/** +This method converts ucs-4 characters to the desired non-modal encoding. +aConversion should be NULL on calling of this function. +If this function leaves, memory is cleaned up. +There is no TPtr overload of this method, as currently it is only called a few times and so would not +produce any noticable benefits. + +@return CCharSetConverter::ConvertFromUnicodeL. + +@leave KErrXmlBadCharacterConversion + +@param aUcs4Src list of ucs-4 characters. +@param aUcs4Count number of ucs4 characters. +@param aDestCharset the desired encoding. +@param aConversion On return, points to the converted encoding. +*/ + { + // convert ucs-4 to ucs-2 + + // Find the length of the output + TText16 buf[2]; + TInt length = 0; + TUint32* src = NULL; + + for (src = aUcs4Src; src != (aUcs4Src + aUcs4Count); ++src) + { + // Convert a single character into the buffer, discard the result + // but increase the length by the number of UTF16 codes output. + length += Utf32ToUtf16(buf, *src) - buf; + } + + HBufC16* utf16Out = HBufC16::NewL(length); + CleanupStack::PushL(utf16Out); + + utf16Out->Des().SetLength(length); + + TText16* p = &((utf16Out->Des())[0]); + + + // go through characters converting to ucs2. + for (src = aUcs4Src; src != aUcs4Src + aUcs4Count; ++src) + { + // convert each ucs4 character + p = Utf32ToUtf16(p, *src); + } + + // convert from ucs2 to desired encoding + aConversion = NULL; + TInt ret = 0; + + //HBufC overload of this method called, due to the need pass back the HBufC to the calling method + ret = CCharSetConverter::ConvertFromUnicodeL(*utf16Out, aDestCharset, aConversion); + CleanupStack::PushL(aConversion); + + if(ret > KErrNone) + { + // CharConv couldn't convert all the bytes. Character encoding may be truncated. + User::Leave(KErrXmlBadCharacterConversion); + } + + CleanupStack::Pop(aConversion); + CleanupStack::PopAndDestroy(utf16Out); + return(ret); + } + + + +TText16* CCharSetConverter::Utf32ToUtf16(TText16* aUtf16Out, TUint32 aUtf32) +/** +This method converts a ucs-4 character to unicode. + +@return Pointer to the next free byte in the output buffer. + +@param aUtf16Out On return, contains the unicode character conversion. +@param aUtf32 The ucs-4 character +*/ + { + if (aUtf32 <= 0xFFFF) + { + // UTF32 (or UCS4) should not have characters in the range + // D800-DBFF (high surrogate) and DC00-DFFF (low surrogate) in it, + // as these are the surrogates that make up the extension mechanism for + // fitting Unicode into 16 bits. + // In principle, surrogates in UCS-4 should be ignored. + // They are considered a bad thing because they might be an aliasing + // problem: one thing looking like another. + // In practice I don't think it is a problem here. + // If you like, you could reject any character between D800 to DFFF. + + // could weed out unpaired surrogates here, but... + *aUtf16Out = static_cast(aUtf32); + return aUtf16Out + 1; + } + + // A way to visualise the use of surrogate pairs is to imaging planes. + // The surrogate is located on plane zero and identifies the actual plane + // this character resides in. + // This is why for supplementary characters we must insert the surrogates + // so that charconv can convert correctly. + // + // 0 D800 + // | | DFFF + // | | | E000 10FFF + // | | | | | + // xxxxxxYxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + // ^ + // For Utf32 this means nothing. + // + // For Utf16 if the following bit pattern is located then it corresponds to a + // supplementary character. + // + // ^ + // D800 DC00 DFFF + // | | | + // yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy + // High Low + // + // 1101 10.. ........ 1101 11.. ........ + // --10 bit-- --10 bit-- + // + // + // Add 10000 to both 10-bit values and the offset to the correct character is obtained. + // + // + // So a test of this function would be to check that the value returned + // matches a utf-8 character encoding manually calculated from the original ucs4 + // value. + + + // We have a supplementary character consists of 5 nibbles (20 bits) + // with no surrogates. + // We have to insert the surrogate pair on the values minus 0x10000. + // b0-b9 is the low order value, b10-b19 is the high order value. + // b19....b10 b9....b0 + // high low + // + // Character values. + // Basic 0x0-0xFFFF + // Supplimentary 0x10000-0x10FFFF + // so 0x10000 >> 10 = 0x43FF + + // To add the surrogate to the high order: + // + // ((utf32-0x10000)>>10)+0xD800 + // = (utf32>>10)-(0x10000>>10)+0xD800 + // = (utf32>>10)+(0xD800-0x40) + // = (utf32>>10)+0xD7C0 + + aUtf16Out[0] = static_cast((aUtf32 >> 10) + 0xD7C0); + + // To add the surrogate to the low order: + // + // ((utf32-0x10000) & 0x3FF)+0xDC00 + // = ((utf32 & 0x3FF) - (0x10000 & 0x3FF)) + 0xDC00 + // = ((utf32 & 0x3FF) - (0)) + 0xDC00 + // = (utf32 & 0x3FF) + 0xDC00 + + aUtf16Out[1] = static_cast(0xDC00 | (aUtf32 & 0x3FF)); + + return aUtf16Out + 2; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/dictionarycodepage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/dictionarycodepage.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,316 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include "XmlFrameworkPanics.h" +#include + +using namespace Xml; + +const TInt KTokenGranularity=30; + +EXPORT_C CDictionaryCodePage* CDictionaryCodePage::NewL(const TStringTable* aElementTable, + const TStringTable* aAttributeTable, + const TStringTable* aValueTable, + TUint8 aCodePage) + + { + return new(ELeave) CDictionaryCodePage(aElementTable, + aAttributeTable, + aValueTable, + aCodePage); + } + + +EXPORT_C CDictionaryCodePage::~CDictionaryCodePage() +/** +Destructor. + +@post This object may be allowed to go out of scope. + +*/ + { + iElementStringPoolIndexToToken.Close(); + iElementTokenToStringPoolIndex.Close(); + iAttributeStringPoolIndexToToken.Close(); + iAttributeTokenToStringPoolIndex.Close(); + iValueStringPoolIndexToToken.Close(); + iValueTokenToStringPoolIndex.Close(); + } + + +CDictionaryCodePage::CDictionaryCodePage(const TStringTable* aElementTable, + const TStringTable* aAttributeTable, + const TStringTable* aValueTable, + TUint8 aCodePage) +/** +Constructor. + +@post This object is properly constructed. + +@param aElementTable the element string table associated with this code page. +@param aAttributeTable the attribute string table associated with this code page. +@param aValueTable the attributevalue string table associated with this code page. +@param aCodePage the codepage number for this object. + +*/ +: iElementTable(aElementTable), // we do not own these StringTable + iAttributeTable(aAttributeTable), + iValueTable(aValueTable), + iElementStringPoolIndexToToken(KTokenGranularity), + iElementTokenToStringPoolIndex(KTokenGranularity, + _FOFF(TStringPoolTokenMapping, iTokenValue)), // key offset + iAttributeStringPoolIndexToToken(KTokenGranularity), + iAttributeTokenToStringPoolIndex(KTokenGranularity, + _FOFF(TStringPoolTokenMapping, iTokenValue)), // key offset + iValueStringPoolIndexToToken(KTokenGranularity), + iValueTokenToStringPoolIndex(KTokenGranularity, + _FOFF(TStringPoolTokenMapping, iTokenValue)), // key offset + iCodePage(aCodePage) + { + // do nothing; + } + + +EXPORT_C const TStringTable* CDictionaryCodePage::StringTable(TStringType aType) const +/** +This method obtains the correct string table based on the type passed. + +@return the correct string table for that type. + +@param aType the type of string table required, e.g. element. +@panic EXmlFrameworkPanicUnexpectedLogic If the type cannot be recognised. + +*/ + { + const TStringTable* table = 0; + + switch (aType) + { + case EStringTypeElement: + { + table = iElementTable; + break; + } + case EStringTypeAttribute: + { + table = iAttributeTable; + break; + } + case EStringTypeAttributeValue: + { + table = iValueTable; + break; + } + default: + { + __ASSERT_ALWAYS(EFalse, Panic(EXmlFrameworkPanicUnexpectedLogic)); + } + }; + return table; + } + + + +EXPORT_C TUint8 CDictionaryCodePage::CodePage() const +/** +This method returns the codepage number for this page. + +@return the codepage number. + +*/ + { + return iCodePage; + } + + + +EXPORT_C TInt CDictionaryCodePage::StringPoolIndexFromToken(TInt aToken, TStringType aType) const +/** +This method obtains a String Pool index from a token value + +@return the String Pool index +@return KErrXmlStringPoolTableNotFound + +@param aToken is the token value. +@param aType is the type of the token, e.g. element. + +@panic EXmlFrameworkPanicUnexpectedLogic If the type cannot be recognised. + +*/ + { + const RArray* toIndex = 0; + + switch (aType) + { + case EStringTypeElement: + { + toIndex = &iElementTokenToStringPoolIndex; + break; + } + case EStringTypeAttribute: + { + toIndex = &iAttributeTokenToStringPoolIndex; + break; + } + case EStringTypeAttributeValue: + { + toIndex = &iValueTokenToStringPoolIndex; + break; + } + default: + { + __ASSERT_ALWAYS(EFalse, Panic(EXmlFrameworkPanicUnexpectedLogic)); + } + }; + + TStringPoolTokenMapping map; + map.iTokenValue = aToken; + TInt index; + + // Since tokens are not numerically adjacent numbers a search is carried out: + if (toIndex->FindInSignedKeyOrder(map, index) == KErrNone) + { + return ((*toIndex)[index]).iTableIndex; + } + return KErrXmlStringPoolTableNotFound; + } + + + +EXPORT_C TInt CDictionaryCodePage::TokenFromStringPoolIndex(TInt aIndex, TStringType aType) const +/** +This method obtains a Token value from a String Pool index. + +@return the Token value. + +@param aIndex is the String Pool index +@param aType is the type of the token, e.g. element. + +@panic EXmlFrameworkPanicUnexpectedLogic If the type cannot be recognised. + +*/ + { + const RArray* toToken = 0; + + switch (aType) + { + case EStringTypeElement: + { + toToken = &iElementStringPoolIndexToToken; + break; + } + case EStringTypeAttribute: + { + toToken = &iAttributeStringPoolIndexToToken; + break; + } + case EStringTypeAttributeValue: + { + toToken = &iValueStringPoolIndexToToken; + break; + } + default: + { + __ASSERT_ALWAYS(EFalse, Panic(EXmlFrameworkPanicUnexpectedLogic)); + } + }; + + return ((*toToken)[aIndex]); + } + + + +EXPORT_C void CDictionaryCodePage::ConstructIndexMappingL(const TInt* aStringPoolToTokenMapping, + TStringType aType) +/** +This method constructs the internal correlation between indices and tokens. + +@param aStringPoolToTokenMapping array of token values, NULL terminated. +@param aType is the type of the token, e.g. element. + +@panic EXmlFrameworkPanicUnexpectedLogic If the type cannot be recognised. + +*/ + { + RArray* toToken = 0; + RArray* toIndex = 0; + + switch (aType) + { + case EStringTypeElement: + { + toToken = &iElementStringPoolIndexToToken; + toIndex = &iElementTokenToStringPoolIndex; + break; + } + case EStringTypeAttribute: + { + toToken = &iAttributeStringPoolIndexToToken; + toIndex = &iAttributeTokenToStringPoolIndex; + break; + } + case EStringTypeAttributeValue: + { + toToken = &iValueStringPoolIndexToToken; + toIndex = &iValueTokenToStringPoolIndex; + break; + } + default: + { + __ASSERT_ALWAYS(EFalse, Panic(EXmlFrameworkPanicUnexpectedLogic)); + } + }; + + TInt element = 0; + for (TInt count=0; (element = aStringPoolToTokenMapping[count]) != 0; ++count) + { + // The index to token mapping is straight forward. + // We simply add a table index. + // The table index is the same index into the RArray saving space. + User::LeaveIfError(toToken->Append(element)); + + // The token to index mapping is slightly more complicated, + // and we use a compare function to extract it. + TStringPoolTokenMapping mapping; + mapping.iTokenValue = element; // This is the primary key (Token) + mapping.iTableIndex = count; // This is the Table index + User::LeaveIfError(toIndex->InsertInOrder( + mapping, + TLinearOrder( + CDictionaryCodePage::CompareStringPoolTokenMappingTable))); + } + } + + + +TInt CDictionaryCodePage::CompareStringPoolTokenMappingTable(const TStringPoolTokenMapping& aFirst, + const TStringPoolTokenMapping& aSecond) +/** +This method compares two codepages and determines the order of two objects of a given class type. + +@return zero, if the two objects are equal +@return a negative value, if the first object is less than the second. +@return a positive value, if the first object is greater than the second. + +@param aFirst the first object. +@param aSecond the second object. +*/ + { + return aFirst.iTokenValue - aSecond.iTokenValue; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/documentparameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/documentparameters.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,84 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +using namespace Xml; + + +EXPORT_C RDocumentParameters::RDocumentParameters() +/** +Default Constructor + +Only Parsers have this access. +@see CParser +*/ + { + // do nothing; + } + + + +EXPORT_C void RDocumentParameters::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +@post This object may be allowed to go out of scope. + +Only Parsers have this access. +@see CParser + +*/ + { + iCharacterSetName.Close(); + } + + + +EXPORT_C void RDocumentParameters::Open(const RString& aCharacterSetName) +/** +This method opens and sets all the parameters contents. +We do not own any resources. + +@pre The object has just been constructed. +@post The objects members have been set to the values given. + +@param aCharacterSetName the Internet-standard name of a character set, + which is identified in Symbian OS by its UID. + +Only Parsers have this access. +@see CParser + +*/ + { + iCharacterSetName = aCharacterSetName; + } + + + +EXPORT_C const RString& RDocumentParameters::CharacterSetName() const +/** +This method returns a handle to the character encoding name, which is +the Internet-standard name of a character set, which is identified in Symbian OS by its UID. + +@return The character encoding name. + +@pre The objects member have been pre-set accordingly. + +*/ + { + return iCharacterSetName; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/matchdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/matchdata.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,884 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of CMatchData class +// +// + +/** + @file + @publishedAll + @released +*/ + +#include +#include + +using namespace Xml; + +/** +The maximum length of variant field + +@internalComponent +*/ +const TInt KXmlMaxVariantLength = 32; + +/** +The maximum length of mime type field + +@internalComponent +*/ +const TInt KXmlMaxMimeTypeLength = 255; + +/** +Fields separator for data and opaque data in resource information file + +@internalComponent +*/ +_LIT8(KXmlDataSeparator, "||"); + +/** +Set flag macro to simplify bitmap management + +@internalComponent +*/ +#define SYMBIAN_XML_FLAG_SET(bitmap, flag, setting) \ + bitmap = setting?(bitmap|flag):(bitmap&(~flag)) + +/** +Rom only flag +To request for rom based parsers only +Default value is FALSE + +@internalComponent +*/ +const TInt32 KXmlRomOnlyFlag = 0x00000001; + +/** +Case Sensitivity flag +To specify how case sensitivity should be applied, while performing strings matching +Default value is TRUE + +@internalComponent +*/ +const TInt32 KXmlCaseSensitivityFlag = 0x00000002; + +/** +Leave on many flag +To leave when the query is narrowed down to more than one parser. +If not set, the XML framework will choose a parser. +Default value is FALSE + +@internalComponent +*/ +const TInt32 KXmlLeaveOnManyFlag = 0x00000004; + +/** +Reserved, unused flags in iAddInfo attribute + +@internalComponent +*/ +const TInt32 KXmlAddInfoReservedFlags = 0xFFFFFFF8; + +/** +Object constructor. Initializes internal state to default values + +@internalComponent +*/ +CMatchData::CMatchData(): + iMimeType(NULL), + iVariant(NULL), + iAddInfo(KXmlCaseSensitivityFlag) + { + + } + +/** +Object destructor. Deletes allocated heap based memory. + +@internalComponent +*/ +CMatchData::~CMatchData() + { + if (iMimeType != NULL) + { + delete iMimeType; + iMimeType = NULL; + } + + if (iVariant != NULL) + { + delete iVariant; + iVariant = NULL; + } + } + +/** +Creates CMatchData object with its default values. + +@leave KErrNoMemory If there is not enough memory to create an object. + +@return A pointer to the newly created CMatchData object. + +*/ +EXPORT_C CMatchData* CMatchData::NewL() + { + CMatchData* me = CMatchData::NewLC(); + CleanupStack::Pop(me); + return me; + } + +/** +Creates CMatchData object using heap based stream of externalized object's data. + +@param aPackage Descriptor to the heap based stream of externalized object + +@leave KErrNoMemory If there is not enough memory to create an object. +@leave KErrArgument If the argument passed to an object is incorrect. + +@return A pointer to the newly created CMatchData object. + +@internalComponent +*/ +EXPORT_C CMatchData* CMatchData::NewL(const TDesC8& aPackage) + { + CMatchData* me = CMatchData::NewLC(aPackage); + CleanupStack::Pop(me); + return me; + } + + +/** +Creates CMatchData object with its default values. +Leaves an obeject pointer on a cleanup stack. + +@leave KErrNoMemory If there is not enough memory + +@return A pointer to the newly created CMatchData object. + +*/ +EXPORT_C CMatchData* CMatchData::NewLC() + { + CMatchData* me = new (ELeave) CMatchData(); + CleanupStack::PushL(me); + return me; + } + + +/** +Creates CMatchData object using heap based stream of externalized object's data. +Leaves an obeject pointer on a cleanup stack. + +@param aPackage Descriptor to the heap based stream of externalized object + +@leave KErrNoMemory If there is not enough memory to create an object. +@leave KErrArgument If the argument passed to an object is incorrect. + +@return A pointer to the newly created CMatchData object. + +@internalComponent +*/ +EXPORT_C CMatchData* CMatchData::NewLC(const TDesC8& aPackage) + { + CMatchData* me = new (ELeave) CMatchData(); + CleanupStack::PushL(me); + me->ConstructL(aPackage); + return me; + } + +/** +Standard symbian 2-phase construction method. +It reads a stream stored on a heap and internalize the object. + +@param aPackage Descriptor to the heap based stream of externalized object + +@leave KErrNoMemory If there is not enough memory to create an object. +@leave KErrArgument If the argument passed to an object is incorrect. + +@return A pointer to the newly created CMatchData object. + +@internalComponent +*/ +void CMatchData::ConstructL(const TDesC8& aPackage) + { + RDesReadStream stream(aPackage); + InternalizeL(stream); + stream.Close(); + } + +/** +Externalizes the object into RWriteStrem. + +@param aStream Stream to write to + +@internalComponent +*/ +void CMatchData::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt16L(iMimeType? iMimeType->Length():0); + if(iMimeType && iMimeType->Length() > 0) + { + aStream.WriteL(*iMimeType, iMimeType->Length()); + } + + aStream.WriteInt16L(iVariant?iVariant->Length():0); + if (iVariant && iVariant->Length() > 0 ) + { + aStream.WriteL(*iVariant, iVariant->Length()); + } + + aStream.WriteUint32L(iAddInfo); + } + +/** +Internalizes the object out of RReadStream. + +@param aStream Stream to read from + +@leave KErrNoMemory If there is not enough memory for new string allocation. +@leave KErrArgument If passed descriptor doesn't comply with length constraints. + +@internalComponent +*/ +void CMatchData::InternalizeL(RReadStream& aStream) + { + TInt16 temp; + + // read mime type and create the heap buffer for it. + // verify constraints + temp = aStream.ReadInt16L(); + if (temp <=0 || temp > KXmlMaxMimeTypeLength) + { + // must not be greater then max + User::LeaveIfError(KErrArgument); + } + + // delete current value as it is no longer valid + if (iMimeType != NULL) + { + delete iMimeType; + iMimeType = NULL; + } + + // create buffer and read new data if available + if (temp > 0) + { + iMimeType = HBufC8::NewL(temp); + TPtr8 ptr = iMimeType->Des(); + aStream.ReadL(ptr, temp); + } + + // read variant and create the heap buffer for it. + // verify constarints + temp = aStream.ReadInt16L(); + if (temp <0 || temp > KXmlMaxVariantLength) + { + // must not be greater then max, zero possible. + User::LeaveIfError(KErrArgument); + } + + // delete current value as it is no longer valid + if (iVariant != NULL) + { + delete iVariant; + iVariant = NULL; + } + + // create buffer and read new data if available + if (temp > 0) + { + iVariant = HBufC8::NewL(temp); + TPtr8 ptr = iVariant->Des(); + aStream.ReadL(ptr, temp); + } + + // read additional info + iAddInfo = aStream.ReadUint32L(); + // check for correctness of the iAddInfo bitmap + if (iAddInfo & KXmlAddInfoReservedFlags > 0 ) + { + // Leave as unexpected flags are set. + User::LeaveIfError(KErrArgument); + } +} + +/** +Sets up a mime type attribute to a string given as an aData descriptor. + +@param aData String descriptor + +@leave KErrNoMemory If there is not enough memory for new string allocation. +@leave KErrArgument If passed descriptor doesn't comply with length constraints. + +*/ +EXPORT_C void CMatchData::SetMimeTypeL(const TDesC8& aData) + { + // verify constraints + if (aData.Length() == 0 || aData.Length() > KXmlMaxMimeTypeLength) + { + // must not be greater than max + User::Leave(KErrArgument); + } + + // delete current value as it is no longer valid + if (iMimeType != NULL) + { + delete iMimeType; + iMimeType = NULL; + } + + // allocate required buffer and copy new data + iMimeType = aData.AllocL(); + + } + +/** +Sets up a variant attribute to a string given as an aVariant descriptor. +If this is not set OR is set to a string of length 0 the Variant ID is +not used during parser resolution and hence the variant IDs of plug-in +parsers are ignored. + +@param aData String descriptor + +@leave KErrNoMemory If there is not enough memory for new string allocation. +@leave KErrArgument If passed descriptor doesn't comply with length constraints. + +*/ +EXPORT_C void CMatchData::SetVariantL(const TDesC8& aVariant) + { + + // verify constraints + if (aVariant.Length() > KXmlMaxVariantLength) + { + // must not be greater than max + User::Leave(KErrArgument); + } + + // delete current value as it is no longer valid + if (iVariant != NULL) + { + delete iVariant; + iVariant = NULL; + } + + // allocate required buffer and copy new data + iVariant = aVariant.AllocL(); + } + +/** +Returns a pointer to the mime type string. + +@return A pointer to the mime type string. + Pointer to KNullDesC8 is returned if not set up yet. + +*/ +EXPORT_C const TPtrC8 CMatchData::MimeType() const + { + TPtrC8 result; + + if(iMimeType) + result.Set(*iMimeType); + else + result.Set(KNullDesC8); + + return result; + } + +/** +Returns a pointer to the variant string. + +@return A pointer to the variant string. + Pointer to KNullDesC8 is returned if not set up yet. + +*/ +EXPORT_C const TPtrC8 CMatchData::Variant() const + { + TPtrC8 result; + + if(iVariant) + result.Set(*iVariant); + else + result.Set(KNullDesC8); + + return result; + } + +/** +Returns a heap based buffer descriptor of an externalized CMatchData object stream. +The newly created object's ownership is shifted to the caller. + +@leave KErrNoMemory If there is not enough memory to create an heap based buffer. + +@return Heap based buffer descriptor of an externalized object stream. + +@internalComponent +*/ +HBufC8* CMatchData::PackToBufferL() const + { + //Create new Heap Descriptor with the size of externalized CMatchData + HBufC8* data = HBufC8::NewLC( (iMimeType?iMimeType->Size():0) + + (iVariant?iVariant->Size():0) + + 2*sizeof(TInt16) // length of mime type and variant strings + + sizeof(TUint32)); // size of addinfo variable + + // create the stream using allocated buffer + TPtr8 dataDes = data->Des(); + RDesWriteStream stream(dataDes); + + // pack object into the allocated buffer + ExternalizeL(stream); + + //cleanup + stream.Close(); + CleanupStack::Pop(data); + return data; + } + + +/** +Sets the LeaveOnManyFlag flag. +If set, it notifies customized resolver it should leave when the query is resolved to more than one parser. +By default this flag is not set, so the framework chooses a parser in this case. + +@param aSetting The setting value. + +*/ +EXPORT_C void CMatchData::SetLeaveOnMany(TBool aSetting) + { + SYMBIAN_XML_FLAG_SET(iAddInfo, KXmlLeaveOnManyFlag, aSetting); + } + +/** +Sets the Rom Only flag. +If set, it notifies customized resolver the request is for ROM-based parsers only. +By default this flag is not set, so the framework searches for rom and non-rom based parsers. + +@param aSetting The setting value. + +*/ +EXPORT_C void CMatchData::SetRomOnly(TBool aSetting) + { + SYMBIAN_XML_FLAG_SET(iAddInfo, KXmlRomOnlyFlag, aSetting); + } + +/** +Sets the Case Sensitivity flag. +Customized resolver uses this setting to turn on or off case sensitivity for strings matching. + +@param aSetting The setting value. + +*/ +EXPORT_C void CMatchData::SetCaseSensitivity(TBool aSetting) + { + SYMBIAN_XML_FLAG_SET(iAddInfo, KXmlCaseSensitivityFlag, aSetting); + } + +/** +Static function to sort an array of CImplementationInformation objects, +in ascending order of their Uid values. +The function is used in CMatchData::ResolveL(). + +@param aImpInfo1 pointer of first CImplementationInformation object +@param aImpInfo2 pointer of second CImplementationInformation object + +@return zero, if the two objects have equal Uids +@return a negative value, if the first object's Uid is less than the second object's Uid. +@return a positive value, if the first object's Uid is greater than the second object's Uid. + +@internalComponent + +*/ +TInt CMatchData::SortOrder(const CImplementationInformation &aImpInfo1, + const CImplementationInformation &aImpInfo2) + { + if (aImpInfo1.ImplementationUid().iUid > aImpInfo2.ImplementationUid().iUid) + { + return 1; + } + if (aImpInfo1.ImplementationUid().iUid < aImpInfo2.ImplementationUid().iUid) + { + return -1; + } + return 0; + } + +/** +Performs a parser resolution. +Following criteria are considered: + - Case sensitivity for string matching is applied according to the Case Sensitivity flag. + - Only ROM-based parsers are considered when ROM only flag is set. + - Mime type is mandatory as it must match the data field in resource information file. + - Variant is optional. If present it must match first entry in the opaque data field. + - If the query is narrowed down to more than one parser the behaviour is determined in + SelectSingleParserL function. + +@param aImplList The list of available parsers to choose from. + +@leave KErrNoMemory +@leave KErrXmlMoreThanOneParserMatched + +@return Parser's Uid or KNullUid if parser isn't found. + +@see SelectSingleParserL + +@internalComponent + +*/ +EXPORT_C TUid CMatchData::ResolveL(RImplInfoArray& aImplList) const + { + TUid matchUid; + + // Create an array to hold multiple matching parser uids + // RImplInfoPtrArray is used here for the usage of TLinearOrder<> pattern + RImplInfoPtrArray parserArray; + + CleanupClosePushL(parserArray); + + // go through the list of implementations for the + for (TInt i = 0 ; i < aImplList.Count(); i++) + { + ::CImplementationInformation* impData = aImplList[i]; + + if (RomOnly() && !(impData->RomBased())) + { + // Request for rom based parser only. + // This one isn't rom based, so continue with the next one + continue; + } + + if ((MimeTypeMatch(impData->DataType()) == TRUE) + && (VariantMatch(impData->OpaqueData()) == TRUE) ) + { + // store the matching implementation occurance + // if there is only one occurance, this Uid will be returned + // otherwise, the list will contain items sorted by Uid + // (see CMatchData::SortOrder()) + parserArray.InsertInOrderL(impData, + TLinearOrder(CMatchData::SortOrder)); + } + } + + // check if multiple match found + if (parserArray.Count()==1) + { + // list filtered down to one parser. + matchUid = parserArray[0]->ImplementationUid(); + } + else if (parserArray.Count()>1) + { + // multiple matches found. we need to make a decision + matchUid = SelectSingleParserL(parserArray); + } + else + { + // no match + matchUid = KNullUid; + } + + CleanupStack::PopAndDestroy(&parserArray); + return matchUid; + } + +/** +Helps parser resolution when multiple matches are found +Following criteria are considered on the list filtered by ResolveL: +- The code might either leave with an error if LeaveOnMany flag is set, or + select a parser from the multiple-item list. The default behaviour is to select + the parser with lowest uid. To preserve backwards compatibility, in the case of + no variant a Symbian supplied parser will be returned if present. If there are + multiple matching Symbian parsers, the one with the lowest Uid will be returned. + +@param aImplList The filtered list of parsers to choose from. + +@leave KErrNoMemory +@leave KErrXmlMoreThanOneParserMatched + +@return Parser's Uid + +@internalComponent +*/ +TUid CMatchData::SelectSingleParserL(RImplInfoPtrArray& aImplList) const + { + TInt arrayLen = aImplList.Count(); + + // check if multiple match found + if ( LeaveOnMany() ) + { + // At this point more than one parser was found matching resolution criteria, + // the user is requesting to leave in such a case + User::Leave(KErrXmlMoreThanOneParserMatched); + } + + if (IsInvalidVariant()) + { + // multiple matches in list and variant is invalid means we should look for Symbian plugin + // we go through the (ascending) sorted list of implementations + for (TInt j = 0 ; j <= arrayLen-1; j++) + { + ::CImplementationInformation* impData = aImplList[j]; + + // we check every matching parser variant for Symbian string + if ((CaseSensitivity() && (impData->OpaqueData().Compare(KXmlSymbianPluginVariant) == 0)) + ||(!CaseSensitivity() && (impData->OpaqueData().CompareF(KXmlSymbianPluginVariant) == 0)) ) + { + // this match is the lowest Uid Symbian parser, return it + return impData->ImplementationUid(); + } + } + // if this for loop finishes without returning, this means there are multiple + // matching parsers none of which are Symbian. We defer their processing to the + // common 'return lowest uid' part of the algorithm + } + + // return the lowest uid, which should be the first item in the list + return aImplList[0]->ImplementationUid(); + } + +/** +Performs string matching for all the entries in an aField string separated by aSeparator. + +@param aField string with several entries separated by aSeparator. +@param aMatchString string to match against entries in aField +@param aSeparator string which separates entries in aField + +@return Match result + +@internalComponent +*/ +TBool CMatchData::MatchField(const TDesC8& aField, const TDesC8& aMatchString, const TDesC8& aSeparator) const + { + // verify input data + if (aField.Length() == 0 || aMatchString.Length() == 0) + { + return EFalse; + } + + // Check if aField and aMatchString are not the same. + // For most cases aField is a one-entry string, so for better performance it is worth to check it up front. + if ( (CaseSensitivity() && (aField.Compare(aMatchString) == 0)) + || (!CaseSensitivity() && (aField.CompareF(aMatchString) == 0) ) ) + { + return ETrue; + } + + // Find the first separator position + TInt separatorPos = aField.Find(aSeparator); + if (separatorPos == KErrNotFound) + { + // No separators in the string. + // Only one entry in the aField string, which was already verified as non-matching. + // No matches found then. + return EFalse; + } + + TInt separatorLength = aSeparator.Length(); + + // call again the method with the "first field" of the string + if (MatchField(aField.Left(separatorPos), aMatchString, aSeparator) == TRUE) + { + return ETrue; + } + + // call the method with the remaining sections of the string + if (MatchField(aField.Mid(separatorPos + separatorLength), aMatchString, aSeparator) == TRUE) + { + return ETrue; + } + + //All recursive calls returned false, so the match wasn't found + return EFalse; + } + +/** +Checks for mime type entry in aDataField string. + +@param aDataFiled string with several mime type entries separated by "||" string. + +@return Match result + +@internalComponent +*/ +TBool CMatchData::MimeTypeMatch(const TDesC8& aDataField) const + { + return MatchField(aDataField, *iMimeType, KXmlDataSeparator); + } + +/** +Checks for variant string entry in first field of aOpaqueField string. + +@param aOpaqueField string with several entries separated by "||" string. + +@return Match result + +@internalComponent +*/ +TBool CMatchData::VariantMatch(const TDesC8& aOpaqueField) const + { + TPtrC8 matchString; + + if (IsInvalidVariant()) + { + // optional variant is not set + // return true in all cases + return ETrue; + } + + TInt separatorPos = aOpaqueField.Find(KXmlDataSeparator); + + // set the first entry in the opague data to match against + if (separatorPos == KErrNotFound) + { + matchString.Set(aOpaqueField); + } + else + { + matchString.Set(aOpaqueField.Left(separatorPos)); + } + + // perform string matching + if ( (CaseSensitivity() && (iVariant->Compare(matchString) == 0)) + ||(!CaseSensitivity() && (iVariant->CompareF(matchString) == 0)) ) + { + return ETrue; + } + + return EFalse; + } +/** +Returns Case Sensitivity flag value + +@return Flag state + +@internalComponent +*/ +TBool CMatchData::CaseSensitivity() const + { + return (iAddInfo & KXmlCaseSensitivityFlag)?ETrue:EFalse; + } + +/** +Returns LeaveOnMany flag value + +@return Flag state + +@internalComponent +*/ +TBool CMatchData::LeaveOnMany() const + { + return (iAddInfo & KXmlLeaveOnManyFlag)?ETrue:EFalse; + } + +/** +Returns Rom-Only flag value + +@return Flag state + +@internalComponent +*/ +TBool CMatchData::RomOnly() const + { + return (iAddInfo & KXmlRomOnlyFlag)?ETrue:EFalse; + } + +/** +Assignement operator + +@param aMatchData CMatchData object to assign from + +@internalComponent +*/ +CMatchData& CMatchData::operator=(const CMatchData & aMatchData) + { + + /* + * SYMBIAN DEF132492 FIX : Added TRAP statements to handle the case wherein the functions + * called here leave. + */ + TRAPD( err, SetMimeTypeL(aMatchData.MimeType()) ) ; + if( err != KErrNone ) + { + return *this; + } + + /* + * SYMBIAN DEF132492 FIX : Added TRAP statements to handle the case wherein the functions + * called here leave. + */ + TRAP( err, SetVariantL(aMatchData.Variant())); + if( err != KErrNone ) + { + return *this; + } + + + iAddInfo = aMatchData.iAddInfo; + return *this; + } +/** +Comparison operator. + +@param aMatchData CMatchData object to compare with + +@internalComponent +*/ +TBool CMatchData::operator==(const CMatchData & aMatchData) const + { + + // verify iAddInfo first as the fastest comparision + if (aMatchData.iAddInfo != iAddInfo) + { + return EFalse; + } + + // verfiy mime type + if (iMimeType == NULL + || (CaseSensitivity() && iMimeType->Compare(aMatchData.MimeType()) != 0) + || (!CaseSensitivity() && iMimeType->CompareF(aMatchData.MimeType()) != 0) ) + { + // iMimeType is NULL or strings doesn't match + // verify the case where both might be NULL. + if ( (iMimeType != NULL) || (aMatchData.iMimeType != NULL ) ) + { + // mime type doesn't match + return EFalse; + } + } + + // verfiy variant + if (iVariant == NULL + || (CaseSensitivity() && iVariant->Compare(aMatchData.Variant()) != 0) + || (!CaseSensitivity() && iVariant->CompareF(aMatchData.Variant()) != 0) ) + { + // iVariant is NULL or strings doesn't match + // verify the case where both might be NULL. + if ( (iVariant != NULL) || (aMatchData.iVariant != NULL) ) + { + // variant doesn't match + return EFalse; + } + } + return ETrue; + } + +/** +Checks if iVariant is not set or empty + +@return Variant string validness + +@internalComponent +*/ +TBool CMatchData::IsInvalidVariant() const + { + return (iVariant == NULL || (iVariant && iVariant->Length() == 0)); + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/parser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/parser.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,507 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include +#include + +#include "parserimpl.h" + + +using namespace Xml; + + +CParser::CParser() : CBase() , iImpl(0) + { + } + +/** This method creates a parser that is ready to parse documents +of the specified mime type. + +If there are multiple parser plugins in the system which can parse the +mime type, the XML framework will choose a parser. + +The criteria used to choose a parser, from many matching parsers, is as follows: + +- A Symbian-supplied parser (with variant field set to "Symbian") will be selected by default. +If there are multiple Symbian-supplied parsers, the one with the lowest Uid will be selected. +Otherwise, the non-Symbian parser with the lowest Uid will be selected. + +@return A constructed parser + +@param aParserMimeType The mime type of the documents to parse (e.g. "txt/xml"). +@param aCallback The handler for parser generated events. + +@leave KErrNoMemory If there is not enough memory to create parser or + one of system wide error codes. + +@leave KErrXmlParserPluginNotFound + If Xml framework is unable to find a parser + based on data provided in aParserMimeType. + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@see CParser::NewL(const CMatchData& aCriteria, MContentHandler& aCallback) +*/ +EXPORT_C CParser* CParser::NewL(const TDesC8& aParserMimeType, MContentHandler& aCallback) + { + CParser* self=NewLC(aParserMimeType, aCallback); + CleanupStack::Pop(self); + return self; + } + +/** This method is similar to NewL, but leaves the created parser on the +cleanup stack. + +@return A constructed parser + +@param aParserMimeType The mime type of the documents to parse (e.g. "txt/xml"). +@param aCallback The handler for parser generated events. + +@leave KErrNoMemory If there is not enough memory to create parser or + one of system wide error codes. + +@leave KErrXmlParserPluginNotFound + If Xml framework is unable to find a parser + based on data provided in aParserMimeType. + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@see CParser::NewL(const TDesC8& aParserMimeType, MContentHandler& aCallback) +@see CParser::NewLC(const CMatchData& aCriteria, MContentHandler& aCallback) +*/ +EXPORT_C CParser* CParser::NewLC(const TDesC8& aParserMimeType, MContentHandler& aCallback) + { + CParser* self = new (ELeave) CParser; + CleanupStack::PushL(self); + self->ConstructL(aParserMimeType, aCallback); + return self; + } + +/** +This method constructs the object with default settings + +@param aParserMimeType Parser Mime type +@param aCallback Event handler + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@internalComponent +*/ + +void CParser::ConstructL(const TDesC8& aParserMimeType, MContentHandler& aCallback) + { + // create parser implementaion class if or created yet. + if (!iImpl) + { + iImpl = new (ELeave) TParserImpl; + } + + // create CMatchData object with default parameters and adequate mime type + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(aParserMimeType); + iImpl->OpenL(*matchData, aCallback); + CleanupStack::PopAndDestroy(matchData); + } + +/** +This method constructs the object according to the details specified in CMatchData object + +@param aMatchData Detailed parser information +@param aCallback Event handler + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@internalComponent +*/ +void CParser::ConstructL(const CMatchData& aMatchData, MContentHandler& aCallback) + { + if (!iImpl) + { + iImpl = new (ELeave) TParserImpl; + } + iImpl->OpenL(aMatchData, aCallback); + } + +/** This method is the destructor for the object.*/ +CParser::~CParser() + { + if (iImpl) + { + iImpl->Close(); + delete iImpl; + iImpl = NULL; + } + } + + +const TUint KDefChunkSize = 0x100; + + +/** +This convenience Xml function may be used to parse the file named in aFilename +using the supplied parser. It reads the file in chunks and passes these to +CParser::ParseL(). When the end of file is reach CParser::ParseEndL() is called. +It assumes the caller has successfully created a valid parser with a valid +MContentHandler reference and has called ParserBeginL(). + +@param aParser A valid CParser object to perform the parsing which has + already had ParseBeginL() called. +@param aFs The file server session to use +@param aFilename The filename of the file to open, read and parse +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void Xml::ParseL(CParser& aParser, RFs& aFs, const TDesC& aFilename) + { + RFile file; + + User::LeaveIfError(file.Open(aFs, aFilename, EFileRead|EFileShareReadersOnly)); + CleanupClosePushL(file); + + TBuf8 data; + User::LeaveIfError(file.Read(data,:: KDefChunkSize)); + TUint length = data.Length(); + + while (length) + { + aParser.ParseL(data); + User::LeaveIfError(file.Read(data, KDefChunkSize)); + length = data.Length(); + } + aParser.ParseEndL(); + CleanupStack::PopAndDestroy(&file); + } + +/** +This convenience Xml function may be used to parse the file held in aFile +using the supplied parser. It reads the file in chunks and passes these to +CParser::ParseL(). When the end of file is reach CParser::ParseEndL() is called. +It assumes the caller has successfully created a valid parser with a valid +MContentHandler reference and has called ParserBeginL(). + +@param aParser A valid CParser object to perform the parsing which has + already had ParseBeginL() called. +@param aFilename Open file handle to the file to read and parse +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void Xml::ParseL(CParser& aParser, RFile& aFile) + { + TBuf8 data; + User::LeaveIfError(aFile.Read(data,:: KDefChunkSize)); + TUint length = data.Length(); + + while (length) + { + aParser.ParseL(data); + User::LeaveIfError(aFile.Read(data, KDefChunkSize)); + length = data.Length(); + } + aParser.ParseEndL(); + } + +/** +This convenience Xml function may be used to parse the XML document held in a +descriptor in memory using the supplied parser. This variant function does call +ParseBeginL() to reset the parser to the default parser as selected for the +mime type given at creation time. It passes the entire descriptor into +CParser::ParseL(). When this returns it calls CParser::ParseEndL(). +It assumes the caller has successfully created a valid parser with a valid +MContentHandler reference. + +This API can be used when parsing different kinds of documents with +the majority being parsed associated with the default parser/mime type. + +@param aParser A valid CParser object to perform the parsing +@param aContent The entire XML document content to parse +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void Xml::ParseL(CParser& aParser, const TDesC8& aContent) + { + aParser.ParseBeginL(); // resets to default mime type + aParser.ParseL(aContent); + aParser.ParseEndL(); + } + + +/** This method tells the parser that we're going to start parsing a document +using the parser associated with this mime type. + +@param aDocumentMimeType the mime type of the document +*/ +EXPORT_C void CParser::ParseBeginL(const TDesC8& aDocumentMimeType) + { + // create CMatchData object with default parameters and adequate mime type + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(aDocumentMimeType); + iImpl->SetMimeTypeL(*matchData); + CleanupStack::PopAndDestroy(); + } + +/** This method tells the parser that we're going to start parsing a document +using the default mime type specified on construction. + +The processor chain and features will be cleared if the parser currently +set is not the default, all old features are removed as these generally +have no meaning between parsers. + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void CParser::ParseBeginL() + { + iImpl->ResetMimeTypeL(); + } + + +/** This method tells the parser to parse a fragment of a document. +Could be the whole document. ParseEndL should be called once the whole document has +been parsed. + +The parser currently set will be used. + +@param aFragment the fragment to parse +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void CParser::ParseL(const TDesC8& aFragment) + { + iImpl->ParseChunkL(aFragment); + } + + +/** This method tells the parser that we've finished parsing the current document +and should be called after calling CParser::ParseL for the final time, +as this will initiate error callbacks via MContentHandler, and clean up memory +where appropriate, should an error have occured during the parsing process. +Such an error could occur when trying to parse a truncated document. +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void CParser::ParseEndL() + { + iImpl->ParseLastChunkL(_L8("")); + } + + + +/** This method changes the client and plugin chain. + +@param aCallback the client at the end of the callback + chain that is to receive the parsed document information. +@param aPlugins a list of plugin implementation uids that + make up the callback chain. +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void CParser::SetProcessorChainL(const RContentProcessorUids& aPlugins) + { + iImpl->SetProcessorChainL(aPlugins); + } + + +/** This method enables a specific feature of the parser. + +@return KErrNone if successful, KErrNotSupported if the parser doesn't support the feature. +@param aParserFeature The parser feature that must be enabled. +@see TParserFeature +*/ +EXPORT_C TInt CParser::EnableFeature(TInt aParserFeature) + { + return iImpl->EnableFeature(aParserFeature); + } + +/** This method disables a specific feature of the parser. + +@return KErrNone if successful, KErrNotSupported if the feature can't be disabled. +@param aParserFeature The parser feature that must be disabled. +@see TParserFeature +*/ +EXPORT_C TInt CParser::DisableFeature(TInt aParserFeature) + { + return iImpl->DisableFeature(aParserFeature); + } + +/** This method tell whether a specific feature of the parser is enabled. +@return True if the feature is enabled. +@see TParserFeature +*/ +EXPORT_C TBool CParser::IsFeatureEnabled(TInt aParserFeature) const + { + return iImpl->IsFeatureEnabled(aParserFeature); + } + + + +/** This method preloads a string dictionary prior to parsing. + +@param aPublicId the public identifier representing the + document dtd. +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +*/ +EXPORT_C void CParser::AddPreloadedDictionaryL(const TDesC8& aPublicId) + { + iImpl->AddPreloadedDictionaryL(aPublicId); + } + + + +/** This method obtains a handle to the current string pool. + +@return handle to the current string pool. +*/ +EXPORT_C RStringPool& CParser::StringPool() + { + return iImpl->StringPool(); + } + + +/** This method obtains a handle to the current StringDictionaryCollection. + +@return handle to the current StringDictionaryCollection. +*/ +EXPORT_C RStringDictionaryCollection& CParser::StringDictionaryCollection() + { + return iImpl->StringDictionaryCollection(); + } + + +/** This method creates the particular parser specified in CMatchData parameter. + +The parser plugin resolution process is based on mime type and variant field. +Both are provided in CMatchData parameter. Mime Type is a mandatory string +for the resolution process and it is matched against the data field of plugin resource files. +Variant string is optional. If it exists, it is matched against the first entry +of the opaque data field of plugin resource files. + +If the query is narrowed down to many parsers, the XML framework might either leave with +an error (KErrXmlMoreThanOneParserMatched), or choose a parser. The behaviour is specified +by LeaveOnMany flag. The default value of the flag is FALSE ('choose a parser' behaviour). + +The criteria used to choose a parser, from many matching parsers, is as follows: + +- If the optional Variant field is specified, the XML framework will choose the parser with +the lowest Uid from the list. + +- If the optional Variant field is not specified, a Symbian-supplied parser (with variant +field set to "Symbian") will be selected by default. If there are multiple Symbian-supplied +parsers, the one with the lowest Uid will be selected. Otherwise, the non-Symbian parser +with the lowest Uid will be selected. + +Case sensitivity of the string matching process is applied according to the relevant flag +in CMatchData. +The default value is TRUE (Case Sensitivity enabled). + +Only ROM-based parsers are returned if the relevant flag is set in CMatchData. +The default value is FALSE (all parsers are considered). + +@return A constructed parser + +@param aCriteria The specific information about required parser + (mime type, variant data). +@param aCallback The xml/wbxml event handler. + +@leave KErrNoMemory If there is not enough memory to create parser or + one of system wide error codes. + +@leave KErrXmlParserPluginNotFound + If Xml framework is unable to find a parser + based on data provided in CMatchData. + +@leave KErrXmlMoreThanOneParserMatched + If Xml framework narrowed down the query + to many parsers and a user requested to leave + in such case (LeaveOnMany flag set). + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@see CMatchData +*/ +EXPORT_C CParser* CParser::NewL(const CMatchData& aCriteria, MContentHandler& aCallback) + { + CParser* me = CParser::NewLC(aCriteria, aCallback); + CleanupStack::Pop(me); + return me; + } + +/** This method creates the particular parser specified in CMatchData parameter. +It performs the same way as NewL with the exception that it leaves the object +on the cleanup stack. + +@return A constructed parser + +@param aCriteria The specific information about required parser + (mime type, version, variant data). +@param aCallback The xml/wbxml event handler. + +@leave KErrNoMemory If there is not enough memory to create parser or + one of system wide error codes. + +@leave KErrXmlParserPluginNotFound + If Xml framework is unable to find a parser + based on data provided in CMatchData. + +@leave KErrXmlMoreThanOneParserMatched + If Xml framework narrowed down the query + to many parsers and a user requested to leave + in such case (LeaveOnMany flag set). + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@see CParser::NewL(const CMatchData& aCriteria, MContentHandler& aCallback) +@see CMatchData +*/ +EXPORT_C CParser* CParser::NewLC(const CMatchData& aCriteria, MContentHandler& aCallback) + { + CParser* me = new (ELeave) CParser(); + CleanupStack::PushL(me); + me->ConstructL(aCriteria, aCallback); + return me; + } + +/** This method tells the parser that we're going to start parsing a document +using the parser associated with given CMatchData criteria. + +@param aCriteria The specific information about required parser + (mime type, version, variant data). + + +@leave KErrNoMemory If there is not enough memory to create parser. + +@leave KErrArgument If the data specified in CMatchData are not sufficient. + +@leave KErrXmlParserPluginNotFound + If Xml framework is unable to find a parser + based on data provided in CMatchData. + +@leave KErrXmlMoreThanOneParserMatched + If Xml framework narrowed down the query + to many parsers and a user requested to leave + in such case (LeaveOnMany flag set). + +@leave ... One of the system wide error codes or one of the Xml + specific ones defined in XmlFrameworkErrors.h +@see CMatchData +*/ +EXPORT_C void CParser::ParseBeginL(const CMatchData& aCriteria) + { + iImpl->SetMimeTypeL(aCriteria); + } + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/parserimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/parserimpl.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,510 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include +#include +#include +#include +#include +#include +#include "XmlFrameworkPanics.h" +#include +#include +#include +#include + +#include "parserimpl.h" + +/** +Indicates the custom resolver implementation for XML parser framework. + +@internalComponent +*/ +const TUid KCustomResolverUid = {0x10273862}; + +using namespace Xml; + +void TParserImpl::DestroyContentProcessorPtrMapping(TAny* aPtr) +/** +Tidy memory associated with this object. + +@param aPtr The ContentProcessor pointer. + +*/ + { + TDtorContentProcessorPtrMapping* ptr = static_cast(aPtr); + + if (ptr->iDtorKey != KNullUid && ptr->iContentProcessor) + { + // Tell ECom to destroy its plugin details + REComSession::DestroyedImplementation(ptr->iDtorKey); + + // Free memory + ptr->iContentProcessor->Release(); + } + + delete (ptr); + } + + + +TParserImpl::TParserImpl() +/** +Default constructor + +@post This object is properly constructed. + +*/ +: iParser(NULL), + iCharSetConverter(NULL), + iStringDictionaryCollection(NULL) + { + + } + + + +void TParserImpl::OpenL(const CMatchData& aCriteria, MContentHandler& aCallback) +/** +This method opens and sets all the objects contents. +The StringDictionaryCollection is created and Opened. + +@pre The object has just been constructed and no other values have been set. +@post The objects members have been set to the values given. + +@param aCriteria Detailed criteria for parser resolution. +@param aCallback client to pass data to. + +*/ + { + Close(); + + if (!iCharSetConverter) + iCharSetConverter = CCharSetConverter::NewL(); + + if (!iStringDictionaryCollection) + { + iStringDictionaryCollection = new(ELeave) RStringDictionaryCollection(); + iStringDictionaryCollection->OpenL(); + } + + //verify mime type + if (aCriteria.MimeType() != KNullDesC8) + { + // Create and remember the current mime type + iCurrentParserMatchData = aCriteria; + } + else + User::Leave(KErrArgument); + + iDefParserMatchData = aCriteria; + iParser = ConstructParserL(aCriteria, aCallback); + iClient = &aCallback; + } + + +void TParserImpl::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +The framework will Close the StringDictionaryCollection and if owned will +delete it. + +@post This object may be allowed to go out of scope. + +*/ + { + // Close any remaining RStrings owned by iElementStack. This will prevent a + // memory leak from occuring when parsing a document that is not complete AND + // ParseEndL is NOT called before destroying the CParser object. + for (TInt i=0;iRelease(); + iParser = NULL; + } + + delete iCharSetConverter; + iCharSetConverter = NULL; + + if (iStringDictionaryCollection) + { + iStringDictionaryCollection->Close(); + delete iStringDictionaryCollection; + iStringDictionaryCollection = NULL; + } + + iClient = NULL; + + REComSession::FinalClose(); + } + + +void TParserImpl::ParseChunkL(const TDesC8& aChunk) +/** +This method starts the parser parsing a descriptor. +The descriptor does not contain the last part of the document. + +@pre OpenL has been called + +@param aChunk the chunk to parse - not the last chunk + +*/ + { + iParser->ParseChunkL(aChunk); + } + + +void TParserImpl::ParseLastChunkL(const TDesC8& aFinalChunk) +/** +This method starts the parser parsing a descriptor. +The descriptor contains the last part of the document. + +@pre OpenL has been called + +@param aFinalChunk the final chunk to parse + +*/ + { + iParser->ParseLastChunkL(aFinalChunk); + } + + +void TParserImpl::SetContentHandler(MContentHandler& aCallback) +/** +Allows the user to set/change the client for this parse session. + +@pre OpenL has been called + +@param aCallback the client at the end of the callback + chain that is to receive the parsed document information. + +*/ + { + iClient = &aCallback; + + MContentSource* prev; + if (iDtorKeyAndPluginList.Count()) + { + // set the last plugin to point to the client + prev = iDtorKeyAndPluginList[iDtorKeyAndPluginList.Count()-1]->iContentProcessor; + } + else + { + // set the parser to point to the client as there is no chain + prev = iParser; + } + prev->SetContentSink(*iClient); + } + + + +void TParserImpl::SetProcessorChainL(const RContentProcessorUids& aPlugins) +/** +Allows the user to change the client and set the plugin chain for +this parse session. + +@pre OpenL has been called + +@param aCallback the client at the end of the callback + chain that is to receive the parsed document information. +@param aPlugins a list of plugin implementation uids that + make up the callback chain. + +*/ + { + // If there is an existing chain delete all but the parser + DestroyChain(); + + // Rebuild the chain. + MContentHandler* callback = BuildChainL(*iClient, aPlugins); + + iParser->SetContentSink(*callback); + } + + +void TParserImpl::ResetMimeTypeL() + { + + if ( !(iCurrentParserMatchData == iDefParserMatchData) ) + { + SetMimeTypeL(iDefParserMatchData); + } + } + + +void TParserImpl::SetMimeTypeL(const CMatchData& aCriteria) +/** +Allows the user to set/change the parser mime type used for +this parse session. + +@pre OpenL has been called + +@param aParserMimeType the mime type of the requested parser + +*/ + { + // Check if we are already using this parser + if (aCriteria == iCurrentParserMatchData) + { + // There is no change to the parser. + return; + } + + // Delete the Parser + if (iParser) + { + REComSession::DestroyedImplementation(iParserDtorKey); + iParser->Release(); + iParser = NULL; + } + + MContentHandler* next; + if (iDtorKeyAndPluginList.Count()) + { + // point the parser to the first plugin in the chain + next = iDtorKeyAndPluginList[0]->iContentProcessor; + } + else + { + // point the parser to the client as there is no chain + next = iClient; + } + // Create the new parser and point to the next plugin + iParser = ConstructParserL(aCriteria, *next); + + // Remember what parser we are using. + iCurrentParserMatchData = aCriteria; + } + + +TInt TParserImpl::EnableFeature(TInt aParserFeature) + { + __ASSERT_ALWAYS(iParser, Panic(EXmlFrameworkPanicUnexpectedLogic)); + + return iParser->EnableFeature(aParserFeature); + } + +TInt TParserImpl::DisableFeature(TInt aParserFeature) + { + __ASSERT_ALWAYS(iParser, Panic(EXmlFrameworkPanicUnexpectedLogic)); + + return iParser->DisableFeature(aParserFeature); + } + +TBool TParserImpl::IsFeatureEnabled(TInt aParserFeature) const + { + __ASSERT_ALWAYS(iParser, Panic(EXmlFrameworkPanicUnexpectedLogic)); + + return iParser->IsFeatureEnabled(aParserFeature); + } + + +void TParserImpl::AddPreloadedDictionaryL(const TDesC8& aPublicId) + { + iStringDictionaryCollection->OpenDictionaryL(aPublicId); + } + + +RStringPool& TParserImpl::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + +RStringDictionaryCollection& TParserImpl::StringDictionaryCollection() + { + return *iStringDictionaryCollection; + } + + +MContentHandler* TParserImpl::BuildChainL(MContentHandler& aCallback, + const RContentProcessorUids& aPlugins) +/** +This method builds the chain of plugins, so that information may flow down +the chain. + +The first in the chain is the parser, the last is the client. + +@param aCallback client to pass data to. +@param aPlugins the list of plugins in the chain. + +@return the first plugin in the chain. If there is no chain + the client is returned. + +*/ + { + // Start with the last plugin first and point it to the callback passed. + // Then work you way up the chain, ending with the Parser calling the first plugin. + + TInt count = aPlugins.Count(); + MContentHandler* callback = &aCallback; + + while (count>0) + { + callback = ConstructPluginInReverseL(aPlugins[--count], *callback); + } + + return (callback); + } + + + +void TParserImpl::DestroyChain() +/** + +Destroys the client and the chain of plugins not including the parser. + +@post The chain and client are destroyed and parsing + cannot take place. +*/ + { + TInt count = iDtorKeyAndPluginList.Count(); + while (count) + { + DestroyContentProcessorPtrMapping(iDtorKeyAndPluginList[--count]); + } + iDtorKeyAndPluginList.Reset(); + } + + +MParser* TParserImpl::ConstructParserL(const CMatchData& aCriteria, + MContentHandler& aCallback) +/** +This method constructs a MParser derived object. + +@return A pointer to the parser found. +@leave KErrXmlParserPluginNotFound If ECom fails to find + the object a leave occurs. +@leave KErrArgument If CMatchData is lacking mandatory mime type field. + +@param aCriteria Detailed criteria for parser resolution. +@param aCallback client to pass data to. + +*/ + { + TInt err; + HBufC8* stream = NULL; + + // Check entry criteria + if (aCriteria.MimeType() == KNullDesC8) + { + User::Leave(KErrArgument); + } + + // Set resolving parameters to find a plug-in with a matching parser + TEComResolverParams resolverParams; + resolverParams.SetWildcardMatch(ETrue); + stream = aCriteria.PackToBufferL(); + CleanupStack::PushL(stream); + resolverParams.SetDataType(*stream); + + // Package up the parameters to pass + TParserInitParams initParams; + initParams.iCharSetConverter = iCharSetConverter; + initParams.iContentHandler = &aCallback; + initParams.iStringDictionaryCollection = iStringDictionaryCollection; + initParams.iElementStack = &iElementStack; + + // do this for now until I work out what to do with the other params + TAny* any = NULL; + TRAP(err, any = REComSession::CreateImplementationL(KParserInterfaceUid, + iParserDtorKey, + (TAny*)&initParams, + resolverParams, + KCustomResolverUid)); + CleanupStack::PopAndDestroy(stream); + if (err != KErrNone) + { + if (err == KErrNotFound) + { + User::Leave(KErrXmlParserPluginNotFound); + } + User::Leave(err); + } + + MParser* object = static_cast(any); + return object; + } + +MContentProcessor* TParserImpl::ConstructPluginInReverseL(const TUid& aImplementationUid, + MContentHandler& aCallback) +/** +This method constructs a CContentProcessor and places it in reverse order in the chain. + +@return A pointer to the plugin found. +@leave KErrXmlPluginNotFound If ECom fails to find + the object a leave occurs. + +@param aImplementationUid The implementation uid of the plugin. +@param aCallback client to pass data to. + +*/ + { + TDtorContentProcessorPtrMapping* mapping = new(ELeave) TDtorContentProcessorPtrMapping; + mapping->iDtorKey = KNullUid; + mapping->iContentProcessor = NULL; + + CleanupStack::PushL(TCleanupItem(DestroyContentProcessorPtrMapping, mapping)); + + // Package up the parameters to pass + TContentProcessorInitParams initParams; + initParams.iContentHandler = &aCallback; + initParams.iStringDictionaryCollection = iStringDictionaryCollection; + initParams.iElementStack = &iElementStack; + + // Client knows specific implementation. + // Pass the callback object of the next thing in the chain. + TAny* any = NULL; + + TRAPD(err, any = REComSession::CreateImplementationL(aImplementationUid, + mapping->iDtorKey, + &initParams)); + + if (err != KErrNone) + { + if (err == KErrNotFound) + { + User::Leave(KErrXmlPluginNotFound); + } + + User::Leave(err); + } + + mapping->iContentProcessor = static_cast(any); + + // We insert at the start as we are building the chain backwards, last till first. + User::LeaveIfError(iDtorKeyAndPluginList.Insert(mapping, 0)); + + CleanupStack::Pop(mapping); + return (mapping->iContentProcessor); + } + + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/parserimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/parserimpl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,110 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __PARSERIMPL_H__ +#define __PARSERIMPL_H__ + +#include // needed for the typedef +#include // needed for the typedef +#include + +class RFs; + +namespace Xml +{ +class MContentHandler; +class MContentProcessor; +class MParser; +class CCharSetConverter; +class RStringDictionaryCollection; + + +class TParserImpl +/** The TParserImpl class hides the implementation of the CParser. +It is responsible for building and maintaining the list of plugins +in the parsing chain, and has ownership of several key objects within +the framework. */ + { +public: + + TParserImpl(); + + void OpenL(const CMatchData& aMatchData, MContentHandler& aCallback); + void Close(); + + + void ParseFileL(RFs& aFs, const TDesC& aFilename); + + void ParseChunkL(const TDesC8& aChunk); + void ParseLastChunkL(const TDesC8& aFinalChunk); + + void SetContentHandler(MContentHandler& aCallback); + void SetProcessorChainL(const RContentProcessorUids& aPlugins); + void SetMimeTypeL(const CMatchData& aCriteria); + void ResetMimeTypeL(); + + TInt EnableFeature(TInt aParserFeature); + TInt DisableFeature(TInt aParserFeature); + TBool IsFeatureEnabled(TInt aParserFeature) const; + + void AddPreloadedDictionaryL(const TDesC8& aPublicId); + + RStringPool& StringPool(); + RStringDictionaryCollection& StringDictionaryCollection(); + +private: + + TParserImpl(const TParserImpl& aOriginal); + TParserImpl& operator=(const TParserImpl& aRhs); + + MContentHandler* BuildChainL(MContentHandler& aCallback, + const RContentProcessorUids& aPlugins); + + void DestroyChain(); + + MParser* ConstructParserL(const CMatchData& aMatchData, MContentHandler& aCallback); + + MContentProcessor* ConstructPluginInReverseL(const TUid& aImplementationUid, + MContentHandler& aCallback); + +private: + + /** The common element stack for this collection of plugins. */ + RElementStack iElementStack; + + struct TDtorContentProcessorPtrMapping + { + TUid iDtorKey; + MContentProcessor* iContentProcessor; + }; + + static void DestroyContentProcessorPtrMapping(TAny* aPtr); + + /** The collection of MContentProcessor pointers and Dtor keys that make up the chain of command. + The chain order is determined by the the index, 0 being the first plugin in the chain. */ + RPointerArray iDtorKeyAndPluginList; + + TUid iParserDtorKey; + MParser* iParser; + CCharSetConverter* iCharSetConverter; + RStringDictionaryCollection* iStringDictionaryCollection; + MContentHandler* iClient; + CMatchData iDefParserMatchData; + CMatchData iCurrentParserMatchData; + }; + +} + +#endif //__PARSERIMPL_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/stringdictionarycollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/stringdictionarycollection.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,127 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +#include + +#include "stringdictionarycollectionimpl.h" + +using namespace Xml; + +EXPORT_C RStringDictionaryCollection::RStringDictionaryCollection() +/** +Default constructor + +@post This object is properly constructed. + +*/ +: iImpl(NULL) + { + // do nothing; + } + + + +void RStringDictionaryCollection::CreateImplL() +/** +Create the implementation object. + +@pre The object has just been constructed but not opened. +@post The object is fully constructed and ready to be used. + +*/ + { + if (!iImpl) + { + iImpl = new (ELeave) RStringDictionaryCollectionImpl; + } + } + + + +EXPORT_C void RStringDictionaryCollection::OpenL() +/** +This method opens this resource incrementing the reference count. +It must be the first method called after construction. + +@post The object is ready to be used. + +*/ + { + CreateImplL(); + iImpl->OpenL(); + } + + +EXPORT_C void RStringDictionaryCollection::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +@post This object may be allowed to go out of scope. + +*/ + { + if (iImpl) + { + if (iImpl->Close() == 0) + { + delete iImpl; + iImpl = NULL; + } + } + } + + +EXPORT_C void RStringDictionaryCollection::OpenDictionaryL(const TDesC8& aDictionaryDescription) +/** +This method loads the Dictionary. + +@pre Connect has been called. +@post The Dictionary has been loaded. + +@param aDictionaryDescription The Namepspace MIME type. +*/ + { + iImpl->OpenDictionaryL(aDictionaryDescription); + } + + + +EXPORT_C RStringPool& RStringDictionaryCollection::StringPool() +/** +This method obtains a handle to the RStringPool + +@return the RStringPool + +*/ + { + return iImpl->StringPool(); + } + + +EXPORT_C MStringDictionary& RStringDictionaryCollection::CurrentDictionaryL() const +/** +This method obtains the current string dictionary in use. +Also, serves as a way to test if any dictionaries have been loaded as none needs be. + +@return the current Dictionary in use, if any. +@leave KErrXmlMissingStringDictionary if there is no dictionary + +*/ + { + return iImpl->CurrentDictionaryL(); + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/stringdictionarycollectionimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/stringdictionarycollectionimpl.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,259 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include +#include "XmlFrameworkPanics.h" +#include + +#include "stringdictionarycollectionimpl.h" + +using namespace Xml; + +void RStringDictionaryCollectionImpl::DestroyMapping(TAny* aPtr) +/** +Tidy memory associated with this object. + +@param aPtr The StringDictionary pointer. + +*/ + { + TDtorMapping* ptr = static_cast(aPtr); + + if (ptr->iDtorKey != KNullUid && ptr->iStringDictionary) + { + // Tell ECom to destroy its plugin details + REComSession::DestroyedImplementation(ptr->iDtorKey); + + // Free memory + ptr->iStringDictionary->Release(); + } + + delete (ptr); + } + + + +RStringDictionaryCollectionImpl::RStringDictionaryCollectionImpl() +/** +Default constructor + +@post This object is properly constructed. + +*/ +: iRefCount(0), + iStringDictionary(NULL) + { + // do nothing; + } + + + +void RStringDictionaryCollectionImpl::OpenL() +/** +This method opens this resource incrementing the reference count. +It must be the first method called after construction. + +@post The object is ready to be used. + +*/ + { + ++iRefCount; + + if (iRefCount == 1) + { + // Need to inc before just in case the Open leaves. + // In this case a subsequent Close will panic if the count is dec below zero. + iStringPool.OpenL(); + } + } + + +TInt RStringDictionaryCollectionImpl::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +@post This object may be allowed to go out of scope. + +*/ + { + if (iRefCount==1) + { + TInt count = iDtorKeyAndDictionaryList.Count(); + + while (count) + { + DestroyMapping(iDtorKeyAndDictionaryList[--count]); + } + + iDtorKeyAndDictionaryList.Reset(); + + iStringPool.Close(); + + REComSession::FinalClose(); + } + + --iRefCount; + __ASSERT_ALWAYS(iRefCount >= 0, Panic(EXmlFrameworkPanicReferenceCountNegative)); + + return iRefCount; + } + + +void RStringDictionaryCollectionImpl::OpenDictionaryL(const TDesC8& aDictionaryDescription) +/** +This method loads the Dictionary. + +@pre Connect has been called. +@post The Dictionary has been loaded. + +@param aDictionaryDescription The Namepspace MIME type. +*/ + { + if (aDictionaryDescription.Size() == 0) + { + // No Mime type provided. + // Dictionary not required. + iStringDictionary = NULL; + return; + } + + // Implies a Dictionary exists + + RString nsUri = iStringPool.OpenStringL(aDictionaryDescription); + CleanupClosePushL(nsUri); + + if (LocateDictionary(nsUri, iStringDictionary) == EFalse) + { + // Locate the plugin + iStringDictionary = ConstructDictionaryL(aDictionaryDescription, iStringPool); + } + + CleanupStack::PopAndDestroy(&nsUri); + } + + + +TBool RStringDictionaryCollectionImpl::LocateDictionary(const RString& aNsUri, MStringDictionary*& aStringDictionary) +/** +This method locates an existing loaded Dictionary by it uri name. + +@return EFalse if the Dictionary cannot be located, ETrue if it has. + +@param aNsUri The Dictionary uri. +@param aStringDictionary On return, points to the requested Dictionary. +*/ + { + TBool found = EFalse; + TUint count = iDtorKeyAndDictionaryList.Count(); + + while (!found && count>0) + { + // Check if its been loaded already + if (iDtorKeyAndDictionaryList[--count]->iStringDictionary->CompareThisDictionary(aNsUri)) + { + aStringDictionary = iDtorKeyAndDictionaryList[count]->iStringDictionary; + found = ETrue; + } + } + return found; + } + + + +RStringPool& RStringDictionaryCollectionImpl::StringPool() +/** +This method obtains a handle to the RStringPool + +@return the RStringPool + +*/ + { + return iStringPool; + } + + +MStringDictionary& RStringDictionaryCollectionImpl::CurrentDictionaryL() const +/** +This method obtains the current string dictionary in use. +Also, serves as a way to test if any dictionaries have been loaded as none needs be. + +@return the current Dictionary in use, if any. +@leave KErrXmlMissingStringDictionary if there is no dictionary + +*/ + { + if (!iStringDictionary) + { + User::Leave(KErrXmlMissingStringDictionary); + } + + return *iStringDictionary; + } + + + +MStringDictionary* RStringDictionaryCollectionImpl::ConstructDictionaryL(const TDesC8& aDictionaryUri, + RStringPool& aStringPool) +/** +This method constructs a StringDictionary. + +@return A pointer to the String Dictionary plugin found. +@leave KErrXmlDictionaryPluginNotFound If ECom fails to find + the object a leave occurs. + +@param aDictionaryUri The uri of this Dictionary. +@param aStringPool Contains the RTable for this Dictionary +*/ + { + TDtorMapping* mapping = new(ELeave) TDtorMapping; + mapping->iDtorKey = KNullUid; + mapping->iStringDictionary = NULL; + + CleanupStack::PushL(TCleanupItem(DestroyMapping, mapping)); + + // Set resolving parameters to find a plug-in with a matching Dictionary URI + TEComResolverParams resolverParams; + resolverParams.SetDataType(aDictionaryUri); + resolverParams.SetWildcardMatch(ETrue); + + TAny* any = NULL; + TRAPD(err, any = REComSession::CreateImplementationL(KStringDictionaryInterfaceUid, + mapping->iDtorKey, + &aStringPool, + resolverParams)); + + if (err != KErrNone) + { + if (err == KErrNotFound) + { + User::Leave(KErrXmlStringDictionaryPluginNotFound); + } + + User::Leave(err); + } + + mapping->iStringDictionary = static_cast(any); + + User::LeaveIfError(iDtorKeyAndDictionaryList.Append(mapping)); + + CleanupStack::Pop(mapping); + return (mapping->iStringDictionary); + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/stringdictionarycollectionimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/stringdictionarycollectionimpl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,92 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __STRINGDICTIONARYCOLLECTIONIMPL_H__ +#define __STRINGDICTIONARYCOLLECTIONIMPL_H__ + +#include + +namespace Xml +{ + +class MStringDictionary; + +class RStringDictionaryCollectionImpl +/** +The RStringDictionaryCollectionImpl class hides the implementation of the +RStringDictionaryCollection. + +It is responsible for maintaining the list of string dictionary plugins +required by the framework. + +@internalTechnology +@released +*/ + { +public: + void OpenL(); + TInt Close(); + + RStringDictionaryCollectionImpl(); + + void OpenDictionaryL(const TDesC8& aDictionaryDescription); + + RStringPool& StringPool(); + + MStringDictionary& CurrentDictionaryL() const; + +private: + + RStringDictionaryCollectionImpl(const RStringDictionaryCollectionImpl& aOriginal); + RStringDictionaryCollectionImpl& operator=(const RStringDictionaryCollectionImpl& aRhs); + + TBool LocateDictionary(const RString& aNsUri, MStringDictionary*& aStringDictionary); + MStringDictionary* ConstructDictionaryL(const TDesC8& aDictionaryUri, + RStringPool& aStringPool); + +private: + + struct TDtorMapping + { + TUid iDtorKey; + MStringDictionary* iStringDictionary; + }; + + RPointerArray iDtorKeyAndDictionaryList; + + static void DestroyMapping(TAny* aPtr); + + +/** +The reference count for this collection. +*/ + TInt iRefCount; + +/** +The StringPool for the Collection. +*/ + RStringPool iStringPool; + +/** +The current Dictionary in use. +We do not own this; for quick access only. +*/ + MStringDictionary* iStringDictionary; + + }; + +} + +#endif //__STRINGDICTIONARYCOLLECTIONIMPL_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/taginfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/taginfo.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,124 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +using namespace Xml; + +EXPORT_C RTagInfo::RTagInfo() +/** +Default constructor + +Only Parsers have this access. +@see CParser + +*/ + { + // do nothing; + } + + +EXPORT_C RTagInfo RTagInfo::Copy() +/** +Copy method. The original and copy must be closed seperately. + +Only Parsers have this access. +@see CParser + +*/ + { + RTagInfo copy; + copy.Open(iUri.Copy(), iPrefix.Copy(), iLocalName.Copy()); + return copy; + } + + +EXPORT_C void RTagInfo::Close() +/** +This method cleans up the object before destruction. It releases all resources in +accordance to the R Class pattern. + +@post This object may be allowed to go out of scope. + +Only Parsers have this access. +@see CParser + +*/ + { + iUri.Close(); + iPrefix.Close(); + iLocalName.Close(); + } + + + +EXPORT_C void RTagInfo::Open(const RString& aUri, const RString& aPrefix, const RString& aLocalName) +/** +This method sets the object's contents, taking ownership of the RStrings. + +@post The objects members have been set to the values given. + +@param aUri the uri of the object. +@param aPrefix the prefix of the object. +@param aLocalName the localName of the object. + +Only Parsers have this access. +@see CParser + +*/ + { + iUri = aUri; + iPrefix = aPrefix; + iLocalName = aLocalName; + } + + + +EXPORT_C const RString& RTagInfo::Uri() const +/** +This method obtains the uri member of this object. + +@return the uri member. + +*/ + { + return iUri; + } + + + +EXPORT_C const RString& RTagInfo::LocalName() const +/** +This method obtains the LocalName member of this object. + +@return the LocalName member. + +*/ + { + return iLocalName; + } + + + +EXPORT_C const RString& RTagInfo::Prefix() const +/** +This method obtains the Prefix member of this object. + +@return the Prefix member. + +*/ + { + return iPrefix; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/xmlframeworkerrors.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/xmlframeworkerrors.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include "XmlFrameworkPanics.h" + +// Panic message + +_LIT(KErrorMsg, "XML"); + + +void Xml::Panic(TXmlFrameworkPanic aError) +/** +This method panics the code. + +@param aError the error code. +*/ + { + User::Panic(KErrorMsg, aError); + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframework/xmlframeworkmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframework/xmlframeworkmain.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframeworkerrors/xmlframeworkerr.ra --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframeworkerrors/xmlframeworkerr.ra Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,53 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +RESOURCE ARRAY r_error_res_framework_errors + { + items= + { + SINGLE_ERROR + { + text=r_framework_error_unexpectedleaveCode; + }, + SINGLE_ERROR + { + text=r_framework_error_unexpectedstate; + }, + SINGLE_ERROR + { + text=r_framework_error_unexpectedlogic; + }, + SINGLE_ERROR + { + text=r_framework_error_positionmisallignment; + }, + SINGLE_ERROR + { + text=r_framework_error_referencecountnegative; + }, + SINGLE_ERROR + { + text=r_framework_error_nullpointer; + } + }; + } + +// Errors -5000 to -5004 +RESOURCE TBUF r_framework_error_unexpectedleaveCode{ buf="A leave code other than that expected was received."; } +RESOURCE TBUF r_framework_error_unexpectedstate{ buf="A state other than that expected was reached."; } +RESOURCE TBUF r_framework_error_unexpectedlogic{ buf="Logic other than that expected was reached."; } +RESOURCE TBUF r_framework_error_positionmisallignment{ buf="The internal document positioning has gone beyond EOF and has failed."; } +RESOURCE TBUF r_framework_error_referencecountnegative{ buf="A reference count has reached a negative value."; } +RESOURCE TBUF r_framework_error_nullpointer{ buf="The pointer is NULL. It can not be dereferenced."; } diff -r 000000000000 -r e35f40988205 xml/xmlfw/src/xmlframeworkerrors/xmlframeworkerr.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/src/xmlframeworkerrors/xmlframeworkerr.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Framework Error Resource +// Pairs to xmlframeworkerrors.mmp. +// +// + +NAME MFER + +#include + +RESOURCE RSS_SIGNATURE { } + +RESOURCE ERROR_SET r_error_res_framework + { + errorarrays= + { + ERROR_ARRAY + { + startError=0; + errors=r_error_res_framework_errors; + } + }; + } + +#include "xmlframeworkerr.ra" diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/101FAA0F.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/101FAA0F.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the XmlFramework Test Validator +// pairs to t_validator.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO validatorInfo + { + dll_uid = 0x101FAA0F; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA10; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FAA11; + version_no = 1; + display_name = "XmlFramework Test Validator."; + default_data = "Test Validator"; + opaque_data = ""; + } + }; + } + }; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/101FADCD.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/101FADCD.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the XmlFramework Test Parser +// pairs to t_parser.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO parserInfo + { + dll_uid = 0x101FADCD; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FBE53; + version_no = 1; + display_name = "XmlFramework Test Parser"; + default_data = "text/testparser"; + opaque_data = ""; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/101FCABF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/101FCABF.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the XmlFramework Test StringDictionary CodePage 00 +// pairs to t_stringdictionary00.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO StringDictionary00Info + { + dll_uid = 0x101FCABF; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FA94F; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FD172; + version_no = 1; + display_name = "XmlFramework Test StringDictionary CodePage 0"; + default_data = "FD1~0||TestStringDictionary:TestStringDictionary1.1||-//TestStringDictionary//DTD TestStringDictionary 1.1//EN~0"; + opaque_data = ""; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/10273863.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/10273863.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the XmlFramework Test Plugin parser +// Pairs to t_testxmlparserplugin1.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO validatorInfo + { + dll_uid = 0x10273863; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273864; + version_no = 2; + display_name = "XML Test1 Parser. Doesn’t provide any functionality"; + default_data = "text/xml||text/wbxml"; + opaque_data = "SymbianExtended"; + }, + + IMPLEMENTATION_INFO + { + // Uid should be less than 0x101FAA0C (Symbian-Provided XML Parser) to cause the defect condition + implementation_uid = 0x101F9782; + version_no = 1; + // Masquarading XML Test1 Parser in the dll + display_name = "XML DefectTest Parser. Doesn’t provide any functionality"; + default_data = "text/xml"; + // opaque_data should be something that is NOT "Symbian" + opaque_data = "OtherPluginProvider"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x101faa00; + version_no = 1; + // Masquarading XML Test1 Parser in the dll + display_name = "Unique Parser"; + // Should be a unique mime type + default_data = "text/unique"; + // opaque_data should be something that is NOT "Symbian" + opaque_data = "OtherPluginProvider"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x101faa01; + version_no = 1; + // Masquarading XML Test1 Parser in the dll + display_name = "Same mime Parser"; + default_data = "text/same"; + // opaque_data should be something that is NOT "Symbian" + opaque_data = "AnOtherProvider"; + } }; + } + }; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/10273865.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/10273865.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Registry file for the XmlFramework Test Plugin parser +// Pairs to t_testxmlparserplugin2.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO validatorInfo + { + dll_uid = 0x10273865; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273866; + version_no = 3; + display_name = "XML Test2 Parser. Doesn’t provide any functionality"; + default_data = "text/xml"; + opaque_data = "SymbianExtended||AdditionalFeatureString"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x101faa02; + version_no = 1; + // Masquarading XML Test1 Parser in the dll + display_name = "My Same mime Parser"; + default_data = "text/same"; + // opaque_data should be something that is NOT "Symbian" + opaque_data = "YetAnotherOne"; + } + }; + } + }; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/10273868.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/10273868.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,99 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Unit test resource inforamtion +// Pairs to tu_xmlramparserplugins.mmp +// +// + +#include + +RESOURCE REGISTRY_INFO validatorInfo + { + dll_uid = 0x10273868; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10273867; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273870; + version_no = 1; + display_name = "Xml Test Parser 1"; + default_data = "text/xml"; + opaque_data = "Symbian"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273871; + version_no = 1; + display_name = "Xml Test Parser 2"; + default_data = "text/wbxml||text/xml"; + opaque_data = "Symbian Advanced"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273872; + version_no = 1; + display_name = "Xml Test Parser 3"; + default_data = "text/xml"; + opaque_data = "External"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273873; + version_no = 1; + display_name = "Xml Test Parser 4"; + default_data = "text/wbxml"; + opaque_data = "Symbian"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273874; + version_no = 1; + display_name = "Xml Test Parser 5"; + default_data = "text/xml||text/wbxml"; + opaque_data = "External||External V1"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x60000000; + version_no = 1; + display_name = "Xml Test Parser Large positive Uid"; + default_data = "MyText/MyXml"; + opaque_data = "symbian"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x8FFFFFFF; + version_no = 1; + display_name = "Xml Test Parser Large negative Uid"; + default_data = "MyText/MyXml"; + opaque_data = "symbian"; + } + }; + } + }; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/10273869.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/10273869.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,81 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Unit test resource inforamtion +// Pairs to tu_xmlromparserplugins.mmp. +// +// + +#include + +RESOURCE REGISTRY_INFO validatorInfo + { + dll_uid = 0x10273869; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10273867; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273875; + version_no = 1; + display_name = "Xml Test Parser 6"; + default_data = "text/xml"; + opaque_data = "Symbian"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273876; + version_no = 1; + display_name = "Xml Test Parser 7"; + default_data = "text/wbxml||text/xml"; + opaque_data = "Symbian Advanced"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273877; + version_no = 1; + display_name = "Xml Test Parser 8"; + default_data = "text/xml"; + opaque_data = "External"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273878; + version_no = 1; + display_name = "Xml Test Parser 9"; + default_data = "text/wbxml"; + opaque_data = "External"; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x10273879; + version_no = 1; + display_name = "Xml Test Parser 10"; + default_data = "text/xml||text/wbxml"; + opaque_data = "External||External V1"; + } + }; + } + }; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/data/simple.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/data/simple.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ + + + + + + + + + + <character data> + + "more character data" + Hello, world!]]> + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_parser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_parser.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,43 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_parser.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x101FADCD +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_parser.cpp + +SOURCEPATH ../data +START RESOURCE 101FADCD.rss +TARGET t_parser.rsc +END + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_parserucs4test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_parserucs4test.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_parserucs4test.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_parserucs4test.cpp + +SOURCEPATH ../../../src/xmlframework +SOURCE charsetconverter.cpp + +LIBRARY charconv.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_processfilemancopyfile.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_processfilemancopyfile.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +// renamed the output file to remove conflict with ECOM's version of the same utility +TARGET t_xmlprocessfilemancopyfile.exe +// needed to access file system +CAPABILITY TCB AllFiles +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../tsrc +SOURCE t_processfilemancopyfile.cpp + +LIBRARY euser.lib efsrv.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_stringdictionary00.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_stringdictionary00.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_stringdictionary00.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x101FCABF +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE +/build/generated/xml +USERINCLUDE ../../../inc + +SOURCEPATH +/build/generated/xml +SOURCE t_stringdictionary00tagtable.cpp + +SOURCEPATH ../tsrc +SOURCE t_stringdictionary00.cpp + +SOURCEPATH ../data +START RESOURCE 101FCABF.rss +TARGET t_stringdictionary00.rsc +END + +LIBRARY bafl.lib +LIBRARY euser.lib // for RStringPool +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_testxmlparserplugin1.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_testxmlparserplugin1.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_testxmlparserplugin1.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x10273863 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_testxmlparser1.cpp + +SOURCEPATH ../data +START RESOURCE 10273863.rss +TARGET t_testxmlparserplugin1.rsc +END + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_testxmlparserplugin2.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_testxmlparserplugin2.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_testxmlparserplugin2.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x10273865 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_testxmlparser2.cpp + +SOURCEPATH ../data +START RESOURCE 10273865.rss +TARGET t_testxmlparserplugin2.rsc +END + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_validator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_validator.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_validator.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x101FAA0F +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_validator.cpp + +SOURCEPATH ../data +START RESOURCE 101FAA0F.rss +TARGET t_validator.rsc +END + +LIBRARY euser.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_xmlcore.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_xmlcore.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_xmlcore.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE t_xmlcore.cpp + +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/t_xmlmisc.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/t_xmlmisc.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET t_xmlmisc.exe +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE +/build/generated/xml +USERINCLUDE ../../../inc + +SOURCEPATH ../../../src/xmlframework +SOURCE charsetconverter.cpp // as the NewL is not exported. Newed by Framework only. + +SOURCEPATH ../tsrc +SOURCE t_componenttests.cpp + +SOURCEPATH +/build/generated/xml +SOURCE t_stringdictionary00tagtable.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY xmlframework.lib +LIBRARY charconv.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/tc_xmlcustomresolvercomptests.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/tc_xmlcustomresolvercomptests.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET tc_xmlcustomresolvercomptests.exe +CAPABILITY None +TARGETTYPE exe + +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE tc_customresolvercomptests.cpp +SOURCE contenthandlers.cpp + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY xmlframework.lib +LIBRARY bafl.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/tp_xmlframeworkperftests.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/tp_xmlframeworkperftests.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,38 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// XML API Performance tests +// +// + +TARGET tp_xmlframeworkperftests.exe +CAPABILITY None +TARGETTYPE exe + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc + +SOURCEPATH ../tsrc +SOURCE tp_frameworkperftests.cpp +SOURCE tp_perftestbase.cpp +SOURCE contenthandlers.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY hal.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/tu_xmlcmatchdataunittests.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/tu_xmlcmatchdataunittests.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// CMatchData unit tests. +// +// + +TARGET tu_xmlcmatchdataunittests.exe +CAPABILITY None +TARGETTYPE exe + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../../inc + +SOURCEPATH ../../../src/xmlframework +SOURCE matchdata.cpp + +SOURCEPATH ../tsrc +SOURCE tu_cmatchdataunittests.cpp + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY efsrv.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/tu_xmlramparserplugins.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/tu_xmlramparserplugins.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET tu_xmlramparserplugins.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x10273868 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE tu_xmlramplugins.cpp + +SOURCEPATH ../data +START RESOURCE 10273868.rss +TARGET tu_xmlramparserplugins.rsc +END + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/tu_xmlromparserplugins.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/tu_xmlromparserplugins.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET tu_xmlromparserplugins.dll +CAPABILITY All -Tcb +TARGETTYPE plugin + +// ECom Plugin Dll UID followed by the unique UID for this dll +// Assigned to UID2 and UID3 respectively +UID 0x10009D8D 0x10273869 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../tsrc +USERINCLUDE ../../../inc + +SOURCEPATH ../tsrc +SOURCE tu_xmlromplugins.cpp + +SOURCEPATH ../data +START RESOURCE 10273869.rss +TARGET tu_xmlromparserplugins.rsc +END + +SOURCEPATH ../../../src/xmlframework +SOURCE xmlframeworkerrors.cpp + +LIBRARY euser.lib +LIBRARY xmlframework.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/xmlcustomresolvertests.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/xmlcustomresolvertests.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,28 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef XMLCUSTOMRESOLVERTESTS_IBY +#define XMLCUSTOMRESOLVERTESTS_IBY + +REM XML Parser Tests + +file=ABI_DIR\BUILD_DIR\tc_xmlcustomresolvercomptests.exe test\tc_xmlcustomresolvercomptests.exe + +data=ZSYSTEM\xmltest\resolver\simple.xml system\xmltest\resolver\simple.xml + +ECOM_PLUGIN(t_testxmlparserplugin1.dll,10273863.rsc) +ECOM_PLUGIN(t_testxmlparserplugin2.dll,10273865.rsc) + +#endif // XMLCUSTOMRESOLVERTESTS_IBY diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/xmlframeworktests.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/xmlframeworktests.bat Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,21 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +t_xmlcore.exe +t_xmlmisc.exe +tc_xmlcustomresolvercomptests.exe +tp_xmlframeworkperftests.exe +tu_xmlcmatchdataunittests.exe diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/group/xmlframeworktests.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/group/xmlframeworktests.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLFRAMEWORKTESTS_IBY__ +#define __XMLFRAMEWORKTESTS_IBY__ + +REM XML Framework Tests + +#include +#include +#include + +// batch file that runs all automatic Framework tests +data=ZSYSTEM\test\xmlframeworktests.bat test\xmlframeworktests.bat + +// Framework test exe +file=ABI_DIR\BUILD_DIR\t_xmlcore.exe test\t_xmlcore.exe + +// Framework components test exe +file=ABI_DIR\BUILD_DIR\t_xmlmisc.exe test\t_xmlmisc.exe + +// CMatchData unit test exe +file=ABI_DIR\BUILD_DIR\tu_xmlcmatchdataunittests.exe test\tu_xmlcmatchdataunittests.exe + +// API performance test exe +file=ABI_DIR\BUILD_DIR\tp_xmlframeworkperftests.exe test\tp_xmlframeworkperftests.exe + +// Access to file system helper exe +file=ABI_DIR\BUILD_DIR\t_xmlprocessfilemancopyfile.exe test\t_xmlprocessfilemancopyfile.exe + +file=ABI_DIR\BUILD_DIR\t_parserucs4test.exe test\t_parserucs4test.exe + + +// Z: to C: +data=EPOCROOT##epoc32\data\z\XmlRAMOnly\tu_xmlramparserplugins.dll XmlRAMOnly\tu_xmlramparserplugins.dll +data=EPOCROOT##epoc32\data\z\XmlRAMOnly\tu_xmlramparserplugins.rsc XmlRAMOnly\tu_xmlramparserplugins.rsc + +// Test plugin + +// Test resources +// +// Test Validator +ECOM_PLUGIN(t_validator.dll,101faa0f.rsc) + +// Test Parser +ECOM_PLUGIN(t_parser.dll,101fadcd.rsc) + +// Test String Dictionary +ECOM_PLUGIN(t_stringdictionary00.dll,101fcabf.rsc) + +// Unit test plugin pack - ROM only +ECOM_PLUGIN(tu_xmlromparserplugins.dll,10273869.rsc) + +#endif diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/contenthandlers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/contenthandlers.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,489 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include + +#include +#include +#include + +#include "contenthandlers.h" + +using namespace Xml; + +GLREF_D RTest test; + + +// +// TRebuildingContentHandler +// +TRebuildingContentHandler::TRebuildingContentHandler(RFile& aOut) + : iError(KErrNone), iOutFile(aOut) + { + } + +void TRebuildingContentHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + iOutFile.Write(_L8("\n")); + } + +void TRebuildingContentHandler::OnEndDocumentL(TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } + +void TRebuildingContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + const TDesC8& localPart8 = aElement.LocalName().DesC(); + const TDesC8& prefix8 = aElement.Prefix().DesC(); + + if(prefix8.Length()) + { + iOutFile.Write(_L8("<")); + iOutFile.Write(prefix8); + iOutFile.Write(_L8(":")); + iOutFile.Write(localPart8); + } + else + { + iOutFile.Write(_L8("<")); + iOutFile.Write(localPart8); + } + + TInt nAttributes = aAttributes.Count(); + for(TInt i=0; i")); + } + +void TRebuildingContentHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + const TDesC8& localPart8 = aElement.LocalName().DesC(); + const TDesC8& prefix8 = aElement.Prefix().DesC(); + + iOutFile.Write(_L8("")); + } + +void TRebuildingContentHandler::OnContentL(const TDesC8& aData8, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + _LIT8(K_gt8, ">"); + _LIT8(K_lt8, "<"); + _LIT8(K_amp8, "&"); + _LIT8(K_apos8, "'"); + _LIT8(K_quot8, """); + + TInt newLength = 0; + TInt length = aData8.Length(); + + TInt i; + for(i=0; i': + newLength += K_gt8().Length(); + break; + case '<': + newLength += K_lt8().Length(); + break; + case '&': + newLength += K_amp8().Length(); + break; + case '\"': + newLength += K_quot8().Length(); + break; + case '\'': + newLength += K_apos8().Length(); + break; + default: + newLength++; + } + + TPtr8 out = HBufC8::NewLC(newLength)->Des(); + + TChar c; + for(i=0; i': + out.Append(K_gt8); + break; + case '<': + out.Append(K_lt8); + break; + case '&': + out.Append(K_amp8); + break; + case '\"': + out.Append(K_quot8); + break; + case '\'': + out.Append(K_apos8); + break; + default: + out.Append(c); + } + + iOutFile.Write(out); + + CleanupStack::PopAndDestroy(); // out + } + +void TRebuildingContentHandler::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } + +void TRebuildingContentHandler::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } + +void TRebuildingContentHandler::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +void TRebuildingContentHandler::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) + { + } + +void TRebuildingContentHandler::OnProcessingInstructionL(const TDesC8& aTarget8, const TDesC8& aData8, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + + iOutFile.Write(_L8("\n")); + } + +void TRebuildingContentHandler::OnExtensionL(const RString& /*aData*/, TInt /*aToken*/, TInt /*aErrorCode*/) + { + // Meaningless in XML + _LIT(KUnsupportedFeature,"Illegal call to TRebuildingContentHandler::OnExtensionL - aborting\n"); + test.Panic(KErrNotSupported, KUnsupportedFeature); + } + +void TRebuildingContentHandler::OnError(TInt aError) + { + iError = aError; + test.Printf(_L("TRebuildingContentHandler::OnError - ERROR: code=%d - Aborting parsing process\n"), aError); + } + +TAny* TRebuildingContentHandler::GetExtendedInterface(const TInt32) + { + // do nothing. + return NULL; + } + +// +// TSimpleContentHandler +// +const TInt TSimpleContentHandler::KExpectedLeaveCode = 1234; + +TSimpleContentHandler::TSimpleContentHandler() + : iLeaveOnStartElement(EFalse), iNumElements(0), iNumSkippedEntities(0), iNumPrefixMappings(0), iNumPrefixUnmappings(0), + iError(KErrNone) + { + } + +void TSimpleContentHandler::OnStartDocumentL(const RDocumentParameters&, TInt) + { + //test.Printf(_L("\n")); + + iNumElements = 0; + iNumSkippedEntities = 0; + iNumPrefixMappings = 0; + iNumPrefixUnmappings = 0; + } + +void TSimpleContentHandler::OnEndDocumentL(TInt) + { + //test.Printf(_L("\n\n")); + + test(!iLeaveOnStartElement); + } + +void TSimpleContentHandler::OnStartElementL(const RTagInfo&, const RAttributeArray&, TInt) + { + // test.Printf(_L("\n")); + + if(iLeaveOnStartElement) + if(iNumElements++ == 0) + { + //test.Printf(_L("TSimpleContentHandler::OnStartElementL: Simulating Leave with code %d\n"), KExpectedLeaveCode); + User::Leave(KExpectedLeaveCode); + } + else + test(0); + + iNumElements++; + } + +void TSimpleContentHandler::OnEndElementL(const RTagInfo&, TInt) + { + // test.Printf(_L("\n")); + + test(!iLeaveOnStartElement); + } + +void TSimpleContentHandler::OnContentL(const TDesC8&, TInt) + { + // test.Printf(_L("\n")); + + test(!iLeaveOnStartElement); + } + +void TSimpleContentHandler::OnProcessingInstructionL(const TDesC8&, const TDesC8&, TInt) + { + // test.Printf(_L("\n")); + + test(!iLeaveOnStartElement || iNumElements==0); + } + +void TSimpleContentHandler::OnOutOfData() + { + _LIT(KUnexpectedOutOfData,"Unexpected call to TSimpleContentHandler::OnOutOfData - aborting\n"); + test.Panic(KErrAbort, KUnexpectedOutOfData); + } + +void TSimpleContentHandler::OnError(TInt aError) + { + iError = aError; + //test.Printf(_L("TSimpleContentHandler::OnError - ERROR: code=%d\n"), aError); + } + +TAny* TSimpleContentHandler::GetExtendedInterface(const TInt32) + { + // do nothing. + return NULL; + } + +void TSimpleContentHandler::OnStartPrefixMappingL(const RString&, const RString&, TInt) + { + iNumPrefixMappings++; + } + +void TSimpleContentHandler::OnEndPrefixMappingL(const RString&, TInt) + { + test(!iLeaveOnStartElement); + iNumPrefixUnmappings++; + } + +void TSimpleContentHandler::OnIgnorableWhiteSpaceL(const TDesC8&, TInt) + { + } + +void TSimpleContentHandler::OnSkippedEntityL(const RString&, TInt) + { + iNumSkippedEntities++; + } + +void TSimpleContentHandler::OnExtensionL(const RString&, TInt, TInt) + { + // Meaningless in XML + _LIT(KUnsupportedFeature,"Illegal call to TSimpleContentHandler::OnExtensionL - aborting\n"); + test.Panic(KErrNotSupported, KUnsupportedFeature); + } + + +// +// TNamespaceContentHandler +// +TNamespaceContentHandler::TNamespaceContentHandler(const TDesC8& aDefaultUri, const TDesC8& aElementPrefix, + const TDesC8& aElementUri, const TDesC8& aAttributePrefix, const TDesC8& aAttributeUri) + : TSimpleContentHandler(), iDefaultUri(aDefaultUri), iElementPrefix(aElementPrefix), iElementUri(aElementUri), + iAttributePrefix(aAttributePrefix), iAttributeUri(aAttributeUri), iState(KNothingMapped) + { + } + +void TNamespaceContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aError) + { + TSimpleContentHandler::OnStartElementL(aElement, aAttributes, aError); + + if(iState==KNothingMapped) + test(aElement.Prefix().DesC().Length()==0 && aElement.Uri().DesC().Length()==0); + else + if(aElement.Prefix().DesC().Length()==0) + test(aElement.Uri().DesC()==iDefaultUri); + else + test(aElement.Prefix().DesC()==iElementPrefix && aElement.Uri().DesC()==iElementUri); + + if(aAttributes.Count()) + { + const RTagInfo& attribute = aAttributes[0].Attribute(); + + if(attribute.Prefix().DesC().Length()==0) + test(attribute.Uri().DesC().Length()==0); + else + { + test(iState!=KNothingMapped); + test(attribute.Prefix().DesC()==iAttributePrefix && attribute.Uri().DesC()==iAttributeUri); + } + } + } + +void TNamespaceContentHandler::OnEndElementL(const RTagInfo& aElement, TInt aError) + { + TSimpleContentHandler::OnEndElementL(aElement, aError); + + if(iState==KNothingMapped) + test(aElement.Prefix().DesC().Length()==0 && aElement.Uri().DesC().Length()==0); + else + if(aElement.Prefix().DesC().Length()==0) + test(aElement.Uri().DesC()==iDefaultUri); + else + test(aElement.Prefix().DesC()==iElementPrefix && aElement.Uri().DesC()==iElementUri); + } + +void TNamespaceContentHandler::OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aError) + { + TSimpleContentHandler::OnStartPrefixMappingL(aPrefix, aUri, aError); + + TPtrC8 prefix = aPrefix.DesC(); + TPtrC8 uri = aUri.DesC(); + + switch(iState) + { + case KNothingMapped: + test(prefix.Length()==0 && uri==iDefaultUri); + iState = KDefaultNsMapped; + break; + + case KDefaultNsMapped: + test(prefix==iElementPrefix && uri==iElementUri); + iState = KElementNsMapped; + break; + + case KElementNsMapped: + test(prefix==iAttributePrefix && uri==iAttributeUri); + iState = KAttributeNsMapped; + break; + + case KAttributeNsMapped: + test(0); + } + } + +void TNamespaceContentHandler::OnEndPrefixMappingL(const RString& aPrefix, TInt aError) + { + TSimpleContentHandler::OnEndPrefixMappingL(aPrefix, aError); + + TPtrC8 prefix = aPrefix.DesC(); + + switch(iState) + { + case KAttributeNsMapped: + test(prefix==iAttributePrefix); + iState = KElementNsMapped; + break; + + case KElementNsMapped: + test(prefix==iElementPrefix); + iState = KDefaultNsMapped; + break; + + case KDefaultNsMapped: + test(prefix.Length()==0); + iState = KNothingMapped; + break; + + case KNothingMapped: + test(0); + } + } + + + +void TCapsContentHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aError) + { + TSimpleContentHandler::OnStartElementL(aElement, aAttributes, aError); + + // Test file should contain the following: + // + + // Expat should deliver it to us as: + // prefix, name, "HTTP://UPPERCASE.COM" + // attprefix, attname, "HTTP://STILLUPPERCASE.COM", "VALUE" + + _LIT8(KPrefix, "prefix"); + _LIT8(KName, "name"); + _LIT8(KUri, "HTTP://UPPERCASE.COM"); + _LIT8(KAttprefix, "attprefix"); + _LIT8(KAttname, "attname"); + _LIT8(KAtturi, "HTTP://STILLUPPERCASE.COM"); + _LIT8(KValue, "VALUE"); + + test(aElement.Prefix().DesC() == KPrefix); + test(aElement.LocalName().DesC() == KName); + test(aElement.Uri().DesC() == KUri); + + test(aAttributes.Count() == 1); + const RAttribute& attribute = aAttributes[0]; + const RTagInfo& nameInfo = attribute.Attribute(); + + test(nameInfo.Prefix().DesC() == KAttprefix); + test(nameInfo.LocalName().DesC() == KAttname); + test(nameInfo.Uri().DesC() == KAtturi); + test(attribute.Value().DesC() == KValue); + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/contenthandlers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/contenthandlers.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,116 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef CONTENTHANDLERS_H +#define CONTENTHANDLERS_H + +#include + +class RFile; + +namespace Xml +{ + +class TRebuildingContentHandler : public MContentHandler + { +public: + + TRebuildingContentHandler(RFile& aOut); + + // From MContentHandler + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + +public: + TInt iError; + +private: + RFile& iOutFile; + }; + +class TSimpleContentHandler : public MContentHandler + { +public: + TSimpleContentHandler(); + + // From MContentHandler + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); + void OnOutOfData(); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + +public: + static const TInt KExpectedLeaveCode; + +public: + TBool iLeaveOnStartElement; + TInt iNumElements; + TInt iNumSkippedEntities; + TInt iNumPrefixMappings; + TInt iNumPrefixUnmappings; + TInt iError; + }; + +class TNamespaceContentHandler : public TSimpleContentHandler + { +public: + TNamespaceContentHandler(const TDesC8& aDefaultUri, const TDesC8& aElementPrefix, const TDesC8& aElementUri, + const TDesC8& aAttributePrefix, const TDesC8& aAttributeUri); + + // From MContentHandler + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + +private: + const TDesC8& iDefaultUri; + const TDesC8& iElementPrefix; + const TDesC8& iElementUri; + const TDesC8& iAttributePrefix; + const TDesC8& iAttributeUri; + enum { KNothingMapped, KDefaultNsMapped, KElementNsMapped, KAttributeNsMapped } iState; + }; + +class TCapsContentHandler : public TSimpleContentHandler + { +public: + // From MContentHandler + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode); + }; +} + +#endif // CONTENTHANDLERS_H diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_componenttests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_componenttests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1374 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "t_componenttests.h" +#include "t_testconstants.h" +#include "t_stringdictionary00.h" +#include "t_stringdictionary00tagtable.h" + +using namespace Xml; + + +_LIT(KTest,"t_ComponentTests"); + +static RTest test(KTest); + +_LIT8 (KTestString1, "This is a test string1."); +_LIT8 (KTestString2, "This is a test string2."); +_LIT8 (KTestString3, "This is a test string3."); +_LIT8 (KTestString4, "This is a test string4."); +_LIT8 (KTestString5, "This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text."); + +_LIT8 (KCharSetName, "Test Charset name."); +_LIT8 (KDictionaryUri, "-//TestStringDictionary//DTD TestStringDictionary 1.1//EN~0"); +_LIT8 (KAddElement, "Add"); + +TBuf16<600> largebuf16 = _L16("This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text."); +TBuf8<600> largebuf8 = _L8("This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text. This is a very large test string containing lots and lots and lots and lots of text."); + +_LIT8 (KEncoding, "UTF-8"); +const TInt KMibEnum = 106; + +const TInt KUnloadedCodePage = 999; +const TInt KUnknownToken = 999; + + + +CComponentTests* CComponentTests::NewL() + { + CComponentTests* self = new(ELeave) CComponentTests(); + return self; + } + + +CComponentTests::CComponentTests() + { + // do nothing; + } + + +CComponentTests::~CComponentTests() + { + // do nothing; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1271 +@SYMTestCaseDesc Tests for RTagInfo::Uri(),RTagInfo::Prefix(),RTagInfo::LocalName() functions +@SYMTestPriority High +@SYMTestActions Tests for heap leak,and open handles +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test1L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1271 Test1L ")); + + // RTagInfo Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString string1 = iStringPool.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = iStringPool.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = iStringPool.OpenStringL(KTestString3); + + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&iStringPool); + + RTagInfo tagInfo; + tagInfo.Open(string1, string2, string3); + + const RString& uri = tagInfo.Uri(); + const RString& prefix = tagInfo.Prefix(); + const RString& localName = tagInfo.LocalName(); + + test (KTestString1() == uri.DesC()); + test (KTestString2() == prefix.DesC()); + test (KTestString3() == localName.DesC()); + + tagInfo.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1272 +@SYMTestCaseDesc Test for RTagInfo copy constructor,assignment operator,Copy functions +@SYMTestPriority High +@SYMTestActions Create three RTagInfo objects using assignment operator,copy constructor,and Copy function with the same information that describes an element. + Tests for the integrity of the data of all the three objects. + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test2L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1272 Test2L ")); + + // RTagInfo Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString string1 = iStringPool.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = iStringPool.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = iStringPool.OpenStringL(KTestString3); + + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&iStringPool); + + RTagInfo tagInfo; + tagInfo.Open(string1, string2, string3); + RTagInfo tagInfo2 = tagInfo; + RTagInfo tagInfo3 (tagInfo); + RTagInfo tagInfo4 = tagInfo.Copy(); + + const RString& uri = tagInfo.Uri(); + const RString& prefix = tagInfo.Prefix(); + const RString& localName = tagInfo.LocalName(); + + test (KTestString1() == uri.DesC()); + test (KTestString2() == prefix.DesC()); + test (KTestString3() == localName.DesC()); + + test (KTestString1() == tagInfo2.Uri().DesC()); + test (KTestString2() == tagInfo2.Prefix().DesC()); + test (KTestString3() == tagInfo2.LocalName().DesC()); + + test (KTestString1() == tagInfo3.Uri().DesC()); + test (KTestString2() == tagInfo3.Prefix().DesC()); + test (KTestString3() == tagInfo3.LocalName().DesC()); + + test (KTestString1() == tagInfo4.Uri().DesC()); + test (KTestString2() == tagInfo4.Prefix().DesC()); + test (KTestString3() == tagInfo4.LocalName().DesC()); + + tagInfo.Close(); + tagInfo4.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1273 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute class +@SYMTestPriority High +@SYMTestActions Tests for the information of RTagInfo objects. + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test3L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1273 Test3L ")); + + // RAttribute Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString string1 = iStringPool.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = iStringPool.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = iStringPool.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = iStringPool.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&iStringPool); + + RAttribute attribute; + attribute.Open(string1, string2, string3); + attribute.SetValue(string4); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + attribute.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1274 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute::Uri,Prefix,LocalName functions +@SYMTestPriority High +@SYMTestActions Create three RAttribute objects using copy constructor,assignment operator and Copy function.Test for information of RAttribute objects + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test4L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1274 Test4L ")); + + // RAttribute Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString string1 = iStringPool.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = iStringPool.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = iStringPool.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = iStringPool.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&iStringPool); + + RAttribute attribute; + attribute.Open(string1, string2, string3, string4); + RAttribute attribute2 = attribute; + RAttribute attribute3 (attribute); + RAttribute attribute4 = attribute.Copy(); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + test (KTestString1() == attribute2.Attribute().Uri().DesC()); + test (KTestString2() == attribute2.Attribute().Prefix().DesC()); + test (KTestString3() == attribute2.Attribute().LocalName().DesC()); + test (KTestString4() == attribute2.Value().DesC()); + test (EAttributeType_NONE == attribute2.Type()); + + test (KTestString1() == attribute3.Attribute().Uri().DesC()); + test (KTestString2() == attribute3.Attribute().Prefix().DesC()); + test (KTestString3() == attribute3.Attribute().LocalName().DesC()); + test (KTestString4() == attribute3.Value().DesC()); + test (EAttributeType_NONE == attribute3.Type()); + + test (KTestString1() == attribute4.Attribute().Uri().DesC()); + test (KTestString2() == attribute4.Attribute().Prefix().DesC()); + test (KTestString3() == attribute4.Attribute().LocalName().DesC()); + test (KTestString4() == attribute4.Value().DesC()); + test (EAttributeType_NONE == attribute4.Type()); + + attribute.Close(); + attribute4.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1275 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute::Uri,Prefix,LocalName functions +@SYMTestPriority High +@SYMTestActions Create RAttribute Test for information of RAttribute objects + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test5L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1275 Test5L ")); + + // RAttribute Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString string1 = iStringPool.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = iStringPool.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = iStringPool.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = iStringPool.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&iStringPool); + + RAttribute attribute; + attribute.Open(string1, string2, string3, string4); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + attribute.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1276 +@SYMTestCaseDesc Tests for information of the document to be passed to client RDocumentParameters::CharacterSetName() functions +@SYMTestPriority High +@SYMTestActions Tests for the character set name of document. + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test6L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1276 Test6L ")); + + // RDocumentParameters Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString characterSetName = iStringPool.OpenStringL(KCharSetName); + + CleanupStack::Pop(&iStringPool); + + RDocumentParameters docParam; + docParam.Open(characterSetName); + + test (KCharSetName() == docParam.CharacterSetName().DesC()); + + docParam.Close(); + iStringPool.Close(); + + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1277 +@SYMTestCaseDesc Tests for information of the document to be passed to client RDocumentParameters::CharacterSetName functions +@SYMTestPriority High +@SYMTestActions Tests for the character set name of document + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test7L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1277 Test7L ")); + + // RDocumentParameters Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + iStringPool.OpenL(); + CleanupClosePushL(iStringPool); + + RString characterSetName = iStringPool.OpenStringL(KCharSetName); + CleanupStack::Pop(&iStringPool); + + RDocumentParameters docParam; + docParam.Open(characterSetName); + + test (KCharSetName() == docParam.CharacterSetName().DesC()); + + docParam.Close(); + iStringPool.Close(); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1278 +@SYMTestCaseDesc Tests for RStringDictionaryCollection::CompareThisDictionary(),SwitchCodePage, + ElementL,AttributeL,AttributeValuePairL,AttributeValueL functions +@SYMTestPriority High +@SYMTestActions Tests for no error,unsupported XML value,XML unsupported Element, + XML unsupported Attribute,XML unsupported AttributeValue + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test8L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1278 Test8L ")); + + // RStringDictionaryCollection Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + RStringDictionaryCollection nsCollection; + CleanupClosePushL(nsCollection); + + nsCollection.OpenL(); + + nsCollection.OpenDictionaryL (KDictionaryUri); + + RString nsUri = nsCollection.StringPool().OpenStringL(KDictionaryUri); + CleanupClosePushL(nsUri); + + RString element; + RString attribute; + RString value; + + CleanupClosePushL(element); + CleanupClosePushL(attribute); + CleanupClosePushL(value); + + + test (nsCollection.CurrentDictionaryL().CompareThisDictionary(nsUri) == (TInt) ETrue); + + test (nsCollection.CurrentDictionaryL().SwitchCodePage(KUnloadedCodePage) == KErrXmlMissingStringDictionary); + + TRAPD(err, nsCollection.CurrentDictionaryL().ElementL(CTestStringDictionary00::ETokenValueAdd, element)); + test (err == KErrNone); + test (element.DesC() == KAddElement); + element.Close(); // as we are reassigning + + TRAP (err, nsCollection.CurrentDictionaryL().ElementL(KUnknownToken, element)); + test (err == KErrXmlUnsupportedElement); + + TRAP (err, nsCollection.CurrentDictionaryL().AttributeL(KUnknownToken, attribute)); + test (err == KErrXmlUnsupportedAttribute); + attribute.Close(); // as we are reassigning + + TRAP (err, nsCollection.CurrentDictionaryL().AttributeValuePairL(KUnknownToken, attribute, value)); + test (err == KErrXmlUnsupportedAttribute); + attribute.Close(); // as we are reassigning + value.Close(); // as we are reassigning + + TRAP (err, nsCollection.CurrentDictionaryL().AttributeValueL(KUnknownToken, value)); + test (err == KErrXmlUnsupportedAttributeValue); + value.Close(); // as we are reassigning + + CleanupStack::PopAndDestroy(&value); + CleanupStack::PopAndDestroy(&attribute); + CleanupStack::PopAndDestroy(&element); + CleanupStack::PopAndDestroy(&nsUri); // on the stringpool + + nsCollection.Close(); + + CleanupStack::Pop(&nsCollection); + + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1279 +@SYMTestCaseDesc Tests for CCharSetConverter functions +@SYMTestPriority High +@SYMTestActions Tests for UTF-8 to Unicode and Unicode to UTF-8 character set conversions. + Tests for no error , no memory error + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void CComponentTests::Test9L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1279 Test9L ")); + + // CCharSetConverter Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + CCharSetConverter* charSet = CCharSetConverter::NewL(); + CleanupStack::PushL(charSet); + + TInt err = KErrNone; + TUint charSetUid = 0; + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KEncoding)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KMibEnum)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + // convert to unicode from utf-8 + HBufC16* unicodeConversion = NULL; + err = charSet->ConvertToUnicodeL(charSetUid, KTestString1, unicodeConversion); + CleanupStack::PushL(unicodeConversion); + test (err == KErrNone); + TBuf16<100> compare; + compare.Copy(KTestString1); + test (*unicodeConversion == compare); + + // convert to utf-8 from unicode + HBufC8* utf8Conversion = NULL; + err = charSet->ConvertFromUnicodeL(*unicodeConversion, charSetUid, utf8Conversion); + CleanupStack::PushL(utf8Conversion); + test (err == KErrNone); + test (*utf8Conversion == KTestString1()); + + CleanupStack::PopAndDestroy(utf8Conversion); + CleanupStack::PopAndDestroy(unicodeConversion); + + // really a test of CharConv as we call it directly. + TRAP (err, charSet->PrepareToConvertToOrFromL(charSetUid)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + + const TInt KUcs4Count = 23; + TUint32 ucs4 [KUcs4Count] = {0}; + ucs4 [0] = 'T'; + ucs4 [1] = 'h'; + ucs4 [2] = 'i'; + ucs4 [3] = 's'; + ucs4 [4] = ' '; + ucs4 [5] = 'i'; + ucs4 [6] = 's'; + ucs4 [7] = ' '; + ucs4 [8] = 'a'; + ucs4 [9] = ' '; + ucs4 [10] = 't'; + ucs4 [11] = 'e'; + ucs4 [12] = 's'; + ucs4 [13] = 't'; + ucs4 [14] = ' '; + ucs4 [15] = 's'; + ucs4 [16] = 't'; + ucs4 [17] = 'r'; + ucs4 [18] = 'i'; + ucs4 [19] = 'n'; + ucs4 [20] = 'g'; + ucs4 [21] = '1'; + ucs4 [22] = '.'; + + utf8Conversion = NULL; + err = charSet->ConvertUcs4CharactersToEncodingL(ucs4, KUcs4Count, KCharacterSetIdentifierUtf8, utf8Conversion); + CleanupStack::PushL(utf8Conversion); + test (err == KErrNone); + test (*utf8Conversion == KTestString1()); + CleanupStack::PopAndDestroy(utf8Conversion); + + HBufC8* Output8 = NULL; + err = charSet->ConvertFromUnicodeL(largebuf16, charSetUid, Output8); + CleanupStack::PushL(Output8); + test (err == KErrNone); + test(largebuf8 == *Output8); + + HBufC16* Output16 = NULL; + err = charSet->ConvertToUnicodeL(charSetUid, largebuf8, Output16); + CleanupStack::PushL(Output16); + test (err == KErrNone); + test(largebuf16 == *Output16); + + CleanupStack::PopAndDestroy(Output16); + CleanupStack::PopAndDestroy(Output8); + CleanupStack::PopAndDestroy(charSet); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-UT-3718 +@SYMTestCaseDesc CDictionaryCodePage tests +@SYMTestPriority Medium +@SYMTestActions Creating a link between indicies and tokens. Checking a token returns an index from the string pool and then + checking if an index return a token. +@SYMTestExpectedResults Indicies and tokens are returns (and not returned) when expected. +@SYMDEF DEF071977 +*/ +void CComponentTests::Test10L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-UT-3718 Test10L ")); + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + TInt index; + TInt token; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + + + iStringPool.OpenL(t_StringDictionary00TagTable::Table); + CleanupClosePushL(iStringPool); + + CDictionaryCodePage* codepage = CDictionaryCodePage::NewL(&t_StringDictionary00TagTable::Table, &t_StringDictionary00TagTable::Table, &t_StringDictionary00TagTable::Table, 0); + CleanupStack::PushL(codepage); + + // Construct the correlation mapping + codepage->ConstructIndexMappingL(iCodePage00, CDictionaryCodePage::EStringTypeElement); + codepage->ConstructIndexMappingL(iCodePage00, CDictionaryCodePage::EStringTypeAttribute); + codepage->ConstructIndexMappingL(iCodePage00, CDictionaryCodePage::EStringTypeAttributeValue); + + index = codepage->StringPoolIndexFromToken(CTestStringDictionary00::ETokenValueAdd, CDictionaryCodePage::EStringTypeElement); + test(index!=KErrXmlStringPoolTableNotFound); + + index = codepage->StringPoolIndexFromToken(KUnknownToken, CDictionaryCodePage::EStringTypeElement); + test(index==KErrXmlStringPoolTableNotFound); + + index = codepage->StringPoolIndexFromToken(CTestStringDictionary00::ETokenValueAdd,CDictionaryCodePage::EStringTypeAttribute); + test(index!=KErrXmlStringPoolTableNotFound); + + index = codepage->StringPoolIndexFromToken(KUnknownToken, CDictionaryCodePage::EStringTypeAttribute); + test(index==KErrXmlStringPoolTableNotFound); + + index = codepage->StringPoolIndexFromToken(CTestStringDictionary00::ETokenValueAdd,CDictionaryCodePage::EStringTypeAttributeValue); + test(index!=KErrXmlStringPoolTableNotFound); + + index = codepage->StringPoolIndexFromToken(KUnknownToken, CDictionaryCodePage::EStringTypeAttributeValue); + test(index==KErrXmlStringPoolTableNotFound); + + token = codepage->TokenFromStringPoolIndex(0,CDictionaryCodePage::EStringTypeElement); + test(token==CTestStringDictionary00::ETokenValueAdd); + + token = codepage->TokenFromStringPoolIndex(0,CDictionaryCodePage::EStringTypeAttribute); + test(token==CTestStringDictionary00::ETokenValueAdd); + + token = codepage->TokenFromStringPoolIndex(0,CDictionaryCodePage::EStringTypeAttributeValue); + test(token==CTestStringDictionary00::ETokenValueAdd); + + test(codepage->CodePage()==0); + + + const RString& aPubId = iStringPool.String(t_StringDictionary00TagTable::EFormalPublicId, + *(codepage->StringTable(CDictionaryCodePage::EStringTypeElement))); + + TPtrC8 ades = aPubId.DesC(); + test(ades.Compare(KDictionaryUri)==0); + + const RString& aPubId1 = iStringPool.String(t_StringDictionary00TagTable::EFormalPublicId, + *(codepage->StringTable(CDictionaryCodePage::EStringTypeAttribute))); + TPtrC8 ades1 = aPubId1.DesC(); + test(ades1.Compare(KDictionaryUri)==0); + + const RString& aPubId2 = iStringPool.String(t_StringDictionary00TagTable::EFormalPublicId, + *(codepage->StringTable(CDictionaryCodePage::EStringTypeAttributeValue))); + TPtrC8 ades2 = aPubId2.DesC(); + test(ades1.Compare(KDictionaryUri)==0); + + + CleanupStack::PopAndDestroy(codepage); + + CleanupStack::PopAndDestroy(&iStringPool); + + + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + __UHEAP_MARKEND; + + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-UT-1577 +@SYMTestCaseDesc Tests the TPtr Overloaded CCharSetConverter functions, making sure they + function correctly. +@SYMTestPriority High +@SYMTestActions Tests for UTF-8 to Unicode and Unicode to UTF-8 character set conversions. + Tests for heap leak and for open handles at the end of the test. +@SYMTestExpectedResults Test must not fail +@SYMDEF DEF075739 +*/ +void CComponentTests::Test11L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-UT-1577 Test11L ")); + + // CCharSetConverter Test + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + TPtr8 conversionOutput8(0,0); + TPtr16 conversionOutput16(0,0); + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + CCharSetConverter* charSet = CCharSetConverter::NewL(); + CleanupStack::PushL(charSet); + + TInt err = KErrNone; + TUint charSetUid = 0; + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KEncoding)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KMibEnum)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + // convert to unicode from utf-8 + err = charSet->ConvertToUnicodeL(charSetUid, KTestString1, conversionOutput16); + test (err == KErrNone); + TBuf16<100> compare; + compare.Copy(KTestString1); + test (conversionOutput16 == compare); + + // convert to utf-8 from unicode + err = charSet->ConvertFromUnicodeL(conversionOutput16, charSetUid, conversionOutput8); + test (err == KErrNone); + test (conversionOutput8 == KTestString1()); + + // really a test of CharConv as we call it directly. + TRAP (err, charSet->PrepareToConvertToOrFromL(charSetUid)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + //Try converting a large amount of data, will require the output buffer to increase in size + //Using the TPtr overload + err = charSet->ConvertFromUnicodeL(largebuf16, charSetUid, conversionOutput8); + test (err == KErrNone); + test(largebuf8 == conversionOutput8); + + //Try converting a large amount of data, will require the output buffer to increase in size + //Using the TPtr overload + err = charSet->ConvertToUnicodeL(charSetUid, largebuf8, conversionOutput16); + test (err == KErrNone); + test(largebuf16 == conversionOutput16); + + CleanupStack::PopAndDestroy(charSet); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-UT-1662 +@SYMTestCaseDesc Tests the CCharSetConverter::ConvertToUnicodeL function to ensure that an inputBuffer which is + larger than 32kB doesn't cause the CCharSetConverter::iConversionBufferSize to overflow. +@SYMTestPriority High +@SYMTestActions Tests CCharSetConverter::ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInput, TPtr16& aOutput) with aInput > 32kB. + Tests for heap leak and for open handles at the end of the test +@SYMTestExpectedResults Test must not fail +@SYMDEF DEF081549 +*/ +void CComponentTests::Test12L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-UT-1662 Test12L ")); + + // Testing CCharSetConverter::ConvertToUnicodeL(TUint32 aSrcCharset, const TDesC8& aInput, TPtr16& aOutput) + // with aInput > 32kB. + // + // =========================================== + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + // Test Starts... + + CCharSetConverter* charSet = CCharSetConverter::NewL(); + CleanupStack::PushL(charSet); + + TInt err = KErrNone; + TUint charSetUid = 0; + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KEncoding)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + TRAP (err, charSet->PrepareCharConvL(charSetUid, KMibEnum)); + // extra clause for OOM tests + test (err == KErrNone || err == KErrNoMemory); + + // convert large string (>32kB) to unicode + TPtr16 largeUnicodeConversion(0,0); + err = charSet->ConvertToUnicodeL(charSetUid, KTestString5, largeUnicodeConversion); + test (err == KErrNone); + + CleanupStack::PopAndDestroy(charSet); + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + // Test Ends... + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +class CTest : public CBase + { + public: + void MainL(); + }; + + +typedef void (CComponentTests::*ClassFuncPtrL) (void); + + +//---------------------------------------------------------------------------- + + +/** +@SYMTestCaseID SYSLIB-XML-CT-1280 +@SYMTestCaseDesc Tests for out of memory conditions +@SYMTestPriority High +@SYMTestActions Tests all basic components for memory errors +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +static void DoOomTestL(CComponentTests* aObjectPtr, ClassFuncPtrL testFuncL) + { + test.Start(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1280 OOM test ")); + TInt err, tryCount = 0; + do + { + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++tryCount); + User::__DbgMarkStart(RHeap::EUser); + TRAP(err, (aObjectPtr->*testFuncL)()); + User::__DbgMarkEnd(RHeap::EUser, 0); + } while(err==KErrNoMemory); + + if(err==KErrNone) + { + // Reset + User::__DbgSetAllocFail(RHeap::EUser,RHeap::ENone,1); + } + else + { + User::Panic(_L("Unexpected leave reason"),err); + } + + test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount); + test.End(); + } + + +//---------------------------------------------------------------------------- + + +static void BasicComponentTestsL() + { + test.Next(_L("BasicComponentTests...")); + + __UHEAP_MARK; + + CComponentTests* client1 = CComponentTests::NewL(); + CleanupStack::PushL(client1); + client1->Test1L(); + CleanupStack::PopAndDestroy(client1); + + CComponentTests* client2 = CComponentTests::NewL(); + CleanupStack::PushL(client2); + client2->Test2L(); + CleanupStack::PopAndDestroy(client2); + + CComponentTests* client3 = CComponentTests::NewL(); + CleanupStack::PushL(client3); + client3->Test3L(); + CleanupStack::PopAndDestroy(client3); + + CComponentTests* client4 = CComponentTests::NewL(); + CleanupStack::PushL(client4); + client4->Test4L(); + CleanupStack::PopAndDestroy(client4); + + CComponentTests* client5 = CComponentTests::NewL(); + CleanupStack::PushL(client5); + client5->Test5L(); + CleanupStack::PopAndDestroy(client5); + + CComponentTests* client6 = CComponentTests::NewL(); + CleanupStack::PushL(client6); + client6->Test6L(); + CleanupStack::PopAndDestroy(client6); + + CComponentTests* client7 = CComponentTests::NewL(); + CleanupStack::PushL(client7); + client7->Test7L(); + CleanupStack::PopAndDestroy(client7); + + CComponentTests* client8 = CComponentTests::NewL(); + CleanupStack::PushL(client8); + client8->Test8L(); + CleanupStack::PopAndDestroy(client8); + + CComponentTests* client9 = CComponentTests::NewL(); + CleanupStack::PushL(client9); + client9->Test9L(); + CleanupStack::PopAndDestroy(client9); + + CComponentTests* client10 = CComponentTests::NewL(); + CleanupStack::PushL(client10); + client10->Test10L(); + CleanupStack::PopAndDestroy(client10); + + CComponentTests* client11 = CComponentTests::NewL(); + CleanupStack::PushL(client11); + client11->Test11L(); + CleanupStack::PopAndDestroy(client11); + + CComponentTests* client12 = CComponentTests::NewL(); + CleanupStack::PushL(client12); + client12->Test12L(); + CleanupStack::PopAndDestroy(client12); + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +static void OomTestsL() + { + test.Next(_L("OOM Tests ...")); + + __UHEAP_MARK; + + CComponentTests* client1 = CComponentTests::NewL(); + CleanupStack::PushL(client1); + DoOomTestL(client1, &CComponentTests::Test1L); + CleanupStack::PopAndDestroy(client1); + + CComponentTests* client2 = CComponentTests::NewL(); + CleanupStack::PushL(client2); + DoOomTestL(client2, &CComponentTests::Test2L); + CleanupStack::PopAndDestroy(client2); + + CComponentTests* client3 = CComponentTests::NewL(); + CleanupStack::PushL(client3); + DoOomTestL(client3, &CComponentTests::Test3L); + CleanupStack::PopAndDestroy(client3); + + CComponentTests* client4 = CComponentTests::NewL(); + CleanupStack::PushL(client4); + DoOomTestL(client4, &CComponentTests::Test4L); + CleanupStack::PopAndDestroy(client4); + + CComponentTests* client5 = CComponentTests::NewL(); + CleanupStack::PushL(client5); + DoOomTestL(client5, &CComponentTests::Test5L); + CleanupStack::PopAndDestroy(client5); + + CComponentTests* client6 = CComponentTests::NewL(); + CleanupStack::PushL(client6); + DoOomTestL(client6, &CComponentTests::Test6L); + CleanupStack::PopAndDestroy(client6); + + CComponentTests* client7 = CComponentTests::NewL(); + CleanupStack::PushL(client7); + DoOomTestL(client7, &CComponentTests::Test7L); + CleanupStack::PopAndDestroy(client7); + + CComponentTests* client8 = CComponentTests::NewL(); + CleanupStack::PushL(client8); + DoOomTestL(client8, &CComponentTests::Test8L); + CleanupStack::PopAndDestroy(client8); + + CComponentTests* client9 = CComponentTests::NewL(); + CleanupStack::PushL(client9); + DoOomTestL(client9, &CComponentTests::Test9L); + CleanupStack::PopAndDestroy(client9); + + CComponentTests* client10 = CComponentTests::NewL(); + CleanupStack::PushL(client10); + DoOomTestL(client10, &CComponentTests::Test10L); + CleanupStack::PopAndDestroy(client10); + + CComponentTests* client11 = CComponentTests::NewL(); + CleanupStack::PushL(client11); + DoOomTestL(client11, &CComponentTests::Test11L); + CleanupStack::PopAndDestroy(client11); + + CComponentTests* client12 = CComponentTests::NewL(); + CleanupStack::PushL(client12); + DoOomTestL(client12, &CComponentTests::Test12L); + CleanupStack::PopAndDestroy(client12); + + __UHEAP_MARKEND; + } + + +//---------------------------------------------------------------------------- + + +static void MainL() + { + BasicComponentTestsL(); + OomTestsL(); + } + + +//---------------------------------------------------------------------------- + + +TInt E32Main() + { + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test.End(); + test (r==KErrNone); + delete c; + test.Close(); + __UHEAP_MARKEND; + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_componenttests.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_componenttests.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,57 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __T_COMPONENTTESTS_H__ +#define __T_COMPONENTTESTS_H__ + +#include + + +// +// The other classes are tested as part of the FrameworkTests, +// or can only be tested when they are derived from, i.e. the Parser. +// + +class CComponentTests : public CBase + { +public: + static CComponentTests* NewL(); + virtual ~CComponentTests(); + + // The tests to run + + // Component tests + void Test1L(); + void Test2L(); + void Test3L(); + void Test4L(); + void Test5L(); + void Test6L(); + void Test7L(); + void Test8L(); + void Test9L(); + void Test10L(); + void Test11L(); + void Test12L(); + +private: + CComponentTests(); + +private: + + RStringPool iStringPool; + }; + +#endif // __T_COMPONENTTESTS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_parser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_parser.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,298 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_testconstants.h" + +using namespace Xml; + +class CDummyParser : public CBase, public MParser + { +public: + + static MParser* NewL(TAny* aInitParams); + virtual ~CDummyParser(); + + // From MParser + + TInt EnableFeature(TInt /*aParserFeature*/) + { + return KErrNotSupported; + } + TInt DisableFeature(TInt /*aParserFeature*/) + { + return KErrNone; + } + TBool IsFeatureEnabled(TInt /*aParserFeature*/) const + { + return EFalse; + } + void Release(); + void ParseChunkL (const TDesC8& aDescriptor); + void ParseLastChunkL(const TDesC8& aDescriptor); + + // From MContentSouce + + void SetContentSink (MContentHandler& aContentHandler); + + RStringPool& StringPool(); + +private: + + CDummyParser(TParserInitParams* aInitParams); + void DoParseL(); + + inline void OnStartDocumentL(); + inline void OnEndDocumentL(); + inline void OnStartElementL(); + inline void OnEndElementL(); + inline void OnContentL(); + inline void OnStartPrefixMappingL(); + inline void OnEndPrefixMappingL(); + inline void OnIgnorableWhiteSpaceL(); + inline void OnSkippedEntityL(); + inline void OnProcessingInstructionL(); + inline void OnExtensionL(); + inline void OnError(TInt aError); + +private: + MContentHandler* iContentHandler; + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + }; + +MParser* CDummyParser::NewL(TAny* aInitParams) + { + + CDummyParser* self = new(ELeave) CDummyParser(reinterpret_cast(aInitParams)); + return (static_cast(self)); + } + + + +CDummyParser::CDummyParser(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + +void CDummyParser::Release() + { + delete (this); + } + + + +CDummyParser::~CDummyParser() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + } + + +void CDummyParser::ParseChunkL (const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +void CDummyParser::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +RStringPool& CDummyParser::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + + +void CDummyParser::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + + +void CDummyParser::DoParseL() + { + OnStartDocumentL(); + OnEndDocumentL(); + OnStartElementL(); + OnEndElementL(); + OnContentL(); + OnStartPrefixMappingL(); + OnEndPrefixMappingL(); + OnIgnorableWhiteSpaceL(); + OnSkippedEntityL(); + OnProcessingInstructionL(); + OnExtensionL(); + //OnError(KErrEof); + } + + + +void CDummyParser::OnStartDocumentL() + { + RDocumentParameters documentParameters; + + iContentHandler->OnStartDocumentL(documentParameters, KErrorCodeOnStartDocument); + } + + +void CDummyParser::OnEndDocumentL() + { + iContentHandler->OnEndDocumentL(KErrorCodeOnEndDocument); + } + + + +void CDummyParser::OnStartElementL() + { + RTagInfo element; + RAttributeArray attributes; + + iContentHandler->OnStartElementL(element, attributes, KErrorCodeOnStartElement); + } + + +void CDummyParser::OnEndElementL() + { + RTagInfo element; + + iContentHandler->OnEndElementL(element, KErrorCodeOnEndElement); + } + + + +void CDummyParser::OnContentL() + { + const TBuf8<2> bytes; + + iContentHandler->OnContentL(bytes, KErrorCodeOnContent); + } + + + +void CDummyParser::OnStartPrefixMappingL() + { + RString prefix; + RString uri; + + iContentHandler->OnStartPrefixMappingL(prefix, uri, KErrorCodeOnStartPrefixMapping); + } + + +void CDummyParser::OnEndPrefixMappingL() + { + RString prefix; + + iContentHandler->OnEndPrefixMappingL(prefix, KErrorCodeOnEndPrefixMapping); + } + + + +void CDummyParser::OnIgnorableWhiteSpaceL() + { + const TBuf8<2> bytes; + + iContentHandler->OnIgnorableWhiteSpaceL(bytes, KErrorCodeOnIgnorableWhiteSpace); + } + + + +void CDummyParser::OnSkippedEntityL() + { + RString name; + + iContentHandler->OnSkippedEntityL(name, KErrorCodeOnSkippedEntity); + } + + + +void CDummyParser::OnProcessingInstructionL() + { + TBuf8<2> target; + TBuf8<2> data; + + iContentHandler->OnProcessingInstructionL(target, data, KErrorCodeOnProcessingInstruction); + } + + +void CDummyParser::OnExtensionL() + { + RString data; + TInt token = 0; + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(data, token, KErrorCodeOnExtension); + } + + +void CDummyParser::OnError(TInt aError) + { + iContentHandler->OnError(aError); + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x101FBE53,CDummyParser::NewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_parserucs4test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_parserucs4test.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,101 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include + +using namespace Xml; + +static RTest test(_L("t_parserucs4test")); + +/** +@SYMTestCaseID SYSLIB-XML-UT-3717 +@SYMTestCaseDesc Converting character set. +@SYMTestPriority Medium +@SYMTestActions Converting the character to unicode. +@SYMTestExpectedResults The expected conversion result and the actual conversion result match. +@SYMREQ REQ0000 +*/ +static void ParserTestsL() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-UT-3717 ParserTestsL tests... ")); + + __UHEAP_MARK; + + + // supplementary character + // 2 9 8 7 6 decimal + // 0010 1001 1000 0111 0110 hex + // 11110000 10101001 10100001 10110110 utf-8 + // F 0 A 9 A 1 B 6 + + TUint32 ucs4Char = 0x29876; + HBufC8* result = NULL; + + CCharSetConverter* charset = CCharSetConverter::NewL(); + CleanupStack::PushL(charset); + + // read supplementary character and convert to utf8 + charset->ConvertUcs4CharactersToEncodingL(&ucs4Char, 1, KCharacterSetIdentifierUtf8, result); + + TBuf8<10> compare; + compare.Append(0xF0); + compare.Append(0xA9); + compare.Append(0xA1); + compare.Append(0xB6); + + test(*result == compare); + + delete result; + CleanupStack::PopAndDestroy(charset); + + + __UHEAP_MARKEND; + } + +static void MainL() + { + ParserTestsL(); + } + +TInt E32Main() + { + + __UHEAP_MARK; + test.Title(); + test.Start(_L("initialising")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + __UHEAP_MARKEND; + + return KErrNone; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_processfilemancopyfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_processfilemancopyfile.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Helper process with high capability to perform copying of files for +// test harnesses. +// +// + +#include +#include + + +_LIT(KSeparator, "|"); // Invalid filepath char used to separate filenames + +TInt DoCopyFileL(const TDesC& anOld,const TDesC& aNew) + { + RFs fs; + fs.Connect(); + CFileMan* fileMan = CFileMan::NewL(fs); + CleanupStack::PushL(fileMan); + // Ensure the path exists + TInt err = fs.MkDirAll(aNew); + // Make the destination file writeable + err = fileMan->Attribs(aNew, 0, KEntryAttReadOnly, TTime(0), 0); + // To process + err = fileMan->Copy(anOld, aNew); + RDebug::Print(_L("CFileMan Copy file %S to %S - err = %d\n"), &anOld, &aNew, err); + + CleanupStack::PopAndDestroy(fileMan); + fs.Close(); + + return err; + } + +// Copy the files specified. Format of aFileNames is [srcFile]|[dstFile]. +static TInt CopyFile(const TDesC& aFileNames) + { + TInt pos = aFileNames.Find(KSeparator); + TFileName srcFile(aFileNames.Mid(0,pos)); + TFileName dstFile(aFileNames.Mid(pos+1, aFileNames.Length()-(pos+1))); + + TRAPD(err,DoCopyFileL(srcFile, dstFile)); + return err; + } + + +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + + TBuf names; + User::CommandLine(names); + TInt err = CopyFile(names); + delete cleanup; + return err; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_stringdictionary00.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_stringdictionary00.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,199 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include + +#include "t_stringdictionary00.h" +#include "t_stringdictionary00tagtable.h" + +using namespace Xml; + +MStringDictionary* CTestStringDictionary00::NewL(TAny* aStringPool) + { + CTestStringDictionary00* self = new(ELeave) CTestStringDictionary00(reinterpret_cast(aStringPool)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return (static_cast(self)); + } + + + +CTestStringDictionary00::CTestStringDictionary00(RStringPool* aStringPool) +: iStringPool(*aStringPool), + iCodePage(0) + { + // do nothing; + } + + + +void CTestStringDictionary00::ConstructL() + { + // we don't own this stringpool + iStringPool.OpenL(t_StringDictionary00TagTable::Table); + + iCodepage00Table = CDictionaryCodePage::NewL(&t_StringDictionary00TagTable::Table, 0, 0, 0); + + // Construct the correlation mapping + iCodepage00Table->ConstructIndexMappingL(iCodePage00, CDictionaryCodePage::EStringTypeElement); + } + + + +void CTestStringDictionary00::Release() + { + delete (this); + } + + + + +CTestStringDictionary00::~CTestStringDictionary00() + { + if (iCodepage00Table) + { + delete iCodepage00Table; + } + } + + + +void CTestStringDictionary00::ElementL(TInt aToken, RString& aElement) const + { + TInt index = iCodepage00Table->StringPoolIndexFromToken( + aToken, CDictionaryCodePage::EStringTypeElement); + + if (index == KErrXmlStringPoolTableNotFound) + { + User::Leave(KErrXmlUnsupportedElement); + } + + // when we have multiple codepages per string dictionary we'd do something like iCodepageTable[n]->StringTable() + aElement = iStringPool.String( + index, + *(iCodepage00Table->StringTable(CDictionaryCodePage::EStringTypeElement))); + } + + + +void CTestStringDictionary00::AttributeL(TInt /*aToken*/, RString& /*aAttribute*/) const + { + // SyncML does not have attributes + User::Leave(KErrXmlUnsupportedAttribute); + }; + + + +void CTestStringDictionary00::AttributeValuePairL(TInt /*aToken*/, RString& /*aAttribute*/, RString& /*aValue*/) const + { + // SyncML does not have attributes + User::Leave(KErrXmlUnsupportedAttribute); + }; + + + +void CTestStringDictionary00::AttributeValueL(TInt /*aToken*/, RString& /*aValue*/) const + { + // SyncML does not have attributes + User::Leave(KErrXmlUnsupportedAttributeValue); + }; + + + +TBool CTestStringDictionary00::CompareThisDictionary(const RString& aDictionaryDescription) const + { + // If this Dictionary has many codepages then all these comparisons should go here. + // Remember, the Dictionary loads up all the RStringTables into its RStringPool + // on construction. So if the comparison fails we do not have it. + if ((aDictionaryDescription == iStringPool.String(t_StringDictionary00TagTable::EUrn, t_StringDictionary00TagTable::Table)) || + (aDictionaryDescription == iStringPool.String(t_StringDictionary00TagTable::EPublicId, t_StringDictionary00TagTable::Table)) || + (aDictionaryDescription == iStringPool.String(t_StringDictionary00TagTable::EFormalPublicId, t_StringDictionary00TagTable::Table))) + { + return ETrue; + } + else + { + return EFalse; + } + } + + + +TInt CTestStringDictionary00::SwitchCodePage(TInt aCodePage) + { + // We only have one codepage sp can't switch + if (aCodePage != iCodePage) + { + return KErrXmlMissingStringDictionary; + } + return iCodePage; + } + + +/** +This method obtains the public identifier from the StringTable. +Either the formal or non formal public id will do. +The stringDictionary .rss files must list both these as wbxml +documents have one or the other. + +@param aPubId The public identifier for this string + dictionary. +*/ + +void CTestStringDictionary00::PublicIdentifier(RString& aPubId) + { + // Better to use the element table as some documents don't have attributes. + aPubId = iStringPool.String( + t_StringDictionary00TagTable::EFormalPublicId, + *(iCodepage00Table->StringTable(CDictionaryCodePage::EStringTypeElement))); + } + + +/** +This method obtains the namespace uri from the StringTable. + +@param aUri The public identifier for this string + dictionary. +*/ + +void CTestStringDictionary00::NamespaceUri(RString& aUri) + { + // Better to use the element table as some documents don't have attributes. + aUri = iStringPool.String( + t_StringDictionary00TagTable::EUrn, + *(iCodepage00Table->StringTable(CDictionaryCodePage::EStringTypeElement))); + } + + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x101FD172,CTestStringDictionary00::NewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_stringdictionary00.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_stringdictionary00.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,187 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Plugin interface +// +// + + +#ifndef __T_STRINGDICTIONARY00_H__ +#define __T_STRINGDICTIONARY00_H__ + +#include +#include + +#include + + +class CTestStringDictionary00 : public CBase, public Xml::MStringDictionary +/** +The TestStringDictionary00 class is a derived class defining the API of a single string dictionary. + +Derived classes must add all elements, attributes names, and attribute values that belong +to this string dictionary as static string tables to the StringPool. WBXML token mappings between +strings and WBXML tokens should also be maintained. +*/ + { +public: + + static Xml::MStringDictionary* NewL(TAny* aStringPool); + virtual ~CTestStringDictionary00(); + + void ConstructL(); + + void ElementL(TInt aToken, RString& aElement) const; + void AttributeL(TInt aToken, RString& aAttribute) const; + void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const; + void AttributeValueL(TInt aToken, RString& aValue) const; + + TBool CompareThisDictionary(const RString& aDictionaryDescription) const; + + TInt SwitchCodePage(TInt aCodePage); + void PublicIdentifier(RString& aPubId); + void NamespaceUri(RString& aUri); + + // From MStringDictionary + void Release(); + +public: + + // CodePage tokens. + // + // Note: There will be correlation between these token values and their + // strings via the CDictionaryCodePage using the RStringPool. + + enum TTokenValue { + // CodePage 00 + // -//SYNCML//DTD SyncML 1.1//EN + ETokenValueAdd = 0x05, + ETokenValueAlert = 0x06, + ETokenValueArchive = 0x07, + ETokenValueAtomic = 0x08, + ETokenValueChal = 0x09, + ETokenValueCmd = 0x0A, + ETokenValueCmdID = 0x0B, + ETokenValueCmdRef = 0x0C, + ETokenValueCopy = 0x0D, + ETokenValueCred = 0x0E, + ETokenValueData = 0x0F, + ETokenValueDelete = 0x10, + ETokenValueExec = 0x11, + ETokenValueFinal = 0x12, + ETokenValueGet = 0x13, + ETokenValueItem = 0x14, + ETokenValueLang = 0x15, + ETokenValueLocName = 0x16, + ETokenValueLocURI = 0x17, + ETokenValueMap = 0x18, + ETokenValueMapItem = 0x19, + ETokenValueMeta = 0x1A, + ETokenValueMsgID = 0x1B, + ETokenValueMsgRef = 0x1C, + ETokenValueNoResp = 0x1D, + ETokenValueNoResults = 0x1E, + ETokenValuePut = 0x1F, + ETokenValueReplace = 0x20, + ETokenValueRespURI = 0x21, + ETokenValueResults = 0x22, + ETokenValueSearch = 0x23, + ETokenValueSequence = 0x24, + ETokenValueSessionID = 0x25, + ETokenValueSftDel = 0x26, + ETokenValueSource = 0x27, + ETokenValueSourceRef = 0x28, + ETokenValueStatus = 0x29, + ETokenValueSync = 0x2A, + ETokenValueSyncBody = 0x2B, + ETokenValueSyncHdr = 0x2C, + ETokenValueSyncML = 0x2D, + ETokenValueTarget = 0x2E, + ETokenValueTargetRef = 0x2F, + ETokenValueReservedForFutureUse = 0x30, + ETokenValueVerDTD = 0x31, + ETokenValueVerProto = 0x32, + ETokenValueNumberOfChanges = 0x33, + ETokenValueMoreData = 0x34, + }; + + +private: + + CTestStringDictionary00(RStringPool* aStringPool); + +private: + +/** +The StringPool for this string dictionary. +We don't own this. +*/ + RStringPool iStringPool; + + Xml::CDictionaryCodePage* iCodepage00Table; + TInt iCodePage; + }; + + +const TInt iCodePage00[] = + {CTestStringDictionary00::ETokenValueAdd, + CTestStringDictionary00::ETokenValueAlert, + CTestStringDictionary00::ETokenValueArchive, + CTestStringDictionary00::ETokenValueAtomic, + CTestStringDictionary00::ETokenValueChal, + CTestStringDictionary00::ETokenValueCmd, + CTestStringDictionary00::ETokenValueCmdID, + CTestStringDictionary00::ETokenValueCmdRef, + CTestStringDictionary00::ETokenValueCopy, + CTestStringDictionary00::ETokenValueCred, + CTestStringDictionary00::ETokenValueData, + CTestStringDictionary00::ETokenValueDelete, + CTestStringDictionary00::ETokenValueExec, + CTestStringDictionary00::ETokenValueFinal, + CTestStringDictionary00::ETokenValueGet, + CTestStringDictionary00::ETokenValueItem, + CTestStringDictionary00::ETokenValueLang, + CTestStringDictionary00::ETokenValueLocName, + CTestStringDictionary00::ETokenValueLocURI, + CTestStringDictionary00::ETokenValueMap, + CTestStringDictionary00::ETokenValueMapItem, + CTestStringDictionary00::ETokenValueMeta, + CTestStringDictionary00::ETokenValueMsgID, + CTestStringDictionary00::ETokenValueMsgRef, + CTestStringDictionary00::ETokenValueNoResp, + CTestStringDictionary00::ETokenValueNoResults, + CTestStringDictionary00::ETokenValuePut, + CTestStringDictionary00::ETokenValueReplace, + CTestStringDictionary00::ETokenValueRespURI, + CTestStringDictionary00::ETokenValueResults, + CTestStringDictionary00::ETokenValueSearch, + CTestStringDictionary00::ETokenValueSequence, + CTestStringDictionary00::ETokenValueSessionID, + CTestStringDictionary00::ETokenValueSftDel, + CTestStringDictionary00::ETokenValueSource, + CTestStringDictionary00::ETokenValueSourceRef, + CTestStringDictionary00::ETokenValueStatus, + CTestStringDictionary00::ETokenValueSync, + CTestStringDictionary00::ETokenValueSyncBody, + CTestStringDictionary00::ETokenValueSyncHdr, + CTestStringDictionary00::ETokenValueSyncML, + CTestStringDictionary00::ETokenValueTarget, + CTestStringDictionary00::ETokenValueTargetRef, + CTestStringDictionary00::ETokenValueReservedForFutureUse, + CTestStringDictionary00::ETokenValueVerDTD, + CTestStringDictionary00::ETokenValueVerProto, + CTestStringDictionary00::ETokenValueNumberOfChanges, + CTestStringDictionary00::ETokenValueMoreData, + 0}; // ok to end with zero as this is used by a global token + +#endif //__T_STRINGDICTIONARY00_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_stringdictionary00tagtable.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_stringdictionary00tagtable.st Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,70 @@ +# t_stringdictionary00tagtable.st +# +# Copyright (c) Symbian Software Ltd 2003 - 2007. All rights reserved. +# +# NOTE: For WBXML - Direct correlation on ordering of tag entries to the tag values +# the parser defines +# No empty lines allowed either +# +# Short String table +# +stringtable t_StringDictionary00TagTable +# ////////////////////////////////////////////////////////////////////// +!// Element names +!// CodePage 00 +EAdd Add +EAlert Alert +EArchive Archive +EAtomic Atomic +EChal Chal +ECmd Cmd +ECmdId CmdID +ECmdRef CmdRef +ECopy Copy +ECred Cred +EData Data +EDelete Delete +EExec Exec +EFinal Final +EGet Get +EItem Item +ELang Lang +ELocName LocName +ELocUri LocURI +EMap Map +EMapItem MapItem +EMeta Meta +EMsgId MsgID +EMsgRef MsgRef +ENoResp NoResp +ENoResults NoResults +EPut Put +EReplace Replace +ERespUri RespURI +EResults Results +ESearch Search +ESequence Sequence +ESessionId SessionID +ESftDel SftDel +ESource Source +ESourceRef SourceRef +EStatus Status +ESync Sync +ESyncBody SyncBody +ESyncHdr SyncHdr +ESyncMl SyncML +ETarget Target +ETargetRef TargetRef +!// We should never parse this but just incase we do the client +!// or test code will see it. +ETokenValueReservedForFutureUse ReservedForFutureUse +EVerDtd VerDTD +EVerProto VerProto +ETokenValueNumberOfChanges NumberOfChanges +ETokenValueMoreData MoreData +# ////////////////////////////////////////////////////////////////////// +!// For XML +EUrn TestStringDictionary:TestStringDictionary1.1 +!// For WBXML +EPublicId FD1~0 +EFormalPublicId -//TestStringDictionary//DTD TestStringDictionary 1.1//EN~0 diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_testconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_testconstants.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __T_TESTCONSTANTS_H__ +#define __T_TESTCONSTANTS_H__ + + +#include + + +const TInt KErrorCodeOnStartDocument = 0x01; +const TInt KErrorCodeOnEndDocument = 0x02; +const TInt KErrorCodeOnStartElement = 0x03; +const TInt KErrorCodeOnEndElement = 0x04; +const TInt KErrorCodeOnContent = 0x05; +const TInt KErrorCodeOnStartPrefixMapping = 0x06; +const TInt KErrorCodeOnEndPrefixMapping = 0x07; +const TInt KErrorCodeOnIgnorableWhiteSpace = 0x08; +const TInt KErrorCodeOnSkippedEntity = 0x09; +const TInt KErrorCodeOnProcessingInstruction = 0x0A; +const TInt KErrorCodeOnExtension = 0x0B; + + +#endif // __T_TESTCONSTANTS_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_testxmlparser1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_testxmlparser1.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,321 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of Test parser. +// +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "t_testconstants.h" + +using namespace Xml; + +class Tes1tXmlParser : public CBase, public MParser + { +public: + + static MParser* NewL(TAny* aInitParams); + virtual ~Tes1tXmlParser(); + + // From MParser + + TInt EnableFeature(TInt /*aParserFeature*/) + { + return KErrNotSupported; + } + TInt DisableFeature(TInt /*aParserFeature*/) + { + return KErrNone; + } + TBool IsFeatureEnabled(TInt /*aParserFeature*/) const + { + return EFalse; + } + void Release(); + void ParseChunkL (const TDesC8& aDescriptor); + void ParseLastChunkL(const TDesC8& aDescriptor); + + // From MContentSouce + + void SetContentSink (MContentHandler& aContentHandler); + + RStringPool& StringPool(); + +private: + + Tes1tXmlParser(TParserInitParams* aInitParams); + void ConstructL(); + + void DoParseL(); + + inline void OnStartDocumentL(); + inline void OnEndDocumentL(); + inline void OnStartElementL(); + inline void OnEndElementL(); + inline void OnContentL(); + inline void OnStartPrefixMappingL(); + inline void OnEndPrefixMappingL(); + inline void OnIgnorableWhiteSpaceL(); + inline void OnSkippedEntityL(); + inline void OnProcessingInstructionL(); + inline void OnExtensionL(); + inline void OnError(TInt aError); + +private: + MContentHandler* iContentHandler; + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + }; + +MParser* Tes1tXmlParser::NewL(TAny* aInitParams) + { + + Tes1tXmlParser* self = new(ELeave) Tes1tXmlParser(reinterpret_cast(aInitParams)); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return (static_cast(self)); + } + + + +Tes1tXmlParser::Tes1tXmlParser(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + + +void Tes1tXmlParser::ConstructL() + { + // do nothing; + } + + + +void Tes1tXmlParser::Release() + { + delete (this); + } + + + +Tes1tXmlParser::~Tes1tXmlParser() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + } + + +void Tes1tXmlParser::ParseChunkL (const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +void Tes1tXmlParser::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +RStringPool& Tes1tXmlParser::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + + +void Tes1tXmlParser::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + +void Tes1tXmlParser::DoParseL() +/** +This method is called when the request to parse a document is issued. +For testing purposes this method always generates one element event, +so the test suite can recognize the plugin parser it is using. + +*/ + { + OnStartDocumentL(); + OnStartElementL(); + OnEndElementL(); + OnEndDocumentL(); + } + + + +void Tes1tXmlParser::OnStartDocumentL() + { + RDocumentParameters documentParameters; + + iContentHandler->OnStartDocumentL(documentParameters, KErrorCodeOnStartDocument); + } + + +void Tes1tXmlParser::OnEndDocumentL() + { + iContentHandler->OnEndDocumentL(KErrorCodeOnEndDocument); + } + + + +void Tes1tXmlParser::OnStartElementL() + { + RTagInfo element; + RAttributeArray attributes; + + iContentHandler->OnStartElementL(element, attributes, KErrorCodeOnStartElement); + } + + +void Tes1tXmlParser::OnEndElementL() + { + RTagInfo element; + + iContentHandler->OnEndElementL(element, KErrorCodeOnEndElement); + } + + + +void Tes1tXmlParser::OnContentL() + { + const TBuf8<2> bytes; + + iContentHandler->OnContentL(bytes, KErrorCodeOnContent); + } + + + +void Tes1tXmlParser::OnStartPrefixMappingL() + { + RString prefix; + RString uri; + + iContentHandler->OnStartPrefixMappingL(prefix, uri, KErrorCodeOnStartPrefixMapping); + } + + +void Tes1tXmlParser::OnEndPrefixMappingL() + { + RString prefix; + + iContentHandler->OnEndPrefixMappingL(prefix, KErrorCodeOnEndPrefixMapping); + } + + + +void Tes1tXmlParser::OnIgnorableWhiteSpaceL() + { + const TBuf8<2> bytes; + + iContentHandler->OnIgnorableWhiteSpaceL(bytes, KErrorCodeOnIgnorableWhiteSpace); + } + + + +void Tes1tXmlParser::OnSkippedEntityL() + { + RString name; + + iContentHandler->OnSkippedEntityL(name, KErrorCodeOnSkippedEntity); + } + + + +void Tes1tXmlParser::OnProcessingInstructionL() + { + TBuf8<2> target; + TBuf8<2> data; + + iContentHandler->OnProcessingInstructionL(target, data, KErrorCodeOnProcessingInstruction); + } + + +void Tes1tXmlParser::OnExtensionL() + { + RString data; + TInt token = 0; + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(data, token, KErrorCodeOnExtension); + } + + +void Tes1tXmlParser::OnError(TInt aError) + { + iContentHandler->OnError(aError); + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x10273864,Tes1tXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x101F9782,Tes1tXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x101faa00,Tes1tXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x101faa01,Tes1tXmlParser::NewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_testxmlparser2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_testxmlparser2.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,322 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of Test parser. +// +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "t_testconstants.h" + +using namespace Xml; + +class Tes2tXmlParser : public CBase, public MParser + { +public: + + static MParser* NewL(TAny* aInitParams); + virtual ~Tes2tXmlParser(); + + // From MParser + + TInt EnableFeature(TInt /*aParserFeature*/) + { + return KErrNotSupported; + } + TInt DisableFeature(TInt /*aParserFeature*/) + { + return KErrNone; + } + TBool IsFeatureEnabled(TInt /*aParserFeature*/) const + { + return EFalse; + } + void Release(); + void ParseChunkL (const TDesC8& aDescriptor); + void ParseLastChunkL(const TDesC8& aDescriptor); + + // From MContentSouce + + void SetContentSink (MContentHandler& aContentHandler); + + RStringPool& StringPool(); + +private: + + Tes2tXmlParser(TParserInitParams* aInitParams); + void ConstructL(); + + void DoParseL(); + + inline void OnStartDocumentL(); + inline void OnEndDocumentL(); + inline void OnStartElementL(); + inline void OnEndElementL(); + inline void OnContentL(); + inline void OnStartPrefixMappingL(); + inline void OnEndPrefixMappingL(); + inline void OnIgnorableWhiteSpaceL(); + inline void OnSkippedEntityL(); + inline void OnProcessingInstructionL(); + inline void OnExtensionL(); + inline void OnError(TInt aError); + +private: + MContentHandler* iContentHandler; + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + }; + +MParser* Tes2tXmlParser::NewL(TAny* aInitParams) + { + + Tes2tXmlParser* self = new(ELeave) Tes2tXmlParser(reinterpret_cast(aInitParams)); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return (static_cast(self)); + } + + + +Tes2tXmlParser::Tes2tXmlParser(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + + +void Tes2tXmlParser::ConstructL() + { + // do nothing; + } + + + +void Tes2tXmlParser::Release() + { + delete (this); + } + + + +Tes2tXmlParser::~Tes2tXmlParser() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + } + + +void Tes2tXmlParser::ParseChunkL (const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +void Tes2tXmlParser::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +RStringPool& Tes2tXmlParser::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + + +void Tes2tXmlParser::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + + +void Tes2tXmlParser::DoParseL() +/** +This method is called when the request to parse a document is issued. +For testing purposes this method always generates two element events, +so the test suite can recognize the plugin parser it is using. + +*/ + { + OnStartDocumentL(); + OnStartElementL(); + OnEndElementL(); + OnStartElementL(); + OnEndElementL(); + OnEndDocumentL(); + } + + + +void Tes2tXmlParser::OnStartDocumentL() + { + RDocumentParameters documentParameters; + + iContentHandler->OnStartDocumentL(documentParameters, KErrorCodeOnStartDocument); + } + + +void Tes2tXmlParser::OnEndDocumentL() + { + iContentHandler->OnEndDocumentL(KErrorCodeOnEndDocument); + } + + + +void Tes2tXmlParser::OnStartElementL() + { + RTagInfo element; + RAttributeArray attributes; + + iContentHandler->OnStartElementL(element, attributes, KErrorCodeOnStartElement); + } + + +void Tes2tXmlParser::OnEndElementL() + { + RTagInfo element; + + iContentHandler->OnEndElementL(element, KErrorCodeOnEndElement); + } + + + +void Tes2tXmlParser::OnContentL() + { + const TBuf8<2> bytes; + + iContentHandler->OnContentL(bytes, KErrorCodeOnContent); + } + + + +void Tes2tXmlParser::OnStartPrefixMappingL() + { + RString prefix; + RString uri; + + iContentHandler->OnStartPrefixMappingL(prefix, uri, KErrorCodeOnStartPrefixMapping); + } + + +void Tes2tXmlParser::OnEndPrefixMappingL() + { + RString prefix; + + iContentHandler->OnEndPrefixMappingL(prefix, KErrorCodeOnEndPrefixMapping); + } + + + +void Tes2tXmlParser::OnIgnorableWhiteSpaceL() + { + const TBuf8<2> bytes; + + iContentHandler->OnIgnorableWhiteSpaceL(bytes, KErrorCodeOnIgnorableWhiteSpace); + } + + + +void Tes2tXmlParser::OnSkippedEntityL() + { + RString name; + + iContentHandler->OnSkippedEntityL(name, KErrorCodeOnSkippedEntity); + } + + + +void Tes2tXmlParser::OnProcessingInstructionL() + { + TBuf8<2> target; + TBuf8<2> data; + + iContentHandler->OnProcessingInstructionL(target, data, KErrorCodeOnProcessingInstruction); + } + + +void Tes2tXmlParser::OnExtensionL() + { + RString data; + TInt token = 0; + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(data, token, KErrorCodeOnExtension); + } + + +void Tes2tXmlParser::OnError(TInt aError) + { + iContentHandler->OnError(aError); + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x10273866,Tes2tXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x101faa02,Tes2tXmlParser::NewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_validator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_validator.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,253 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Written to test compilation +// +// + +#include +#include // RDebug +#include + +#include + +using namespace Xml; + +#include "t_validator.h" +#include "t_testconstants.h" + + +_LIT(KTestMsgPrefix, "CValidator::"); + + +MContentProcessor* CValidator::NewL(TAny* aInitParams) + { + CValidator* self = new(ELeave) CValidator(reinterpret_cast(aInitParams)); + return (static_cast(self)); + } + + +CValidator::CValidator(TContentProcessorInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)) + { + } + + +CValidator::~CValidator() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iElementStack = NULL; + } + + + +void CValidator::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnStartDocumentL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnStartDocument, User::Invariant()); + iContentHandler->OnStartDocumentL(aDocParam, aErrorCode); + } + + +void CValidator::OnEndDocumentL(TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnEndDocumentL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnEndDocument, User::Invariant()); + iContentHandler->OnEndDocumentL(aErrorCode); + } + +void CValidator::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttribute, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnStartElementL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnStartElement, User::Invariant()); + iContentHandler->OnStartElementL(aElement, aAttribute, aErrorCode); + } + +void CValidator::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnEndElementL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnEndElement, User::Invariant()); + iContentHandler->OnEndElementL(aElement, aErrorCode); + } + +void CValidator::OnContentL(const TDesC8& aBytes, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnContentL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnContent, User::Invariant()); + iContentHandler->OnContentL(aBytes, aErrorCode); + } + +void CValidator::OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnStartPrefixMappingL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnStartPrefixMapping, User::Invariant()); + iContentHandler->OnStartPrefixMappingL(aPrefix, aUri, aErrorCode); + } + +void CValidator::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnEndPrefixMappingL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnEndPrefixMapping, User::Invariant()); + iContentHandler->OnEndPrefixMappingL(aPrefix, aErrorCode); + } + +void CValidator::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnIgnorableWhiteSpaceL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnIgnorableWhiteSpace, User::Invariant()); + iContentHandler->OnIgnorableWhiteSpaceL(aBytes, aErrorCode); + } + +void CValidator::OnSkippedEntityL(const RString& aName, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnSkippedEntityL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnSkippedEntity, User::Invariant()); + iContentHandler->OnSkippedEntityL(aName, aErrorCode); + } + +void CValidator::OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnProcessingInstructionL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnProcessingInstruction, User::Invariant()); + iContentHandler->OnProcessingInstructionL(aTarget, aData, aErrorCode); + } + +void CValidator::OnError(TInt aError) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnError\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + iContentHandler->OnError(aError); + } + +TAny* CValidator::GetExtendedInterface(const TInt32 aUid) +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + { + if (aUid == MWbxmlExtensionHandler::EExtInterfaceUid) + { + return static_cast(this); + } + return 0; + } + + +// From MWbxmlExtensionHandler + +void CValidator::OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode) + { + TBuf<50> wholeMsg(KTestMsgPrefix); + _LIT(KFuncName, "OnExtensionL\n"); + wholeMsg.Append(KFuncName); + RDebug::Print(wholeMsg); + + __ASSERT_ALWAYS(aErrorCode == KErrorCodeOnExtension, User::Invariant()); + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(aData, aToken, aErrorCode); + } + + +// From MContentSource + +void CValidator::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + + +// From MContentProcessor + +void CValidator::Release() + { + delete (this); + } + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x101FAA11,CValidator::NewL) +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_validator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_validator.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,86 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __T_VALIDATOR_H__ +#define __T_VALIDATOR_H__ + +#include +#include +#include + + +class CValidator : public CBase, public MWbxmlExtensionHandler, public MContentProcessor + { +public: + static MContentProcessor* NewL(TAny* aInitParams); + virtual ~CValidator(); + + + // From MContentHandler + + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttribute, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + + // From MContentSource + + void SetContentSink (MContentHandler& aContentHandler); + + + void OnError(TInt aErrorCode); + + + // From MWbxmlExtensionHandler + void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); + + // From MContentProcessor + void Release(); + +private: + + CValidator(TContentProcessorInitParams* aInitParams); + +private: + +/** +The child to callback. +We do not own this. +*/ + MContentHandler* iContentHandler; + +/** +Useful stringpool collection of RStrings. +We do not own this. +*/ + RStringDictionaryCollection* iStringDictionaryCollection; + +/** +A stack that helps correllate the start and end of elements. +We do not own this. +*/ + RElementStack* iElementStack; + + }; + + +#endif //__T_VALIDATOR_H__ diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/t_xmlcore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/t_xmlcore.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,885 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_testconstants.h" + +_LIT8(KDictionaryUri, "-//TestStringDictionary//DTD TestStringDictionary 1.1//EN~0"); +_LIT8(KParserMimeType, "text/testparser"); + +const TUid KValidatorImplUid = {0x101FAA11}; +const TUid KNonExistantValidator = {0x101FD197}; + +using namespace Xml; + +class RCoreTests : public RTest, public MWbxmlExtensionHandler, public MContentHandler + { +public: + RCoreTests(); + + void RunTest(); + + // From MContentHandler + void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttribute, TInt aErrorCode); + void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + + void OnError(TInt aErrorCode); + + + // From MWbxmlExtensionHandler + void OnExtensionL(const RString& aData, TInt aToken, TInt aErrorCode); + +private: + void RunTestL(); + + typedef void (*TestFunc) (void); + + void DoTestL(TestFunc testFuncL, const TDesC& aDesc); + void DoOomTest(TestFunc testFuncL, const TDesC& aDesc); + + }; + + +RCoreTests::RCoreTests(): + RTest(_L("XML Framework Core")) + { + } + +// Core framework tests +void SimpleL(); +void NoProcessorsL(); +void OneProcessorL(); +void ManyProcessorsL(); +void BadDictionaryL(); +void BadParserL(); +void BadChainL(); +void ParserL(); +void EmptyChunkL(); +void TagInfoL(); +void TagInfo2L(); +void AttributeL(); +void Attribute2L(); +void Attribute3L(); +void DocumentParamsL(); +void DocumentParams2L(); + +void RCoreTests::RunTestL() + { + DoTestL(SimpleL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1255 Simple test... ")); + DoTestL(NoProcessorsL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1256 Chain with no processors... ")); + DoTestL(OneProcessorL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1257 Chain with 1 processor... ")); + DoTestL(ManyProcessorsL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1258 Chain with many processors... ")); + DoTestL(BadDictionaryL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1259 Non-existing dictionary... ")); + DoTestL(BadParserL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1260 Non-existing parser->.. ")); + DoTestL(BadChainL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1261 Non-existing processors... ")); + DoTestL(ParserL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1262 Parser test... ")); + DoTestL(EmptyChunkL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1263 Parsing an empty chunk... ")); + DoTestL(TagInfoL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1264 RTagInfo... ")); + DoTestL(TagInfo2L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1265 More RTagInfo... ")); + DoTestL(AttributeL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1266 RAttribute... ")); + DoTestL(Attribute2L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1267 More RAttribute... ")); + DoTestL(Attribute3L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1268 Even more RAttribute... ")); + DoTestL(DocumentParamsL, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1269 RDocumentParameters... ")); + DoTestL(DocumentParams2L, _L(" @SYMTestCaseID:SYSLIB-XML-CT-1270 More RDocumentParameters... ")); + } + +void RCoreTests::RunTest() + { + Title(); + Start(_L("XML Framework Core")); + + TRAPD(err,RunTestL()); + + if (err != KErrNone) + User::Panic(_L("Testing failed: "),err); + + //Getch(); + + End(); + Close(); + } + +RCoreTests test; + +void RCoreTests::DoTestL(TestFunc aTestFuncL, const TDesC& aDesc) + { + Next(aDesc); + + // Set up for heap leak checking + __UHEAP_MARK; + + // and leaking thread handles + TInt startProcessHandleCount; + TInt startThreadHandleCount; + TInt endProcessHandleCount; + TInt endThreadHandleCount; + + // Test Starts... + + RThread thisThread; + thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount); + + (*aTestFuncL)(); + + REComSession::FinalClose(); // Don't want leaks outside the test + + //-------------- + // Check for open handles + thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount); + + test(startThreadHandleCount == endThreadHandleCount); + + __UHEAP_MARKEND; + + DoOomTest(aTestFuncL, aDesc); + + } + + +/** +@SYMTestCaseID SYSLIB-XML-CT-3733 +@SYMTestCaseDesc Out of memory testing. +@SYMTestPriority Medium +@SYMTestActions Running the test set in low memory conditions. +@SYMTestExpectedResults The tests perform as expected in low memory conditions. +@SYMREQ REQ0000 +*/ +void RCoreTests::DoOomTest(TestFunc testFuncL, const TDesC& /*aDesc*/) + { + Printf(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3733 OOM test ")); + + TInt err, tryCount = 0; + do + { + User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++tryCount); + User::__DbgMarkStart(RHeap::EUser); + TRAP(err, (*testFuncL)()); + User::__DbgMarkEnd(RHeap::EUser, 0); + } while(err==KErrNoMemory); + + if(err==KErrNone) + { + // Reset + User::__DbgSetAllocFail(RHeap::EUser,RHeap::ENone,1); + } + else + { + User::Panic(_L("Unexpected leave reason"),err); + } + + Printf(_L("- succeeded with rate %i\r\n"), tryCount); + } + + + +// From MContentHandler + +// maps to SAX 2.0 startDocument method. +void RCoreTests::OnStartDocumentL(const RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnStartDocument); + } + + + // maps to SAX 2.0 endDocument method. +void RCoreTests::OnEndDocumentL(TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnEndDocument); + } + + +// maps to SAX 2.0 startElement method. +void RCoreTests::OnStartElementL(const RTagInfo& /*aElement*/, const RAttributeArray& /*aAttribute*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnStartElement); + } + + +// maps to SAX 2.0 endElement method. +void RCoreTests::OnEndElementL(const RTagInfo& /*aElement*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnEndElement); + } + + +// maps to SAX 2.0 characters method. +void RCoreTests::OnContentL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnContent); + } + + +// maps to SAX 2.0 startPrefixMapping method. +void RCoreTests::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnStartPrefixMapping); + } + + +// maps to SAX 2.0 endPrefixMapping method. +void RCoreTests::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnEndPrefixMapping); + } + + +// maps to SAX 2.0 ignorableWhitespace method. +void RCoreTests::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnIgnorableWhiteSpace); + } + + +// maps to SAX 2.0 skippedEntity method. +void RCoreTests::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnSkippedEntity); + } + + +// maps to SAX 2.0 processingInstruction method. +void RCoreTests::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnProcessingInstruction); + } + + +// NOTE: SAX 2.0 setDocumentLocator method not supported. + +void RCoreTests::OnExtensionL(const RString& /*aData*/, TInt /*aToken*/, TInt aErrorCode) + { + test(aErrorCode == KErrorCodeOnExtension); + } + + + +void RCoreTests::OnError(TInt aErrorCode) + { + test (aErrorCode == KErrEof); + } + + +TAny* RCoreTests::GetExtendedInterface(const TInt32 aUid) +/** +This method obtains the interface matching the specified uid. +@return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. +@param aUid the uid identifying the required interface. +*/ + { + if (aUid == MWbxmlExtensionHandler::EExtInterfaceUid) + { + return static_cast(this); + } + return 0; + } + + +//---------------------------------------------------------------------------- +//Basic Framework Tests + +/** +@SYMTestCaseID SYSLIB-XML-CT-1255 +@SYMTestCaseDesc Tests for XML parser CParser::AddPreloadedDictionaryL() function +@SYMTestPriority High +@SYMTestActions Tests for loading a string dictionary prior to parsing. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void SimpleL() + { + + CParser* parser = CParser::NewLC(KParserMimeType, test); + parser->AddPreloadedDictionaryL(KDictionaryUri); + CleanupStack::PopAndDestroy(parser); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1256 +@SYMTestCaseDesc Tests for XML parser CParser::AddPreloadedDictionaryL(),CParser::SetProcessorChainL() functions +@SYMTestPriority High +@SYMTestActions Tests for changing the client and plugin chain,loading a string dictionary prior to parsing. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void NoProcessorsL() + { + + CParser* parser = CParser::NewLC(KParserMimeType, test); + + RContentProcessorUids pUids; + CleanupClosePushL(pUids); + + parser->SetProcessorChainL(pUids); + parser->AddPreloadedDictionaryL(KDictionaryUri); + + CleanupStack::PopAndDestroy(&pUids); + CleanupStack::PopAndDestroy(parser); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1257 +@SYMTestCaseDesc Tests for XML parser CParser::AddPreloadedDictionaryL,SetProcessorChainL functions +@SYMTestPriority High +@SYMTestActions Tests for changing the client and plugin chain,loading a string dictionary prior to parsing. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void OneProcessorL() + { + + RContentProcessorUids pUids; + CleanupClosePushL(pUids); + + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + CParser* parser = CParser::NewLC(KParserMimeType, test); + parser->SetProcessorChainL(pUids); + parser->AddPreloadedDictionaryL(KDictionaryUri); + + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(&pUids); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1258 +@SYMTestCaseDesc Tests for XML parser CParser::AddPreloadedDictionaryL(),CParser::SetProcessorChainL() functions +@SYMTestPriority High +@SYMTestActions Tests for changing the client and plugin chain,loading a string dictionary prior to parsing. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void ManyProcessorsL() + { + + RContentProcessorUids pUids; + CleanupClosePushL(pUids); + + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + + CParser* parser = CParser::NewLC(KParserMimeType, test); + parser->SetProcessorChainL(pUids); + parser->AddPreloadedDictionaryL(KDictionaryUri); + + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(&pUids); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1259 +@SYMTestCaseDesc Tests for XML parser CParser::AddPreloadedDictionaryL() function +@SYMTestPriority High +@SYMTestActions Tests for loading a bad string dictionary prior to parsing. + Tests for memory error and non availability of XML string dictionary plugin +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void BadDictionaryL() + { + + _LIT8(KNonexistantDictionaryUri, "NONEXISTANT:NONEXISTANT1.0"); + CParser* parser = CParser::NewLC(KParserMimeType, test); + TRAPD(err, parser->AddPreloadedDictionaryL(KNonexistantDictionaryUri)); + if (err == KErrNoMemory) + { + User::Leave(err); + } + test(err == KErrXmlStringDictionaryPluginNotFound); + + CleanupStack::PopAndDestroy(parser); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1260 +@SYMTestCaseDesc Tests for bad XML parser CParser +@SYMTestPriority High +@SYMTestActions Tests for noexistant parser.Check for out of memory and pulgin not found errors. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void BadParserL() + { + + CParser* parser = NULL; + + _LIT8(KNonexistantParserMimeType, "NONEXISTANT PARSER MIME TYPE"); + TRAPD(err, parser = CParser::NewLC(KNonexistantParserMimeType, test)); + + // For OOM tests + if (err == KErrNoMemory) + { + User::Leave(err); + } + + test(err == KErrXmlParserPluginNotFound); + + if(err == KErrNone) + { + CleanupStack::PopAndDestroy(parser); + } + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1261 +@SYMTestCaseDesc Tests for bad client and plugin chain.CParser::SetProcessorChainL() function +@SYMTestPriority High +@SYMTestActions Tests for out of memory,plugin not found errors +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void BadChainL() + { + + RContentProcessorUids pUids; + CleanupClosePushL(pUids); + + User::LeaveIfError(pUids.Append(KNonExistantValidator)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + + CParser* parser = CParser::NewLC(KParserMimeType, test); + TRAPD(err, parser->SetProcessorChainL(pUids)); + + // For OOM tests + if (err == KErrNoMemory) + { + User::Leave(KErrNoMemory); + } + + test (err == KErrXmlPluginNotFound); + + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(&pUids); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1262 +@SYMTestCaseDesc Tests for loading new XML parser . +@SYMTestPriority High +@SYMTestActions Tests for CParser::NewLC() function +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void ParserL() + { + + CParser* parser = CParser::NewLC(KParserMimeType, test); + CleanupStack::PopAndDestroy(parser); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1263 +@SYMTestCaseDesc Tests for XML parser +@SYMTestPriority High +@SYMTestActions Tests for empty chunk to parse +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void EmptyChunkL() + { + + RContentProcessorUids pUids; + CleanupClosePushL(pUids); + + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + User::LeaveIfError(pUids.Append(KValidatorImplUid)); + CParser* parser = CParser::NewLC(KParserMimeType, test); + parser->SetProcessorChainL(pUids); + parser->AddPreloadedDictionaryL(KDictionaryUri); + + TBuf8<10> nothing; + ParseL(*parser, nothing); + + CleanupStack::PopAndDestroy(parser); + CleanupStack::PopAndDestroy(&pUids); + } + +_LIT8 (KTestString1, "This is a test string1."); +_LIT8 (KTestString2, "This is a test string2."); +_LIT8 (KTestString3, "This is a test string3."); +_LIT8 (KTestString4, "This is a test string4."); + +/** +@SYMTestCaseID SYSLIB-XML-CT-1264 +@SYMTestCaseDesc Tests for RTagInfo::Uri(),RTagInfo::Prefix(),RTagInfo::LocalName() functions +@SYMTestPriority High +@SYMTestActions Tests for creating a tag info with three strings. + Read them back and test for integrity of the data. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void TagInfoL() + { + + RStringPool sp; + CleanupClosePushL(sp); + sp.OpenL(); + + RString string1 = sp.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = sp.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = sp.OpenStringL(KTestString3); + + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&sp); + + RTagInfo tagInfo; + tagInfo.Open(string1, string2, string3); + + const RString& uri = tagInfo.Uri(); + const RString& prefix = tagInfo.Prefix(); + const RString& localName = tagInfo.LocalName(); + + test (KTestString1() == uri.DesC()); + test (KTestString2() == prefix.DesC()); + test (KTestString3() == localName.DesC()); + + tagInfo.Close(); + sp.Close(); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1265 +@SYMTestCaseDesc Tests for RTagInfo's constructor functions +@SYMTestPriority High +@SYMTestActions Create three RTagInfo objects using assignment operator,copy constructor,and Copy function with the same information that describes an element. + Tests for the integrity of the data of all the three objects. +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void TagInfo2L() + { + + RStringPool sp; + CleanupClosePushL(sp); + sp.OpenL(); + + RString string1 = sp.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = sp.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = sp.OpenStringL(KTestString3); + + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&sp); + + RTagInfo tagInfo; + tagInfo.Open(string1, string2, string3); + RTagInfo tagInfo2 = tagInfo; + RTagInfo tagInfo3 (tagInfo); + RTagInfo tagInfo4 = tagInfo.Copy(); + + const RString& uri = tagInfo.Uri(); + const RString& prefix = tagInfo.Prefix(); + const RString& localName = tagInfo.LocalName(); + + test (KTestString1() == uri.DesC()); + test (KTestString2() == prefix.DesC()); + test (KTestString3() == localName.DesC()); + + test (KTestString1() == tagInfo2.Uri().DesC()); + test (KTestString2() == tagInfo2.Prefix().DesC()); + test (KTestString3() == tagInfo2.LocalName().DesC()); + + test (KTestString1() == tagInfo3.Uri().DesC()); + test (KTestString2() == tagInfo3.Prefix().DesC()); + test (KTestString3() == tagInfo3.LocalName().DesC()); + + test (KTestString1() == tagInfo4.Uri().DesC()); + test (KTestString2() == tagInfo4.Prefix().DesC()); + test (KTestString3() == tagInfo4.LocalName().DesC()); + + tagInfo.Close(); + tagInfo4.Close(); + sp.Close(); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1266 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute class +@SYMTestPriority High +@SYMTestActions Tests for the information of RTagInfo objects +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void AttributeL() + { + + RStringPool sp; + sp.OpenL(); + CleanupClosePushL(sp); + + RString string1 = sp.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = sp.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = sp.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = sp.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&sp); + + RAttribute attribute; + attribute.Open(string1, string2, string3); + attribute.SetValue(string4); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + attribute.Close(); + sp.Close(); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1267 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute::Uri(),Prefix(),LocalName() functions +@SYMTestPriority High +@SYMTestActions Create three RAttribute objects using copy constructor,assignment operator and Copy function.Test for information of RAttribute objects +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void Attribute2L() + { + + RStringPool sp; + sp.OpenL(); + CleanupClosePushL(sp); + + RString string1 = sp.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = sp.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = sp.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = sp.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&sp); + + RAttribute attribute; + attribute.Open(string1, string2, string3, string4); + RAttribute attribute2 = attribute; + RAttribute attribute3 (attribute); + RAttribute attribute4 = attribute.Copy(); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + test (KTestString1() == attribute2.Attribute().Uri().DesC()); + test (KTestString2() == attribute2.Attribute().Prefix().DesC()); + test (KTestString3() == attribute2.Attribute().LocalName().DesC()); + test (KTestString4() == attribute2.Value().DesC()); + test (EAttributeType_NONE == attribute2.Type()); + + test (KTestString1() == attribute3.Attribute().Uri().DesC()); + test (KTestString2() == attribute3.Attribute().Prefix().DesC()); + test (KTestString3() == attribute3.Attribute().LocalName().DesC()); + test (KTestString4() == attribute3.Value().DesC()); + test (EAttributeType_NONE == attribute3.Type()); + + test (KTestString1() == attribute4.Attribute().Uri().DesC()); + test (KTestString2() == attribute4.Attribute().Prefix().DesC()); + test (KTestString3() == attribute4.Attribute().LocalName().DesC()); + test (KTestString4() == attribute4.Value().DesC()); + test (EAttributeType_NONE == attribute4.Type()); + + attribute.Close(); + attribute4.Close(); + sp.Close(); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1268 +@SYMTestCaseDesc Tests for RTagInfo created from RAttribute::Uri,Prefix,LocalName functions +@SYMTestPriority High +@SYMTestActions Create RAttribute Test for information of RAttribute objects +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void Attribute3L() + { + + RStringPool sp; + sp.OpenL(); + CleanupClosePushL(sp); + + RString string1 = sp.OpenStringL(KTestString1); + CleanupClosePushL(string1); + + RString string2 = sp.OpenStringL(KTestString2); + CleanupClosePushL(string2); + + RString string3 = sp.OpenStringL(KTestString3); + CleanupClosePushL(string3); + + RString string4 = sp.OpenStringL(KTestString4); + + CleanupStack::Pop(&string3); + CleanupStack::Pop(&string2); + CleanupStack::Pop(&string1); + CleanupStack::Pop(&sp); + + RAttribute attribute; + attribute.Open(string1, string2, string3, string4); + + const RTagInfo& tagInfo = attribute.Attribute(); + const RString& value = attribute.Value(); + TAttributeType type = attribute.Type(); + + test (KTestString1() == tagInfo.Uri().DesC()); + test (KTestString2() == tagInfo.Prefix().DesC()); + test (KTestString3() == tagInfo.LocalName().DesC()); + test (KTestString4() == value.DesC()); + test (EAttributeType_NONE == type); + + attribute.Close(); + sp.Close(); + } + +_LIT8 (KCharSetName, "Test Charset name."); + +/** +@SYMTestCaseID SYSLIB-XML-CT-1269 +@SYMTestCaseDesc Tests for information of the document to be passed to client RDocumentParameters::CharacterSetName() functions +@SYMTestPriority High +@SYMTestActions Tests for the character set name of document +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void DocumentParamsL() + { + + RStringPool sp; + sp.OpenL(); + CleanupClosePushL(sp); + + RString characterSetName = sp.OpenStringL(KCharSetName); + + CleanupStack::Pop(&sp); + + RDocumentParameters docParam; + docParam.Open(characterSetName); + + test (KCharSetName() == docParam.CharacterSetName().DesC()); + + docParam.Close(); + sp.Close(); + } + +/** +@SYMTestCaseID SYSLIB-XML-CT-1270 +@SYMTestCaseDesc Tests for information of the document to be passed to client RDocumentParameters::CharacterSetName() functions +@SYMTestPriority High +@SYMTestActions Tests for the character set name of document +@SYMTestExpectedResults Test must not fail +@SYMREQ REQ0000 +*/ +void DocumentParams2L() + { + + RStringPool sp; + sp.OpenL(); + CleanupClosePushL(sp); + + RString characterSetName = sp.OpenStringL(KCharSetName); + CleanupStack::Pop(&sp); + + RDocumentParameters docParam; + docParam.Open(characterSetName); + + test (KCharSetName() == docParam.CharacterSetName().DesC()); + + docParam.Close(); + sp.Close(); + } + + + + +TInt E32Main() + { + CTrapCleanup* tc=CTrapCleanup::New(); + + __UHEAP_MARK; + test.RunTest(); + __UHEAP_MARKEND; + + delete tc; + User::Heap().Check(); + return 0; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tc_customresolvercomptests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tc_customresolvercomptests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,734 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of Component Tests for CR JROE6C2LB7. +// Those tests are based on the parser plugins provided with Symbian OS +// and test parsers written for this purpose: +// 1. XML parser - production code (mime type: text/xml, variant ID: Symbian) +// 2. WBXML parser - production code (mime type: text/wbxml, variant ID: Symbian) +// 3. XML/WBXML parser - test code (mime type: text/xml||text/wbxml, variant ID: SymbianExtended) +// 4. XML parser - test code (mime type: text/xml, variant ID: SymbianExtended) +// 5 XML parser - test code (mime type: text/testparser, variant ID: ) +// If the number of Symbian production parsers is changed, +// those test could require necessary updates. +// +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include + +#include +#include +#include +#include + +#include "contenthandlers.h" + +using namespace Xml; + +_LIT(KXmlTestSimpleTestFile, "z:\\System\\XmlTest\\Resolver\\simple.xml"); +_LIT8(KXmlTestParserMimeType, "text/xml"); +_LIT8(KXmlTestParserMimeTypeCS, "TEXT/XML"); +_LIT8(KXmlTestWbXmlParserMimeType, "text/wbxml"); +_LIT8(KXmlTestSymbianString, "Symbian"); +_LIT8(KXmlTestSymbianStringCS, "SYMBIAN"); +_LIT8(KXmlTestSymbianExtendedString, "SymbianExtended"); +_LIT8(KXmlTestTestParser, "text/testparser"); + +RTest test(_L("t_XmlCustomResolverTests")); + +//========================================================================= +// Class declaration + +class CXmlCustomResolverTests : public CBase +{ +public: + CXmlCustomResolverTests(); + +public: + // The tests to run + void Test1L(RFs& aRFs); + void Test2L(); + void Test3L(RFs& aRFs); + void Test4L(RFs& aRFs); + void Test5L(); + void Test6L(); + void Test7L(); + void Test8L(); + void Test9L(RFs& aRFs); + void Test10L(RFs& aRFs); + void Test11L(); + void Test12L(); + void Test13L(RFs& aRFs); + void Test14L(RFs& aRFs); +}; + + + +//========================================================================= +// Class constructor +CXmlCustomResolverTests::CXmlCustomResolverTests() + { + } + +//========================================================================= + +/** +Test Xmlparser creation - 1. +MimeType: text/xml +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements > 0 + Any XML parser + +@SYMTestCaseID SYSLIB-XML-CT-1377 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test1L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1377 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeType); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + CParser* parser = NULL; + parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements>0); + delete parser; parser = NULL; + + // NewLC test + handler->iNumElements = 0; + parser = CParser::NewLC(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements>0); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + + +/** +Test Xmlparser creation - 2. +MimeType: text/xml +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: TRUE + +Expected: leave, KErrXmlMoreThanOneParserMatched + +@SYMTestCaseID SYSLIB-XML-CT-1378 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test2L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1378 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetLeaveOnMany(ETrue); + + // NewL test + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + TRAPD(err, CParser::NewL(*matchData, *handler)); + test(err == KErrXmlMoreThanOneParserMatched); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test(err == KErrXmlMoreThanOneParserMatched); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser creation - 3. +MimeType: text/xml +Variant: Symbian +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements == 6 + Production, Symbian parser. + +@SYMTestCaseID SYSLIB-XML-CT-1379 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test3L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1379 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetVariantL(KXmlTestSymbianString); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL + CParser* parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements==6); + delete parser; parser = NULL; + + // NewLC + parser = CParser::NewLC(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements==6); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + +/** +Test Xmlparser creation - 4. +MimeType: text/xml +Variant: SymbianExtended +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements == 1 || handler->iNumElements == 2 + Either of two test parsers. + +@SYMTestCaseID SYSLIB-XML-CT-1380 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test4L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1380 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetVariantL(KXmlTestSymbianExtendedString); + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + CParser* parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements==1 || handler->iNumElements==2 ); + delete parser; parser = NULL; + + // NewLC test + parser = CParser::NewLC(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements==1 || handler->iNumElements==2 ); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + +/** +Test Xmlparser createion - 5. +MimeType: text/xml +Variant: SymbianExtended +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: TRUE + +Expected: leave, KErrXmlMoreThanOneParserMatched + +@SYMTestCaseID SYSLIB-XML-CT-1381 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test5L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1381 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetVariantL(KXmlTestSymbianExtendedString); + matchData->SetLeaveOnMany(ETrue); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + TRAPD(err, CParser::NewL(*matchData, *handler)); + test (err == KErrXmlMoreThanOneParserMatched); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test (err == KErrXmlMoreThanOneParserMatched); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser createion - 6. +MimeType: text/wbxml +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: any of wbxml parsers + +@SYMTestCaseID SYSLIB-XML-CT-1382 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test6L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1382 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestWbXmlParserMimeType); + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + CParser* parser = CParser::NewL(*matchData, *handler); + delete parser; parser = NULL; + + // NewLC test + parser = CParser::NewLC(*matchData, *handler); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + +/** +Test Xmlparser createion - 7. +MimeType: text/wbxml +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: TRUE + +Expected: leave, KErrXmlMoreThanOneParserMatched + +@SYMTestCaseID SYSLIB-XML-CT-1383 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test7L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1383 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestWbXmlParserMimeType); + matchData->SetLeaveOnMany(ETrue); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + TRAPD(err, CParser::NewL(*matchData, *handler)); + test(err == KErrXmlMoreThanOneParserMatched); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test(err == KErrXmlMoreThanOneParserMatched); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser createion - 8. +MimeType: TEXT/XML +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: leave, KErrXmlParserPluginNotFound + +@SYMTestCaseID SYSLIB-XML-CT-1384 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test8L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1384 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeTypeCS); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + TRAPD(err, CParser::NewL(*matchData, *handler)); + test(err == KErrXmlParserPluginNotFound); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test(err == KErrXmlParserPluginNotFound); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser createion - 9. +MimeType: TEXT/XML +Variant: NULL +CaseSensitivity: FALSE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements > 0 + Any XML parser + +@SYMTestCaseID SYSLIB-XML-CT-1385 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test9L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1385 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeTypeCS); + matchData->SetCaseSensitivity(EFalse); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + CParser* parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements > 0); + delete parser; parser = NULL; + + // NewLC test + parser = CParser::NewLC(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements > 0); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + +/** +Test Xmlparser createion - 10. +MimeType: TEXT/XML +Variant: SYMBIAN +CaseSensitivity: FALSE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements > 0 + Any XML parser + +@SYMTestCaseID SYSLIB-XML-CT-1386 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test10L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1386 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeTypeCS); + matchData->SetVariantL(KXmlTestSymbianStringCS); + matchData->SetCaseSensitivity(EFalse); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + CParser* parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements == 6); + delete parser; parser = NULL; + + // NewLC test + parser = CParser::NewLC(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements == 6); + + delete handler; + CleanupStack::PopAndDestroy(2, matchData); + } + +/** +Test Xmlparser createion - 11. +MimeType: TEXT/XML +Variant: SYMBIAN +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumElements > 0 + Any XML parser + +@SYMTestCaseID SYSLIB-XML-CT-3752 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test11L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3752 ")); + + CMatchData* matchData = CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlTestParserMimeTypeCS); + matchData->SetVariantL(KXmlTestSymbianStringCS); + matchData->SetCaseSensitivity(ETrue); + + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + TRAPD(err, CParser::NewL(*matchData, *handler)); + test(err == KErrXmlParserPluginNotFound); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test(err == KErrXmlParserPluginNotFound); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser creation - 12. +MimeType: NULL +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: Leave, KErrArgument - mime type mandatory + +@SYMTestCaseID SYSLIB-XML-CT-3753 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test12L() + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3753 ")); + + CMatchData* matchData = CMatchData::NewLC(); + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // NewL test + TRAPD(err, CParser::NewL(*matchData, *handler)); + test(err == KErrArgument); + + // NewLC test + TRAP(err, CParser::NewLC(*matchData, *handler)); + test(err == KErrArgument); + + delete handler; + CleanupStack::PopAndDestroy(matchData); + + } + +/** +Test Xmlparser creation - 13. +MimeType: text/testparser +Variant: NULL +CaseSensitivity: TRUE +Rom-Only: FALSE +LeaveOnMany: FALSE + +Expected: handler->iNumPrefixMappings should be equal to 1 + +@SYMTestCaseID SYSLIB-XML-CT-1411 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test13L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1411 ")); + + CMatchData* matchData = CMatchData::NewLC(); + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + matchData->SetMimeTypeL(KXmlTestTestParser); + CParser* parser = CParser::NewL(*matchData, *handler); + TRAPD(err, ParseL(*parser, aRFs, KXmlTestSimpleTestFile)); + test(err == KErrXmlUnsupportedExtInterface); + + delete parser; + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + +/** +Test Xmlparser swap test - 14. +This method is testing parser swapping using ParseBeginL method. +Test steps: + 1. Get xml test parser + Test for 1 or 2 events generated. + + 2. Swap to xml production parser + Test for 6 events genrated. + + 3. Swap to wbxml production parser + Test for no errors. + + 4. Swap to xml production parser + Test for 6 events gerated. + +@SYMTestCaseID SYSLIB-XML-CT-1412 +@SYMTestCaseDesc +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMCR CR0000 +*/ +void CXmlCustomResolverTests::Test14L(RFs& aRFs) + { + test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-1412 ")); + + CMatchData* matchData = CMatchData::NewLC(); + TSimpleContentHandler* handler = new (ELeave) TSimpleContentHandler(); + + // Get the tests parser of xml + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetVariantL(KXmlTestSymbianExtendedString); + CParser* parser = CParser::NewL(*matchData, *handler); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements == 1 || handler->iNumElements == 2); + + // Try to swap parsers to production xml + matchData->SetVariantL(KXmlTestSymbianString); + handler->iNumElements = 0; + parser->ParseBeginL(*matchData); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements == 6); + + // Try to swap parser to wbxml production parser + matchData->SetMimeTypeL(KXmlTestWbXmlParserMimeType); + TRAPD(err, parser->ParseBeginL(*matchData)); + test(err == KErrNone); + + // Try to swap again to test xml parser + matchData->SetMimeTypeL(KXmlTestParserMimeType); + matchData->SetVariantL(KXmlTestSymbianExtendedString); + parser->ParseBeginL(*matchData); + ParseL(*parser, aRFs, KXmlTestSimpleTestFile); + test(handler->iNumElements == 1 || handler->iNumElements == 2); + + delete parser; + delete handler; + CleanupStack::PopAndDestroy(matchData); + } + + +//======================================================================== + +static void XmlCustomResolverTestsL() + { + CXmlCustomResolverTests *customResolverTests = new (ELeave) CXmlCustomResolverTests(); + CleanupStack::PushL(customResolverTests); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + customResolverTests->Test1L(fs); + customResolverTests->Test2L(); + customResolverTests->Test3L(fs); + customResolverTests->Test4L(fs); + customResolverTests->Test5L(); + customResolverTests->Test6L(); + customResolverTests->Test7L(); + customResolverTests->Test8L(); + customResolverTests->Test9L(fs); + customResolverTests->Test10L(fs); + customResolverTests->Test11L(); + customResolverTests->Test12L(); + customResolverTests->Test13L(fs); + customResolverTests->Test14L(fs); + CleanupStack::PopAndDestroy(2, customResolverTests); + } + +static void MainL() + { + __UHEAP_MARK; + XmlCustomResolverTestsL(); + REComSession::FinalClose(); + __UHEAP_MARKEND; + } + +TInt E32Main() + { + test.SetLogged(ETrue); + test.Title(); + test.Start(_L("XML Framework enhancement tests")); + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + test (fs.Connect()==KErrNone); + fs.Close(); + + test (c!=0); + TRAPD(r,MainL()); + test (r==KErrNone); + delete c; + test.End(); + test.Close(); + + return KErrNone; + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tp_frameworkperftests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tp_frameworkperftests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,315 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Performance test implementation for XML API +// +// + +/** + @file + @internalComponent +*/ +#include +#include + +#include +#include + +#include "contenthandlers.h" +#include "tp_perftestbase.h" + +#define CR_JROE6C2LB7 + +//************************************************ +// Class definition +class CXmlApiTests : public CPerformanceTests + { + public: + static CXmlApiTests* NewL(); + static CXmlApiTests* NewLC(); + + public: + friend void TestParseBeginL(); + friend void TestNewLMimeType(); + friend void TestNewLCMimeType(); + friend void TestNewLMatchData(); + friend void TestNewLCMatchData(); + friend void TestParseBeginLMD(); + + + + public: + ~CXmlApiTests(); + + virtual void GetMethodListL(RApiList& aAPIList); + virtual TInt GetNumberOfRepetition(); + virtual void PrepareTestsL(); + + private: + void ConstructL(); + CXmlApiTests(); + + private: + Xml::TSimpleContentHandler* iHandler; + }; + + +//************************************************ +// Globals +_LIT8(KXmlTestNewLMimeType, "NewL(mimeType) --- SYSLIB-XML-PT-1413"); +_LIT8(KXmlTestNewLCMimeType, "NewLC(mimeType) --- SYSLIB-XML-PT-1414"); +_LIT8(KXmlTestParseBeginL, "ParseBeginL(mimeType) --- SYSLIB-XML-PT-1415"); + +#ifdef CR_JROE6C2LB7 +_LIT8(KXmlTestNewLMatchData, "NewL(CMatchData) --- SYSLIB-XML-PT-1416"); +_LIT8(KXmlTestNewLCMatchData, "NewLC(CMatchData) --- SYSLIB-XML-PT-1417"); +_LIT8(KXmlTestParseBeginLMD, "ParseBeginL(CMatchData)--- SYSLIB-XML-PT-1418"); +#endif // CR_JROE6C2LB7 + +_LIT8(KXmlXmlParserMimeType, "text/xml"); +_LIT8(KXmlWbXmlParserMimeType, "text/wbxml"); +_LIT(KXmlPerformanceTestName, "Xml Api Performance Tests"); + +CXmlApiTests* apiTest; + + +//************************************************ +// Test methods + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1413 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +void TestNewLMimeType() + { + apiTest->ApiTestStart(); + Xml::CParser* parser = Xml::CParser::NewL(KXmlXmlParserMimeType(), *apiTest->iHandler); + apiTest->ApiTestEnd(); + delete parser; + } + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1414 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +void TestNewLCMimeType() + { + apiTest->ApiTestStart(); + Xml::CParser* parser = Xml::CParser::NewLC(KXmlXmlParserMimeType(), *apiTest->iHandler); + apiTest->ApiTestEnd(); + CleanupStack::Pop(parser); + delete parser; + } + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1415 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +void TestParseBeginL() + { + Xml::CParser* parser = Xml::CParser::NewLC(KXmlXmlParserMimeType(), *apiTest->iHandler); + apiTest->ApiTestStart(); + parser->ParseBeginL(KXmlWbXmlParserMimeType()); + apiTest->ApiTestEnd(); + CleanupStack::PopAndDestroy(parser); + } + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1416 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +#ifdef CR_JROE6C2LB7 +void TestNewLMatchData() + { + Xml::CMatchData* matchData = Xml::CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlXmlParserMimeType); + apiTest->ApiTestStart(); + Xml::CParser* parser = Xml::CParser::NewLC(*matchData, *apiTest->iHandler); + apiTest->ApiTestEnd(); + CleanupStack::PopAndDestroy(2, matchData); + } + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1417 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +void TestNewLCMatchData() + { + apiTest->ApiTestStart(); + Xml::CParser* parser = Xml::CParser::NewLC(KXmlXmlParserMimeType(), *apiTest->iHandler); + apiTest->ApiTestEnd(); + CleanupStack::Pop(parser); + delete parser; + } + + +/** +@SYMTestCaseID SYSLIB-XML-PT-1418 +@SYMTestCaseDesc Performance test. +@SYMTestPriority Medium +@SYMTestActions +@SYMTestExpectedResults +@SYMREQ REQ0000 +*/ +void TestParseBeginLMD() + { + Xml::CMatchData* matchData = Xml::CMatchData::NewLC(); + matchData->SetMimeTypeL(KXmlXmlParserMimeType); + Xml::CParser* parser = Xml::CParser::NewLC(*matchData, *apiTest->iHandler); + + Xml::CMatchData* matchDataNew = Xml::CMatchData::NewLC(); + + matchDataNew->SetMimeTypeL(KXmlWbXmlParserMimeType); + apiTest->ApiTestStart(); + parser->ParseBeginL(*matchDataNew); + apiTest->ApiTestEnd(); + CleanupStack::PopAndDestroy(3, matchData); + } +#endif // CR_JROE6C2LB7 + + +//************************************************* +// Derivied virtuals method + +void CXmlApiTests::PrepareTestsL() + { + iHandler = new (ELeave) Xml::TSimpleContentHandler(); + } + +void CXmlApiTests::GetMethodListL(RApiList& aApiList) + { + ASSERT(aApiList.Count() == 0); +#ifdef _DEBUG + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLMimeType, TestNewLMimeType, 17103000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLCMimeType, TestNewLCMimeType, 17142000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestParseBeginL, TestParseBeginL, 11874000)); +#ifdef CR_JROE6C2LB7 + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLMatchData, TestNewLMatchData, 17215000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLCMatchData, TestNewLCMatchData, 17321000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestParseBeginLMD, TestParseBeginLMD, 12019000)); +#endif //CR_JROE6C2LB7 + +#else + + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLMimeType, TestNewLMimeType, 9017000 )); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLCMimeType, TestNewLCMimeType, 9037000 )); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestParseBeginL, TestParseBeginL, 6720000)); + +#ifdef CR_JROE6C2LB7 + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLMatchData, TestNewLMatchData, 8986000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestNewLCMatchData, TestNewLCMatchData, 9031000)); + aApiList.Append( new (ELeave) TApiRecord(KXmlTestParseBeginLMD, TestParseBeginLMD, 6685000)); +#endif //CR_JROE6C2LB7 + +#endif //_DEBUG + } +TInt CXmlApiTests::GetNumberOfRepetition() + { + return 1000; + } + + +//*********************************************************** +// Construction / descrution + +CXmlApiTests* CXmlApiTests::NewL() + { + CXmlApiTests* self = CXmlApiTests::NewLC(); + CleanupStack::Pop(self); + return self; + } + +CXmlApiTests* CXmlApiTests::NewLC() + { + CXmlApiTests* self = new (ELeave) CXmlApiTests(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CXmlApiTests::ConstructL() + { + CPerformanceTests::ConstructL(KXmlPerformanceTestName()); + } + +CXmlApiTests::CXmlApiTests() + { + + } + +CXmlApiTests::~CXmlApiTests() + { + REComSession::FinalClose(); + if (iHandler) + { + delete iHandler; + iHandler = NULL; + } + } + + +//*********************************************************** + +static void MainL() + { + __UHEAP_MARK; + apiTest = CXmlApiTests::NewLC(); + apiTest->RunTestsL(); + CleanupStack::Pop(apiTest); + delete apiTest; + __UHEAP_MARKEND; + } + + +TInt E32Main() + { + + CTrapCleanup* c=CTrapCleanup::New(); + + // start the loader + RFs fs; + User::LeaveIfError(fs.Connect()==KErrNone); + fs.Close(); + + User::LeaveIfError (c!=0); + TRAPD(r,MainL()); + User::LeaveIfError(r); + delete c; + + return KErrNone; + } diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tp_perftestbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tp_perftestbase.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,321 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Generic performance test framework implementation. +// +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include +#include +#include + +#include "tp_perftestbase.h" + +/** +The log directory. +*/ +_LIT(KPTestOutput, "c:\\logs\\"); + +/** +Global test object +*/ +RTest test(_L("Perfomance Testing")); + +/** +Class constructor. + +@param aAPIName Name of the API method to test +@param aAPIPtr Pointer to the API method +@param aMaxDuration The maximum duration of the performance test for that API method +*/ +TApiRecord::TApiRecord(const TDesC8& aAPIName, TFuncPtr aAPIPtr, TUint64 aMaxDuration) + { + iAPIName = aAPIName; + iAPIPtr = aAPIPtr; + iMaxDuration = aMaxDuration; + } + +/** +Set method for API pointer attribute + +@param aAPIPtr Pointer to API method +*/ +void TApiRecord::SetAPIPtr(TFuncPtr aAPIPtr) + { + iAPIPtr = aAPIPtr; + } + +/** +Set method for API name attribute + +@param aAPIName Function name +*/ +void TApiRecord::SetAPIName(TDesC8& aAPIName) + { + iAPIName = aAPIName; + } + +/** +Get method for API name attribute + +@return API name string +*/ +const TDesC8& TApiRecord::APIName() + { + return iAPIName; + } + +/** +Get method for API method pointer + +@return API method pointer +*/ +TFuncPtr TApiRecord::APIPtr() + { + return iAPIPtr; + } + +/** +Set method for max duration attribute + +@param aMaxDuration The maximum duration of the performance test for that API method +*/ +void TApiRecord::SetMaxDuration(TUint64 aMaxDuration) + { + iMaxDuration = aMaxDuration; + } + +/** +Get method for max duration attribute + +@return The maximum duration of the performance test for that API method +*/ +TUint64 TApiRecord::MaxDuration() + { + return iMaxDuration; + } + +/** +Class consturctor. +*/ +CPerformanceTests::CPerformanceTests(): iOutputFile(NULL) + { + + } + +/** +Second phase constructor. +Creates adequate directory and output file for logging purposes. + +@param aTestName Test name string +*/ +void CPerformanceTests::ConstructL(const TDesC& aTestName) + { + ParserComandLineL(); + if (iOutputFile != NULL) + { + HBufC* fileName = HBufC::NewLC(KPTestOutput().Length() + iOutputFile->Length()); + TPtr ptr(fileName->Des()); + + User::LeaveIfError(session.Connect()); + + // create the directory if not existing + if (!session.IsValidName(KPTestOutput())) + { + session.MkDirAll(KPTestOutput()); + } + + ptr = KPTestOutput; + ptr.Append(*iOutputFile); + + //create the file + User::LeaveIfError(output.Replace(session, *fileName, EFileWrite )); + CleanupStack::PopAndDestroy(fileName); + } + else + { + test.Start(aTestName); + test.Title(); + } + } + +/** +Destructor. +*/ +CPerformanceTests::~CPerformanceTests() + { + while (list.Count() > 0) + { + delete list[list.Count()-1]; + list.Remove(list.Count()-1); + } + if (iOutputFile != NULL) + { + delete iOutputFile; + } + list.Reset(); + if (iOutputFile) + { + output.Flush(); + output.Close(); + session.Close(); + } + else + { + test.End(); + test.Close(); + } + + } + +/** +Runs all the required tests. +*/ +void CPerformanceTests::RunTestsL() + { + GetMethodListL(list); + iRepNum = GetNumberOfRepetition(); + PrepareTestsL(); + + for (TInt i = 0 ; i < list.Count();i++) + { + TApiRecord* apiRecord = list[i]; + TestApi(*apiRecord); + } + } + +/** +Tests particular API method. +Logs the perfomance benchmarks to the output file. + +@param aApi The API record +*/ +void CPerformanceTests::TestApi(TApiRecord& aApi) + { + TUint64 total = 0; + TUint64 average = 0; + TUint64 firstCall = 0; + TBuf8<255> string; + TInt freq; + + if (iOutputFile) + { + output.Write(aApi.APIName()); + } + + HAL::Get(HAL::EFastCounterFrequency, freq); + + //first call time verification + iEndTime = 0; + iStartTime = 0; + aApi.APIPtr()(); + + //error checking + if (iEndTime == 0 || iStartTime == 0) + { + // user test method did not call either ApiTestStart or ApiTestEnd method + User::Panic(_L("Xml Framework Error"), KErrGeneral); + } + + // calculate and convert to miliseconds + firstCall = (1000000*(iEndTime - iStartTime))/freq; + + for (TInt i = 0; i < iRepNum; i++) + { + // initialize members + iEndTime = 0; + iStartTime = 0; + + //method call + aApi.APIPtr()(); + + //error checking + if (iEndTime == 0 || iStartTime == 0) + { + // user test method did not call either ApiTestStart or ApiTestEnd method + User::Panic(_L("Xml Framework Error"), KErrGeneral); + } + // time counting + total += iEndTime - iStartTime; + } + // calculate and convert to miliseconds + // Fast counter frequency already in MHz + total = (1000000*total)/freq; + average = total/iRepNum; + if (iOutputFile) + { + string.Format(_L8("\n First call time: %Ld ms\n Number of repetitions: %d\n Time: %Ld ms\n Average: %Ld ms\n Max duration: %Ld ms\n\n"), + firstCall, + iRepNum, + total, + average, + aApi.MaxDuration()); + TPtrC8 des(string); + output.Write(des); + } + else + { +#ifdef EABI + test(total < aApi.MaxDuration()); +#else + test(ETrue); +#endif // EABI + TBuf<100> temp; + temp.Copy(aApi.APIName()); + test.Printf(_L("\n %S - Performance testing results\n\t First call time: %Ld ms\n\t Number of repetitions: %d\n\t Time: %Ld ms \n\t Average: %Ld ms\n\t Max duration: %Ld ms \n"), + &temp, firstCall, iRepNum, total, average, aApi.MaxDuration()); + } + } +/** +Stores the start time of Api call. +ApiTestStart and ApiTestEnd should enlosed to particular API call. +*/ +void CPerformanceTests::ApiTestStart() + { + iStartTime = User::FastCounter(); + } + +/** +Stores the end time of Api call. +ApiTestStart and ApiTestEnd should enlosed to particular API call. +*/ +void CPerformanceTests::ApiTestEnd() + { + iEndTime = User::FastCounter(); + } + +/** +Parses the command line +*/ +void CPerformanceTests::ParserComandLineL() + { + CCommandLineArguments* pCmd = CCommandLineArguments::NewLC(); + if (pCmd->Count() == 3) + { + if (pCmd->Arg(1).CompareF(_L("-l")) == 0) + { + iOutputFile = pCmd->Arg(2).AllocL(); + } + } + + CleanupStack::PopAndDestroy(pCmd); + } + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tp_perftestbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tp_perftestbase.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,155 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Generic performance test framework +// +// + +/** + @file + @internalComponent +*/ + +#ifndef TP_FRAMEWORK_H +#define TP_FRAMEWORK_H + +#include +#include + +/** +Typedef for method pointer +*/ +typedef TAny (*TFuncPtr)(); + +/** +The class purpose is to store all necessary details of API method to call. +*/ +class TApiRecord + { + public: + TApiRecord(const TDesC8& aAPIName, TFuncPtr aAPIPtr, TUint64 aMaxDuration); + + + public: + void SetAPIPtr(TFuncPtr aAPIPtr); + const TDesC8& APIName(); + + void SetAPIName(TDesC8& aAPIName); + TFuncPtr APIPtr(); + + void SetMaxDuration(TUint64 aMaxDuration); + TUint64 MaxDuration(); + + private: + /** + API method name + */ + TBuf8<100> iAPIName; + + /** + API method pointer + */ + TFuncPtr iAPIPtr; + + /** + The maximum duration of the performance test for that API method + */ + TUint64 iMaxDuration; + }; + +/** +Typedef to simplify usage of the Api record list. +*/ +typedef RPointerArray RApiList; + +/** +The base clase for API performance testing. +The class users should inherit from this class to use the performance test functionality. + +The user needs to provide a number of test methods, which should be a friend to the class. +Each of this method should have a call to ApiTestStart and ApiTestEnd methods, which +should enclose particular functionality (API method) for performance testing. It allows to +performance test only requried functionality leaving out of test scope the test preparation +and post test activity. + +Here is the test method prototype: +void TestAPIMethod() + { + // test preparation here + apiTest->ApiTestStart(); + // call to the API method + apiTest->ApiTestEnd(); + // post test activity + } + +The framework will call all test methods required number of times for perfromance testing. +The test results will be shown on the console and logged into result file in "C:\Log" directory. +*/ +class CPerformanceTests : public CBase + { + +public: + void RunTestsL(); + ~CPerformanceTests(); + +public: + /** + User should implement GetMethodList to create full list of require API method to test + */ + virtual void GetMethodListL(RApiList& aApiList) = 0; + + /** + User should implement GetNumberOfRepetition to inform the framework about the number + of repetitions for performance testing. + */ + virtual TInt GetNumberOfRepetition() = 0; + + /** + User should implement this method for some general purpose test preparation. + */ + virtual void PrepareTestsL() = 0; + +private: + void TestApi(TApiRecord& aApi); + +protected: + void ConstructL(const TDesC& aTestName); + CPerformanceTests(); + void ApiTestStart(); + void ApiTestEnd(); + void ParserComandLineL(); + +private: + /** The list of methods to perform the test on */ + RApiList list; + + /** Output log file handle */ + RFile output; + + /** RF session for logging */ + RFs session; + + /** Start time of API call */ + TUint64 iStartTime; + + /** End time of API call */ + TUint64 iEndTime; + + /** Number of required repetition */ + TInt iRepNum; + + /** Name of outpu file */ + HBufC* iOutputFile; + }; + +#endif // TP_FRAMEWORK_H diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tu_cmatchdataunittests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tu_cmatchdataunittests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,882 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Unit test implementation for CMatchData class +// +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include +#include + +#include +#include + +/* +Those tests will make use of a fake array of parsers built for the purpuse of unit test only. +Here is a detailed list of parser used: +*/ + +const TUid KXmlUtP1Uid = {0x10273870}; +const TUid KXmlUtP2Uid = {0x10273871}; +const TUid KXmlUtP4Uid = {0x10273873}; +const TUid KXmlUtP6Uid = {0x10273875}; +const TUid KXmlUtP7Uid = {0x10273876}; +const TUid KXmlUtP9Uid = {0x10273878}; + +//These 2 Uids are added to test the fix of DEF116214. +//const TUid KXmlUtP10Uid = {0x60000000}; //0b01100000000000000000000000000000 Large positive number +const TUid KXmlUtP11Uid = {0x8FFFFFFF}; //0b10001111111111111111111111111111 Very Large negative number + + +// + +_LIT(KTestName, "CMatchData Unit Tests"); +RTest Test(KTestName); + +// +//Global variable systemStatus indicating the plugin system status +RImplInfoArray systemPlugins; +RImplInfoArray systemPluginsBase; + + +//Test Data +_LIT8(KXmlUtParserXmlMimeType, "text/xml"); +_LIT8(KXmlUtParserWbXmlMimeType, "text/wbxml"); +_LIT8(KXmlUtSymbianString, "Symbian"); +_LIT8(KXmlUtNullString, ""); +_LIT8(KXmlUtNonExistantString,"NonExistant"); +_LIT8(KXmlUtParserXmlMimeTypeCS, "Text/Xml"); +_LIT8(KXmlUtParserWbXmlMimeTypeCS, "Text/WbXml"); +_LIT8(KXmlUtSymbianStringCS, "symbian"); +_LIT8(KXmlUtExternalString, "External"); +_LIT8(KXmlUtSymbianAdvancedString, "Symbian Advanced"); +_LIT8(KXmlUtExternalV1String, "External V1"); +_LIT8(KXmlUtParserMyXmlMimeTypeCS, "MyText/MyXml"); + + +// 256 character string +TBuf8<256> KXmlUtLongString256; +//255 character string +TBuf8<255> KXmlUtLongString255; + +// 33 character string +TBuf8<33> KXmlUtLongString33; +// 32 character string +TBuf8<32> KXmlUtLongString32; + +// Interface UID for unit test parsers +TUid KXmlUtParsers = {0x10273867}; + +// Separator for comand line to run the file copy process +_LIT(KSeparator, "|"); + +// Name of the file copy process +_LIT(KProcessFileManCopyFile, "t_XMLprocessfilemancopyfile.exe"); + +// Const value for 1 second in miliseconds +const TInt KOneSecond = 1000000; + +static void FileCopyL(const TDesC& anOld,const TDesC& aNew) + { + TBuf<120> fileNames(anOld); + fileNames.Append(KSeparator); + fileNames.Append(aNew); + + // Launch process with highier capabilities (to copy into c:\sys\bin directory) + TRequestStatus stat; + RProcess p; + User::LeaveIfError(p.Create(KProcessFileManCopyFile(), fileNames)); + // Asynchronous logon: completes when process terminates with process + // exit code + p.Logon(stat); + p.Resume(); + + User::WaitForRequest(stat); + TInt exitReason = p.ExitReason(); + p.Close(); + User::LeaveIfError(exitReason); + + } + +static void TestPrepareL() + { + FileCopyL(_L("z:\\XMLRAMONLY\\tu_XmlRamParserPlugins.dll"), _L("C:\\sys\\bin\\tu_XmlRamParserPlugins.dll")); + FileCopyL(_L("z:\\XMLRAMONLY\\tu_XmlRamParserPlugins.RSC"), _L("C:\\resource\\plugins\\tu_XmlRamParserPlugins.RSC")); + + //The reason for the folowing delay is: + //ECOM server could be already started. It means that when we copy some + //ECOM plugins from Z: to C: drive - ECOM server should look for and + //find the new ECOM plugins. The ECOM server uses for that CDiscoverer::CIdleScanningTimer + //which is an active object. So the discovering service is asynchronous. We have to + //wait some time until it finishes. Otherwise ListImplementationsL could fail to find + //requested implementations. + User::After(KOneSecond * 3); + } + + +static void SetUpSystemStatusL() + { + REComSession& session = REComSession::OpenL(); + RImplInfoPtrArray array; + session.ListImplementationsL(KXmlUtParsers, array); + session.Close(); + for (TInt i = 0; i < array.Count(); i++) + { + systemPluginsBase.Append(array[i]); + } + } + +static void RefreshPluginsStatus() + { + systemPlugins.Reset(); + + for (TInt i = 0; i < systemPluginsBase.Count(); i++) + { + systemPlugins.Append(systemPluginsBase[i]); + } + } +static void CleanSystem() + { + for (TInt i = 0; i < systemPluginsBase.Count(); i++) + { + delete systemPluginsBase[i]; + } + systemPlugins.Close(); + systemPluginsBase.Close(); + } + + +/** +@SYMTestCaseID SYSLIB-XML-UT-3719 +@SYMTestCaseDesc Checking CMatchData functions +@SYMTestPriority Medium +@SYMTestActions Testing various functions of the CMatchData class +@SYMTestExpectedResults The functions should perform as expected. +@SYMREQ REQ0000 +*/ +static void RunTestsL() + { + Xml::CMatchData *mData = Xml::CMatchData::NewL(); + TInt result; + TUid resultUid; + + //set up systemStatus + TestPrepareL(); + SetUpSystemStatusL(); + RefreshPluginsStatus(); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 1")); + TRAP(result,mData->SetMimeTypeL(KXmlUtParserXmlMimeType)); + + Test(result == KErrNone); + Test(mData->MimeType().Compare(KXmlUtParserXmlMimeType)==0); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 2")); + KXmlUtLongString256.SetLength(256); + TRAP(result,mData->SetMimeTypeL(KXmlUtLongString256)); + + Test(result == KErrArgument); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 3")); + KXmlUtLongString255.SetLength(255); + TRAP(result,mData->SetMimeTypeL(KXmlUtLongString255)); + + Test(result == KErrNone); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 4")); + TRAP(result,mData->SetMimeTypeL(KXmlUtNullString)); + + Test(result == KErrArgument); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 5")); + TRAP(result,mData->SetVariantL(KXmlUtSymbianString)); + + Test(result == KErrNone); + Test(mData->Variant().Compare(KXmlUtSymbianString)==0); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 6")); + KXmlUtLongString33.SetLength(33); + TRAP(result,mData->SetVariantL(KXmlUtLongString33)); + + Test(result == KErrArgument); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 7")); + KXmlUtLongString32.SetLength(32); + TRAP(result,mData->SetVariantL(KXmlUtLongString32)); + + Test(result == KErrNone); + + //************************************************* + //Test - Basic API + Test.Next(_L("Basic Api 8")); + TRAP(result,mData->SetVariantL(KXmlUtNullString)); + + Test(result == KErrNone); + Test(mData->Variant().Compare(KXmlUtNullString)==0); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 1")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + // Now returns lowest uid Symbian parser + Test(mData->ResolveL(systemPlugins) == KXmlUtP1Uid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 2")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + // Now returns lowest uid Symbian parser + Test(KXmlUtP1Uid == mData->ResolveL(systemPlugins)); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 3")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + Test(KXmlUtP6Uid == mData->ResolveL(systemPlugins)); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 4")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + Test(KXmlUtP6Uid == mData->ResolveL(systemPlugins)); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 5")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 6")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue) ; + mData->SetMimeTypeL(KXmlUtParserXmlMimeTypeCS); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 7")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserXmlMimeTypeCS); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 8")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtNonExistantString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 9")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid Symbian parser + Test(resultUid == KXmlUtP4Uid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 10")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid parser + Test(resultUid == KXmlUtP7Uid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 11")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 12")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid parser + Test(resultUid == KXmlUtP7Uid); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 13")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + + //************************************************* + //Test - Mime type tests + Test.Next(_L("Mime type test 14")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtNonExistantString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 1")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + mData->SetVariantL(KXmlUtSymbianString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KXmlUtP6Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 2")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + mData->SetVariantL(KXmlUtSymbianString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KXmlUtP6Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 3")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserXmlMimeType); + mData->SetVariantL(KXmlUtSymbianString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(resultUid == KXmlUtP6Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 4")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KXmlUtP7Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 5")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KXmlUtP7Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 6")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 7")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + mData->SetVariantL(KXmlUtExternalString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid parser + Test(resultUid == KXmlUtP9Uid); + + //************************************************* + //Test - Mime type and variant tests. + Test.Next(_L("Mime type and variant test 8")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid parser + Test(resultUid == KXmlUtP2Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 9")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + mData->SetVariantL(KXmlUtExternalString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 10")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtExternalV1String); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 11")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(ETrue); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KXmlUtP7Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 12")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 13")); + mData->SetCaseSensitivity(EFalse); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid parser + Test(resultUid == KXmlUtP2Uid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 14")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(EFalse); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtSymbianAdvancedString); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + //************************************************* + //Test - Mime type and variant tests + Test.Next(_L("Mime type and variant test 15")); + mData->SetCaseSensitivity(ETrue); + mData->SetRomOnly(EFalse); + mData->SetLeaveOnMany(ETrue); + mData->SetMimeTypeL(KXmlUtParserWbXmlMimeTypeCS); + mData->SetVariantL(KXmlUtExternalV1String); + TRAP(result, resultUid = mData->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + + + //************************************************* + //Test - DEF116214 - CMatchData::SortOrder() function behaviour test. + Test.Next(_L("CMatchData DEF116214 fix test")); + Xml::CMatchData *mData_2 = Xml::CMatchData::NewL(); + mData_2->SetCaseSensitivity(ETrue); + mData_2->SetRomOnly(EFalse); + mData_2->SetLeaveOnMany(EFalse); + mData_2->SetMimeTypeL(KXmlUtParserMyXmlMimeTypeCS); + mData_2->SetVariantL(KXmlUtSymbianStringCS); + + //There are 2 elements which could match this mData_2 criteria, + //ResolveL should return the first one (the smallest one). In the old + //implementation of CMatchData::SortOrder(), ResolveL() return KXmlUtP10Uid + //but after the applied fix ResolveL() returns KXmlUtP11Uid. + //The following test should pass. + Test(mData_2->ResolveL(systemPlugins) == KXmlUtP11Uid); + + delete mData_2; + + //************************************************* + //Test - CMatchData default values + Test.Next(_L("CMatchData default test 1")); + Xml::CMatchData *newData1 = Xml::CMatchData::NewL(); + newData1->SetMimeTypeL(KXmlUtParserWbXmlMimeType); + + TRAP(result, resultUid = newData1->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Default behaviour became backwards compatible, so Test plugin 4 + // is returned instead of 2 here because Test Plugin 2's variant is + // not an exact match of "Symbian", but 4's is. + Test(resultUid == KXmlUtP4Uid); + delete newData1; + + //************************************************* + //Test - CMatchData default values + Test.Next(_L("CMatchData default test 2")); + Xml::CMatchData *newData2 = Xml::CMatchData::NewL(); + newData2->SetMimeTypeL(KXmlUtParserXmlMimeType); + + TRAP(result, resultUid = newData2->ResolveL(systemPlugins)); + + Test(result == KErrNone); + // Now returns lowest uid Symbian parser + Test(resultUid == KXmlUtP1Uid); + delete newData2; + + //************************************************* + //Test - CMatchData default values + Test.Next(_L("CMatchData default test 3")); + Xml::CMatchData *newData3 = Xml::CMatchData::NewL(); + newData3->SetMimeTypeL(KXmlUtParserXmlMimeTypeCS); + + TRAP(result, resultUid = newData3->ResolveL(systemPlugins)); + + Test(result == KErrNone); + Test(resultUid == KNullUid); + delete newData3; + + //************************************************* + //Test - CMatchData default values + Test.Next(_L("CMatchData default test 4")); + Xml::CMatchData *newData4 = Xml::CMatchData::NewL(); + newData4->SetMimeTypeL(KXmlUtParserXmlMimeType); + newData4->SetLeaveOnMany(ETrue); + + TRAP(result, resultUid = newData4->ResolveL(systemPlugins)); + + Test(result == Xml::KErrXmlMoreThanOneParserMatched); + delete newData4; + + //************************************************* + //Test - comparison operator tests + Test.Next(_L("Comparison operator tests")); + Xml::CMatchData *newData5 = Xml::CMatchData::NewL(); + Xml::CMatchData *newData6 = Xml::CMatchData::NewL(); + Test(*newData5 == *newData6); + + newData5->SetCaseSensitivity(EFalse); + newData6->SetCaseSensitivity(EFalse); + Test(*newData5 == *newData6); + + newData5->SetMimeTypeL(KXmlUtParserXmlMimeType); + Test(!(*newData5 == *newData6)); + + newData6->SetMimeTypeL(KXmlUtParserXmlMimeTypeCS); + Test(*newData5 == *newData6); + + newData5->SetCaseSensitivity(ETrue); + Test(!(*newData5 == *newData6)); + + newData6->SetCaseSensitivity(ETrue); + Test(!(*newData5 == *newData6)); + + newData6->SetMimeTypeL(KXmlUtParserXmlMimeType); + Test(*newData5 == *newData6); + + newData6->SetLeaveOnMany(ETrue); + Test(!(*newData5 == *newData6)); + + newData6->SetLeaveOnMany(EFalse); + newData6->SetRomOnly(ETrue); + Test(!(*newData5 == *newData6)); + + newData6->SetRomOnly(EFalse); + Test(*newData5 == *newData6); + + newData5->SetVariantL(KXmlUtSymbianString); + Test(!(*newData5 == *newData6)); + + newData6->SetVariantL(KXmlUtSymbianString); + Test(*newData5 == *newData6); + + newData5->SetCaseSensitivity(ETrue); + newData6->SetCaseSensitivity(ETrue); + Test(*newData5 == *newData6); + + newData6->SetVariantL(KXmlUtSymbianStringCS); + Test(!(*newData5 == *newData6)); + + newData5->SetCaseSensitivity(EFalse); + newData6->SetCaseSensitivity(EFalse); + Test(*newData5 == *newData6); + + newData6->SetVariantL(_L8("")); + Test(!(*newData5 == *newData6)); + + delete newData5; + delete newData6; + + //************************************************* + //Test - Assignement tests + Test.Next(_L("Comparison operator tests")); + Xml::CMatchData *newData7 = Xml::CMatchData::NewL(); + Xml::CMatchData *newData8 = Xml::CMatchData::NewL(); + Test(*newData7 == *newData8); + + newData8->SetMimeTypeL(KXmlUtParserXmlMimeType); + Test(!(*newData7 == *newData8)); + + *newData7 = *newData8; + Test(*newData7 == *newData8); + Test(newData7->MimeType().Compare(KXmlUtParserXmlMimeType()) == 0); + + newData7->SetVariantL(KXmlUtSymbianString); + *newData7 = *newData8; + Test(*newData7 == *newData8); + Test(newData7->Variant() == KNullDesC8); + + delete newData7; + delete newData8; + + //************************************************* + // Out of memory tests + Test.Next(_L("Out of memory tests")); + TInt err; + Xml::CMatchData* parser9 = NULL; + + // Test NewL + for(TInt count=1;;++count) + { + // Setting Heap failure for OOM test + __UHEAP_SETFAIL(RHeap::EDeterministic, count); + __UHEAP_MARK; + + TRAP(err, parser9 = Xml::CMatchData::NewL()); + if(err == KErrNoMemory) + { + __UHEAP_MARKEND; + } + else if(err == KErrNone) + { + delete parser9; + __UHEAP_MARKEND; + RDebug::Print(_L("The OOM test 1 succeeded at heap failure rate=%d.\n"), count); + __UHEAP_RESET; + break; + } + else + { + __UHEAP_MARKEND; + Test(err, KErrNone); + } + __UHEAP_RESET; + } + + TRAP(err, parser9 = Xml::CMatchData::NewL()); + Test(err == KErrNone); + + //Test SetMimeTypeL + for(TInt count=1;;++count) + { + // Setting Heap failure for OOM test + __UHEAP_SETFAIL(RHeap::EDeterministic, count); + __UHEAP_MARK; + + TRAP(err, parser9->SetMimeTypeL(KXmlUtParserXmlMimeType())); + if(err == KErrNoMemory) + { + __UHEAP_MARKEND; + } + else if(err == KErrNone) + { + RDebug::Print(_L("The OOM test 1 succeeded at heap failure rate=%d.\n"), count); + __UHEAP_RESET; + break; + } + else + { + __UHEAP_MARKEND; + Test(err, KErrNone); + } + __UHEAP_RESET; + } + + //Test SetVariantL + for(TInt count=1;;++count) + { + // Setting Heap failure for OOM test + __UHEAP_SETFAIL(RHeap::EDeterministic, count); + __UHEAP_MARK; + + TRAP(err, parser9->SetVariantL(KXmlUtSymbianString())); + if(err == KErrNoMemory) + { + __UHEAP_MARKEND; + } + else if(err == KErrNone) + { + RDebug::Print(_L("The OOM test 1 succeeded at heap failure rate=%d.\n"), count); + __UHEAP_RESET; + break; + } + else + { + __UHEAP_MARKEND; + Test(err, KErrNone); + } + __UHEAP_RESET; + } + delete parser9; + + //************************************************* + //Test cleanup + delete mData; + CleanSystem(); + systemPlugins.Close(); + } + + + +//*********************************************************************************** +GLDEF_C TInt E32Main() + { + CTrapCleanup* tc = CTrapCleanup::New(); + Test(tc != NULL); + + + TInt err; + Test.Start(_L(" @SYMTestCaseID:SYSLIB-XML-UT-3719 CMatchData Tests ")); + Test.Title(); + + __UHEAP_MARK; + TRAP(err, ::RunTestsL()) + Test(err== KErrNone); + __UHEAP_MARKEND; + + Test.End(); + Test.Close(); + + + + delete tc; + + return(KErrNone); + + } + + + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tu_xmlramplugins.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tu_xmlramplugins.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,315 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_testconstants.h" + +using namespace Xml; + +class CXmlParser : public CBase, public MParser + { +public: + + static MParser* NewL(TAny* aInitParams); + virtual ~CXmlParser(); + + // From MParser + + TInt EnableFeature(TInt /*aParserFeature*/) + { + return KErrNotSupported; + } + TInt DisableFeature(TInt /*aParserFeature*/) + { + return KErrNone; + } + TBool IsFeatureEnabled(TInt /*aParserFeature*/) const + { + return EFalse; + } + void Release(); + void ParseChunkL (const TDesC8& aDescriptor); + void ParseLastChunkL(const TDesC8& aDescriptor); + + // From MContentSouce + + void SetContentSink (MContentHandler& aContentHandler); + + RStringPool& StringPool(); + +private: + + CXmlParser(TParserInitParams* aInitParams); + void ConstructL(); + + void DoParseL(); + + inline void OnStartDocumentL(); + inline void OnEndDocumentL(); + inline void OnStartElementL(); + inline void OnEndElementL(); + inline void OnContentL(); + inline void OnStartPrefixMappingL(); + inline void OnEndPrefixMappingL(); + inline void OnIgnorableWhiteSpaceL(); + inline void OnSkippedEntityL(); + inline void OnProcessingInstructionL(); + inline void OnExtensionL(); + inline void OnError(TInt aError); + +private: + MContentHandler* iContentHandler; + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + }; + +MParser* CXmlParser::NewL(TAny* aInitParams) + { + + CXmlParser* self = new(ELeave) CXmlParser(reinterpret_cast(aInitParams)); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return (static_cast(self)); + } + + + +CXmlParser::CXmlParser(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + + +void CXmlParser::ConstructL() + { + // do nothing; + } + + + +void CXmlParser::Release() + { + delete (this); + } + + + +CXmlParser::~CXmlParser() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + } + + +void CXmlParser::ParseChunkL (const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +void CXmlParser::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +RStringPool& CXmlParser::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + + +void CXmlParser::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + + +void CXmlParser::DoParseL() +/** +This method gets executed when a request to parse a file is issued. +This function generates just one element event. +*/ + { + OnStartDocumentL(); + OnStartElementL(); + OnEndElementL(); + OnEndDocumentL(); + } + + + +void CXmlParser::OnStartDocumentL() + { + RDocumentParameters documentParameters; + + iContentHandler->OnStartDocumentL(documentParameters, KErrorCodeOnStartDocument); + } + + +void CXmlParser::OnEndDocumentL() + { + iContentHandler->OnEndDocumentL(KErrorCodeOnEndDocument); + } + + + +void CXmlParser::OnStartElementL() + { + RTagInfo element; + RAttributeArray attributes; + + iContentHandler->OnStartElementL(element, attributes, KErrorCodeOnStartElement); + } + + +void CXmlParser::OnEndElementL() + { + RTagInfo element; + + iContentHandler->OnEndElementL(element, KErrorCodeOnEndElement); + } + + + +void CXmlParser::OnContentL() + { + const TBuf8<2> bytes; + + iContentHandler->OnContentL(bytes, KErrorCodeOnContent); + } + + + +void CXmlParser::OnStartPrefixMappingL() + { + RString prefix; + RString uri; + + iContentHandler->OnStartPrefixMappingL(prefix, uri, KErrorCodeOnStartPrefixMapping); + } + + +void CXmlParser::OnEndPrefixMappingL() + { + RString prefix; + + iContentHandler->OnEndPrefixMappingL(prefix, KErrorCodeOnEndPrefixMapping); + } + + + +void CXmlParser::OnIgnorableWhiteSpaceL() + { + const TBuf8<2> bytes; + + iContentHandler->OnIgnorableWhiteSpaceL(bytes, KErrorCodeOnIgnorableWhiteSpace); + } + + + +void CXmlParser::OnSkippedEntityL() + { + RString name; + + iContentHandler->OnSkippedEntityL(name, KErrorCodeOnSkippedEntity); + } + + + +void CXmlParser::OnProcessingInstructionL() + { + TBuf8<2> target; + TBuf8<2> data; + + iContentHandler->OnProcessingInstructionL(target, data, KErrorCodeOnProcessingInstruction); + } + + +void CXmlParser::OnExtensionL() + { + RString data; + TInt token = 0; + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(data, token, KErrorCodeOnExtension); + } + + +void CXmlParser::OnError(TInt aError) + { + iContentHandler->OnError(aError); + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x10273870,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273871,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273872,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273873,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273874,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x60000000,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x8FFFFFFF,CXmlParser::NewL), +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmlfw/test/rtest/tsrc/tu_xmlromplugins.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmlfw/test/rtest/tsrc/tu_xmlromplugins.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,311 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t_testconstants.h" + +using namespace Xml; + +class CXmlParser : public CBase, public MParser + { +public: + + static MParser* NewL(TAny* aInitParams); + virtual ~CXmlParser(); + + // From MParser + + TInt EnableFeature(TInt /*aParserFeature*/) + { + return KErrNotSupported; + } + TInt DisableFeature(TInt /*aParserFeature*/) + { + return KErrNone; + } + TBool IsFeatureEnabled(TInt /*aParserFeature*/) const + { + return EFalse; + } + void Release(); + void ParseChunkL (const TDesC8& aDescriptor); + void ParseLastChunkL(const TDesC8& aDescriptor); + + // From MContentSouce + + void SetContentSink (MContentHandler& aContentHandler); + + RStringPool& StringPool(); + +private: + + CXmlParser(TParserInitParams* aInitParams); + void ConstructL(); + + void DoParseL(); + + inline void OnStartDocumentL(); + inline void OnEndDocumentL(); + inline void OnStartElementL(); + inline void OnEndElementL(); + inline void OnContentL(); + inline void OnStartPrefixMappingL(); + inline void OnEndPrefixMappingL(); + inline void OnIgnorableWhiteSpaceL(); + inline void OnSkippedEntityL(); + inline void OnProcessingInstructionL(); + inline void OnExtensionL(); + inline void OnError(TInt aError); + +private: + MContentHandler* iContentHandler; + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + }; + +MParser* CXmlParser::NewL(TAny* aInitParams) + { + + CXmlParser* self = new(ELeave) CXmlParser(reinterpret_cast(aInitParams)); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return (static_cast(self)); + } + + + +CXmlParser::CXmlParser(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast(aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + + +void CXmlParser::ConstructL() + { + // do nothing; + } + + + +void CXmlParser::Release() + { + delete (this); + } + + + +CXmlParser::~CXmlParser() + { + // We don't own this + iContentHandler = NULL; + iStringDictionaryCollection = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + } + + +void CXmlParser::ParseChunkL (const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +void CXmlParser::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + DoParseL(); + } + + +RStringPool& CXmlParser::StringPool() + { + return iStringDictionaryCollection->StringPool(); + } + + + +void CXmlParser::SetContentSink (MContentHandler& aContentHandler) +/** +This method allows for the correct streaming of data to another plugin in the chain. + +@post the next plugin in the chain is set to receive our callbacks. + +*/ + { + iContentHandler = &aContentHandler; + } + + +void CXmlParser::DoParseL() +/** +This method gets executed when a request to parse a file is issued. +This function generates just one element event. +*/ + { + OnStartDocumentL(); + OnStartElementL(); + OnEndElementL(); + OnEndDocumentL(); + } + + + +void CXmlParser::OnStartDocumentL() + { + RDocumentParameters documentParameters; + + iContentHandler->OnStartDocumentL(documentParameters, KErrorCodeOnStartDocument); + } + + +void CXmlParser::OnEndDocumentL() + { + iContentHandler->OnEndDocumentL(KErrorCodeOnEndDocument); + } + + + +void CXmlParser::OnStartElementL() + { + RTagInfo element; + RAttributeArray attributes; + + iContentHandler->OnStartElementL(element, attributes, KErrorCodeOnStartElement); + } + + +void CXmlParser::OnEndElementL() + { + RTagInfo element; + + iContentHandler->OnEndElementL(element, KErrorCodeOnEndElement); + } + + + +void CXmlParser::OnContentL() + { + const TBuf8<2> bytes; + + iContentHandler->OnContentL(bytes, KErrorCodeOnContent); + } + + + +void CXmlParser::OnStartPrefixMappingL() + { + RString prefix; + RString uri; + + iContentHandler->OnStartPrefixMappingL(prefix, uri, KErrorCodeOnStartPrefixMapping); + } + + +void CXmlParser::OnEndPrefixMappingL() + { + RString prefix; + + iContentHandler->OnEndPrefixMappingL(prefix, KErrorCodeOnEndPrefixMapping); + } + + + +void CXmlParser::OnIgnorableWhiteSpaceL() + { + const TBuf8<2> bytes; + + iContentHandler->OnIgnorableWhiteSpaceL(bytes, KErrorCodeOnIgnorableWhiteSpace); + } + + + +void CXmlParser::OnSkippedEntityL() + { + RString name; + + iContentHandler->OnSkippedEntityL(name, KErrorCodeOnSkippedEntity); + } + + + +void CXmlParser::OnProcessingInstructionL() + { + TBuf8<2> target; + TBuf8<2> data; + + iContentHandler->OnProcessingInstructionL(target, data, KErrorCodeOnProcessingInstruction); + } + + +void CXmlParser::OnExtensionL() + { + RString data; + TInt token = 0; + + MWbxmlExtensionHandler* ptr = + static_cast + (iContentHandler->GetExtendedInterface(MWbxmlExtensionHandler::EExtInterfaceUid)); + + if (!ptr) + { + User::Leave(KErrXmlUnsupportedExtInterface); + } + + ptr->OnExtensionL(data, token, KErrorCodeOnExtension); + } + + +void CXmlParser::OnError(TInt aError) + { + iContentHandler->OnError(aError); + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x10273875,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273876,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273877,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273878,CXmlParser::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10273879,CXmlParser::NewL), +}; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Build information file for project Symbian XML Framework libxml2 plug-in +// + + +PRJ_EXPORTS +xmlenginesaxplugin.iby /epoc32/rom/include/xmlenginesaxplugin.iby + +#ifndef GCCXML +PRJ_MMPFILES +xmlenginesaxplugin.mmp +#endif + +#include "../test/tef/xmlparser2/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/group/syslibs_xmlparser2.history.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/group/syslibs_xmlparser2.history.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,20 @@ + + + + libxml2 XML Framework parser plugin. + + + + + + The Symbian OS XML services subsystem shall be extended with a new DOM API, the open source libxml2 library and a new libxml2-based SAX plug-in for the existing XML Parser Framework. + + + + + + + Relocating Header files for XML API + + + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/group/syslibs_xmlparser2.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/group/syslibs_xmlparser2.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,10 @@ +component syslibs_xmlparser2 + +source \sf\os\xmlsrv\xml\xmllibxml2parser + +exports \sf\os\xmlsrv\xml\xmllibxml2parser\group +binary \sf\os\xmlsrv\xml\xmllibxml2parser\group all + +notes_source \component_defs\release.src + +ipr E diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/group/xmlenginesaxplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/group/xmlenginesaxplugin.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// IBY file for Symbian XML Framework libxml2 plug-in +// + +#ifndef XMLENGINESAXPLUGIN_IBY +#define XMLENGINESAXPLUGIN_IBY + +#include +#include + +ECOM_PLUGIN(xmlenginesaxplugin.dll,101f9782.rsc) + + +#endif // XMLENGINESAXPLUGIN_IBY diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/group/xmlenginesaxplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/group/xmlenginesaxplugin.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,47 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Project specification file for XML Engine SAX Ecom Plugin. +// +// + +TARGET xmlenginesaxplugin.dll +CAPABILITY All -Tcb +TARGETTYPE plugin +UID 0x10009D8D 0x101f9782 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_LIBC_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/stdapis/libxml2 + +USERINCLUDE ../../libxml2libs/inc/libxml2_nonexport + +SOURCEPATH ../src +SOURCE xmlengsaxplugin.cpp +SOURCE xmlengsaxcallback.cpp + +SOURCEPATH ../src +START RESOURCE 101f9782.rss +TARGET xmlenginesaxplugin.rsc +END + +LIBRARY euser.lib +LIBRARY xmlframework.lib +LIBRARY xmlengine.lib +LIBRARY xmlengineutils.lib +LIBRARY bafl.lib + + + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/101f9782.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/101f9782.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Name : 101F9782.RSS +// Registry file for the XmlFramework SAX Plugin Parser. +// + + +#include "ecom/registryinfo.rh" + +RESOURCE REGISTRY_INFO parserInfo + { + dll_uid = 0x101F9782; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F9783; + version_no = 1; + display_name = "libxml2 SAX Parser Plugin"; + default_data = "text/xml"; + opaque_data = "libxml2"; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/xmlengsaxcallback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/xmlengsaxcallback.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,824 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Callback methods for SAX libxml2 parser +// + +#include +#include +#include "xmlengsaxplugin.h" +#include "xmlengsaxpluginerror.h" + +_LIT8(KEmptyString, ""); + +LOCAL_C const TInt KAttribPrefixOffset = 1; +LOCAL_C const TInt KAttribURIOffset = 2; +LOCAL_C const TInt KAttribValueWithEndOffset = 3; +LOCAL_C const TInt KAttribEndOffset = 4; +LOCAL_C const TInt KAttributeNextOffset = 5; + +/** + * GetLengthString: + * @param aString the string + * + * Return length of string. + */ +TInt GetLengthString(const xmlChar* aString) + { + const xmlChar* ptr = aString; + if(!ptr) + { + return 0; + } + while (*ptr) + { + ++ptr; + } + + return ptr - aString; + } + +/** + * AttributeArrayDelete: + * @param aPtr the argument required by TCleanupItem object + * + * Operation which pop and closed RAttributeArray object. + */ +LOCAL_C void AttributeArrayDelete(TAny *aPtr) + { + RAttributeArray& attributes = *(RAttributeArray*)aPtr; + + TInt nAttributes = attributes.Count(); + + for(TInt i=0; i(aUserData); + + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + //because condition in parser.c file + if (aType == XML_EXTERNAL_GENERAL_PARSED_ENTITY) + { + wrapper->getParserContext()->replaceEntities = 1; + } + else + { + wrapper->getParserContext()->replaceEntities = 0; + } + xmlSAX2EntityDecl(wrapper->getParserContext(), aName, aType, aPublicId, aSystemId, aContent); + } + +/** + * ExternalSubset: + * @param aUserData the user data (XML parser context) + * @param aName the root element name + * @param aExternalID the external ID + * @param aSystemID the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +void ExternalSubset(void *aUserData, + const xmlChar *aName, + const xmlChar *aExternalID, + const xmlChar *aSystemID) + + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + xmlSAX2ExternalSubset(wrapper->getParserContext(), aName, aExternalID, aSystemID); + } + +/** + * ResolveEntity: + * @param aUserData the user data (XML parser context) + * @param aPublicId The public ID of the entity + * @param aSystemId The system ID of the entity + * + * Callback on resolve entity. + */ +xmlParserInputPtr ResolveEntity(void *aUserData, + const xmlChar *aPublicId, + const xmlChar *aSystemId) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + return xmlSAX2ResolveEntity(wrapper->getParserContext(), aPublicId, aSystemId); + } + +/** + * GetEntityL: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetEntityL(void *aUserData, + const xmlChar *aName) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->getParserContext()->replaceEntities = 0; + + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + xmlEntityPtr entity; + entity = xmlSAX2GetEntity(wrapper->getParserContext(), aName); + + //predefined, internal and external entity + if (entity) + { + //entity in attribute + if (wrapper->getParserContext()->instate == XML_PARSER_ATTRIBUTE_VALUE) + { + wrapper->getParserContext()->replaceEntities = 1; + } + //entity in content + else + { + + //internal and predefined - nothing + + //external entity + if (entity->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) + { + TPtrC8 skipString(aName); + RString ref = wrapper->StringPool().OpenStringL(skipString); + + CleanupClosePushL(ref); + wrapper->getContentHandler()->OnSkippedEntityL(ref, KErrNone); + CleanupStack::PopAndDestroy(&ref); + } + } + + return entity; + } + + //external subset + if (wrapper->getParserContext()->hasExternalSubset) + { + + wrapper->GetEntity().name = aName; + wrapper->GetEntity().type = XML_ENTITY_DECL; + wrapper->GetEntity().etype = XML_INTERNAL_GENERAL_ENTITY; + wrapper->GetEntity().orig = BAD_CAST ""; + wrapper->GetEntity().content = BAD_CAST ""; + + if (wrapper->getParserContext()->instate == XML_PARSER_ATTRIBUTE_VALUE + && !wrapper->IsFeatureEnabled(EReplaceIntEntityFromExtSubsetByRef)) + { + wrapper->getParserContext()->replaceEntities = 1; + return &(wrapper->GetEntity()); + } + + TPtrC8 skipString(aName); + RString ref = wrapper->StringPool().OpenStringL(skipString); + + CleanupClosePushL(ref); + wrapper->getContentHandler()->OnSkippedEntityL(ref, KErrNone); + CleanupStack::PopAndDestroy(&ref); + + return &(wrapper->GetEntity()); + + } + + return NULL; + } + +/** + * GetEntityCal: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetEntityCal(void *aUserData, const xmlChar *aName) + { + xmlEntityPtr tmp = NULL; + TRAPD(error,tmp = GetEntityL(aUserData,aName)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + return tmp; + } + +/** + * GetParameterEntity: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetParameterEntity(void *aUserData, + const xmlChar *aName) +{ + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + + xmlEntityPtr entity; + entity = xmlSAX2GetParameterEntity(wrapper->getParserContext(), aName); + + return entity; +} + +/** + * StructuredError: + * @param aUserData user provided data for the error callback + * @param aError the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +void StructuredError(void *aUserData, + xmlErrorPtr aError) +{ + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + TInt error = GetErrorNum(aError->code); + + // warning handling + if (error == KErrNone) + { + return; + } + + //because cascade of errors + //first error is returned in case when any other event occurs between cascade of calling libxml2_StructuredError event + if (!wrapper->IsErrorStatus()) + { + wrapper->getContentHandler()->OnError(error); + wrapper->SetErrorStatus(ETrue); + } +} + +/** + * StartDocumentL: + * @param aUserData the user data (XML parser context) + * + * Called when the document start being processed. + */ +void StartDocumentL(void* aUserData) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + RDocumentParameters params; + TPtrC8 enc(KEmptyString); + + if (wrapper->getParserContext()->encoding) + { + TPtrC8 tmpStr(wrapper->getParserContext()->encoding); + enc.Set(tmpStr); + } + + params.Open(wrapper->StringPool().OpenStringL(enc)); + CleanupClosePushL(params); + + wrapper->getContentHandler()->OnStartDocumentL(params, KErrNone); + CleanupStack::PopAndDestroy(¶ms); + } + +/** + * StartDocument: + * @param aUserData the user data (XML parser context) + * + * Called when the document start being processed. + */ +void StartDocument(void* aUserData) + { + TRAPD(error,StartDocumentL(aUserData)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + } + +/** + * EndDocumentL: + * @param aUserData the user data (XML parser context) + * + * Called when the document end has been detected. + */ +void EndDocument(void* aUserData) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TRAPD(error,wrapper->getContentHandler()->OnEndDocumentL(KErrNone)); + if(error) + { + wrapper->StopParsing(error); + } + } + +/** + * Characters: + * @param aUserData the user data (XML parser context) + * @param aCharacter a xmlChar string + * @param aLen the number of xmlChar + * + * Receiving some chars from the parser. + */ +void Characters(void* aUserData, const xmlChar* aCharacter, int aLen) +{ + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TPtrC8 ptr(aCharacter, aLen); + TRAPD(error,wrapper->getContentHandler()->OnContentL(ptr, KErrNone)); + if(error) + { + wrapper->StopParsing(error); + } +} + +/** + * IgnorableWhitespace: + * @param aUserData the user data (XML parser context) + * @param aCharacter a xmlChar string + * @param aLen the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +void IgnorableWhitespace(void *aUserData, const xmlChar* aCharacter, int aLen) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TPtrC8 ptr(aCharacter, aLen); + TRAPD(error,wrapper->getContentHandler()->OnIgnorableWhiteSpaceL(ptr, KErrNone)); + if(error) + { + wrapper->StopParsing(error); + } + } + +/** + * ProcessingInstruction: + * @param aUserData the user data (XML parser context) + * @param aTarget the target name + * @param aData the PI data's + * + * A processing instruction has been parsed. + */ +void ProcessingInstruction(void *aUserData, const xmlChar* aTarget, const xmlChar* aData) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TPtrC8 target(KEmptyString); + TPtrC8 data(KEmptyString); + + if (aTarget) + { + TPtrC8 ptrTemp(aTarget); + target.Set(ptrTemp); + } + + if (aData) + { + TPtrC8 ptrTemp(aData); + data.Set(ptrTemp); + } + + TRAPD(error,wrapper->getContentHandler()->OnProcessingInstructionL(target, data, KErrNone)); + if(error) + { + wrapper->StopParsing(error); + } + } + +/** + * StartElementNsL: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * @param aNbNamespaces number of namespace definitions on that node + * @param aNamespaces pointer to the array of prefix/URI pairs namespace definitions + * @param aNbAttributes the number of attributes on that node + * @param aNbDefaulted the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @param aAttributes pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ +void StartElementNsL( + void *aUserData, + const xmlChar *aLocalName, + const xmlChar *aPrefix, + const xmlChar *aURI, + int /*aNbNamespaces*/, + const xmlChar **/*aNamespaces*/, + int aNbAttributes, + int /*aNbDefaulted*/, + const xmlChar **aAttributes) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TPtrC8 ptrName(aLocalName); + TPtrC8 ptrPrefix; + TPtrC8 ptrUri; + HBufC8* buf = NULL; + + if(wrapper->IsFeatureEnabled(EConvertTagsToLowerCase)) + { + //remove buffer when any function in this method leave + buf = HBufC8::NewLC(ptrName.Length()); + buf->Des().Copy(ptrName); + buf->Des().LowerCase(); + ptrName.Set(buf->Des()); + } + + if (aPrefix) + ptrPrefix.Set(aPrefix); + + if (aURI) + ptrUri.Set(aURI); + + RTagInfo nameTagInfo; + RString strURI, strPrefix, strName; + + strURI = wrapper->StringPool().OpenStringL(ptrUri); + CleanupClosePushL(strURI); + + strPrefix = wrapper->StringPool().OpenStringL(ptrPrefix); + CleanupClosePushL(strPrefix); + + strName = wrapper->StringPool().OpenStringL(ptrName); + + CleanupStack::Pop(&strPrefix); + CleanupStack::Pop(&strURI); + + nameTagInfo.Open(strURI, strPrefix, strName); + CleanupClosePushL(nameTagInfo); + + const TUint8** ptr; + ptr = aAttributes; + + RAttributeArray attributeArray; + CleanupStack::PushL(TCleanupItem(AttributeArrayDelete, &attributeArray)); + + if (ptr) + { + for (TInt i=0; iStringPool().OpenStringL(attribURI); + CleanupClosePushL(strAttribURI); + + strAttribPrefix = wrapper->StringPool().OpenStringL(attribPrefix); + CleanupClosePushL(strAttribPrefix); + + strAttribName = wrapper->StringPool().OpenStringL(attribName); + CleanupClosePushL(strAttribName); + + strAttribValue = wrapper->StringPool().OpenStringL(attribValue); + + CleanupStack::Pop(&strAttribName); + CleanupStack::Pop(&strAttribPrefix); + CleanupStack::Pop(&strAttribURI); + + RAttribute attrib; + attrib.Open(strAttribURI, strAttribPrefix, strAttribName, strAttribValue); + CleanupClosePushL(attrib); + attributeArray.AppendL(attrib); + CleanupStack::Pop(&attrib); + + ptr = ptr + KAttributeNextOffset; + } + } + wrapper->getContentHandler()->OnStartElementL(nameTagInfo,attributeArray, KErrNone); + CleanupStack::PopAndDestroy(&attributeArray); + CleanupStack::PopAndDestroy(&nameTagInfo); + + if (buf) + { + CleanupStack::PopAndDestroy(buf); + } + } + +/** + * StartElementNs: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * @param aNbNamespaces number of namespace definitions on that node + * @param aNamespaces pointer to the array of prefix/URI pairs namespace definitions + * @param aNbAttributes the number of attributes on that node + * @param aNbDefaulted the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @param aAttributes pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ +void StartElementNs( + void *aUserData, + const xmlChar *aLocalName, + const xmlChar *aPrefix, + const xmlChar *aURI, + int aNbNamespaces, + const xmlChar **aNamespaces, + int aNbAttributes, + int aNbDefaulted, + const xmlChar **aAttributes) + { + TRAPD(error, StartElementNsL(aUserData,aLocalName,aPrefix,aURI, + aNbNamespaces,aNamespaces,aNbAttributes,aNbDefaulted,aAttributes)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + } + +/** + * EndElementNsL: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ +void EndElementNsL( + void *aUserData, + const xmlChar *aLocalName, + const xmlChar *aPrefix, + const xmlChar *aURI) + { + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + TPtrC8 ptrUri; + TPtrC8 ptrPrefix; + TPtrC8 ptrName(aLocalName); + + HBufC8* buf = NULL; + + if(wrapper->IsFeatureEnabled(EConvertTagsToLowerCase)) + { + //remove buffer when any function in this method leave + buf = HBufC8::NewLC(ptrName.Length()); + buf->Des().Copy(ptrName); + buf->Des().LowerCase(); + ptrName.Set(buf->Des()); + } + + + if (aPrefix) + ptrPrefix.Set(aPrefix); + + if (aURI) + ptrUri.Set(aURI); + + RTagInfo nameTagInfo; + RString strURI, strPrefix, strName; + + strURI = wrapper->StringPool().OpenStringL(ptrUri); + CleanupClosePushL(strURI); + + strPrefix = wrapper->StringPool().OpenStringL(ptrPrefix); + CleanupClosePushL(strPrefix); + + strName = wrapper->StringPool().OpenStringL(ptrName); + CleanupClosePushL(strName); + + nameTagInfo.Open(strURI, strPrefix, strName); + wrapper->getContentHandler()->OnEndElementL(nameTagInfo, KErrNone); + + CleanupStack::PopAndDestroy(&strName); + CleanupStack::PopAndDestroy(&strPrefix); + CleanupStack::PopAndDestroy(&strURI); + + if (buf) + { + CleanupStack::PopAndDestroy(buf); + } + } + +/** + * EndElementNs: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ +void EndElementNs( void *aUserData, + const xmlChar *aLocalName, + const xmlChar *aPrefix, + const xmlChar *aURI) + { + TRAPD(error, EndElementNsL(aUserData,aLocalName,aPrefix,aURI)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + } + +/** + * StartPrefixMappingL: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL if default namespace + * @param aURI the element namespace name if available + * + * SAX2 callback when namespace prefix mapping is done. + */ +void StartPrefixMappingL( + void* aUserData, + const xmlChar* aPrefix, + const xmlChar* aURI) +{ + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + if (wrapper->IsFeatureEnabled(EReportNamespaceMapping)) + { + TPtrC8 ptrPrefix; + TPtrC8 ptrURI; + + if (aPrefix) + { + ptrPrefix.Set(aPrefix); + } + + if (aURI) + { + ptrURI.Set(aURI); + } + + + RString strPrefix = wrapper->StringPool().OpenStringL(ptrPrefix); + CleanupClosePushL(strPrefix); + RString strURI = wrapper->StringPool().OpenStringL(ptrURI); + CleanupClosePushL(strURI); + wrapper->getContentHandler()->OnStartPrefixMappingL(strPrefix, strURI, KErrNone); + CleanupStack::PopAndDestroy(&strURI); + CleanupStack::PopAndDestroy(&strPrefix); + } +} + +/** + * StartPrefixMapping: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL if default namespace + * @param aURI the element namespace name if available + * + * SAX2 callback when namespace prefix mapping is done. + */ +void StartPrefixMapping( + void* aUserData, + const xmlChar* aPrefix, + const xmlChar* aURI) + { + TRAPD(error, StartPrefixMappingL(aUserData,aPrefix,aURI)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + } + +/** + * EndPrefixMappingL: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL otherwise + * + * SAX2 callback when namespace prefix mapping is getting out of scope. + */ +void EndPrefixMappingL( + void* aUserData, + const xmlChar* aPrefix) +{ + + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + //reset of recoverable error + wrapper->SetErrorStatus(EFalse); + + if (wrapper->IsFeatureEnabled(EReportNamespaceMapping)) + { + TPtrC8 ptrPrefix; + + if (aPrefix) + { + ptrPrefix.Set(aPrefix); + } + + RString strPrefix = wrapper->StringPool().OpenStringL(ptrPrefix); + CleanupClosePushL(strPrefix); + wrapper->getContentHandler()->OnEndPrefixMappingL(strPrefix, KErrNone); + CleanupStack::PopAndDestroy(&strPrefix); + } +} + +/** + * EndPrefixMapping: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL otherwise + * + * SAX2 callback when namespace prefix mapping is getting out of scope. + */ +void EndPrefixMapping( + void* aUserData, + const xmlChar* aPrefix) + { + TRAPD(error, EndPrefixMappingL(aUserData,aPrefix)); + if(error != KErrNone) + { + CXMLEngineSAXPlugin* wrapper = reinterpret_cast(aUserData); + wrapper->StopParsing(error); + } + } diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/xmlengsaxplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/xmlengsaxplugin.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,310 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SAX libxml2 parser plugin +// + +#include "xmlengsaxplugin.h" +#include "xmlengsaxpluginerror.h" +#include "libxml2_globals_private.h" + +MParser* CXMLEngineSAXPlugin::NewL(TAny* aInitParams) + { + + CXMLEngineSAXPlugin* self = new(ELeave) + CXMLEngineSAXPlugin(reinterpret_cast(aInitParams)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return (static_cast(self)); + } + + +CXMLEngineSAXPlugin::CXMLEngineSAXPlugin(TParserInitParams* aInitParams) +: iContentHandler (reinterpret_cast(aInitParams->iContentHandler)), + iStringDictionaryCollection (reinterpret_cast + (aInitParams->iStringDictionaryCollection)), + iCharSetConverter (reinterpret_cast(aInitParams->iCharSetConverter)), + iElementStack (reinterpret_cast(aInitParams->iElementStack)) + { + } + + +void CXMLEngineSAXPlugin::ConstructL() + { + + //settings flag as EFalse + Flag_Error_Status = EFalse; + + //setting the callbacks for LibXML2 sax parser + iParserEvents.externalSubset = ExternalSubset; + iParserEvents.entityDecl = EntityDeclaration; + iParserEvents.getEntity = GetEntityCal; + iParserEvents.resolveEntity = ResolveEntity; + iParserEvents.startDocument = StartDocument; + iParserEvents.endDocument = EndDocument; + iParserEvents.characters = Characters; + iParserEvents.startPrefixMapping = StartPrefixMapping; + iParserEvents.endPrefixMapping = EndPrefixMapping; + iParserEvents.initialized = XML_SAX2_MAGIC; + iParserEvents.startElementNs = StartElementNs; + iParserEvents.endElementNs = EndElementNs; + iParserEvents.ignorableWhitespace = IgnorableWhitespace; + iParserEvents.processingInstruction = ProcessingInstruction; + iParserEvents.serror = StructuredError; + iParserEvents.getParameterEntity = GetParameterEntity; + + //checking if content handler or dictionary are null + User::LeaveIfNull(iContentHandler); + User::LeaveIfNull(iStringDictionaryCollection); + + iStringPool = iStringDictionaryCollection->StringPool(); + XmlEngineAttachL(); + } + +CXMLEngineSAXPlugin::~CXMLEngineSAXPlugin() + { + XmlEngineCleanup(iParserContext); + iParserContext = NULL; + + //releasing rest of objects + iStringDictionaryCollection = NULL; + iContentHandler = NULL; + iCharSetConverter = NULL; + iElementStack = NULL; + + //releasing entity object + iEntity.name = NULL; + iEntity.orig = NULL; + iEntity.content = NULL; + } + + +//From MParser + +/** + * Enable a feature. + */ +TInt CXMLEngineSAXPlugin::EnableFeature(TInt aParserFeature) + { + if(aParserFeature & ~(KFeatures)) + return KErrNotSupported; + + iParserMode |= aParserFeature; + + return KErrNone; + } + +/** + * Disable a feature. + */ +TInt CXMLEngineSAXPlugin::DisableFeature(TInt aParserFeature) + { + if(aParserFeature & ~(KFeatures)) + return KErrNotSupported; + + iParserMode &= ~aParserFeature; + + return KErrNone; + } + +/** + * See if a feature is enabled. + */ +TBool CXMLEngineSAXPlugin::IsFeatureEnabled(TInt aParserFeature) const + { + return iParserMode & aParserFeature; + } + +void CXMLEngineSAXPlugin::StopParsing(TInt aError) + { + if(iParserContext) + { + xmlStopParser(iParserContext); + iParserContext->errNo = aError; + if ( aError == KErrNoMemory ) + { + xmlSetOOM(); + } + } + } + +/** + * Parses a descriptor that contains part of a document. + */ +void CXMLEngineSAXPlugin::ParseChunkL(const TDesC8& aDescriptor) + { + + TInt result = KErrNone; + + if (!iParserContext) + { + //creating sax parser object + iParserContext = xmlCreatePushParserCtxt( + (xmlSAXHandler*) &iParserEvents, + this, + (const char *) aDescriptor.Ptr(), + aDescriptor.Length(), + NULL + ); + if(!iParserContext) + { + CleanupAndLeaveL(KErrNoMemory); + } + + //creating empty document object + iParserContext->myDoc = xmlNewDoc(BAD_CAST "SAX compatibility mode document"); + if(!iParserContext->myDoc) + { + CleanupAndLeaveL(KErrNoMemory); + } + iParserContext->myDoc->intSubset = xmlNewDtd(iParserContext->myDoc, BAD_CAST "fake", NULL, NULL); + if(!iParserContext->myDoc->intSubset) + { + CleanupAndLeaveL(KErrNoMemory); + } + + //parsing process + result = xmlParseChunk(iParserContext, NULL, 0, 0); + } + else + { + //parsing process + result = xmlParseChunk( + iParserContext, + (const char *) aDescriptor.Ptr(), + aDescriptor.Length(), + 0); + } + + //handling error situation + //if fatal error, function throws exception + //in any other case next chunk is taken (recoverable) + if ((result == XML_ERR_NO_MEMORY) || (iParserContext->lastError.level == XML_ERR_FATAL) + || (result < 0)) + { + CleanupAndLeaveL(GetErrorNum(result)); + } + } + +/** + * Parses a descriptor that contains the last part of a document. + */ +void CXMLEngineSAXPlugin::ParseLastChunkL(const TDesC8& /*aDescriptor*/) + { + if (!iParserContext) + { + User::Leave(EXmlParserError); + } + + //parsing process + TInt result(KErrNone); + result = xmlParseChunk(iParserContext, NULL, 0, 1); + if ((result == XML_ERR_NO_MEMORY) || (iParserContext->lastError.level == XML_ERR_FATAL) + || (result < 0)) + { + CleanupAndLeaveL(GetErrorNum(result)); + } + + //releasing context to the parser + xmlParserCtxtPtr ctxt = reinterpret_cast(iParserContext); + if(ctxt->myDoc) + { + xmlFreeDoc(ctxt->myDoc); + } + xmlFreeParserCtxt(ctxt); + iParserContext = NULL; + + } + +/** + * Interfaces don't have a destructor, so we have an explicit method instead. + */ +void CXMLEngineSAXPlugin::Release() + { + delete this; + } + +void CXMLEngineSAXPlugin::CleanupAndLeaveL(TInt aError) + { + // reseting OOM flag + if((aError == KErrNoMemory) && xmlOOMFlag()) + { + xmlResetOOM(); + } + + //releasing context to the parser + if(iParserContext) + { + xmlParserCtxtPtr ctxt = reinterpret_cast(iParserContext); + if(ctxt->myDoc) + { + xmlFreeDoc(ctxt->myDoc); + } + xmlFreeParserCtxt(ctxt); + } + iParserContext = NULL; + + if (aError) + { + User::Leave(aError); + } + else + { + User::Leave(EXmlParserError); + } + } + +// From MContentSouce + +/** + * This method tells us what's the next content handler in the chain. + */ +void CXMLEngineSAXPlugin::SetContentSink (MContentHandler& aContentHandler) + { + iContentHandler = &aContentHandler; + } + + +//Public getter and setter method + +/** + * This method returns a parser context object. + */ +xmlParserCtxtPtr CXMLEngineSAXPlugin::getParserContext() const + { + return iParserContext; + } + +xmlEntity& CXMLEngineSAXPlugin::GetEntity() + { + return iEntity; + } + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = { + IMPLEMENTATION_PROXY_ENTRY(0x101f9783, CXMLEngineSAXPlugin::NewL) + }; + + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/xmlengsaxplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/xmlengsaxplugin.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,477 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SAX libxml2 parser plugin +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSAXPLUGIN_H +#define XMLENGSAXPLUGIN_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +using namespace Xml; + +const TInt KFeatures = EConvertTagsToLowerCase | EReportNamespaceMapping + | EReportNamespaces | EReportNamespacePrefixes + | EReplaceIntEntityFromExtSubsetByRef; + +const TInt KGranularityOfEntitiesArray = 8; + +/** + * GetLengthString: + * @param aString the string + * + * Return length of string. + */ +TInt GetLengthString(const xmlChar* aString); + +/** + * EntityDecl: + * @param aUserData the user data (XML parser context) + * @param aName the entity name + * @param aType the entity type + * @param aPublicId The public ID of the entity + * @param aSystemId The system ID of the entity + * @param aContent the entity value (without processing). + * + * An entity definition has been parsed. + */ +void EntityDeclaration(void *aUserData, + const xmlChar *aName, + int aType, + const xmlChar *aPublicId, + const xmlChar *aSystemId, + xmlChar *aContent); + +/** + * ExternalSubset: + * @param aUserData the user data (XML parser context) + * @param aName the root element name + * @param aExternalID the external ID + * @param aSystemID the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +void ExternalSubset(void *aUserData, + const xmlChar *aName, + const xmlChar *aExternalID, + const xmlChar *aSystemID); + +/** + * ResolveEntity: + * @param aUserData the user data (XML parser context) + * @param aPublicId The public ID of the entity + * @param aSystemId The system ID of the entity + * + * Callback on resolve entity. + */ +xmlParserInputPtr ResolveEntity(void *aUserData, + const xmlChar *aPublicId, + const xmlChar *aSystemId); + +/** + * StructuredError: + * @param aUserData user provided data for the error callback + * @param aError the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +void StructuredError(void *aUserData, + xmlErrorPtr aError); + +/** + * GetEntityL: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetEntityL(void *aUserData, + const xmlChar *aName); + +/** + * GetEntityCal: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetEntityCal(void *aUserData, + const xmlChar *aName); + +/** + * GetParameterEntityL: + * @param aUserData the user data (XML parser context) + * @param aName The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +xmlEntityPtr GetParameterEntity(void *aUserData, + const xmlChar *aName); + +/** + * StartDocument: + * @param aUserData the user data (XML parser context) + * + * Called when the document start being processed. + */ +void StartDocument(void* aUserData); + +/** + * EndDocument: + * @param aUserData the user data (XML parser context) + * + * Called when the document end has been detected. + */ +void EndDocument(void* aUserData); + +/** + * Characters: + * @param aUserData the user data (XML parser context) + * @param aCharacter a xmlChar string + * @param aLen the number of xmlChar + * + * Receiving some chars from the parser. + */ +void Characters(void* aUserData, const xmlChar* aCharacter, int aLen); + +/** + * IgnorableWhitespace: + * @param aUserData the user data (XML parser context) + * @param aCharacter a xmlChar string + * @param aLen the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +void IgnorableWhitespace(void *aUserData, const xmlChar* aCharacter, int aLen); + +/** + * ProcessingInstruction: + * @param aUserData the user data (XML parser context) + * @param aTarget the target name + * @param aData the PI data's + * + * A processing instruction has been parsed. + */ +void ProcessingInstruction(void *aUserData, const xmlChar* aTarget, const xmlChar* aData); + +/** + * StartElementNsL: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * @param aNbNamespaces number of namespace definitions on that node + * @param aNamespaces pointer to the array of prefix/URI pairs namespace definitions + * @param aNbAttributes the number of attributes on that node + * @param aNbDefaulted the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @param aAttributes pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ +void StartElementNsL( + void *aUserData, + const xmlChar *aLocalname, + const xmlChar *aPrefix, + const xmlChar *aURI, + int aNbNamespaces, + const xmlChar **aNamespaces, + int aNbAttributes, + int aNbDefaulted, + const xmlChar **aAttributes); + +/** + * StartElementNs: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * @param aNbNamespaces number of namespace definitions on that node + * @param aNamespaces pointer to the array of prefix/URI pairs namespace definitions + * @param aNbAttributes the number of attributes on that node + * @param aNbDefaulted the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @param aAttributes pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ +void StartElementNs( + void *aUserData, + const xmlChar *aLocalname, + const xmlChar *aPrefix, + const xmlChar *aURI, + int aNbNamespaces, + const xmlChar **aNamespaces, + int aNbAttributes, + int aNbDefaulted, + const xmlChar **aAttributes); + +/** + * EndElementNsL: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ +void EndElementNsL( + void *aUserData, + const xmlChar *aLocalname, + const xmlChar *aPrefix, + const xmlChar *aURI); + +/** + * EndElementNs: + * @param aUserData the user data (XML parser context) + * @param aLocalname the local name of the element + * @param aPrefix the element namespace prefix if available + * @param aURI the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ +void EndElementNs( + void *aUserData, + const xmlChar *aLocalname, + const xmlChar *aPrefix, + const xmlChar *aURI); + +/** + * StartPrefixMappingL: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL if default namespace + * @param aURI the element namespace name if available + * + * SAX2 callback when namespace prefix mapping is done. + */ +void StartPrefixMappingL( + void* aUserData, + const xmlChar* aPrefix, + const xmlChar* aURI); + +/** + * EndPrefixMappingL: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL otherwise + * + * SAX2 callback when namespace prefix mapping is getting out of scope. + */ +void EndPrefixMappingL( + void* aUserData, + const xmlChar* aPrefix); + +/** + * StartPrefixMapping: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL if default namespace + * @param aURI the element namespace name if available + * + * SAX2 callback when namespace prefix mapping is done. + */ +void StartPrefixMapping( + void* aUserData, + const xmlChar* aPrefix, + const xmlChar* aURI); + +/** + * EndPrefixMapping: + * @param aUserData the user data (XML parser context) + * @param aPrefix the element namespace prefix if available, NULL otherwise + * + * SAX2 callback when namespace prefix mapping is getting out of scope. + */ +void EndPrefixMapping( + void* aUserData, + const xmlChar* aPrefix); + +/* + +CXMLEngineSAXPlugin class. + +This class encapsulates the LibXML2 parser. It is the engine behind CXMLEngineSAXPlugin. + +Handles construction and deletion of LibXML2 parser. Defines handlers required for LibXML2, +transforms handler data to required types and passes this to the client by MContentHandler +callbacks. + +*/ + +class CXMLEngineSAXPlugin : public CBase, public MParser + { + + + public: + + static MParser* NewL(TAny* aInitParams); + + virtual ~CXMLEngineSAXPlugin(); + + //From MParser + + /** + * Enable a feature. + */ + TInt EnableFeature(TInt aParserFeature); + + /** + * Disable a feature. + */ + TInt DisableFeature(TInt); + + /** + * See if a feature is enabled. + */ + TBool IsFeatureEnabled(TInt) const; + + /** + * Parses a descriptor that contains part of a document. + */ + void ParseChunkL (const TDesC8& aDescriptor); + + /** + * Parses a descriptor that contains the last part of a document. + */ + void ParseLastChunkL(const TDesC8& aDescriptor); + + /** + * Interfaces don't have a destructor, so we have an explicit method instead. + */ + void Release(); + + // From MContentSouce + + /** + * This method tells us what's the next content handler in the chain. + */ + void SetContentSink (MContentHandler& aContentHandler); + + //Public getter and setter method + + /** + * This method returns pool object. + */ + inline RStringPool& StringPool(); + + /** + * This method returns a user handler object. + */ + inline MContentHandler* getContentHandler() const; + + /** + * This method returns a parser context object. + */ + xmlParserCtxtPtr getParserContext() const; + + /** + * This method return error status. + */ + inline TBool IsErrorStatus(); + + /** + * This method set error status. + */ + inline void SetErrorStatus(TBool aStatus); + + /** + * This method stop parsing. + */ + void StopParsing(TInt aError); + + xmlEntity& GetEntity(); + + /** + * This method releases context and leaves with aError code + */ + void CleanupAndLeaveL(TInt aError); + + private: + + //constructor of CXMLEngineSAXPlugin + CXMLEngineSAXPlugin(TParserInitParams* aInitParams); + void ConstructL(); + + private: + + //user handler object + MContentHandler* iContentHandler; + + RStringDictionaryCollection* iStringDictionaryCollection; + CCharSetConverter* iCharSetConverter; + RElementStack* iElementStack; + RStringPool iStringPool; + + //context to the libxml2 sax parser + xmlParserCtxtPtr iParserContext; + + //context to the libxml2 sax handler + xmlSAXHandler iParserEvents; + + //Features mode + TInt iParserMode; + + //flag which tells that in parsing process error occurs (TRUE if error was found) + TBool Flag_Error_Status; + + xmlEntity iEntity; + }; + +#include "xmlengsaxplugin.inl" + +#endif /* XMLENGSAXPLUGIN_H */ + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/xmlengsaxplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/xmlengsaxplugin.inl Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// SAX libxml2 parser plugin inlined definitions +// This method returns pool object. +// + + + +inline RStringPool& CXMLEngineSAXPlugin::StringPool() + { + return iStringPool; + } + +/** + * This method returns a user handler object. + */ +inline MContentHandler* CXMLEngineSAXPlugin::getContentHandler() const + { + return iContentHandler; + } + +/** + * This method returns error status. + */ +inline TBool CXMLEngineSAXPlugin::IsErrorStatus() + { + return Flag_Error_Status; + } + +/** + * This method sets error status. + */ +inline void CXMLEngineSAXPlugin::SetErrorStatus(TBool aStatus) + { + Flag_Error_Status = aStatus; + } + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/src/xmlengsaxpluginerror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/src/xmlengsaxpluginerror.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,176 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Sax error maping functions. +// + + + +/** + @file + @internalComponent + @released +*/ +#ifndef XMLENGSAXPLUGINERROR_H +#define XMLENGSAXPLUGINERROR_H + +LOCAL_C const TInt KErrorArrayGeneralMapSize = 101; +LOCAL_C const TInt KErrorArrayGeneralMapOffset = 0; + +LOCAL_C const TInt KErrorArrayGenMap[] = + { + KErrNone, /* 0 XML_ERR_OK */ + EXmlSyntax, /* 1 XML_ERR_INTERNAL_ERROR */ + KErrNoMemory, /* 2 XML_ERR_NO_MEMORY */ + EXmlSyntax, /* 3 XML_ERR_DOCUMENT_START */ + EXmlNoElements, /* 4 XML_ERR_DOCUMENT_EMPTY */ + EXmlJunkAfterDocElement, /* 5 XML_ERR_DOCUMENT_END */ + EXmlBadCharRef, /* 6 XML_ERR_INVALID_HEX_CHARREF */ + EXmlBadCharRef, /* 7 XML_ERR_INVALID_DEC_CHARREF */ + EXmlBadCharRef, /* 8 XML_ERR_INVALID_CHARREF */ + EXmlInvalidToken, /* 9 XML_ERR_INVALID_CHAR */ + EXmlSyntax, /* 10 XML_ERR_CHARREF_AT_EOF */ + EXmlSyntax, /* 11 XML_ERR_CHARREF_IN_PROLOG */ + EXmlSyntax, /* 12 XML_ERR_CHARREF_IN_EPILOG */ + EXmlSyntax, /* 13 XML_ERR_CHARREF_IN_DTD */ + EXmlSyntax, /* 14 XML_ERR_ENTITYREF_AT_EOF */ + EXmlSyntax, /* 15 XML_ERR_ENTITYREF_IN_PROLOG */ + EXmlSyntax, /* 16 XML_ERR_ENTITYREF_IN_EPILOG */ + EXmlSyntax, /* 17 XML_ERR_ENTITYREF_IN_DTD */ + EXmlSyntax, /* 18 XML_ERR_PEREF_AT_EOF */ + EXmlSyntax, /* 19 XML_ERR_PEREF_IN_PROLOG */ + EXmlSyntax, /* 20 XML_ERR_PEREF_IN_EPILOG */ + EXmlSyntax, /* 21 XML_ERR_PEREF_IN_INT_SUBSET */ + EXmlInvalidToken, /* 22 XML_ERR_ENTITYREF_NO_NAME */ + EXmlInvalidToken, /* 23 XML_ERR_ENTITYREF_SEMICOL_MISSING */ + EXmlInvalidToken, /* 24 XML_ERR_PEREF_NO_NAME */ + EXmlInvalidToken, /* 25 XML_ERR_PEREF_SEMICOL_MISSING */ + EXmlUndefinedEntity, /* 26 XML_ERR_UNDECLARED_ENTITY */ + KErrNone, /* 27 XML_WAR_UNDECLARED_ENTITY */ + EXmlSyntax, /* 28 XML_ERR_UNPARSED_ENTITY */ + EXmlSyntax, /* 29 XML_ERR_ENTITY_IS_EXTERNAL */ + EXmlSyntax, /* 30 XML_ERR_ENTITY_IS_PARAMETER */ + EXmlUnknownEncoding, /* 31 XML_ERR_UNKNOWN_ENCODING */ + EXmlIncorrectEncoding, /* 32 XML_ERR_UNSUPPORTED_ENCODING */ + EXmlSyntax, /* 33 XML_ERR_STRING_NOT_STARTED */ + EXmlSyntax, /* 34 XML_ERR_STRING_NOT_CLOSED */ + EXmlSyntax, /* 35 XML_ERR_NS_DECL_ERROR */ + EXmlInvalidToken, /* 36 XML_ERR_ENTITY_NOT_STARTED */ + EXmlUnclosedToken, /* 37 XML_ERR_ENTITY_NOT_FINISHED */ + EXmlInvalidToken, /* 38 XML_ERR_LT_IN_ATTRIBUTE */ + EXmlInvalidToken, /* 39 XML_ERR_ATTRIBUTE_NOT_STARTED */ + EXmlUnclosedToken, /* 40 XML_ERR_ATTRIBUTE_NOT_FINISHED */ + EXmlInvalidToken, /* 41 XML_ERR_ATTRIBUTE_WITHOUT_VALUE */ + EXmlDuplicateAttribute, /* 42 XML_ERR_ATTRIBUTE_REDEFINED */ + EXmlInvalidToken, /* 43 XML_ERR_LITERAL_NOT_STARTED */ + EXmlUnclosedToken, /* 44 XML_ERR_LITERAL_NOT_FINISHED */ + EXmlUnclosedToken, /* 45 XML_ERR_COMMENT_NOT_FINISHED */ + EXmlInvalidToken, /* 46 XML_ERR_PI_NOT_STARTED */ + EXmlUnclosedToken, /* 47 XML_ERR_PI_NOT_FINISHED */ + EXmlInvalidToken, /* 48 XML_ERR_NOTATION_NOT_STARTED */ + EXmlUnclosedToken, /* 49 XML_ERR_NOTATION_NOT_FINISHED */ + EXmlSyntax, /* 50 XML_ERR_ATTLIST_NOT_STARTED */ + EXmlUnclosedToken, /* 51 XML_ERR_ATTLIST_NOT_FINISHED */ + EXmlInvalidToken, /* 52 XML_ERR_MIXED_NOT_STARTED */ + EXmlUnclosedToken, /* 53 XML_ERR_MIXED_NOT_FINISHED */ + EXmlInvalidToken, /* 54 XML_ERR_ELEMCONTENT_NOT_STARTED */ + EXmlUnclosedToken, /* 55 XML_ERR_ELEMCONTENT_NOT_FINISHED */ + EXmlInvalidToken, /* 56 XML_ERR_XMLDECL_NOT_STARTED */ + EXmlUnclosedToken, /* 57 XML_ERR_XMLDECL_NOT_FINISHED */ + EXmlInvalidToken, /* 58 XML_ERR_CONDSEC_NOT_STARTED */ + EXmlUnclosedToken, /* 59 XML_ERR_CONDSEC_NOT_FINISHED */ + EXmlUnclosedToken, /* 60 XML_ERR_EXT_SUBSET_NOT_FINISHED */ + EXmlSyntax, /* 61 XML_ERR_DOCTYPE_NOT_FINISHED */ + EXmlInvalidToken, /* 62 XML_ERR_MISPLACED_CDATA_END */ + EXmlUnclosedToken, /* 63 XML_ERR_CDATA_NOT_FINISHED */ + EXmlSyntax, /* 64 XML_ERR_RESERVED_XML_NAME */ + EXmlInvalidToken, /* 65 XML_ERR_SPACE_REQUIRED */ + EXmlSyntax, /* 66 XML_ERR_SEPARATOR_REQUIRED */ + EXmlSyntax, /* 67 XML_ERR_NMTOKEN_REQUIRED */ + EXmlInvalidToken, /* 68 XML_ERR_NAME_REQUIRED */ + EXmlSyntax, /* 69 XML_ERR_PCDATA_REQUIRED */ + EXmlSyntax, /* 70 XML_ERR_URI_REQUIRED */ + EXmlSyntax, /* 71 XML_ERR_PUBID_REQUIRED */ + EXmlInvalidToken, /* 72 XML_ERR_LT_REQUIRED */ + EXmlInvalidToken, /* 73 XML_ERR_GT_REQUIRED */ + EXmlSyntax, /* 74 XML_ERR_LTSLASH_REQUIRED */ + EXmlSyntax, /* 75 XML_ERR_EQUAL_REQUIRED */ + EXmlTagMismatch, /* 76 XML_ERR_TAG_NAME_MISMATCH */ + EXmlUnclosedToken, /* 77 XML_ERR_TAG_NOT_FINISHED */ + EXmlSyntax, /* 78 XML_ERR_STANDALONE_VALUE */ + EXmlSyntax, /* 79 XML_ERR_ENCODING_NAME */ + EXmlInvalidToken, /* 80 XML_ERR_HYPHEN_IN_COMMENT */ + EXmlSyntax, /* 81 XML_ERR_INVALID_ENCODING */ + EXmlSyntax, /* 82 XML_ERR_EXT_ENTITY_STANDALONE */ + EXmlSyntax, /* 83 XML_ERR_CONDSEC_INVALID */ + EXmlSyntax, /* 84 XML_ERR_VALUE_REQUIRED */ + EXmlSyntax, /* 85 XML_ERR_NOT_WELL_BALANCED */ + EXmlSyntax, /* 86 XML_ERR_EXTRA_CONTENT */ + EXmlSyntax, /* 87 XML_ERR_ENTITY_CHAR_ERROR */ + EXmlSyntax, /* 88 XML_ERR_ENTITY_PE_INTERNAL */ + EXmlRecursiveEntity, /* 89 XML_ERR_ENTITY_LOOP */ + EXmlSyntax, /* 90 XML_ERR_ENTITY_BOUNDARY */ + EXmlSyntax, /* 91 XML_ERR_INVALID_URI */ + EXmlSyntax, /* 92 XML_ERR_URI_FRAGMENT */ + KErrNone, /* 93 XML_WAR_CATALOG_PI */ + EXmlSyntax, /* 94 XML_ERR_NO_DTD */ + EXmlSyntax, /* 95 XML_ERR_CONDSEC_INVALID_KEYWORD */ + EXmlSyntax, /* 96 XML_ERR_VERSION_MISSING */ + KErrNone, /* 97 XML_WAR_UNKNOWN_VERSION */ + KErrNone, /* 98 XML_WAR_LANG_VALUE */ + KErrNone, /* 99 XML_WAR_NS_URI */ + KErrNone, /* 100 XML_WAR_NS_URI_RELATIVE */ + EXmlSyntax, /* 101 XML_ERR_MISSING_ENCODING */ + }; + +LOCAL_C const TInt KErrorArrayNSMapSize = 4; +LOCAL_C const TInt KErrorArrayNSMapOffset = 200; + +LOCAL_C const TInt KErrorArrayNSMap[] = + { + EXmlSyntax, /* 200 XML_NS_ERR_XML_NAMESPACE */ + EXmlSyntax, /* 201 XML_NS_ERR_UNDEFINED_NAMESPACE */ + EXmlSyntax, /* 202 XML_NS_ERR_QNAME */ + EXmlDuplicateAttribute, /* 203 XML_NS_ERR_ATTRIBUTE_REDEFINED */ + }; + +/** + * GetErrorNum: + * @param aString the string + * + * Mapping from libxml2 error to xml symbian error + */ +LOCAL_C TInt GetErrorNum(TInt errorNum) +{ + //symbian error + if (errorNum < 0) + { + return errorNum; + } + //general error mapping + else if (errorNum >= KErrorArrayGeneralMapOffset + && errorNum < KErrorArrayGeneralMapOffset + KErrorArrayGeneralMapSize) + { + return KErrorArrayGenMap[errorNum - KErrorArrayGeneralMapOffset]; + } + //namespace error mapping + else if (errorNum >= KErrorArrayNSMapOffset + && errorNum < KErrorArrayNSMapOffset + KErrorArrayNSMapSize) + { + return KErrorArrayNSMap[errorNum - KErrorArrayNSMapOffset]; + } + return EXmlSyntax; +} + +#endif + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/data/20021CE5.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/data/20021CE5.rss Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file 20021CE5.rss + @internalTechnology +*/ + +#include + +RESOURCE REGISTRY_INFO parserInfo + { + dll_uid = 0x20021CE5; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FAA0B; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20021CE5; + version_no = 1; + display_name = "Test processor"; + default_data = "text/testparser"; + opaque_data = ""; + } + }; + } + }; + } + + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/data/corruptxml1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/data/corruptxml1.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/data/xmlexample.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/data/xmlexample.dtd Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/data/xmlexample.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/data/xmlexample.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,16 @@ + + + + + &unknown; + XmlExample.xml + + This file shows XML file parsing example of syslibs component using Symbian OS XML parser framework. + + + Copyright (c) Symbian Software Ltd 2007. All rights reserved. + + + Happy programming to all + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file bld.inf + @internalTechnology +*/ +PRJ_TESTMMPFILES +xmlparser2tef.mmp manual +testcontentprocessor.mmp support + +PRJ_TESTEXPORTS +xmlparser2teftests.iby /epoc32/rom/include/xmlparser2teftests.iby +../scripts/xmlparser2tefsuite.script z:/tef_xml2/xmlparser2tefsuite.script +../data/xmlexample.xml z:/testdata/xmlexample.xml +../data/xmlexample.dtd z:/testdata/xmlexample.dtd +../data/corruptxml1.xml z:/testdata/corruptxml1.xml + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/group/testcontentprocessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/group/testcontentprocessor.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file testcontentprocessor.mmp + @internalTechnology +*/ + +TARGET tetestcontentprocessor.dll +TARGETTYPE PLUGIN +CAPABILITY NONE + + +UID 0x10009D8D 0x20021CE5 + + +VENDORID 0x70000001 + +SOURCEPATH ../src +SOURCE tepluginentry.cpp tetestcontentprocessor.cpp + + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + +START RESOURCE ../data/20021CE5.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET tetestcontentprocessor.rsc +#endif +END + +LIBRARY euser.lib +LIBRARY XmlFramework.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/group/xmlparser2tef.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/group/xmlparser2tef.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,41 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file xmlparser2tef.mmp + @internalTechnology +*/ + + +TARGET texmlparser2.exe +TARGETTYPE exe + +SOURCEPATH ../src +SOURCE texmlparser2server.cpp texmlparser2step.cpp tetestcontenthandler.cpp + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_LIBXML2_SYSTEMINCLUDE + +USERINCLUDE ../src +USERINCLUDE ../../../../../libxml2libs/inc/libxml2_nonexport + +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib +LIBRARY euser.lib +LIBRARY XmlFramework.lib efsrv.lib +LIBRARY xmlengine.lib + +SMPSAFE diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/group/xmlparser2teftests.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/group/xmlparser2teftests.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __XMLPARSER2TEFTESTS_IBY__ +#define __XMLPARSER2TEFTESTS_IBY__ + +#include +#include + +data=ABI_DIR/BUILD_DIR/texmlparser2.exe sys/bin/texmlparser2.exe +data=DATAZ_/tef_xml2/xmlparser2tefsuite.script tef_xml2/xmlparser2tefsuite.script +data=EPOCROOT##Epoc32/data/z/testdata/corruptxml1.xml /testdata/corruptxml1.xml +data=EPOCROOT##Epoc32/data/z/testdata/xmlexample.dtd /testdata/xmlexample.dtd +data=EPOCROOT##Epoc32/data/z/testdata/xmlexample.xml /testdata/xmlexample.xml +ECOM_PLUGIN(tetestcontentprocessor.dll,tetestcontentprocessor.rsc) + +#endif \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/scripts/xmlparser2tefsuite.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/scripts/xmlparser2tefsuite.script Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Loading suite texmlparser2 +LOAD_SUITE texmlparser2 +DELAY 500 + +// +//! @SYMTestCaseID BASESRVCS-XML-CT-4928 +//! @SYMTestCaseDesc Tests the APIs under different memory conditions +//! @SYMPREQ PREQ2051 +//! @SYMTestPriority High +//! @SYMTestActions The following APIs are testing under various +//! memory conditions: +//! SetProcessorChainL, DisableFeature, EnableFeature +//! @SYMTestExpectedResults EPass +// + +START_TESTCASE BASESRVCS-XML-CT-4928 + RUN_TEST_STEP 100 texmlparser2 XmlParser2SetContentSink + RUN_TEST_STEP 100 texmlparser2 XmlParser2OOMTests + RUN_TEST_STEP 100 texmlparser2 XmlParser2OOMTests2 + RUN_TEST_STEP 100 texmlparser2 XmlParser2OOMTests3 + RUN_TEST_STEP 100 texmlparser2 XmlParser2OOMTests4 +END_TESTCASE BASESRVCS-XML-CT-4928 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/tepluginentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/tepluginentry.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,49 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file tepluginentry.cpp + @internalTechnology +*/ + +#include +#include +#include "tetestcontentprocessor.h" + +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x20021CE5, CTestContentProcessor::NewL) + }; + +// The one and only exported function that is the ECom entry point +EXPORT_C const TImplementationProxy* ImplementationGroupProxy +(TInt& aTableCount) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + + return ImplementationTable; + } + +/** + * Standard Symbian OS DLL entry point. + */ +#ifndef EKA2 +TBool E32Dll(TDllReason) + { + return ETrue; + } +#endif // EKA2 +// End of File diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontenthandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontenthandler.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,149 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file tetestcontenthandler.cpp + @internalTechnology +*/ + +#include "tetestcontenthandler.h" +#include +#include +#include + +using namespace Xml; +/** + Allocates and constructs a CTestContentHandler object. + Initialises all member data to their default values. + */ +CTestContentHandler* CTestContentHandler::NewL() + { + CTestContentHandler* self = new (ELeave) CTestContentHandler(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } +/** + * Empty routine + */ +CTestContentHandler::~CTestContentHandler() + { + } +/** + * Empty routine + */ +CTestContentHandler::CTestContentHandler() + { + } +/** + * Empty routine + */ +void CTestContentHandler::ConstructL() + { + } +/** + * Empty routine + */ +void CTestContentHandler::OnStartDocumentL(const RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnEndDocumentL(TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnStartElementL(const RTagInfo& /*aElement*/, + const Xml::RAttributeArray& /*aAttributes*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnEndElementL(const RTagInfo& /*aElement*/, + TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnContentL(const TDesC8& /*aBytes*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnStartPrefixMappingL(const RString& /*aPrefix*/, + const RString& /*aUri*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnEndPrefixMappingL(const RString& /*aPrefix*/, + TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, + TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnSkippedEntityL(const RString& /*aName*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnProcessingInstructionL(const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } +/** + * Empty routine + */ +void CTestContentHandler::OnError(TInt aErrorCode) + { + User::LeaveIfError(aErrorCode); + } + +/** + Obtain the interface matching the specified uid. + */ +TAny* CTestContentHandler::GetExtendedInterface(const TInt32 /*aUid*/) + { + // do nothing. + return NULL; + } + diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontenthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontenthandler.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,54 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file tetestcontenthandler.h + @internalTechnology +*/ + +#ifndef _TE_TESTCONTENTHANDLER_H_ +#define _TE_TESTCONTENTHANDLER_H_ + +#include +#include + +/** + * Dummy content handler for XML + */ +class CTestContentHandler: public CBase, public Xml::MContentHandler + { +public: + static CTestContentHandler* NewL(); + ~CTestContentHandler(); + + // From MContentHandler + void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); + void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode) ; + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + +private: + CTestContentHandler(); + void ConstructL(); + }; +#endif /*TE_TESTCONTENTHANDLER_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontentprocessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontentprocessor.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,111 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file tetestcontentprocessor.cpp + @internalTechnology +*/ + +#include "tetestcontentprocessor.h" + +using namespace Xml; +/** + * Empty routine + */ +void CTestContentProcessor::Release() + {} +/** + * Empty routine + */ +void CTestContentProcessor::SetContentSink(MContentHandler& /*aContentHandler*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnStartDocumentL( + const RDocumentParameters& /*aDocParam*/, TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnEndDocumentL(TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnStartElementL(const RTagInfo& /*aElement*/, + const RAttributeArray& /*aAttributes*/, TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnEndElementL(const RTagInfo& /*aElement*/, + TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnContentL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnStartPrefixMappingL(const RString& /*aPrefix*/, + const RString& /*aUri*/, TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnEndPrefixMappingL(const RString& /*aPrefix*/, + TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, + TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnSkippedEntityL(const RString& /*aName*/, + TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnProcessingInstructionL(const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +void CTestContentProcessor::OnError(TInt /*aErrorCode*/) + {} +/** + * Empty routine + */ +TAny* CTestContentProcessor::GetExtendedInterface(const TInt32 /*aUid*/) + { + return NULL; + } +/** + * Static constructor + */ +CTestContentProcessor* CTestContentProcessor::NewL() + { + CTestContentProcessor* self = new (ELeave) CTestContentProcessor(); + return self; + } diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontentprocessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/tetestcontentprocessor.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file tetestcontentprocessor.h + @internalTechnology +*/ + +#ifndef _TE_TESTCONTENTPROCESSOR_H_ +#define _TE_TESTCONTENTPROCESSOR_H_ + +#include +#include +#include + +using namespace Xml; +/** + * Dummy Content processor for XML + */ +class CTestContentProcessor: public Xml::MContentProcessor + { + public: + void Release(); + + void SetContentSink(MContentHandler& aContentHandler); + + void OnStartDocumentL( + const RDocumentParameters& aDocParam, TInt aErrorCode); + + void OnEndDocumentL(TInt aErrorCode); + + void OnStartElementL(const RTagInfo& aElement, + const RAttributeArray& aAttributes, TInt aErrorCode); + + void OnEndElementL(const RTagInfo& aElement, + TInt aErrorCode); + + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + + void OnStartPrefixMappingL(const RString& aPrefix, + const RString& aUri, TInt aErrorCode); + + void OnEndPrefixMappingL(const RString& aPrefix, + TInt aErrorCode); + + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, + TInt aErrorCode); + + void OnSkippedEntityL(const RString& aName, + TInt aErrorCode); + + void OnProcessingInstructionL(const TDesC8& aTarget, + const TDesC8& aData, TInt aErrorCode); + + void OnError(TInt aErrorCode); + + TAny* GetExtendedInterface(const TInt32 aUid); + + static CTestContentProcessor* NewL(); + }; +#endif /*TE_TESTCONTENTPROCESSOR_H_*/ diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2server.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2server.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,97 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file texmlparser2server.cpp + @internalTechnology +*/ + +#include "texmlparser2server.h" +#include "texmlparser2step.h" +/** + @return - Instance of the test server + */ +CXmlParser2TestServer* CXmlParser2TestServer::NewL() + { + CXmlParser2TestServer * server = new (ELeave) CXmlParser2TestServer(); + CleanupStack::PushL(server); + server->ConstructL(KServerName); + CleanupStack::Pop(server); + return server; + } +/** + * Standard Symbian two phase constructor + */ +void CXmlParser2TestServer::ConstructL(const TDesC& aName) + { + CTestServer::ConstructL(aName); + } + +LOCAL_C void MainL() + { + + CActiveScheduler* sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CXmlParser2TestServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CXmlParser2TestServer::NewL()); + if (KErrNone == err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + +/** + * Entry point + */ +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on exit + */ + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()) + ; + delete cleanup; + + __UHEAP_MARKEND; + return err; + } + +CTestStep* CXmlParser2TestServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep= NULL; + + if (aStepName == KXmlParser2SetContentSink || aStepName + == KXmlParser2OOMTests || aStepName == KXmlParser2OOMTests2 + || aStepName == KXmlParser2OOMTests3 ||aStepName == KXmlParser2OOMTests4) + { + testStep = new CXmlParser2Step(aStepName); + } + return testStep; + } diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2server.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file texmlparser2server.h + @internalTechnology +*/ + +#ifndef _TEF_XMLPARSER2SERVER_H_ +#define _TEF_XMLPARSER2SERVER_H_ + +#include +#include + +/** Test server to implement the pure virtual CreateTestStep + method. + */ +_LIT(KServerName, "texmlparser2"); + +class CXmlParser2TestServer : public CTestServer + { +public: + static CXmlParser2TestServer* NewL(); + void ConstructL(const TDesC& aName); + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + }; + +#endif diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2step.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,353 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file texmlparser2step.cpp + @internalTechnology +*/ + +#include "texmlparser2step.h" +#include "tetestcontenthandler.h" +#include "libxml2_globals_private.h" +#include +#include +#include + +using namespace Xml; +/** + * Class CXmlParser2Step implementation + */ +_LIT(KSimpleXmlFile, "z:\\testdata\\xmlexample.xml"); +#ifdef _DEBUG +_LIT(KCorruptXm1File, "z:\\testdata\\corruptxml1.xml"); +#endif + +/** + * Constructor. Sets the test step name so that it can be + * differentiated from within doTestStepL() + */ +CXmlParser2Step::CXmlParser2Step(const TDesC& aStepName) + { + SetTestStepName(aStepName); + } + +/** + * TEF invokes doTestStepL interface along with the step name + * to let appropriate action to be taken for the test step. + */ +TVerdict CXmlParser2Step::doTestStepL(void) + { + if (TestStepName() == KXmlParser2SetContentSink) + { + INFO_PRINTF1(KXmlParser2SetContentSink); + SetTestStepResult(TestKXmlParser2SetContentSink()); + } + else if (TestStepName() == KXmlParser2OOMTests) + { + INFO_PRINTF1(KXmlParser2OOMTests); + SetTestStepResult(TestKXmlParser2OOMTests()); + } + else if (TestStepName() == KXmlParser2OOMTests2) + { + INFO_PRINTF1(KXmlParser2OOMTests2); + SetTestStepResult(TestKXmlParser2OOMTests2()); + } + else if (TestStepName() == KXmlParser2OOMTests3) + { + INFO_PRINTF1(KXmlParser2OOMTests3); + SetTestStepResult(TestKXmlParser2OOMTests3()); + } + else if (TestStepName() == KXmlParser2OOMTests4) + { + INFO_PRINTF1(KXmlParser2OOMTests4); + SetTestStepResult(TestKXmlParser2OOMTests4()); + } + return TestStepResult(); + } + +TVerdict CXmlParser2Step::TestKXmlParser2SetContentSink() + { + RFs fs; + User::LeaveIfError(fs.Connect()); + + CTestContentHandler *sax = CTestContentHandler::NewL(); + RFile handle; + TInt err; + TRAP(err,handle.Open(fs, KSimpleXmlFile, EFileShareReadersOnly)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error opening test XML file")); + User::Leave(err); + } + CleanupClosePushL(handle); + CMatchData *matchData = CMatchData::NewL(); + matchData->SetMimeTypeL(_L8("text/xml")); + matchData->SetVariantL(_L8("libxml2")); + CParser *parser = CParser::NewL(*matchData, *sax); + TInt retVal = KErrNone; + //Valid feature + retVal = parser->EnableFeature(EReportNamespaceMapping); + if (retVal != KErrNone) + { + INFO_PRINTF1(_L("Error Enabling valid feature")); + return EFail; + } + //Invalid feature + TInt EInvalidFeatureId = 0x1111; + retVal = parser->EnableFeature(EInvalidFeatureId); + if (retVal != KErrNotSupported) + { + INFO_PRINTF1(_L("Unexpected error while enabling invalid feature")); + return EFail; + } + //Valid feature + retVal = parser->DisableFeature(EReportNamespaces); + if (retVal != KErrNone) + { + INFO_PRINTF1(_L("Error Disabling valid feature")); + return EFail; + } + + //Invalid feature + retVal = parser->DisableFeature(EInvalidFeatureId); + if (retVal != KErrNotSupported) + { + INFO_PRINTF1(_L("Unexpected error while disabling invalid feature")); + return EFail; + } + RContentProcessorUids *uid = new (ELeave)RContentProcessorUids; + const TUid KXmlContProcUid = + { + 0x20021CE5 //UID3 + }; + uid->Append(KXmlContProcUid); + TRAP(err, parser->SetProcessorChainL(*uid)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error Setting up processor chain")); + return EFail; + } + TRAP(err,ParseL(*parser, handle)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error Parsing")); + return EFail; + } + delete parser; + fs.Close(); + CleanupStack::Pop(&handle); + return EPass; + } +/** + * This test step should be run only on debug builds owing to the + * __UHEAP macros that are defined only in debug builds. + */ +TVerdict CXmlParser2Step::TestKXmlParser2OOMTests() + { +#ifdef _DEBUG + RFs fs; + User::LeaveIfError(fs.Connect()); + CTestContentHandler *sax = CTestContentHandler::NewL(); + RFile handle; + TInt err; + CleanupClosePushL(handle); + TRAP(err,handle.Open(fs, KSimpleXmlFile, EFileShareReadersOnly)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error opening test XML file")); + User::Leave(err); + } + + CMatchData *matchData = CMatchData::NewL(); + matchData->SetMimeTypeL(_L8("text/xml")); + matchData->SetVariantL(_L8("libxml2")); + CParser *parser = CParser::NewL(*matchData, *sax); + CleanupStack::PushL(parser); + + __UHEAP_SETFAIL(RHeap::EDeterministic, 40); + TRAP(err,ParseL(*parser, handle)); + //it could be a random error + if (err == KErrNone) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :40")); + parser->ParseBeginL(); + __UHEAP_SETFAIL(RHeap::EDeterministic, 50); + TRAP(err,ParseL(*parser, handle)); + //it could be a random error + if (err == KErrNone) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :50")); + parser->ParseBeginL(); + __UHEAP_SETFAIL(RHeap::EDeterministic, 100); + TRAP(err,ParseL(*parser, handle)); + //it could be a random error + if (err == KErrNone) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :100")); + parser->ParseBeginL(); + __UHEAP_SETFAIL(RHeap::ENone, 0); + fs.Close(); + CleanupStack::Pop(parser); + CleanupStack::Pop(&handle); +#else + INFO_PRINTF1(_L("This test is meant to be run only in DEBUG builds. Returning EPASS")); +#endif + return EPass; + } + +/** + * This test step should be run only on debug builds owing to the + * __UHEAP macros that are defined only in debug builds. + */ +TVerdict CXmlParser2Step::TestKXmlParser2OOMTests2() + { +#ifdef _DEBUG + RFs fs; + User::LeaveIfError(fs.Connect()); + CTestContentHandler *sax = CTestContentHandler::NewL(); + RFile handle; + TInt err; + CleanupClosePushL(handle); + TRAP(err,handle.Open(fs, KSimpleXmlFile, EFileShareReadersOnly)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error opening test XML file")); + User::Leave(err); + } + + CMatchData *matchData = CMatchData::NewL(); + matchData->SetMimeTypeL(_L8("text/xml")); + matchData->SetVariantL(_L8("libxml2")); + CParser *parser = CParser::NewL(*matchData, *sax); + CleanupStack::PushL(parser); + + __UHEAP_SETFAIL(RHeap::EDeterministic, 1); + TRAP(err,ParseL(*parser, handle)); + if (err != KErrNoMemory) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :1")); + __UHEAP_SETFAIL(RHeap::EDeterministic, 33); + TRAP(err,ParseL(*parser, handle)); + //it could be a random error + if (err == KErrNone) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :33")); + __UHEAP_SETFAIL(RHeap::ENone, 0); + + fs.Close(); + CleanupStack::Pop(parser); + CleanupStack::Pop(&handle); +#else + INFO_PRINTF1(_L("This test is meant to be run only in DEBUG builds. Returning EPASS")); +#endif + return EPass; + } +/** + * This test step should be run only on debug builds owing to the + * __UHEAP macros that are defined only in debug builds. + */ +TVerdict CXmlParser2Step::TestKXmlParser2OOMTests3() + { +#ifdef _DEBUG + RFs fs; + User::LeaveIfError(fs.Connect()); + CTestContentHandler *sax = CTestContentHandler::NewL(); + RFile handle; + TInt err; + CleanupClosePushL(handle); + TRAP(err,handle.Open(fs, KSimpleXmlFile, EFileShareReadersOnly)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error opening test XML file")); + User::Leave(err); + } + + CMatchData *matchData = CMatchData::NewL(); + matchData->SetMimeTypeL(_L8("text/xml")); + matchData->SetVariantL(_L8("libxml2")); + CParser *parser = CParser::NewL(*matchData, *sax); + CleanupStack::PushL(parser); + + __UHEAP_SETFAIL(RHeap::EDeterministic, 32); + TRAP(err,ParseL(*parser, handle)); + //it could be a random error + if (err == KErrNone) + { + return EFail; + } + INFO_PRINTF1(_L("Tests passed at Heap failure rate :32")); + __UHEAP_SETFAIL(RHeap::ENone, 0); + + fs.Close(); + CleanupStack::Pop(parser); + CleanupStack::Pop(&handle); +#else + INFO_PRINTF1(_L("This test is meant to be run only in DEBUG builds. Returning EPASS")); +#endif + return EPass; + } + +TVerdict CXmlParser2Step::TestKXmlParser2OOMTests4() + { +#ifdef _DEBUG + RFs fs; + User::LeaveIfError(fs.Connect()); + CTestContentHandler *sax = CTestContentHandler::NewL(); + RFile handle; + TInt err; + CleanupClosePushL(handle); + TRAP(err,handle.Open(fs, KCorruptXm1File, EFileShareReadersOnly)); + if (err != KErrNone) + { + INFO_PRINTF1(_L("Error opening test XML file")); + User::Leave(err); + } + + CMatchData *matchData = CMatchData::NewL(); + CleanupStack::PushL(matchData); + matchData->SetMimeTypeL(_L8("text/xml")); + matchData->SetVariantL(_L8("libxml2")); + CParser *parser = CParser::NewL(*matchData, *sax); + CleanupStack::PushL(parser); + + __UHEAP_SETFAIL(RHeap::EDeterministic, 72); + + TRAP(err,ParseL(*parser, handle);); + TInt EXmlTagMismatch = -993; //copied from xmlparseerrors.h + if (err != EXmlTagMismatch) + { + return EFail; + } + __UHEAP_SETFAIL(RHeap::ENone, 0); + + fs.Close(); + CleanupStack::Pop(parser); + CleanupStack::Pop(matchData); + CleanupStack::Pop(&handle); +#else + INFO_PRINTF1(_L("This test is meant to be run only in DEBUG builds. Returning EPASS")); +#endif + return EPass; + } diff -r 000000000000 -r e35f40988205 xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2step.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2step.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file texmlparser2step.h + @internalTechnology +*/ + +#ifndef _TE_XMLPARSER2STEP_H_ +#define _TE_XMLPARSER2STEP_H_ + +#include + +/** + * Test Steps + */ +_LIT(KXmlParser2SetContentSink, "XmlParser2SetContentSink"); +_LIT(KXmlParser2OOMTests, "XmlParser2OOMTests"); +_LIT(KXmlParser2OOMTests2, "XmlParser2OOMTests2"); +_LIT(KXmlParser2OOMTests3, "XmlParser2OOMTests3"); +_LIT(KXmlParser2OOMTests4, "XmlParser2OOMTests4"); +/** + * Class to test XML SAX parser + */ +class CXmlParser2Step : public CTestStep + { +public: + CXmlParser2Step(const TDesC& aStepName); + virtual TVerdict doTestStepL(void); + TVerdict TestKXmlParser2SetContentSink(); + TVerdict TestKXmlParser2OOMTests(); + TVerdict TestKXmlParser2OOMTests2(); + TVerdict TestKXmlParser2OOMTests3(); + TVerdict TestKXmlParser2OOMTests4(); + }; +#endif /*TE_XMLPARSER2STEP_H_*/ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Xml Security Engine Subsystem +* +*/ + + + + + + + +#include "../inc/xmlsecvariant.hrh" + +/* +* Order is important +*/ + +#include "../xmlseccertman/group/bld.inf" +#include "../xmlsec/group/bld.inf" +#include "../xmlseccrypto/group/bld.inf" +#include "../xmlsecwrapper/group/bld.inf" diff -r 000000000000 -r e35f40988205 xmlsecurityengine/inc/xmlsecvariant.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/inc/xmlsecvariant.hrh Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Here are the flags that allows to compile code +* +*/ + + + + + +/* ============================================================================== +* Name : xmlsecvariant.hrh +* Part of : Xml Security Engine +* Interface : +* Description : Here are the flags that allows to compile code +* Version : %version % +* +* ============================================================================== +*/ + +#ifndef XMLSECVARIANT_HRH +#define XMLSECVARIANT_HRH + +#include +/* +//Enale following macro for wsstar prefixed xmlengine binaries linking +#if !defined ( __RD_XMLSEC_SRCINC_CHANGE_REVERSE__ ) + #define __RD_XMLSEC_SRCINC_CHANGE_REVERSE__ 1 +#endif//__RD_XMLSEC_SRCINC_CHANGE_REVERSE__ +*/ +#endif // XMLSECVARIANT_HRH diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/bwinscw/xmlsec.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/bwinscw/xmlsec.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,489 @@ +EXPORTS + xmlSecAddChild @ 1 NONAME + xmlSecAddChildNode @ 2 NONAME + xmlSecAddIDs @ 3 NONAME + xmlSecAddNextSibling @ 4 NONAME + xmlSecAddPrevSibling @ 5 NONAME + xmlSecBase64CtxCreate @ 6 NONAME + xmlSecBase64CtxDestroy @ 7 NONAME + xmlSecBase64CtxFinal @ 8 NONAME + xmlSecBase64CtxFinalize @ 9 NONAME + xmlSecBase64CtxInitialize @ 10 NONAME + xmlSecBase64CtxUpdate @ 11 NONAME + xmlSecBase64Decode @ 12 NONAME + xmlSecBase64Encode @ 13 NONAME + xmlSecBnAdd @ 14 NONAME + xmlSecBnBlobSetNodeValue @ 15 NONAME + xmlSecBnCompare @ 16 NONAME + xmlSecBnCompareReverse @ 17 NONAME + xmlSecBnCreate @ 18 NONAME + xmlSecBnDestroy @ 19 NONAME + xmlSecBnDiv @ 20 NONAME + xmlSecBnFinalize @ 21 NONAME + xmlSecBnFromDecString @ 22 NONAME + xmlSecBnFromHexString @ 23 NONAME + xmlSecBnFromString @ 24 NONAME + xmlSecBnGetData @ 25 NONAME + xmlSecBnGetNodeValue @ 26 NONAME + xmlSecBnGetSize @ 27 NONAME + xmlSecBnInitialize @ 28 NONAME + xmlSecBnMul @ 29 NONAME + xmlSecBnReverse @ 30 NONAME + xmlSecBnSetData @ 31 NONAME + xmlSecBnSetNodeValue @ 32 NONAME + xmlSecBnToDecString @ 33 NONAME + xmlSecBnToHexString @ 34 NONAME + xmlSecBnToString @ 35 NONAME + xmlSecBnZero @ 36 NONAME + xmlSecBufferAppend @ 37 NONAME + xmlSecBufferBase64NodeContentRead @ 38 NONAME + xmlSecBufferBase64NodeContentWrite @ 39 NONAME + xmlSecBufferCreate @ 40 NONAME + xmlSecBufferCreateOutputBuffer @ 41 NONAME + xmlSecBufferDestroy @ 42 NONAME + xmlSecBufferEmpty @ 43 NONAME + xmlSecBufferFinalize @ 44 NONAME + xmlSecBufferGetData @ 45 NONAME + xmlSecBufferGetMaxSize @ 46 NONAME + xmlSecBufferGetSize @ 47 NONAME + xmlSecBufferInitialize @ 48 NONAME + xmlSecBufferPrepend @ 49 NONAME + xmlSecBufferReadFile @ 50 NONAME + xmlSecBufferRemoveHead @ 51 NONAME + xmlSecBufferRemoveTail @ 52 NONAME + xmlSecBufferSetData @ 53 NONAME + xmlSecBufferSetDefaultAllocMode @ 54 NONAME + xmlSecBufferSetMaxSize @ 55 NONAME + xmlSecBufferSetSize @ 56 NONAME + xmlSecCheckErrorFlag @ 57 NONAME + xmlSecCheckNodeName @ 58 NONAME + xmlSecCheckVersionExt @ 59 NONAME + xmlSecCreateTree @ 60 NONAME + xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms @ 61 NONAME + xmlSecDSigCtxCreate @ 62 NONAME + xmlSecDSigCtxDebugDump @ 63 NONAME + xmlSecDSigCtxDebugXmlDump @ 64 NONAME + xmlSecDSigCtxDestroy @ 65 NONAME + xmlSecDSigCtxEnableReferenceTransform @ 66 NONAME + xmlSecDSigCtxEnableSignatureTransform @ 67 NONAME + xmlSecDSigCtxFinalize @ 68 NONAME + xmlSecDSigCtxGetPreSignBuffer @ 69 NONAME + xmlSecDSigCtxInitialize @ 70 NONAME + xmlSecDSigCtxSign @ 71 NONAME + xmlSecDSigCtxVerify @ 72 NONAME + xmlSecDSigReferenceCtxCreate @ 73 NONAME + xmlSecDSigReferenceCtxDebugDump @ 74 NONAME + xmlSecDSigReferenceCtxDebugXmlDump @ 75 NONAME + xmlSecDSigReferenceCtxDestroy @ 76 NONAME + xmlSecDSigReferenceCtxFinalize @ 77 NONAME + xmlSecDSigReferenceCtxGetPreDigestBuffer @ 78 NONAME + xmlSecDSigReferenceCtxInitialize @ 79 NONAME + xmlSecDSigReferenceCtxListGetKlass @ 80 NONAME + xmlSecDSigReferenceCtxProcessNode @ 81 NONAME + xmlSecEncCtxBinaryEncrypt @ 82 NONAME + xmlSecEncCtxCopyUserPref @ 83 NONAME + xmlSecEncCtxCreate @ 84 NONAME + xmlSecEncCtxDebugDump @ 85 NONAME + xmlSecEncCtxDebugXmlDump @ 86 NONAME + xmlSecEncCtxDecrypt @ 87 NONAME + xmlSecEncCtxDecryptToBuffer @ 88 NONAME + xmlSecEncCtxDestroy @ 89 NONAME + xmlSecEncCtxFinalize @ 90 NONAME + xmlSecEncCtxInitialize @ 91 NONAME + xmlSecEncCtxReset @ 92 NONAME + xmlSecEncCtxUriEncrypt @ 93 NONAME + xmlSecEncCtxXmlEncrypt @ 94 NONAME + xmlSecError @ 95 NONAME + xmlSecErrorsDefaultCallback @ 96 NONAME + xmlSecErrorsDefaultCallbackEnableOutput @ 97 NONAME + xmlSecErrorsGetCode @ 98 NONAME + xmlSecErrorsGetMsg @ 99 NONAME + xmlSecErrorsInit @ 100 NONAME + xmlSecErrorsSetCallback @ 101 NONAME + xmlSecErrorsShutdown @ 102 NONAME + xmlSecFindChild @ 103 NONAME + xmlSecFindNode @ 104 NONAME + xmlSecFindParent @ 105 NONAME + xmlSecGenerateAndAddID @ 106 NONAME + xmlSecGenerateID @ 107 NONAME + xmlSecGetGlobalConsts @ 108 NONAME + xmlSecGetNextElementNode @ 109 NONAME + xmlSecGetNodeNsHref @ 110 NONAME + xmlSecGetQName @ 111 NONAME + xmlSecGlobalConsts @ 112 NONAME + xmlSecIOCleanupCallbacks @ 113 NONAME + xmlSecIOInit @ 114 NONAME + xmlSecIORegisterCallbacks @ 115 NONAME + xmlSecIORegisterDefaultCallbacks @ 116 NONAME + xmlSecIOShutdown @ 117 NONAME + xmlSecInit @ 118 NONAME + xmlSecIsEmptyNode @ 119 NONAME + xmlSecIsEmptyString @ 120 NONAME + xmlSecKeyAdoptData @ 121 NONAME + xmlSecKeyCopy @ 122 NONAME + xmlSecKeyCreate @ 123 NONAME + xmlSecKeyDataBinRead @ 124 NONAME + xmlSecKeyDataBinWrite @ 125 NONAME + xmlSecKeyDataBinaryValueBinRead @ 126 NONAME + xmlSecKeyDataBinaryValueBinWrite @ 127 NONAME + xmlSecKeyDataBinaryValueDebugDump @ 128 NONAME + xmlSecKeyDataBinaryValueDebugXmlDump @ 129 NONAME + xmlSecKeyDataBinaryValueDuplicate @ 130 NONAME + xmlSecKeyDataBinaryValueFinalize @ 131 NONAME + xmlSecKeyDataBinaryValueGetBuffer @ 132 NONAME + xmlSecKeyDataBinaryValueGetSize @ 133 NONAME + xmlSecKeyDataBinaryValueInitialize @ 134 NONAME + xmlSecKeyDataBinaryValueSetBuffer @ 135 NONAME + xmlSecKeyDataBinaryValueXmlRead @ 136 NONAME + xmlSecKeyDataBinaryValueXmlWrite @ 137 NONAME + xmlSecKeyDataCreate @ 138 NONAME + xmlSecKeyDataDebugDump @ 139 NONAME + xmlSecKeyDataDebugXmlDump @ 140 NONAME + xmlSecKeyDataDestroy @ 141 NONAME + xmlSecKeyDataDuplicate @ 142 NONAME + xmlSecKeyDataEncryptedKeyGetKlass @ 143 NONAME + xmlSecKeyDataGenerate @ 144 NONAME + xmlSecKeyDataGetIdentifier @ 145 NONAME + xmlSecKeyDataGetSize @ 146 NONAME + xmlSecKeyDataGetType @ 147 NONAME + xmlSecKeyDataIdListDebugDump @ 148 NONAME + xmlSecKeyDataIdListDebugXmlDump @ 149 NONAME + xmlSecKeyDataIdListFind @ 150 NONAME + xmlSecKeyDataIdListFindByHref @ 151 NONAME + xmlSecKeyDataIdListFindByName @ 152 NONAME + xmlSecKeyDataIdListFindByNode @ 153 NONAME + xmlSecKeyDataIdListGetKlass @ 154 NONAME + xmlSecKeyDataIdsGet @ 155 NONAME + xmlSecKeyDataIdsInit @ 156 NONAME + xmlSecKeyDataIdsRegister @ 157 NONAME + xmlSecKeyDataIdsRegisterDefault @ 158 NONAME + xmlSecKeyDataIdsShutdown @ 159 NONAME + xmlSecKeyDataListGetKlass @ 160 NONAME + xmlSecKeyDataNameGetKlass @ 161 NONAME + xmlSecKeyDataRetrievalMethodGetKlass @ 162 NONAME + xmlSecKeyDataStoreCreate @ 163 NONAME + xmlSecKeyDataStoreDestroy @ 164 NONAME + xmlSecKeyDataStorePtrListGetKlass @ 165 NONAME + xmlSecKeyDataValueGetKlass @ 166 NONAME + xmlSecKeyDataXmlRead @ 167 NONAME + xmlSecKeyDataXmlWrite @ 168 NONAME + xmlSecKeyDebugDump @ 169 NONAME + xmlSecKeyDebugXmlDump @ 170 NONAME + xmlSecKeyDestroy @ 171 NONAME + xmlSecKeyDuplicate @ 172 NONAME + xmlSecKeyEmpty @ 173 NONAME + xmlSecKeyEnsureData @ 174 NONAME + xmlSecKeyGenerate @ 175 NONAME + xmlSecKeyGenerateByName @ 176 NONAME + xmlSecKeyGetData @ 177 NONAME + xmlSecKeyGetName @ 178 NONAME + xmlSecKeyGetType @ 179 NONAME + xmlSecKeyGetValue @ 180 NONAME + xmlSecKeyInfoCtxCopyUserPref @ 181 NONAME + xmlSecKeyInfoCtxCreate @ 182 NONAME + xmlSecKeyInfoCtxCreateEncCtx @ 183 NONAME + xmlSecKeyInfoCtxDebugDump @ 184 NONAME + xmlSecKeyInfoCtxDebugXmlDump @ 185 NONAME + xmlSecKeyInfoCtxDestroy @ 186 NONAME + xmlSecKeyInfoCtxFinalize @ 187 NONAME + xmlSecKeyInfoCtxInitialize @ 188 NONAME + xmlSecKeyInfoCtxReset @ 189 NONAME + xmlSecKeyInfoNodeRead @ 190 NONAME + xmlSecKeyInfoNodeWrite @ 191 NONAME + xmlSecKeyMatch @ 192 NONAME + xmlSecKeyPtrListGetKlass @ 193 NONAME + xmlSecKeyReadBinaryFile @ 194 NONAME + xmlSecKeyReadBuffer @ 195 NONAME + xmlSecKeyReadMemory @ 196 NONAME + xmlSecKeyReqCopy @ 197 NONAME + xmlSecKeyReqDebugDump @ 198 NONAME + xmlSecKeyReqDebugXmlDump @ 199 NONAME + xmlSecKeyReqFinalize @ 200 NONAME + xmlSecKeyReqInitialize @ 201 NONAME + xmlSecKeyReqMatchKey @ 202 NONAME + xmlSecKeyReqMatchKeyValue @ 203 NONAME + xmlSecKeyReqReset @ 204 NONAME + xmlSecKeySetName @ 205 NONAME + xmlSecKeySetValue @ 206 NONAME + xmlSecKeyStoreCreate @ 207 NONAME + xmlSecKeyStoreDestroy @ 208 NONAME + xmlSecKeyStoreFindKey @ 209 NONAME + xmlSecKeyUseWithCopy @ 210 NONAME + xmlSecKeyUseWithCreate @ 211 NONAME + xmlSecKeyUseWithDebugDump @ 212 NONAME + xmlSecKeyUseWithDebugXmlDump @ 213 NONAME + xmlSecKeyUseWithDestroy @ 214 NONAME + xmlSecKeyUseWithDuplicate @ 215 NONAME + xmlSecKeyUseWithFinalize @ 216 NONAME + xmlSecKeyUseWithInitialize @ 217 NONAME + xmlSecKeyUseWithPtrListGetKlass @ 218 NONAME + xmlSecKeyUseWithReset @ 219 NONAME + xmlSecKeyUseWithSet @ 220 NONAME + xmlSecKeysMngrAdoptDataStore @ 221 NONAME + xmlSecKeysMngrAdoptKeysStore @ 222 NONAME + xmlSecKeysMngrCreate @ 223 NONAME + xmlSecKeysMngrDestroy @ 224 NONAME + xmlSecKeysMngrFindKey @ 225 NONAME + xmlSecKeysMngrGetDataStore @ 226 NONAME + xmlSecKeysMngrGetKey @ 227 NONAME + xmlSecKeysMngrGetKeysStore @ 228 NONAME + xmlSecNodeSetAdd @ 229 NONAME + xmlSecNodeSetAddList @ 230 NONAME + xmlSecNodeSetContains @ 231 NONAME + xmlSecNodeSetCreate @ 232 NONAME + xmlSecNodeSetDebugDump @ 233 NONAME + xmlSecNodeSetDestroy @ 234 NONAME + xmlSecNodeSetDocDestroy @ 235 NONAME + xmlSecNodeSetDumpTextNodes @ 236 NONAME + xmlSecNodeSetGetChildren @ 237 NONAME + xmlSecNodeSetWalk @ 238 NONAME + xmlSecParseFile @ 239 NONAME + xmlSecParseMemory @ 240 NONAME + xmlSecParseMemoryExt @ 241 NONAME + xmlSecPtrListAdd @ 242 NONAME + xmlSecPtrListCopy @ 243 NONAME + xmlSecPtrListCreate @ 244 NONAME + xmlSecPtrListDebugDump @ 245 NONAME + xmlSecPtrListDebugXmlDump @ 246 NONAME + xmlSecPtrListDestroy @ 247 NONAME + xmlSecPtrListDuplicate @ 248 NONAME + xmlSecPtrListEmpty @ 249 NONAME + xmlSecPtrListFinalize @ 250 NONAME + xmlSecPtrListGetItem @ 251 NONAME + xmlSecPtrListGetSize @ 252 NONAME + xmlSecPtrListInitialize @ 253 NONAME + xmlSecPtrListRemove @ 254 NONAME + xmlSecPtrListSet @ 255 NONAME + xmlSecPtrListSetDefaultAllocMode @ 256 NONAME + xmlSecQName2BitMaskDebugDump @ 257 NONAME + xmlSecQName2BitMaskDebugXmlDump @ 258 NONAME + xmlSecQName2BitMaskGetBitMask @ 259 NONAME + xmlSecQName2BitMaskGetBitMaskFromString @ 260 NONAME + xmlSecQName2BitMaskGetInfo @ 261 NONAME + xmlSecQName2BitMaskGetStringFromBitMask @ 262 NONAME + xmlSecQName2BitMaskNodesRead @ 263 NONAME + xmlSecQName2BitMaskNodesWrite @ 264 NONAME + xmlSecQName2IntegerAttributeRead @ 265 NONAME + xmlSecQName2IntegerAttributeWrite @ 266 NONAME + xmlSecQName2IntegerDebugDump @ 267 NONAME + xmlSecQName2IntegerDebugXmlDump @ 268 NONAME + xmlSecQName2IntegerGetInfo @ 269 NONAME + xmlSecQName2IntegerGetInteger @ 270 NONAME + xmlSecQName2IntegerGetIntegerFromString @ 271 NONAME + xmlSecQName2IntegerGetStringFromInteger @ 272 NONAME + xmlSecQName2IntegerNodeRead @ 273 NONAME + xmlSecQName2IntegerNodeWrite @ 274 NONAME + xmlSecReplaceContent @ 275 NONAME + xmlSecReplaceNode @ 276 NONAME + xmlSecReplaceNodeBuffer @ 277 NONAME + xmlSecResetErrorFlag @ 278 NONAME + xmlSecSetErrorFlag @ 279 NONAME + xmlSecShutdown @ 280 NONAME + xmlSecSimpleKeysStoreAdoptKey @ 281 NONAME + xmlSecSimpleKeysStoreGetKeys @ 282 NONAME + xmlSecSimpleKeysStoreGetKlass @ 283 NONAME + xmlSecSimpleKeysStoreLoad @ 284 NONAME + xmlSecSimpleKeysStoreSave @ 285 NONAME + xmlSecSoap11AddBodyEntry @ 286 NONAME + xmlSecSoap11AddFaultEntry @ 287 NONAME + xmlSecSoap11CheckEnvelope @ 288 NONAME + xmlSecSoap11CreateEnvelope @ 289 NONAME + xmlSecSoap11EnsureHeader @ 290 NONAME + xmlSecSoap11GetBody @ 291 NONAME + xmlSecSoap11GetBodyEntriesNumber @ 292 NONAME + xmlSecSoap11GetBodyEntry @ 293 NONAME + xmlSecSoap11GetFaultEntry @ 294 NONAME + xmlSecSoap11GetHeader @ 295 NONAME + xmlSecSoap12AddBodyEntry @ 296 NONAME + xmlSecSoap12AddFaultDetailEntry @ 297 NONAME + xmlSecSoap12AddFaultEntry @ 298 NONAME + xmlSecSoap12AddFaultReasonText @ 299 NONAME + xmlSecSoap12AddFaultSubcode @ 300 NONAME + xmlSecSoap12CheckEnvelope @ 301 NONAME + xmlSecSoap12CreateEnvelope @ 302 NONAME + xmlSecSoap12EnsureHeader @ 303 NONAME + xmlSecSoap12GetBody @ 304 NONAME + xmlSecSoap12GetBodyEntriesNumber @ 305 NONAME + xmlSecSoap12GetBodyEntry @ 306 NONAME + xmlSecSoap12GetFaultEntry @ 307 NONAME + xmlSecSoap12GetHeader @ 308 NONAME + xmlSecStringListGetKlass @ 309 NONAME + xmlSecTmplCipherReferenceAddTransform @ 310 NONAME + xmlSecTmplEncDataAddEncProperty @ 311 NONAME + xmlSecTmplEncDataCreate @ 312 NONAME + xmlSecTmplEncDataEnsureCipherReference @ 313 NONAME + xmlSecTmplEncDataEnsureCipherValue @ 314 NONAME + xmlSecTmplEncDataEnsureEncProperties @ 315 NONAME + xmlSecTmplEncDataEnsureKeyInfo @ 316 NONAME + xmlSecTmplEncDataGetEncMethodNode @ 317 NONAME + xmlSecTmplKeyInfoAddEncryptedKey @ 318 NONAME + xmlSecTmplKeyInfoAddKeyName @ 319 NONAME + xmlSecTmplKeyInfoAddKeyValue @ 320 NONAME + xmlSecTmplKeyInfoAddRetrievalMethod @ 321 NONAME + xmlSecTmplKeyInfoAddX509Data @ 322 NONAME + xmlSecTmplManifestAddReference @ 323 NONAME + xmlSecTmplObjectAddManifest @ 324 NONAME + xmlSecTmplObjectAddSignProperties @ 325 NONAME + xmlSecTmplReferenceAddTransform @ 326 NONAME + xmlSecTmplReferenceListAddDataReference @ 327 NONAME + xmlSecTmplReferenceListAddKeyReference @ 328 NONAME + xmlSecTmplRetrievalMethodAddTransform @ 329 NONAME + xmlSecTmplSignatureAddObject @ 330 NONAME + xmlSecTmplSignatureAddReference @ 331 NONAME + xmlSecTmplSignatureCreate @ 332 NONAME + xmlSecTmplSignatureEnsureKeyInfo @ 333 NONAME + xmlSecTmplSignatureGetC14NMethodNode @ 334 NONAME + xmlSecTmplSignatureGetSignMethodNode @ 335 NONAME + xmlSecTmplTransformAddC14NInclNamespaces @ 336 NONAME + xmlSecTmplTransformAddHmacOutputLength @ 337 NONAME + xmlSecTmplTransformAddRsaOaepParam @ 338 NONAME + xmlSecTmplTransformAddXPath @ 339 NONAME + xmlSecTmplTransformAddXPath2 @ 340 NONAME + xmlSecTmplTransformAddXPointer @ 341 NONAME + xmlSecTmplTransformAddXsltStylesheet @ 342 NONAME + xmlSecTmplX509DataAddCRL @ 343 NONAME + xmlSecTmplX509DataAddCertificate @ 344 NONAME + xmlSecTmplX509DataAddIssuerSerial @ 345 NONAME + xmlSecTmplX509DataAddSKI @ 346 NONAME + xmlSecTmplX509DataAddSubjectName @ 347 NONAME + xmlSecTransformBase64GetKlass @ 348 NONAME + xmlSecTransformBase64SetLineSize @ 349 NONAME + xmlSecTransformConnect @ 350 NONAME + xmlSecTransformCreate @ 351 NONAME + xmlSecTransformCreateInputBuffer @ 352 NONAME + xmlSecTransformCreateOutputBuffer @ 353 NONAME + xmlSecTransformCtxAppend @ 354 NONAME + xmlSecTransformCtxBinaryExecute @ 355 NONAME + xmlSecTransformCtxCopyUserPref @ 356 NONAME + xmlSecTransformCtxCreate @ 357 NONAME + xmlSecTransformCtxCreateAndAppend @ 358 NONAME + xmlSecTransformCtxCreateAndPrepend @ 359 NONAME + xmlSecTransformCtxDebugDump @ 360 NONAME + xmlSecTransformCtxDebugXmlDump @ 361 NONAME + xmlSecTransformCtxDestroy @ 362 NONAME + xmlSecTransformCtxExecute @ 363 NONAME + xmlSecTransformCtxFinalize @ 364 NONAME + xmlSecTransformCtxInitialize @ 365 NONAME + xmlSecTransformCtxNodeRead @ 366 NONAME + xmlSecTransformCtxNodesListRead @ 367 NONAME + xmlSecTransformCtxPrepare @ 368 NONAME + xmlSecTransformCtxPrepend @ 369 NONAME + xmlSecTransformCtxReset @ 370 NONAME + xmlSecTransformCtxSetUri @ 371 NONAME + xmlSecTransformCtxUriExecute @ 372 NONAME + xmlSecTransformCtxXmlExecute @ 373 NONAME + xmlSecTransformDebugDump @ 374 NONAME + xmlSecTransformDebugXmlDump @ 375 NONAME + xmlSecTransformDefaultGetDataType @ 376 NONAME + xmlSecTransformDefaultPopBin @ 377 NONAME + xmlSecTransformDefaultPopXml @ 378 NONAME + xmlSecTransformDefaultPushBin @ 379 NONAME + xmlSecTransformDefaultPushXml @ 380 NONAME + xmlSecTransformDestroy @ 381 NONAME + xmlSecTransformEnvelopedGetKlass @ 382 NONAME + xmlSecTransformExclC14NGetKlass @ 383 NONAME + xmlSecTransformExclC14NWithCommentsGetKlass @ 384 NONAME + xmlSecTransformExecute @ 385 NONAME + xmlSecTransformGetDataType @ 386 NONAME + xmlSecTransformIdListDebugDump @ 387 NONAME + xmlSecTransformIdListDebugXmlDump @ 388 NONAME + xmlSecTransformIdListFind @ 389 NONAME + xmlSecTransformIdListFindByHref @ 390 NONAME + xmlSecTransformIdListFindByName @ 391 NONAME + xmlSecTransformIdListGetKlass @ 392 NONAME + xmlSecTransformIdsGet @ 393 NONAME + xmlSecTransformIdsInit @ 394 NONAME + xmlSecTransformIdsRegister @ 395 NONAME + xmlSecTransformIdsRegisterDefault @ 396 NONAME + xmlSecTransformIdsShutdown @ 397 NONAME + xmlSecTransformInclC14NGetKlass @ 398 NONAME + xmlSecTransformInclC14NWithCommentsGetKlass @ 399 NONAME + xmlSecTransformInputURIGetKlass @ 400 NONAME + xmlSecTransformInputURIOpen @ 401 NONAME + xmlSecTransformMemBufGetBuffer @ 402 NONAME + xmlSecTransformMemBufGetKlass @ 403 NONAME + xmlSecTransformNodeRead @ 404 NONAME + xmlSecTransformPopBin @ 405 NONAME + xmlSecTransformPopXml @ 406 NONAME + xmlSecTransformPump @ 407 NONAME + xmlSecTransformPushBin @ 408 NONAME + xmlSecTransformPushXml @ 409 NONAME + xmlSecTransformRemove @ 410 NONAME + xmlSecTransformRemoveXmlTagsC14NGetKlass @ 411 NONAME + xmlSecTransformSetKey @ 412 NONAME + xmlSecTransformSetKeyReq @ 413 NONAME + xmlSecTransformUriTypeCheck @ 414 NONAME + xmlSecTransformVerify @ 415 NONAME + xmlSecTransformVerifyNodeContent @ 416 NONAME + xmlSecTransformVisa3DHackGetKlass @ 417 NONAME + xmlSecTransformVisa3DHackSetID @ 418 NONAME + xmlSecTransformXPath2GetKlass @ 419 NONAME + xmlSecTransformXPathGetKlass @ 420 NONAME + xmlSecTransformXPointerGetKlass @ 421 NONAME + xmlSecTransformXPointerSetExpr @ 422 NONAME + xmlSecTransformXmlParserGetKlass @ 423 NONAME + xmlSecX509DataGetNodeContent @ 424 NONAME + xmlSecXkmsRespondWithDebugDump @ 425 NONAME + xmlSecXkmsRespondWithDebugXmlDump @ 426 NONAME + xmlSecXkmsRespondWithDefaultNodeRead @ 427 NONAME + xmlSecXkmsRespondWithDefaultNodeWrite @ 428 NONAME + xmlSecXkmsRespondWithIdListFind @ 429 NONAME + xmlSecXkmsRespondWithIdListFindByNodeValue @ 430 NONAME + xmlSecXkmsRespondWithIdListGetKlass @ 431 NONAME + xmlSecXkmsRespondWithIdListWrite @ 432 NONAME + xmlSecXkmsRespondWithIdsGet @ 433 NONAME + xmlSecXkmsRespondWithIdsInit @ 434 NONAME + xmlSecXkmsRespondWithIdsRegister @ 435 NONAME + xmlSecXkmsRespondWithIdsRegisterDefault @ 436 NONAME + xmlSecXkmsRespondWithIdsShutdown @ 437 NONAME + xmlSecXkmsRespondWithKeyNameGetKlass @ 438 NONAME + xmlSecXkmsRespondWithKeyValueGetKlass @ 439 NONAME + xmlSecXkmsRespondWithNodeRead @ 440 NONAME + xmlSecXkmsRespondWithNodeWrite @ 441 NONAME + xmlSecXkmsRespondWithPGPGetKlass @ 442 NONAME + xmlSecXkmsRespondWithPrivateKeyGetKlass @ 443 NONAME + xmlSecXkmsRespondWithRetrievalMethodGetKlass @ 444 NONAME + xmlSecXkmsRespondWithSPKIGetKlass @ 445 NONAME + xmlSecXkmsRespondWithX509CRLGetKlass @ 446 NONAME + xmlSecXkmsRespondWithX509CertGetKlass @ 447 NONAME + xmlSecXkmsRespondWithX509ChainGetKlass @ 448 NONAME + xmlSecXkmsServerCtxCopyUserPref @ 449 NONAME + xmlSecXkmsServerCtxCreate @ 450 NONAME + xmlSecXkmsServerCtxDebugDump @ 451 NONAME + xmlSecXkmsServerCtxDebugXmlDump @ 452 NONAME + xmlSecXkmsServerCtxDestroy @ 453 NONAME + xmlSecXkmsServerCtxFatalErrorResponseCreate @ 454 NONAME + xmlSecXkmsServerCtxFinalize @ 455 NONAME + xmlSecXkmsServerCtxInitialize @ 456 NONAME + xmlSecXkmsServerCtxProcess @ 457 NONAME + xmlSecXkmsServerCtxPtrListGetKlass @ 458 NONAME + xmlSecXkmsServerCtxRequestRead @ 459 NONAME + xmlSecXkmsServerCtxRequestUnwrap @ 460 NONAME + xmlSecXkmsServerCtxReset @ 461 NONAME + xmlSecXkmsServerCtxResponseWrap @ 462 NONAME + xmlSecXkmsServerCtxResponseWrite @ 463 NONAME + xmlSecXkmsServerCtxSetResult @ 464 NONAME + xmlSecXkmsServerFormatFromString @ 465 NONAME + xmlSecXkmsServerFormatToString @ 466 NONAME + xmlSecXkmsServerRequestCompoundGetKlass @ 467 NONAME + xmlSecXkmsServerRequestDebugDump @ 468 NONAME + xmlSecXkmsServerRequestDebugXmlDump @ 469 NONAME + xmlSecXkmsServerRequestExecute @ 470 NONAME + xmlSecXkmsServerRequestIdListFind @ 471 NONAME + xmlSecXkmsServerRequestIdListFindByName @ 472 NONAME + xmlSecXkmsServerRequestIdListFindByNode @ 473 NONAME + xmlSecXkmsServerRequestIdListGetKlass @ 474 NONAME + xmlSecXkmsServerRequestIdsGet @ 475 NONAME + xmlSecXkmsServerRequestIdsInit @ 476 NONAME + xmlSecXkmsServerRequestIdsRegister @ 477 NONAME + xmlSecXkmsServerRequestIdsRegisterDefault @ 478 NONAME + xmlSecXkmsServerRequestIdsShutdown @ 479 NONAME + xmlSecXkmsServerRequestLocateGetKlass @ 480 NONAME + xmlSecXkmsServerRequestNodeRead @ 481 NONAME + xmlSecXkmsServerRequestNodeWrite @ 482 NONAME + xmlSecXkmsServerRequestResultGetKlass @ 483 NONAME + xmlSecXkmsServerRequestStatusGetKlass @ 484 NONAME + xmlSecXkmsServerRequestValidateGetKlass @ 485 NONAME + xmlSetNewLineFlag @ 486 NONAME + xmlSetPrefix @ 487 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/eabi/wsstarxmlsec.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/eabi/wsstarxmlsec.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,489 @@ +EXPORTS + xmlSecAddChild @ 1 NONAME + xmlSecAddChildNode @ 2 NONAME + xmlSecAddIDs @ 3 NONAME + xmlSecAddNextSibling @ 4 NONAME + xmlSecAddPrevSibling @ 5 NONAME + xmlSecBase64CtxCreate @ 6 NONAME + xmlSecBase64CtxDestroy @ 7 NONAME + xmlSecBase64CtxFinal @ 8 NONAME + xmlSecBase64CtxFinalize @ 9 NONAME + xmlSecBase64CtxInitialize @ 10 NONAME + xmlSecBase64CtxUpdate @ 11 NONAME + xmlSecBase64Decode @ 12 NONAME + xmlSecBase64Encode @ 13 NONAME + xmlSecBnAdd @ 14 NONAME + xmlSecBnBlobSetNodeValue @ 15 NONAME + xmlSecBnCompare @ 16 NONAME + xmlSecBnCompareReverse @ 17 NONAME + xmlSecBnCreate @ 18 NONAME + xmlSecBnDestroy @ 19 NONAME + xmlSecBnDiv @ 20 NONAME + xmlSecBnFinalize @ 21 NONAME + xmlSecBnFromDecString @ 22 NONAME + xmlSecBnFromHexString @ 23 NONAME + xmlSecBnFromString @ 24 NONAME + xmlSecBnGetData @ 25 NONAME + xmlSecBnGetNodeValue @ 26 NONAME + xmlSecBnGetSize @ 27 NONAME + xmlSecBnInitialize @ 28 NONAME + xmlSecBnMul @ 29 NONAME + xmlSecBnReverse @ 30 NONAME + xmlSecBnSetData @ 31 NONAME + xmlSecBnSetNodeValue @ 32 NONAME + xmlSecBnToDecString @ 33 NONAME + xmlSecBnToHexString @ 34 NONAME + xmlSecBnToString @ 35 NONAME + xmlSecBnZero @ 36 NONAME + xmlSecBufferAppend @ 37 NONAME + xmlSecBufferBase64NodeContentRead @ 38 NONAME + xmlSecBufferBase64NodeContentWrite @ 39 NONAME + xmlSecBufferCreate @ 40 NONAME + xmlSecBufferCreateOutputBuffer @ 41 NONAME + xmlSecBufferDestroy @ 42 NONAME + xmlSecBufferEmpty @ 43 NONAME + xmlSecBufferFinalize @ 44 NONAME + xmlSecBufferGetData @ 45 NONAME + xmlSecBufferGetMaxSize @ 46 NONAME + xmlSecBufferGetSize @ 47 NONAME + xmlSecBufferInitialize @ 48 NONAME + xmlSecBufferPrepend @ 49 NONAME + xmlSecBufferReadFile @ 50 NONAME + xmlSecBufferRemoveHead @ 51 NONAME + xmlSecBufferRemoveTail @ 52 NONAME + xmlSecBufferSetData @ 53 NONAME + xmlSecBufferSetDefaultAllocMode @ 54 NONAME + xmlSecBufferSetMaxSize @ 55 NONAME + xmlSecBufferSetSize @ 56 NONAME + xmlSecCheckErrorFlag @ 57 NONAME + xmlSecCheckNodeName @ 58 NONAME + xmlSecCheckVersionExt @ 59 NONAME + xmlSecCreateTree @ 60 NONAME + xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms @ 61 NONAME + xmlSecDSigCtxCreate @ 62 NONAME + xmlSecDSigCtxDebugDump @ 63 NONAME + xmlSecDSigCtxDebugXmlDump @ 64 NONAME + xmlSecDSigCtxDestroy @ 65 NONAME + xmlSecDSigCtxEnableReferenceTransform @ 66 NONAME + xmlSecDSigCtxEnableSignatureTransform @ 67 NONAME + xmlSecDSigCtxFinalize @ 68 NONAME + xmlSecDSigCtxGetPreSignBuffer @ 69 NONAME + xmlSecDSigCtxInitialize @ 70 NONAME + xmlSecDSigCtxSign @ 71 NONAME + xmlSecDSigCtxVerify @ 72 NONAME + xmlSecDSigReferenceCtxCreate @ 73 NONAME + xmlSecDSigReferenceCtxDebugDump @ 74 NONAME + xmlSecDSigReferenceCtxDebugXmlDump @ 75 NONAME + xmlSecDSigReferenceCtxDestroy @ 76 NONAME + xmlSecDSigReferenceCtxFinalize @ 77 NONAME + xmlSecDSigReferenceCtxGetPreDigestBuffer @ 78 NONAME + xmlSecDSigReferenceCtxInitialize @ 79 NONAME + xmlSecDSigReferenceCtxListGetKlass @ 80 NONAME + xmlSecDSigReferenceCtxProcessNode @ 81 NONAME + xmlSecEncCtxBinaryEncrypt @ 82 NONAME + xmlSecEncCtxCopyUserPref @ 83 NONAME + xmlSecEncCtxCreate @ 84 NONAME + xmlSecEncCtxDebugDump @ 85 NONAME + xmlSecEncCtxDebugXmlDump @ 86 NONAME + xmlSecEncCtxDecrypt @ 87 NONAME + xmlSecEncCtxDecryptToBuffer @ 88 NONAME + xmlSecEncCtxDestroy @ 89 NONAME + xmlSecEncCtxFinalize @ 90 NONAME + xmlSecEncCtxInitialize @ 91 NONAME + xmlSecEncCtxReset @ 92 NONAME + xmlSecEncCtxUriEncrypt @ 93 NONAME + xmlSecEncCtxXmlEncrypt @ 94 NONAME + xmlSecError @ 95 NONAME + xmlSecErrorsDefaultCallback @ 96 NONAME + xmlSecErrorsDefaultCallbackEnableOutput @ 97 NONAME + xmlSecErrorsGetCode @ 98 NONAME + xmlSecErrorsGetMsg @ 99 NONAME + xmlSecErrorsInit @ 100 NONAME + xmlSecErrorsSetCallback @ 101 NONAME + xmlSecErrorsShutdown @ 102 NONAME + xmlSecFindChild @ 103 NONAME + xmlSecFindNode @ 104 NONAME + xmlSecFindParent @ 105 NONAME + xmlSecGenerateAndAddID @ 106 NONAME + xmlSecGenerateID @ 107 NONAME + xmlSecGetGlobalConsts @ 108 NONAME + xmlSecGetNextElementNode @ 109 NONAME + xmlSecGetNodeNsHref @ 110 NONAME + xmlSecGetQName @ 111 NONAME + xmlSecGlobalConsts @ 112 NONAME + xmlSecIOCleanupCallbacks @ 113 NONAME + xmlSecIOInit @ 114 NONAME + xmlSecIORegisterCallbacks @ 115 NONAME + xmlSecIORegisterDefaultCallbacks @ 116 NONAME + xmlSecIOShutdown @ 117 NONAME + xmlSecInit @ 118 NONAME + xmlSecIsEmptyNode @ 119 NONAME + xmlSecIsEmptyString @ 120 NONAME + xmlSecKeyAdoptData @ 121 NONAME + xmlSecKeyCopy @ 122 NONAME + xmlSecKeyCreate @ 123 NONAME + xmlSecKeyDataBinRead @ 124 NONAME + xmlSecKeyDataBinWrite @ 125 NONAME + xmlSecKeyDataBinaryValueBinRead @ 126 NONAME + xmlSecKeyDataBinaryValueBinWrite @ 127 NONAME + xmlSecKeyDataBinaryValueDebugDump @ 128 NONAME + xmlSecKeyDataBinaryValueDebugXmlDump @ 129 NONAME + xmlSecKeyDataBinaryValueDuplicate @ 130 NONAME + xmlSecKeyDataBinaryValueFinalize @ 131 NONAME + xmlSecKeyDataBinaryValueGetBuffer @ 132 NONAME + xmlSecKeyDataBinaryValueGetSize @ 133 NONAME + xmlSecKeyDataBinaryValueInitialize @ 134 NONAME + xmlSecKeyDataBinaryValueSetBuffer @ 135 NONAME + xmlSecKeyDataBinaryValueXmlRead @ 136 NONAME + xmlSecKeyDataBinaryValueXmlWrite @ 137 NONAME + xmlSecKeyDataCreate @ 138 NONAME + xmlSecKeyDataDebugDump @ 139 NONAME + xmlSecKeyDataDebugXmlDump @ 140 NONAME + xmlSecKeyDataDestroy @ 141 NONAME + xmlSecKeyDataDuplicate @ 142 NONAME + xmlSecKeyDataEncryptedKeyGetKlass @ 143 NONAME + xmlSecKeyDataGenerate @ 144 NONAME + xmlSecKeyDataGetIdentifier @ 145 NONAME + xmlSecKeyDataGetSize @ 146 NONAME + xmlSecKeyDataGetType @ 147 NONAME + xmlSecKeyDataIdListDebugDump @ 148 NONAME + xmlSecKeyDataIdListDebugXmlDump @ 149 NONAME + xmlSecKeyDataIdListFind @ 150 NONAME + xmlSecKeyDataIdListFindByHref @ 151 NONAME + xmlSecKeyDataIdListFindByName @ 152 NONAME + xmlSecKeyDataIdListFindByNode @ 153 NONAME + xmlSecKeyDataIdListGetKlass @ 154 NONAME + xmlSecKeyDataIdsGet @ 155 NONAME + xmlSecKeyDataIdsInit @ 156 NONAME + xmlSecKeyDataIdsRegister @ 157 NONAME + xmlSecKeyDataIdsRegisterDefault @ 158 NONAME + xmlSecKeyDataIdsShutdown @ 159 NONAME + xmlSecKeyDataListGetKlass @ 160 NONAME + xmlSecKeyDataNameGetKlass @ 161 NONAME + xmlSecKeyDataRetrievalMethodGetKlass @ 162 NONAME + xmlSecKeyDataStoreCreate @ 163 NONAME + xmlSecKeyDataStoreDestroy @ 164 NONAME + xmlSecKeyDataStorePtrListGetKlass @ 165 NONAME + xmlSecKeyDataValueGetKlass @ 166 NONAME + xmlSecKeyDataXmlRead @ 167 NONAME + xmlSecKeyDataXmlWrite @ 168 NONAME + xmlSecKeyDebugDump @ 169 NONAME + xmlSecKeyDebugXmlDump @ 170 NONAME + xmlSecKeyDestroy @ 171 NONAME + xmlSecKeyDuplicate @ 172 NONAME + xmlSecKeyEmpty @ 173 NONAME + xmlSecKeyEnsureData @ 174 NONAME + xmlSecKeyGenerate @ 175 NONAME + xmlSecKeyGenerateByName @ 176 NONAME + xmlSecKeyGetData @ 177 NONAME + xmlSecKeyGetName @ 178 NONAME + xmlSecKeyGetType @ 179 NONAME + xmlSecKeyGetValue @ 180 NONAME + xmlSecKeyInfoCtxCopyUserPref @ 181 NONAME + xmlSecKeyInfoCtxCreate @ 182 NONAME + xmlSecKeyInfoCtxCreateEncCtx @ 183 NONAME + xmlSecKeyInfoCtxDebugDump @ 184 NONAME + xmlSecKeyInfoCtxDebugXmlDump @ 185 NONAME + xmlSecKeyInfoCtxDestroy @ 186 NONAME + xmlSecKeyInfoCtxFinalize @ 187 NONAME + xmlSecKeyInfoCtxInitialize @ 188 NONAME + xmlSecKeyInfoCtxReset @ 189 NONAME + xmlSecKeyInfoNodeRead @ 190 NONAME + xmlSecKeyInfoNodeWrite @ 191 NONAME + xmlSecKeyMatch @ 192 NONAME + xmlSecKeyPtrListGetKlass @ 193 NONAME + xmlSecKeyReadBinaryFile @ 194 NONAME + xmlSecKeyReadBuffer @ 195 NONAME + xmlSecKeyReadMemory @ 196 NONAME + xmlSecKeyReqCopy @ 197 NONAME + xmlSecKeyReqDebugDump @ 198 NONAME + xmlSecKeyReqDebugXmlDump @ 199 NONAME + xmlSecKeyReqFinalize @ 200 NONAME + xmlSecKeyReqInitialize @ 201 NONAME + xmlSecKeyReqMatchKey @ 202 NONAME + xmlSecKeyReqMatchKeyValue @ 203 NONAME + xmlSecKeyReqReset @ 204 NONAME + xmlSecKeySetName @ 205 NONAME + xmlSecKeySetValue @ 206 NONAME + xmlSecKeyStoreCreate @ 207 NONAME + xmlSecKeyStoreDestroy @ 208 NONAME + xmlSecKeyStoreFindKey @ 209 NONAME + xmlSecKeyUseWithCopy @ 210 NONAME + xmlSecKeyUseWithCreate @ 211 NONAME + xmlSecKeyUseWithDebugDump @ 212 NONAME + xmlSecKeyUseWithDebugXmlDump @ 213 NONAME + xmlSecKeyUseWithDestroy @ 214 NONAME + xmlSecKeyUseWithDuplicate @ 215 NONAME + xmlSecKeyUseWithFinalize @ 216 NONAME + xmlSecKeyUseWithInitialize @ 217 NONAME + xmlSecKeyUseWithPtrListGetKlass @ 218 NONAME + xmlSecKeyUseWithReset @ 219 NONAME + xmlSecKeyUseWithSet @ 220 NONAME + xmlSecKeysMngrAdoptDataStore @ 221 NONAME + xmlSecKeysMngrAdoptKeysStore @ 222 NONAME + xmlSecKeysMngrCreate @ 223 NONAME + xmlSecKeysMngrDestroy @ 224 NONAME + xmlSecKeysMngrFindKey @ 225 NONAME + xmlSecKeysMngrGetDataStore @ 226 NONAME + xmlSecKeysMngrGetKey @ 227 NONAME + xmlSecKeysMngrGetKeysStore @ 228 NONAME + xmlSecNodeSetAdd @ 229 NONAME + xmlSecNodeSetAddList @ 230 NONAME + xmlSecNodeSetContains @ 231 NONAME + xmlSecNodeSetCreate @ 232 NONAME + xmlSecNodeSetDebugDump @ 233 NONAME + xmlSecNodeSetDestroy @ 234 NONAME + xmlSecNodeSetDocDestroy @ 235 NONAME + xmlSecNodeSetDumpTextNodes @ 236 NONAME + xmlSecNodeSetGetChildren @ 237 NONAME + xmlSecNodeSetWalk @ 238 NONAME + xmlSecParseFile @ 239 NONAME + xmlSecParseMemory @ 240 NONAME + xmlSecParseMemoryExt @ 241 NONAME + xmlSecPtrListAdd @ 242 NONAME + xmlSecPtrListCopy @ 243 NONAME + xmlSecPtrListCreate @ 244 NONAME + xmlSecPtrListDebugDump @ 245 NONAME + xmlSecPtrListDebugXmlDump @ 246 NONAME + xmlSecPtrListDestroy @ 247 NONAME + xmlSecPtrListDuplicate @ 248 NONAME + xmlSecPtrListEmpty @ 249 NONAME + xmlSecPtrListFinalize @ 250 NONAME + xmlSecPtrListGetItem @ 251 NONAME + xmlSecPtrListGetSize @ 252 NONAME + xmlSecPtrListInitialize @ 253 NONAME + xmlSecPtrListRemove @ 254 NONAME + xmlSecPtrListSet @ 255 NONAME + xmlSecPtrListSetDefaultAllocMode @ 256 NONAME + xmlSecQName2BitMaskDebugDump @ 257 NONAME + xmlSecQName2BitMaskDebugXmlDump @ 258 NONAME + xmlSecQName2BitMaskGetBitMask @ 259 NONAME + xmlSecQName2BitMaskGetBitMaskFromString @ 260 NONAME + xmlSecQName2BitMaskGetInfo @ 261 NONAME + xmlSecQName2BitMaskGetStringFromBitMask @ 262 NONAME + xmlSecQName2BitMaskNodesRead @ 263 NONAME + xmlSecQName2BitMaskNodesWrite @ 264 NONAME + xmlSecQName2IntegerAttributeRead @ 265 NONAME + xmlSecQName2IntegerAttributeWrite @ 266 NONAME + xmlSecQName2IntegerDebugDump @ 267 NONAME + xmlSecQName2IntegerDebugXmlDump @ 268 NONAME + xmlSecQName2IntegerGetInfo @ 269 NONAME + xmlSecQName2IntegerGetInteger @ 270 NONAME + xmlSecQName2IntegerGetIntegerFromString @ 271 NONAME + xmlSecQName2IntegerGetStringFromInteger @ 272 NONAME + xmlSecQName2IntegerNodeRead @ 273 NONAME + xmlSecQName2IntegerNodeWrite @ 274 NONAME + xmlSecReplaceContent @ 275 NONAME + xmlSecReplaceNode @ 276 NONAME + xmlSecReplaceNodeBuffer @ 277 NONAME + xmlSecResetErrorFlag @ 278 NONAME + xmlSecSetErrorFlag @ 279 NONAME + xmlSecShutdown @ 280 NONAME + xmlSecSimpleKeysStoreAdoptKey @ 281 NONAME + xmlSecSimpleKeysStoreGetKeys @ 282 NONAME + xmlSecSimpleKeysStoreGetKlass @ 283 NONAME + xmlSecSimpleKeysStoreLoad @ 284 NONAME + xmlSecSimpleKeysStoreSave @ 285 NONAME + xmlSecSoap11AddBodyEntry @ 286 NONAME + xmlSecSoap11AddFaultEntry @ 287 NONAME + xmlSecSoap11CheckEnvelope @ 288 NONAME + xmlSecSoap11CreateEnvelope @ 289 NONAME + xmlSecSoap11EnsureHeader @ 290 NONAME + xmlSecSoap11GetBody @ 291 NONAME + xmlSecSoap11GetBodyEntriesNumber @ 292 NONAME + xmlSecSoap11GetBodyEntry @ 293 NONAME + xmlSecSoap11GetFaultEntry @ 294 NONAME + xmlSecSoap11GetHeader @ 295 NONAME + xmlSecSoap12AddBodyEntry @ 296 NONAME + xmlSecSoap12AddFaultDetailEntry @ 297 NONAME + xmlSecSoap12AddFaultEntry @ 298 NONAME + xmlSecSoap12AddFaultReasonText @ 299 NONAME + xmlSecSoap12AddFaultSubcode @ 300 NONAME + xmlSecSoap12CheckEnvelope @ 301 NONAME + xmlSecSoap12CreateEnvelope @ 302 NONAME + xmlSecSoap12EnsureHeader @ 303 NONAME + xmlSecSoap12GetBody @ 304 NONAME + xmlSecSoap12GetBodyEntriesNumber @ 305 NONAME + xmlSecSoap12GetBodyEntry @ 306 NONAME + xmlSecSoap12GetFaultEntry @ 307 NONAME + xmlSecSoap12GetHeader @ 308 NONAME + xmlSecStringListGetKlass @ 309 NONAME + xmlSecTmplCipherReferenceAddTransform @ 310 NONAME + xmlSecTmplEncDataAddEncProperty @ 311 NONAME + xmlSecTmplEncDataCreate @ 312 NONAME + xmlSecTmplEncDataEnsureCipherReference @ 313 NONAME + xmlSecTmplEncDataEnsureCipherValue @ 314 NONAME + xmlSecTmplEncDataEnsureEncProperties @ 315 NONAME + xmlSecTmplEncDataEnsureKeyInfo @ 316 NONAME + xmlSecTmplEncDataGetEncMethodNode @ 317 NONAME + xmlSecTmplKeyInfoAddEncryptedKey @ 318 NONAME + xmlSecTmplKeyInfoAddKeyName @ 319 NONAME + xmlSecTmplKeyInfoAddKeyValue @ 320 NONAME + xmlSecTmplKeyInfoAddRetrievalMethod @ 321 NONAME + xmlSecTmplKeyInfoAddX509Data @ 322 NONAME + xmlSecTmplManifestAddReference @ 323 NONAME + xmlSecTmplObjectAddManifest @ 324 NONAME + xmlSecTmplObjectAddSignProperties @ 325 NONAME + xmlSecTmplReferenceAddTransform @ 326 NONAME + xmlSecTmplReferenceListAddDataReference @ 327 NONAME + xmlSecTmplReferenceListAddKeyReference @ 328 NONAME + xmlSecTmplRetrievalMethodAddTransform @ 329 NONAME + xmlSecTmplSignatureAddObject @ 330 NONAME + xmlSecTmplSignatureAddReference @ 331 NONAME + xmlSecTmplSignatureCreate @ 332 NONAME + xmlSecTmplSignatureEnsureKeyInfo @ 333 NONAME + xmlSecTmplSignatureGetC14NMethodNode @ 334 NONAME + xmlSecTmplSignatureGetSignMethodNode @ 335 NONAME + xmlSecTmplTransformAddC14NInclNamespaces @ 336 NONAME + xmlSecTmplTransformAddHmacOutputLength @ 337 NONAME + xmlSecTmplTransformAddRsaOaepParam @ 338 NONAME + xmlSecTmplTransformAddXPath @ 339 NONAME + xmlSecTmplTransformAddXPath2 @ 340 NONAME + xmlSecTmplTransformAddXPointer @ 341 NONAME + xmlSecTmplTransformAddXsltStylesheet @ 342 NONAME + xmlSecTmplX509DataAddCRL @ 343 NONAME + xmlSecTmplX509DataAddCertificate @ 344 NONAME + xmlSecTmplX509DataAddIssuerSerial @ 345 NONAME + xmlSecTmplX509DataAddSKI @ 346 NONAME + xmlSecTmplX509DataAddSubjectName @ 347 NONAME + xmlSecTransformBase64GetKlass @ 348 NONAME + xmlSecTransformBase64SetLineSize @ 349 NONAME + xmlSecTransformConnect @ 350 NONAME + xmlSecTransformCreate @ 351 NONAME + xmlSecTransformCreateInputBuffer @ 352 NONAME + xmlSecTransformCreateOutputBuffer @ 353 NONAME + xmlSecTransformCtxAppend @ 354 NONAME + xmlSecTransformCtxBinaryExecute @ 355 NONAME + xmlSecTransformCtxCopyUserPref @ 356 NONAME + xmlSecTransformCtxCreate @ 357 NONAME + xmlSecTransformCtxCreateAndAppend @ 358 NONAME + xmlSecTransformCtxCreateAndPrepend @ 359 NONAME + xmlSecTransformCtxDebugDump @ 360 NONAME + xmlSecTransformCtxDebugXmlDump @ 361 NONAME + xmlSecTransformCtxDestroy @ 362 NONAME + xmlSecTransformCtxExecute @ 363 NONAME + xmlSecTransformCtxFinalize @ 364 NONAME + xmlSecTransformCtxInitialize @ 365 NONAME + xmlSecTransformCtxNodeRead @ 366 NONAME + xmlSecTransformCtxNodesListRead @ 367 NONAME + xmlSecTransformCtxPrepare @ 368 NONAME + xmlSecTransformCtxPrepend @ 369 NONAME + xmlSecTransformCtxReset @ 370 NONAME + xmlSecTransformCtxSetUri @ 371 NONAME + xmlSecTransformCtxUriExecute @ 372 NONAME + xmlSecTransformCtxXmlExecute @ 373 NONAME + xmlSecTransformDebugDump @ 374 NONAME + xmlSecTransformDebugXmlDump @ 375 NONAME + xmlSecTransformDefaultGetDataType @ 376 NONAME + xmlSecTransformDefaultPopBin @ 377 NONAME + xmlSecTransformDefaultPopXml @ 378 NONAME + xmlSecTransformDefaultPushBin @ 379 NONAME + xmlSecTransformDefaultPushXml @ 380 NONAME + xmlSecTransformDestroy @ 381 NONAME + xmlSecTransformEnvelopedGetKlass @ 382 NONAME + xmlSecTransformExclC14NGetKlass @ 383 NONAME + xmlSecTransformExclC14NWithCommentsGetKlass @ 384 NONAME + xmlSecTransformExecute @ 385 NONAME + xmlSecTransformGetDataType @ 386 NONAME + xmlSecTransformIdListDebugDump @ 387 NONAME + xmlSecTransformIdListDebugXmlDump @ 388 NONAME + xmlSecTransformIdListFind @ 389 NONAME + xmlSecTransformIdListFindByHref @ 390 NONAME + xmlSecTransformIdListFindByName @ 391 NONAME + xmlSecTransformIdListGetKlass @ 392 NONAME + xmlSecTransformIdsGet @ 393 NONAME + xmlSecTransformIdsInit @ 394 NONAME + xmlSecTransformIdsRegister @ 395 NONAME + xmlSecTransformIdsRegisterDefault @ 396 NONAME + xmlSecTransformIdsShutdown @ 397 NONAME + xmlSecTransformInclC14NGetKlass @ 398 NONAME + xmlSecTransformInclC14NWithCommentsGetKlass @ 399 NONAME + xmlSecTransformInputURIGetKlass @ 400 NONAME + xmlSecTransformInputURIOpen @ 401 NONAME + xmlSecTransformMemBufGetBuffer @ 402 NONAME + xmlSecTransformMemBufGetKlass @ 403 NONAME + xmlSecTransformNodeRead @ 404 NONAME + xmlSecTransformPopBin @ 405 NONAME + xmlSecTransformPopXml @ 406 NONAME + xmlSecTransformPump @ 407 NONAME + xmlSecTransformPushBin @ 408 NONAME + xmlSecTransformPushXml @ 409 NONAME + xmlSecTransformRemove @ 410 NONAME + xmlSecTransformRemoveXmlTagsC14NGetKlass @ 411 NONAME + xmlSecTransformSetKey @ 412 NONAME + xmlSecTransformSetKeyReq @ 413 NONAME + xmlSecTransformUriTypeCheck @ 414 NONAME + xmlSecTransformVerify @ 415 NONAME + xmlSecTransformVerifyNodeContent @ 416 NONAME + xmlSecTransformVisa3DHackGetKlass @ 417 NONAME + xmlSecTransformVisa3DHackSetID @ 418 NONAME + xmlSecTransformXPath2GetKlass @ 419 NONAME + xmlSecTransformXPathGetKlass @ 420 NONAME + xmlSecTransformXPointerGetKlass @ 421 NONAME + xmlSecTransformXPointerSetExpr @ 422 NONAME + xmlSecTransformXmlParserGetKlass @ 423 NONAME + xmlSecX509DataGetNodeContent @ 424 NONAME + xmlSecXkmsRespondWithDebugDump @ 425 NONAME + xmlSecXkmsRespondWithDebugXmlDump @ 426 NONAME + xmlSecXkmsRespondWithDefaultNodeRead @ 427 NONAME + xmlSecXkmsRespondWithDefaultNodeWrite @ 428 NONAME + xmlSecXkmsRespondWithIdListFind @ 429 NONAME + xmlSecXkmsRespondWithIdListFindByNodeValue @ 430 NONAME + xmlSecXkmsRespondWithIdListGetKlass @ 431 NONAME + xmlSecXkmsRespondWithIdListWrite @ 432 NONAME + xmlSecXkmsRespondWithIdsGet @ 433 NONAME + xmlSecXkmsRespondWithIdsInit @ 434 NONAME + xmlSecXkmsRespondWithIdsRegister @ 435 NONAME + xmlSecXkmsRespondWithIdsRegisterDefault @ 436 NONAME + xmlSecXkmsRespondWithIdsShutdown @ 437 NONAME + xmlSecXkmsRespondWithKeyNameGetKlass @ 438 NONAME + xmlSecXkmsRespondWithKeyValueGetKlass @ 439 NONAME + xmlSecXkmsRespondWithNodeRead @ 440 NONAME + xmlSecXkmsRespondWithNodeWrite @ 441 NONAME + xmlSecXkmsRespondWithPGPGetKlass @ 442 NONAME + xmlSecXkmsRespondWithPrivateKeyGetKlass @ 443 NONAME + xmlSecXkmsRespondWithRetrievalMethodGetKlass @ 444 NONAME + xmlSecXkmsRespondWithSPKIGetKlass @ 445 NONAME + xmlSecXkmsRespondWithX509CRLGetKlass @ 446 NONAME + xmlSecXkmsRespondWithX509CertGetKlass @ 447 NONAME + xmlSecXkmsRespondWithX509ChainGetKlass @ 448 NONAME + xmlSecXkmsServerCtxCopyUserPref @ 449 NONAME + xmlSecXkmsServerCtxCreate @ 450 NONAME + xmlSecXkmsServerCtxDebugDump @ 451 NONAME + xmlSecXkmsServerCtxDebugXmlDump @ 452 NONAME + xmlSecXkmsServerCtxDestroy @ 453 NONAME + xmlSecXkmsServerCtxFatalErrorResponseCreate @ 454 NONAME + xmlSecXkmsServerCtxFinalize @ 455 NONAME + xmlSecXkmsServerCtxInitialize @ 456 NONAME + xmlSecXkmsServerCtxProcess @ 457 NONAME + xmlSecXkmsServerCtxPtrListGetKlass @ 458 NONAME + xmlSecXkmsServerCtxRequestRead @ 459 NONAME + xmlSecXkmsServerCtxRequestUnwrap @ 460 NONAME + xmlSecXkmsServerCtxReset @ 461 NONAME + xmlSecXkmsServerCtxResponseWrap @ 462 NONAME + xmlSecXkmsServerCtxResponseWrite @ 463 NONAME + xmlSecXkmsServerCtxSetResult @ 464 NONAME + xmlSecXkmsServerFormatFromString @ 465 NONAME + xmlSecXkmsServerFormatToString @ 466 NONAME + xmlSecXkmsServerRequestCompoundGetKlass @ 467 NONAME + xmlSecXkmsServerRequestDebugDump @ 468 NONAME + xmlSecXkmsServerRequestDebugXmlDump @ 469 NONAME + xmlSecXkmsServerRequestExecute @ 470 NONAME + xmlSecXkmsServerRequestIdListFind @ 471 NONAME + xmlSecXkmsServerRequestIdListFindByName @ 472 NONAME + xmlSecXkmsServerRequestIdListFindByNode @ 473 NONAME + xmlSecXkmsServerRequestIdListGetKlass @ 474 NONAME + xmlSecXkmsServerRequestIdsGet @ 475 NONAME + xmlSecXkmsServerRequestIdsInit @ 476 NONAME + xmlSecXkmsServerRequestIdsRegister @ 477 NONAME + xmlSecXkmsServerRequestIdsRegisterDefault @ 478 NONAME + xmlSecXkmsServerRequestIdsShutdown @ 479 NONAME + xmlSecXkmsServerRequestLocateGetKlass @ 480 NONAME + xmlSecXkmsServerRequestNodeRead @ 481 NONAME + xmlSecXkmsServerRequestNodeWrite @ 482 NONAME + xmlSecXkmsServerRequestResultGetKlass @ 483 NONAME + xmlSecXkmsServerRequestStatusGetKlass @ 484 NONAME + xmlSecXkmsServerRequestValidateGetKlass @ 485 NONAME + xmlSetNewLineFlag @ 486 NONAME + xmlSetPrefix @ 487 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/eabi/xmlsec.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/eabi/xmlsec.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,489 @@ +EXPORTS + xmlSecAddChild @ 1 NONAME + xmlSecAddChildNode @ 2 NONAME + xmlSecAddIDs @ 3 NONAME + xmlSecAddNextSibling @ 4 NONAME + xmlSecAddPrevSibling @ 5 NONAME + xmlSecBase64CtxCreate @ 6 NONAME + xmlSecBase64CtxDestroy @ 7 NONAME + xmlSecBase64CtxFinal @ 8 NONAME + xmlSecBase64CtxFinalize @ 9 NONAME + xmlSecBase64CtxInitialize @ 10 NONAME + xmlSecBase64CtxUpdate @ 11 NONAME + xmlSecBase64Decode @ 12 NONAME + xmlSecBase64Encode @ 13 NONAME + xmlSecBnAdd @ 14 NONAME + xmlSecBnBlobSetNodeValue @ 15 NONAME + xmlSecBnCompare @ 16 NONAME + xmlSecBnCompareReverse @ 17 NONAME + xmlSecBnCreate @ 18 NONAME + xmlSecBnDestroy @ 19 NONAME + xmlSecBnDiv @ 20 NONAME + xmlSecBnFinalize @ 21 NONAME + xmlSecBnFromDecString @ 22 NONAME + xmlSecBnFromHexString @ 23 NONAME + xmlSecBnFromString @ 24 NONAME + xmlSecBnGetData @ 25 NONAME + xmlSecBnGetNodeValue @ 26 NONAME + xmlSecBnGetSize @ 27 NONAME + xmlSecBnInitialize @ 28 NONAME + xmlSecBnMul @ 29 NONAME + xmlSecBnReverse @ 30 NONAME + xmlSecBnSetData @ 31 NONAME + xmlSecBnSetNodeValue @ 32 NONAME + xmlSecBnToDecString @ 33 NONAME + xmlSecBnToHexString @ 34 NONAME + xmlSecBnToString @ 35 NONAME + xmlSecBnZero @ 36 NONAME + xmlSecBufferAppend @ 37 NONAME + xmlSecBufferBase64NodeContentRead @ 38 NONAME + xmlSecBufferBase64NodeContentWrite @ 39 NONAME + xmlSecBufferCreate @ 40 NONAME + xmlSecBufferCreateOutputBuffer @ 41 NONAME + xmlSecBufferDestroy @ 42 NONAME + xmlSecBufferEmpty @ 43 NONAME + xmlSecBufferFinalize @ 44 NONAME + xmlSecBufferGetData @ 45 NONAME + xmlSecBufferGetMaxSize @ 46 NONAME + xmlSecBufferGetSize @ 47 NONAME + xmlSecBufferInitialize @ 48 NONAME + xmlSecBufferPrepend @ 49 NONAME + xmlSecBufferReadFile @ 50 NONAME + xmlSecBufferRemoveHead @ 51 NONAME + xmlSecBufferRemoveTail @ 52 NONAME + xmlSecBufferSetData @ 53 NONAME + xmlSecBufferSetDefaultAllocMode @ 54 NONAME + xmlSecBufferSetMaxSize @ 55 NONAME + xmlSecBufferSetSize @ 56 NONAME + xmlSecCheckErrorFlag @ 57 NONAME + xmlSecCheckNodeName @ 58 NONAME + xmlSecCheckVersionExt @ 59 NONAME + xmlSecCreateTree @ 60 NONAME + xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms @ 61 NONAME + xmlSecDSigCtxCreate @ 62 NONAME + xmlSecDSigCtxDebugDump @ 63 NONAME + xmlSecDSigCtxDebugXmlDump @ 64 NONAME + xmlSecDSigCtxDestroy @ 65 NONAME + xmlSecDSigCtxEnableReferenceTransform @ 66 NONAME + xmlSecDSigCtxEnableSignatureTransform @ 67 NONAME + xmlSecDSigCtxFinalize @ 68 NONAME + xmlSecDSigCtxGetPreSignBuffer @ 69 NONAME + xmlSecDSigCtxInitialize @ 70 NONAME + xmlSecDSigCtxSign @ 71 NONAME + xmlSecDSigCtxVerify @ 72 NONAME + xmlSecDSigReferenceCtxCreate @ 73 NONAME + xmlSecDSigReferenceCtxDebugDump @ 74 NONAME + xmlSecDSigReferenceCtxDebugXmlDump @ 75 NONAME + xmlSecDSigReferenceCtxDestroy @ 76 NONAME + xmlSecDSigReferenceCtxFinalize @ 77 NONAME + xmlSecDSigReferenceCtxGetPreDigestBuffer @ 78 NONAME + xmlSecDSigReferenceCtxInitialize @ 79 NONAME + xmlSecDSigReferenceCtxListGetKlass @ 80 NONAME + xmlSecDSigReferenceCtxProcessNode @ 81 NONAME + xmlSecEncCtxBinaryEncrypt @ 82 NONAME + xmlSecEncCtxCopyUserPref @ 83 NONAME + xmlSecEncCtxCreate @ 84 NONAME + xmlSecEncCtxDebugDump @ 85 NONAME + xmlSecEncCtxDebugXmlDump @ 86 NONAME + xmlSecEncCtxDecrypt @ 87 NONAME + xmlSecEncCtxDecryptToBuffer @ 88 NONAME + xmlSecEncCtxDestroy @ 89 NONAME + xmlSecEncCtxFinalize @ 90 NONAME + xmlSecEncCtxInitialize @ 91 NONAME + xmlSecEncCtxReset @ 92 NONAME + xmlSecEncCtxUriEncrypt @ 93 NONAME + xmlSecEncCtxXmlEncrypt @ 94 NONAME + xmlSecError @ 95 NONAME + xmlSecErrorsDefaultCallback @ 96 NONAME + xmlSecErrorsDefaultCallbackEnableOutput @ 97 NONAME + xmlSecErrorsGetCode @ 98 NONAME + xmlSecErrorsGetMsg @ 99 NONAME + xmlSecErrorsInit @ 100 NONAME + xmlSecErrorsSetCallback @ 101 NONAME + xmlSecErrorsShutdown @ 102 NONAME + xmlSecFindChild @ 103 NONAME + xmlSecFindNode @ 104 NONAME + xmlSecFindParent @ 105 NONAME + xmlSecGenerateAndAddID @ 106 NONAME + xmlSecGenerateID @ 107 NONAME + xmlSecGetGlobalConsts @ 108 NONAME + xmlSecGetNextElementNode @ 109 NONAME + xmlSecGetNodeNsHref @ 110 NONAME + xmlSecGetQName @ 111 NONAME + xmlSecGlobalConsts @ 112 NONAME DATA 1260 + xmlSecIOCleanupCallbacks @ 113 NONAME + xmlSecIOInit @ 114 NONAME + xmlSecIORegisterCallbacks @ 115 NONAME + xmlSecIORegisterDefaultCallbacks @ 116 NONAME + xmlSecIOShutdown @ 117 NONAME + xmlSecInit @ 118 NONAME + xmlSecIsEmptyNode @ 119 NONAME + xmlSecIsEmptyString @ 120 NONAME + xmlSecKeyAdoptData @ 121 NONAME + xmlSecKeyCopy @ 122 NONAME + xmlSecKeyCreate @ 123 NONAME + xmlSecKeyDataBinRead @ 124 NONAME + xmlSecKeyDataBinWrite @ 125 NONAME + xmlSecKeyDataBinaryValueBinRead @ 126 NONAME + xmlSecKeyDataBinaryValueBinWrite @ 127 NONAME + xmlSecKeyDataBinaryValueDebugDump @ 128 NONAME + xmlSecKeyDataBinaryValueDebugXmlDump @ 129 NONAME + xmlSecKeyDataBinaryValueDuplicate @ 130 NONAME + xmlSecKeyDataBinaryValueFinalize @ 131 NONAME + xmlSecKeyDataBinaryValueGetBuffer @ 132 NONAME + xmlSecKeyDataBinaryValueGetSize @ 133 NONAME + xmlSecKeyDataBinaryValueInitialize @ 134 NONAME + xmlSecKeyDataBinaryValueSetBuffer @ 135 NONAME + xmlSecKeyDataBinaryValueXmlRead @ 136 NONAME + xmlSecKeyDataBinaryValueXmlWrite @ 137 NONAME + xmlSecKeyDataCreate @ 138 NONAME + xmlSecKeyDataDebugDump @ 139 NONAME + xmlSecKeyDataDebugXmlDump @ 140 NONAME + xmlSecKeyDataDestroy @ 141 NONAME + xmlSecKeyDataDuplicate @ 142 NONAME + xmlSecKeyDataEncryptedKeyGetKlass @ 143 NONAME + xmlSecKeyDataGenerate @ 144 NONAME + xmlSecKeyDataGetIdentifier @ 145 NONAME + xmlSecKeyDataGetSize @ 146 NONAME + xmlSecKeyDataGetType @ 147 NONAME + xmlSecKeyDataIdListDebugDump @ 148 NONAME + xmlSecKeyDataIdListDebugXmlDump @ 149 NONAME + xmlSecKeyDataIdListFind @ 150 NONAME + xmlSecKeyDataIdListFindByHref @ 151 NONAME + xmlSecKeyDataIdListFindByName @ 152 NONAME + xmlSecKeyDataIdListFindByNode @ 153 NONAME + xmlSecKeyDataIdListGetKlass @ 154 NONAME + xmlSecKeyDataIdsGet @ 155 NONAME + xmlSecKeyDataIdsInit @ 156 NONAME + xmlSecKeyDataIdsRegister @ 157 NONAME + xmlSecKeyDataIdsRegisterDefault @ 158 NONAME + xmlSecKeyDataIdsShutdown @ 159 NONAME + xmlSecKeyDataListGetKlass @ 160 NONAME + xmlSecKeyDataNameGetKlass @ 161 NONAME + xmlSecKeyDataRetrievalMethodGetKlass @ 162 NONAME + xmlSecKeyDataStoreCreate @ 163 NONAME + xmlSecKeyDataStoreDestroy @ 164 NONAME + xmlSecKeyDataStorePtrListGetKlass @ 165 NONAME + xmlSecKeyDataValueGetKlass @ 166 NONAME + xmlSecKeyDataXmlRead @ 167 NONAME + xmlSecKeyDataXmlWrite @ 168 NONAME + xmlSecKeyDebugDump @ 169 NONAME + xmlSecKeyDebugXmlDump @ 170 NONAME + xmlSecKeyDestroy @ 171 NONAME + xmlSecKeyDuplicate @ 172 NONAME + xmlSecKeyEmpty @ 173 NONAME + xmlSecKeyEnsureData @ 174 NONAME + xmlSecKeyGenerate @ 175 NONAME + xmlSecKeyGenerateByName @ 176 NONAME + xmlSecKeyGetData @ 177 NONAME + xmlSecKeyGetName @ 178 NONAME + xmlSecKeyGetType @ 179 NONAME + xmlSecKeyGetValue @ 180 NONAME + xmlSecKeyInfoCtxCopyUserPref @ 181 NONAME + xmlSecKeyInfoCtxCreate @ 182 NONAME + xmlSecKeyInfoCtxCreateEncCtx @ 183 NONAME + xmlSecKeyInfoCtxDebugDump @ 184 NONAME + xmlSecKeyInfoCtxDebugXmlDump @ 185 NONAME + xmlSecKeyInfoCtxDestroy @ 186 NONAME + xmlSecKeyInfoCtxFinalize @ 187 NONAME + xmlSecKeyInfoCtxInitialize @ 188 NONAME + xmlSecKeyInfoCtxReset @ 189 NONAME + xmlSecKeyInfoNodeRead @ 190 NONAME + xmlSecKeyInfoNodeWrite @ 191 NONAME + xmlSecKeyMatch @ 192 NONAME + xmlSecKeyPtrListGetKlass @ 193 NONAME + xmlSecKeyReadBinaryFile @ 194 NONAME + xmlSecKeyReadBuffer @ 195 NONAME + xmlSecKeyReadMemory @ 196 NONAME + xmlSecKeyReqCopy @ 197 NONAME + xmlSecKeyReqDebugDump @ 198 NONAME + xmlSecKeyReqDebugXmlDump @ 199 NONAME + xmlSecKeyReqFinalize @ 200 NONAME + xmlSecKeyReqInitialize @ 201 NONAME + xmlSecKeyReqMatchKey @ 202 NONAME + xmlSecKeyReqMatchKeyValue @ 203 NONAME + xmlSecKeyReqReset @ 204 NONAME + xmlSecKeySetName @ 205 NONAME + xmlSecKeySetValue @ 206 NONAME + xmlSecKeyStoreCreate @ 207 NONAME + xmlSecKeyStoreDestroy @ 208 NONAME + xmlSecKeyStoreFindKey @ 209 NONAME + xmlSecKeyUseWithCopy @ 210 NONAME + xmlSecKeyUseWithCreate @ 211 NONAME + xmlSecKeyUseWithDebugDump @ 212 NONAME + xmlSecKeyUseWithDebugXmlDump @ 213 NONAME + xmlSecKeyUseWithDestroy @ 214 NONAME + xmlSecKeyUseWithDuplicate @ 215 NONAME + xmlSecKeyUseWithFinalize @ 216 NONAME + xmlSecKeyUseWithInitialize @ 217 NONAME + xmlSecKeyUseWithPtrListGetKlass @ 218 NONAME + xmlSecKeyUseWithReset @ 219 NONAME + xmlSecKeyUseWithSet @ 220 NONAME + xmlSecKeysMngrAdoptDataStore @ 221 NONAME + xmlSecKeysMngrAdoptKeysStore @ 222 NONAME + xmlSecKeysMngrCreate @ 223 NONAME + xmlSecKeysMngrDestroy @ 224 NONAME + xmlSecKeysMngrFindKey @ 225 NONAME + xmlSecKeysMngrGetDataStore @ 226 NONAME + xmlSecKeysMngrGetKey @ 227 NONAME + xmlSecKeysMngrGetKeysStore @ 228 NONAME + xmlSecNodeSetAdd @ 229 NONAME + xmlSecNodeSetAddList @ 230 NONAME + xmlSecNodeSetContains @ 231 NONAME + xmlSecNodeSetCreate @ 232 NONAME + xmlSecNodeSetDebugDump @ 233 NONAME + xmlSecNodeSetDestroy @ 234 NONAME + xmlSecNodeSetDocDestroy @ 235 NONAME + xmlSecNodeSetDumpTextNodes @ 236 NONAME + xmlSecNodeSetGetChildren @ 237 NONAME + xmlSecNodeSetWalk @ 238 NONAME + xmlSecParseFile @ 239 NONAME + xmlSecParseMemory @ 240 NONAME + xmlSecParseMemoryExt @ 241 NONAME + xmlSecPtrListAdd @ 242 NONAME + xmlSecPtrListCopy @ 243 NONAME + xmlSecPtrListCreate @ 244 NONAME + xmlSecPtrListDebugDump @ 245 NONAME + xmlSecPtrListDebugXmlDump @ 246 NONAME + xmlSecPtrListDestroy @ 247 NONAME + xmlSecPtrListDuplicate @ 248 NONAME + xmlSecPtrListEmpty @ 249 NONAME + xmlSecPtrListFinalize @ 250 NONAME + xmlSecPtrListGetItem @ 251 NONAME + xmlSecPtrListGetSize @ 252 NONAME + xmlSecPtrListInitialize @ 253 NONAME + xmlSecPtrListRemove @ 254 NONAME + xmlSecPtrListSet @ 255 NONAME + xmlSecPtrListSetDefaultAllocMode @ 256 NONAME + xmlSecQName2BitMaskDebugDump @ 257 NONAME + xmlSecQName2BitMaskDebugXmlDump @ 258 NONAME + xmlSecQName2BitMaskGetBitMask @ 259 NONAME + xmlSecQName2BitMaskGetBitMaskFromString @ 260 NONAME + xmlSecQName2BitMaskGetInfo @ 261 NONAME + xmlSecQName2BitMaskGetStringFromBitMask @ 262 NONAME + xmlSecQName2BitMaskNodesRead @ 263 NONAME + xmlSecQName2BitMaskNodesWrite @ 264 NONAME + xmlSecQName2IntegerAttributeRead @ 265 NONAME + xmlSecQName2IntegerAttributeWrite @ 266 NONAME + xmlSecQName2IntegerDebugDump @ 267 NONAME + xmlSecQName2IntegerDebugXmlDump @ 268 NONAME + xmlSecQName2IntegerGetInfo @ 269 NONAME + xmlSecQName2IntegerGetInteger @ 270 NONAME + xmlSecQName2IntegerGetIntegerFromString @ 271 NONAME + xmlSecQName2IntegerGetStringFromInteger @ 272 NONAME + xmlSecQName2IntegerNodeRead @ 273 NONAME + xmlSecQName2IntegerNodeWrite @ 274 NONAME + xmlSecReplaceContent @ 275 NONAME + xmlSecReplaceNode @ 276 NONAME + xmlSecReplaceNodeBuffer @ 277 NONAME + xmlSecResetErrorFlag @ 278 NONAME + xmlSecSetErrorFlag @ 279 NONAME + xmlSecShutdown @ 280 NONAME + xmlSecSimpleKeysStoreAdoptKey @ 281 NONAME + xmlSecSimpleKeysStoreGetKeys @ 282 NONAME + xmlSecSimpleKeysStoreGetKlass @ 283 NONAME + xmlSecSimpleKeysStoreLoad @ 284 NONAME + xmlSecSimpleKeysStoreSave @ 285 NONAME + xmlSecSoap11AddBodyEntry @ 286 NONAME + xmlSecSoap11AddFaultEntry @ 287 NONAME + xmlSecSoap11CheckEnvelope @ 288 NONAME + xmlSecSoap11CreateEnvelope @ 289 NONAME + xmlSecSoap11EnsureHeader @ 290 NONAME + xmlSecSoap11GetBody @ 291 NONAME + xmlSecSoap11GetBodyEntriesNumber @ 292 NONAME + xmlSecSoap11GetBodyEntry @ 293 NONAME + xmlSecSoap11GetFaultEntry @ 294 NONAME + xmlSecSoap11GetHeader @ 295 NONAME + xmlSecSoap12AddBodyEntry @ 296 NONAME + xmlSecSoap12AddFaultDetailEntry @ 297 NONAME + xmlSecSoap12AddFaultEntry @ 298 NONAME + xmlSecSoap12AddFaultReasonText @ 299 NONAME + xmlSecSoap12AddFaultSubcode @ 300 NONAME + xmlSecSoap12CheckEnvelope @ 301 NONAME + xmlSecSoap12CreateEnvelope @ 302 NONAME + xmlSecSoap12EnsureHeader @ 303 NONAME + xmlSecSoap12GetBody @ 304 NONAME + xmlSecSoap12GetBodyEntriesNumber @ 305 NONAME + xmlSecSoap12GetBodyEntry @ 306 NONAME + xmlSecSoap12GetFaultEntry @ 307 NONAME + xmlSecSoap12GetHeader @ 308 NONAME + xmlSecStringListGetKlass @ 309 NONAME + xmlSecTmplCipherReferenceAddTransform @ 310 NONAME + xmlSecTmplEncDataAddEncProperty @ 311 NONAME + xmlSecTmplEncDataCreate @ 312 NONAME + xmlSecTmplEncDataEnsureCipherReference @ 313 NONAME + xmlSecTmplEncDataEnsureCipherValue @ 314 NONAME + xmlSecTmplEncDataEnsureEncProperties @ 315 NONAME + xmlSecTmplEncDataEnsureKeyInfo @ 316 NONAME + xmlSecTmplEncDataGetEncMethodNode @ 317 NONAME + xmlSecTmplKeyInfoAddEncryptedKey @ 318 NONAME + xmlSecTmplKeyInfoAddKeyName @ 319 NONAME + xmlSecTmplKeyInfoAddKeyValue @ 320 NONAME + xmlSecTmplKeyInfoAddRetrievalMethod @ 321 NONAME + xmlSecTmplKeyInfoAddX509Data @ 322 NONAME + xmlSecTmplManifestAddReference @ 323 NONAME + xmlSecTmplObjectAddManifest @ 324 NONAME + xmlSecTmplObjectAddSignProperties @ 325 NONAME + xmlSecTmplReferenceAddTransform @ 326 NONAME + xmlSecTmplReferenceListAddDataReference @ 327 NONAME + xmlSecTmplReferenceListAddKeyReference @ 328 NONAME + xmlSecTmplRetrievalMethodAddTransform @ 329 NONAME + xmlSecTmplSignatureAddObject @ 330 NONAME + xmlSecTmplSignatureAddReference @ 331 NONAME + xmlSecTmplSignatureCreate @ 332 NONAME + xmlSecTmplSignatureEnsureKeyInfo @ 333 NONAME + xmlSecTmplSignatureGetC14NMethodNode @ 334 NONAME + xmlSecTmplSignatureGetSignMethodNode @ 335 NONAME + xmlSecTmplTransformAddC14NInclNamespaces @ 336 NONAME + xmlSecTmplTransformAddHmacOutputLength @ 337 NONAME + xmlSecTmplTransformAddRsaOaepParam @ 338 NONAME + xmlSecTmplTransformAddXPath @ 339 NONAME + xmlSecTmplTransformAddXPath2 @ 340 NONAME + xmlSecTmplTransformAddXPointer @ 341 NONAME + xmlSecTmplTransformAddXsltStylesheet @ 342 NONAME + xmlSecTmplX509DataAddCRL @ 343 NONAME + xmlSecTmplX509DataAddCertificate @ 344 NONAME + xmlSecTmplX509DataAddIssuerSerial @ 345 NONAME + xmlSecTmplX509DataAddSKI @ 346 NONAME + xmlSecTmplX509DataAddSubjectName @ 347 NONAME + xmlSecTransformBase64GetKlass @ 348 NONAME + xmlSecTransformBase64SetLineSize @ 349 NONAME + xmlSecTransformConnect @ 350 NONAME + xmlSecTransformCreate @ 351 NONAME + xmlSecTransformCreateInputBuffer @ 352 NONAME + xmlSecTransformCreateOutputBuffer @ 353 NONAME + xmlSecTransformCtxAppend @ 354 NONAME + xmlSecTransformCtxBinaryExecute @ 355 NONAME + xmlSecTransformCtxCopyUserPref @ 356 NONAME + xmlSecTransformCtxCreate @ 357 NONAME + xmlSecTransformCtxCreateAndAppend @ 358 NONAME + xmlSecTransformCtxCreateAndPrepend @ 359 NONAME + xmlSecTransformCtxDebugDump @ 360 NONAME + xmlSecTransformCtxDebugXmlDump @ 361 NONAME + xmlSecTransformCtxDestroy @ 362 NONAME + xmlSecTransformCtxExecute @ 363 NONAME + xmlSecTransformCtxFinalize @ 364 NONAME + xmlSecTransformCtxInitialize @ 365 NONAME + xmlSecTransformCtxNodeRead @ 366 NONAME + xmlSecTransformCtxNodesListRead @ 367 NONAME + xmlSecTransformCtxPrepare @ 368 NONAME + xmlSecTransformCtxPrepend @ 369 NONAME + xmlSecTransformCtxReset @ 370 NONAME + xmlSecTransformCtxSetUri @ 371 NONAME + xmlSecTransformCtxUriExecute @ 372 NONAME + xmlSecTransformCtxXmlExecute @ 373 NONAME + xmlSecTransformDebugDump @ 374 NONAME + xmlSecTransformDebugXmlDump @ 375 NONAME + xmlSecTransformDefaultGetDataType @ 376 NONAME + xmlSecTransformDefaultPopBin @ 377 NONAME + xmlSecTransformDefaultPopXml @ 378 NONAME + xmlSecTransformDefaultPushBin @ 379 NONAME + xmlSecTransformDefaultPushXml @ 380 NONAME + xmlSecTransformDestroy @ 381 NONAME + xmlSecTransformEnvelopedGetKlass @ 382 NONAME + xmlSecTransformExclC14NGetKlass @ 383 NONAME + xmlSecTransformExclC14NWithCommentsGetKlass @ 384 NONAME + xmlSecTransformExecute @ 385 NONAME + xmlSecTransformGetDataType @ 386 NONAME + xmlSecTransformIdListDebugDump @ 387 NONAME + xmlSecTransformIdListDebugXmlDump @ 388 NONAME + xmlSecTransformIdListFind @ 389 NONAME + xmlSecTransformIdListFindByHref @ 390 NONAME + xmlSecTransformIdListFindByName @ 391 NONAME + xmlSecTransformIdListGetKlass @ 392 NONAME + xmlSecTransformIdsGet @ 393 NONAME + xmlSecTransformIdsInit @ 394 NONAME + xmlSecTransformIdsRegister @ 395 NONAME + xmlSecTransformIdsRegisterDefault @ 396 NONAME + xmlSecTransformIdsShutdown @ 397 NONAME + xmlSecTransformInclC14NGetKlass @ 398 NONAME + xmlSecTransformInclC14NWithCommentsGetKlass @ 399 NONAME + xmlSecTransformInputURIGetKlass @ 400 NONAME + xmlSecTransformInputURIOpen @ 401 NONAME + xmlSecTransformMemBufGetBuffer @ 402 NONAME + xmlSecTransformMemBufGetKlass @ 403 NONAME + xmlSecTransformNodeRead @ 404 NONAME + xmlSecTransformPopBin @ 405 NONAME + xmlSecTransformPopXml @ 406 NONAME + xmlSecTransformPump @ 407 NONAME + xmlSecTransformPushBin @ 408 NONAME + xmlSecTransformPushXml @ 409 NONAME + xmlSecTransformRemove @ 410 NONAME + xmlSecTransformRemoveXmlTagsC14NGetKlass @ 411 NONAME + xmlSecTransformSetKey @ 412 NONAME + xmlSecTransformSetKeyReq @ 413 NONAME + xmlSecTransformUriTypeCheck @ 414 NONAME + xmlSecTransformVerify @ 415 NONAME + xmlSecTransformVerifyNodeContent @ 416 NONAME + xmlSecTransformVisa3DHackGetKlass @ 417 NONAME + xmlSecTransformVisa3DHackSetID @ 418 NONAME + xmlSecTransformXPath2GetKlass @ 419 NONAME + xmlSecTransformXPathGetKlass @ 420 NONAME + xmlSecTransformXPointerGetKlass @ 421 NONAME + xmlSecTransformXPointerSetExpr @ 422 NONAME + xmlSecTransformXmlParserGetKlass @ 423 NONAME + xmlSecX509DataGetNodeContent @ 424 NONAME + xmlSecXkmsRespondWithDebugDump @ 425 NONAME + xmlSecXkmsRespondWithDebugXmlDump @ 426 NONAME + xmlSecXkmsRespondWithDefaultNodeRead @ 427 NONAME + xmlSecXkmsRespondWithDefaultNodeWrite @ 428 NONAME + xmlSecXkmsRespondWithIdListFind @ 429 NONAME + xmlSecXkmsRespondWithIdListFindByNodeValue @ 430 NONAME + xmlSecXkmsRespondWithIdListGetKlass @ 431 NONAME + xmlSecXkmsRespondWithIdListWrite @ 432 NONAME + xmlSecXkmsRespondWithIdsGet @ 433 NONAME + xmlSecXkmsRespondWithIdsInit @ 434 NONAME + xmlSecXkmsRespondWithIdsRegister @ 435 NONAME + xmlSecXkmsRespondWithIdsRegisterDefault @ 436 NONAME + xmlSecXkmsRespondWithIdsShutdown @ 437 NONAME + xmlSecXkmsRespondWithKeyNameGetKlass @ 438 NONAME + xmlSecXkmsRespondWithKeyValueGetKlass @ 439 NONAME + xmlSecXkmsRespondWithNodeRead @ 440 NONAME + xmlSecXkmsRespondWithNodeWrite @ 441 NONAME + xmlSecXkmsRespondWithPGPGetKlass @ 442 NONAME + xmlSecXkmsRespondWithPrivateKeyGetKlass @ 443 NONAME + xmlSecXkmsRespondWithRetrievalMethodGetKlass @ 444 NONAME + xmlSecXkmsRespondWithSPKIGetKlass @ 445 NONAME + xmlSecXkmsRespondWithX509CRLGetKlass @ 446 NONAME + xmlSecXkmsRespondWithX509CertGetKlass @ 447 NONAME + xmlSecXkmsRespondWithX509ChainGetKlass @ 448 NONAME + xmlSecXkmsServerCtxCopyUserPref @ 449 NONAME + xmlSecXkmsServerCtxCreate @ 450 NONAME + xmlSecXkmsServerCtxDebugDump @ 451 NONAME + xmlSecXkmsServerCtxDebugXmlDump @ 452 NONAME + xmlSecXkmsServerCtxDestroy @ 453 NONAME + xmlSecXkmsServerCtxFatalErrorResponseCreate @ 454 NONAME + xmlSecXkmsServerCtxFinalize @ 455 NONAME + xmlSecXkmsServerCtxInitialize @ 456 NONAME + xmlSecXkmsServerCtxProcess @ 457 NONAME + xmlSecXkmsServerCtxPtrListGetKlass @ 458 NONAME + xmlSecXkmsServerCtxRequestRead @ 459 NONAME + xmlSecXkmsServerCtxRequestUnwrap @ 460 NONAME + xmlSecXkmsServerCtxReset @ 461 NONAME + xmlSecXkmsServerCtxResponseWrap @ 462 NONAME + xmlSecXkmsServerCtxResponseWrite @ 463 NONAME + xmlSecXkmsServerCtxSetResult @ 464 NONAME + xmlSecXkmsServerFormatFromString @ 465 NONAME + xmlSecXkmsServerFormatToString @ 466 NONAME + xmlSecXkmsServerRequestCompoundGetKlass @ 467 NONAME + xmlSecXkmsServerRequestDebugDump @ 468 NONAME + xmlSecXkmsServerRequestDebugXmlDump @ 469 NONAME + xmlSecXkmsServerRequestExecute @ 470 NONAME + xmlSecXkmsServerRequestIdListFind @ 471 NONAME + xmlSecXkmsServerRequestIdListFindByName @ 472 NONAME + xmlSecXkmsServerRequestIdListFindByNode @ 473 NONAME + xmlSecXkmsServerRequestIdListGetKlass @ 474 NONAME + xmlSecXkmsServerRequestIdsGet @ 475 NONAME + xmlSecXkmsServerRequestIdsInit @ 476 NONAME + xmlSecXkmsServerRequestIdsRegister @ 477 NONAME + xmlSecXkmsServerRequestIdsRegisterDefault @ 478 NONAME + xmlSecXkmsServerRequestIdsShutdown @ 479 NONAME + xmlSecXkmsServerRequestLocateGetKlass @ 480 NONAME + xmlSecXkmsServerRequestNodeRead @ 481 NONAME + xmlSecXkmsServerRequestNodeWrite @ 482 NONAME + xmlSecXkmsServerRequestResultGetKlass @ 483 NONAME + xmlSecXkmsServerRequestStatusGetKlass @ 484 NONAME + xmlSecXkmsServerRequestValidateGetKlass @ 485 NONAME + xmlSetNewLineFlag @ 486 NONAME + xmlSetPrefix @ 487 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for XMLSec component. +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +PRJ_EXPORTS +../inc/xmlsec_base64.h |../../inc/xmlsec_base64.h +../inc/xmlsec_buffer.h |../../inc/xmlsec_buffer.h +../inc/xmlsec_config.h |../../inc/xmlsec_config.h +../inc/xmlsec_crypto.h |../../inc/xmlsec_crypto.h +../inc/xmlsec_dl.h |../../inc/xmlsec_dl.h +../inc/xmlsec_error_flag.h |../../inc/xmlsec_error_flag.h +../inc/xmlsec_errors.h |../../inc/xmlsec_errors.h +../inc/xmlsec_exports.h |../../inc/xmlsec_exports.h +../inc/xmlsec_keyinfo.h |../../inc/xmlsec_keyinfo.h +../inc/xmlsec_keys.h |../../inc/xmlsec_keys.h +../inc/xmlsec_keysdata.h |../../inc/xmlsec_keysdata.h +../inc/xmlsec_keysmngr.h |../../inc/xmlsec_keysmngr.h +../inc/xmlsec_list.h |../../inc/xmlsec_list.h +../inc/xmlsec_nodeset.h |../../inc/xmlsec_nodeset.h +../inc/xmlsec_private.h |../../inc/xmlsec_private.h +../inc/xmlsec_strings.h |../../inc/xmlsec_strings.h +../inc/xmlsec_templates.h |../../inc/xmlsec_templates.h +../inc/xmlsec_transforms.h |../../inc/xmlsec_transforms.h +../inc/xmlsec_version.h |../../inc/xmlsec_version.h +../inc/xmlsec_x509.h |../../inc/xmlsec_x509.h +../inc/xmlsec_xmldsig.h |../../inc/xmlsec_xmldsig.h +../inc/xmlsec_xmlenc.h |../../inc/xmlsec_xmlenc.h +../inc/xmlsec_xmlsec.h |../../inc/xmlsec_xmlsec.h +../inc/xmlsec_xmltree.h |../../inc/xmlsec_xmltree.h +../rom/xmlsec.iby CORE_OS_LAYER_IBY_EXPORT_PATH(xmlsec.iby) + +PRJ_MMPFILES +xmlsec.mmp diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/group/xmlsec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/group/xmlsec.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for XMLSec component. +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +TARGET xmlsec.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9790 + +SOURCEPATH ../src + +SOURCE xmlsec_app.c +SOURCE xmlsec_base64.c +SOURCE xmlsec_bn.c +SOURCE xmlsec_buffer.c +SOURCE xmlsec_c14n.c +SOURCE xmlsec_dl.c +SOURCE xmlsec_enveloped.c +SOURCE xmlsec_errors.c +SOURCE xmlsec_io.c +SOURCE xmlsec_keyinfo.c +SOURCE xmlsec_keys.c +SOURCE xmlsec_keysdata.c +SOURCE xmlsec_keysmngr.c +SOURCE xmlsec_list.c +SOURCE xmlsec_membuf.c +SOURCE xmlsec_nodeset.c +SOURCE xmlsec_error_flag.c +SOURCE xmlsec_parser.c +SOURCE xmlsec_soap.c +SOURCE xmlsec_strings.c +SOURCE xmlsec_templates.c +SOURCE xmlsec_transforms.c +SOURCE xmlsec_x509.c +SOURCE xmlsec_xkms.c +SOURCE xmlsec_xmldsig.c +SOURCE xmlsec_xmlenc.c +SOURCE xmlsec_xmlsec.c +SOURCE xmlsec_xmltree.c +SOURCE xmlsec_xpath.c +SOURCE xmlsec_xslt.c + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc + +SYSTEMINCLUDE /epoc32/include/libc + +USERINCLUDE ../inc + +LIBRARY estlib.lib +#if !defined(__RD_XMLSEC_SRCINC_CHANGE_REVERSE__) +LIBRARY xmlengine.lib +#else +LIBRARY wsstarxmlengine.lib +#endif + +nostrictdef +epocallowdlldata + +#if defined(ARMCC) +#if !defined(__RD_XMLSEC_MEMCOPY_PROBLEM_FIX__) + DEFFILE ../eabi/xmlsec.def +#else + DEFFILE ../eabi/wsstarxmlsec.def +#endif +#elif defined(WINSCW) || defined(WINS) + DEFFILE ../bwinscw/xmlsec.def +#endif + +#ifdef CAP_GENERAL_DLL + CAPABILITY CAP_GENERAL_DLL +#else + CAPABILITY ALL -TCB +#endif + + VENDORID VID_DEFAULT + +SMPSAFE diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/Copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/Copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,59 @@ +xmlsec, xmlsec-openssl, xmlsec-gnutls libraries +------------------------------------------------------------------------------ + +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + + +xmlsec-nss library +------------------------------------------------------------------------------ +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. +Copyright (c) 2003 America Online, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Portions of the Software were created using source code and/or APIs +governed by the Mozilla Public License (MPL). The MPL is available +at http://www.mozilla.org/MPL/MPL-1.1.html. The MPL permits such +portions to be distributed with code not governed by MPL, as long +as the requirements of MPL are fulfilled for such portions. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_app.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,413 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_APP_H__ +#define __XMLSEC_APP_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + +#if !defined(IN_XMLSEC) && !defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) +#error To use dynamic crypto engines loading define XMLSEC_CRYPTO_DYNAMIC_LOADING +#endif /* !defined(IN_XMLSEC) && !defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_dl.h" + +/********************************************************************** + * + * Crypto Init/shutdown + * + *********************************************************************/ +XMLSEC_EXPORT int xmlSecCryptoInit (void); +XMLSEC_EXPORT int xmlSecCryptoShutdown (void); +XMLSEC_EXPORT int xmlSecCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr); + +/********************************************************************* + * + * Key data ids + * + ********************************************************************/ +/** + * xmlSecKeyDataAesId: + * + * The AES key klass. + */ +#define xmlSecKeyDataAesId xmlSecKeyDataAesGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataAesGetKlass (void); +/** + * xmlSecKeyDataDesId: + * + * The DES key klass. + */ +#define xmlSecKeyDataDesId xmlSecKeyDataDesGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDesGetKlass (void); +/** + * xmlSecKeyDataDsaId: + * + * The DSA key klass. + */ +#define xmlSecKeyDataDsaId xmlSecKeyDataDsaGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDsaGetKlass (void); +/** + * xmlSecKeyDataHmacId: + * + * The DHMAC key klass. + */ +#define xmlSecKeyDataHmacId xmlSecKeyDataHmacGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataHmacGetKlass (void); +/** + * xmlSecKeyDataRsaId: + * + * The RSA key klass. + */ +#define xmlSecKeyDataRsaId xmlSecKeyDataRsaGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRsaGetKlass (void); +/** + * xmlSecKeyDataX509Id: + * + * The X509 data klass. + */ +#define xmlSecKeyDataX509Id xmlSecKeyDataX509GetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataX509GetKlass (void); +/** + * xmlSecKeyDataRawX509CertId: + * + * The raw X509 certificate klass. + */ +#define xmlSecKeyDataRawX509CertId xmlSecKeyDataRawX509CertGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRawX509CertGetKlass(void); + +/********************************************************************* + * + * Key data store ids + * + ********************************************************************/ +/** + * xmlSecX509StoreId: + * + * The X509 store klass. + */ +#define xmlSecX509StoreId xmlSecX509StoreGetKlass() +XMLSEC_EXPORT xmlSecKeyDataStoreId xmlSecX509StoreGetKlass (void); + +/********************************************************************* + * + * Crypto transforms ids + * + ********************************************************************/ +/** + * xmlSecTransformAes128CbcId: + * + * The AES128 CBC cipher transform klass. + */ +#define xmlSecTransformAes128CbcId xmlSecTransformAes128CbcGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes128CbcGetKlass(void); +/** + * xmlSecTransformAes192CbcId: + * + * The AES192 CBC cipher transform klass. + */ +#define xmlSecTransformAes192CbcId xmlSecTransformAes192CbcGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes192CbcGetKlass(void); +/** + * xmlSecTransformAes256CbcId: + * + * The AES256 CBC cipher transform klass. + */ +#define xmlSecTransformAes256CbcId xmlSecTransformAes256CbcGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes256CbcGetKlass(void); +/** + * xmlSecTransformKWAes128Id: + * + * The AES 128 key wrap transform klass. + */ +#define xmlSecTransformKWAes128Id xmlSecTransformKWAes128GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes128GetKlass (void); +/** + * xmlSecTransformKWAes192Id: + * + * The AES 192 key wrap transform klass. + */ +#define xmlSecTransformKWAes192Id xmlSecTransformKWAes192GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes192GetKlass (void); +/** + * xmlSecTransformKWAes256Id: + * + * The AES 256 key wrap transform klass. + */ +#define xmlSecTransformKWAes256Id xmlSecTransformKWAes256GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes256GetKlass (void); +/** + * xmlSecTransformDes3CbcId: + * + * The Triple DES encryption transform klass. + */ +#define xmlSecTransformDes3CbcId xmlSecTransformDes3CbcGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDes3CbcGetKlass (void); +/** + * xmlSecTransformKWDes3Id: + * + * The DES3 CBC cipher transform klass. + */ +#define xmlSecTransformKWDes3Id xmlSecTransformKWDes3GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWDes3GetKlass (void); +/** + * xmlSecTransformDsaSha1Id: + * + * The DSA-SHA1 signature transform klass. + */ +#define xmlSecTransformDsaSha1Id xmlSecTransformDsaSha1GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDsaSha1GetKlass (void); + +/** + * xmlSecTransformHmacMd5Id: + * + * The HMAC with MD5 signature transform klass. + */ +#define xmlSecTransformHmacMd5Id xmlSecTransformHmacMd5GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacMd5GetKlass (void); +/** + * xmlSecTransformHmacRipemd160Id: + * + * The HMAC with RipeMD160 signature transform klass. + */ +#define xmlSecTransformHmacRipemd160Id xmlSecTransformHmacRipemd160GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacRipemd160GetKlass(void); +/** + * xmlSecTransformHmacSha1Id: + * + * The HMAC with SHA1 signature transform klass. + */ +#define xmlSecTransformHmacSha1Id xmlSecTransformHmacSha1GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha1GetKlass (void); +/** + * xmlSecTransformHmacSha224Id: + * + * The HMAC with SHA224 signature transform klass. + */ +#define xmlSecTransformHmacSha224Id xmlSecTransformHmacSha224GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha224GetKlass (void); +/** + * xmlSecTransformHmacSha256Id: + * + * The HMAC with SHA256 signature transform klass. + */ +#define xmlSecTransformHmacSha256Id xmlSecTransformHmacSha256GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha256GetKlass (void); +/** + * xmlSecTransformHmacSha384Id: + * + * The HMAC with SHA384 signature transform klass. + */ +#define xmlSecTransformHmacSha384Id xmlSecTransformHmacSha384GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha384GetKlass (void); +/** + * xmlSecTransformHmacSha512Id: + * + * The HMAC with SHA512 signature transform klass. + */ +#define xmlSecTransformHmacSha512Id xmlSecTransformHmacSha512GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha512GetKlass (void); +/** + * xmlSecTransformMd5Id: + * + * The MD5 digest transform klass. + */ +#define xmlSecTransformMd5Id xmlSecTransformMd5GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMd5GetKlass(void); +/** + * xmlSecTransformRipemd160Id: + * + * The RIPEMD160 digest transform klass. + */ +#define xmlSecTransformRipemd160Id xmlSecTransformRipemd160GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRipemd160GetKlass(void); +/** + * xmlSecTransformRsaMd5Id: + * + * The RSA-MD5 signature transform klass. + */ +#define xmlSecTransformRsaMd5Id xmlSecTransformRsaMd5GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaMd5GetKlass (void); +/** + * xmlSecTransformRsaRipemd160Id: + * + * The RSA-RIPEMD160 signature transform klass. + */ +#define xmlSecTransformRsaRipemd160Id xmlSecTransformRsaRipemd160GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaRipemd160GetKlass (void); +/** + * xmlSecTransformRsaSha1Id: + * + * The RSA-SHA1 signature transform klass. + */ +#define xmlSecTransformRsaSha1Id xmlSecTransformRsaSha1GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha1GetKlass (void); +/** + * xmlSecTransformRsaSha224Id: + * + * The RSA-SHA224 signature transform klass. + */ +#define xmlSecTransformRsaSha224Id xmlSecTransformRsaSha224GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha224GetKlass (void); +/** + * xmlSecTransformRsaSha256Id: + * + * The RSA-SHA256 signature transform klass. + */ +#define xmlSecTransformRsaSha256Id xmlSecTransformRsaSha256GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha256GetKlass (void); +/** + * xmlSecTransformRsaSha384Id: + * + * The RSA-SHA384 signature transform klass. + */ +#define xmlSecTransformRsaSha384Id xmlSecTransformRsaSha384GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha384GetKlass (void); +/** + * xmlSecTransformRsaSha512Id: + * + * The RSA-SHA512 signature transform klass. + */ +#define xmlSecTransformRsaSha512Id xmlSecTransformRsaSha512GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha512GetKlass (void); + +/** + * xmlSecTransformRsaPkcs1Id: + * + * The RSA PKCS1 key transport transform klass. + */ +#define xmlSecTransformRsaPkcs1Id xmlSecTransformRsaPkcs1GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaPkcs1GetKlass (void); +/** + * xmlSecTransformRsaOaepId: + * + * The RSA PKCS1 key transport transform klass. + */ +#define xmlSecTransformRsaOaepId xmlSecTransformRsaOaepGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaOaepGetKlass (void); +/** + * xmlSecTransformSha1Id: + * + * The SHA1 digest transform klass. + */ +#define xmlSecTransformSha1Id xmlSecTransformSha1GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha1GetKlass (void); +/** + * xmlSecTransformSha224Id: + * + * The SHA224 digest transform klass. + */ +#define xmlSecTransformSha224Id xmlSecTransformSha224GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha224GetKlass (void); +/** + * xmlSecTransformSha256Id: + * + * The SHA256 digest transform klass. + */ +#define xmlSecTransformSha256Id xmlSecTransformSha256GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha256GetKlass (void); +/** + * xmlSecTransformSha384Id: + * + * The SHA384 digest transform klass. + */ +#define xmlSecTransformSha384Id xmlSecTransformSha384GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha384GetKlass (void); +/** + * xmlSecTransformSha512Id: + * + * The SHA512 digest transform klass. + */ +#define xmlSecTransformSha512Id xmlSecTransformSha512GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha512GetKlass (void); + +/********************************************************************* + * + * High level routines form xmlsec command line utility + * + ********************************************************************/ +XMLSEC_EXPORT int xmlSecCryptoAppInit (const char* config); +XMLSEC_EXPORT int xmlSecCryptoAppShutdown (void); +XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr); +XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr, + xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr, + const char* uri); +XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr, + const char* filename, + xmlSecKeyDataType type); +XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr, + const char *filename, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +/* Venus: xmlSecCryptoAppKeyLoad replaced by xmlSecCryptoAppKeyloadWithName */ +/* +XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoad (const char *filename, + xmlSecKeyDataFormat format, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +*/ +/* Venus: xmlSecCryptoAppKeyLoadWithName is a new API added for Symbian */ +XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoadWithName (const char *filename, + xmlSecKeyDataFormat format, + const char* keyname, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoadMemory (const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12Load (const char* filename, + const char* pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12LoadMemory (const xmlSecByte* data, + xmlSecSize dataSize, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoad (xmlSecKeyPtr key, + const char* filename, + xmlSecKeyDataFormat format); +XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format); +XMLSEC_EXPORT void* xmlSecCryptoAppGetDefaultPwdCallback(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + +#endif /* __XMLSEC_APP_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_base64.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_base64.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Base64 encode/decode transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_BASE64_H__ +#define __XMLSEC_BASE64_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_transforms.h" + +/** + * XMLSEC_BASE64_LINESIZE: + * + * The default maximum base64 encoded line size. + */ +#define XMLSEC_BASE64_LINESIZE 64 + +/** + * Base64 Context + */ +typedef struct _xmlSecBase64Ctx xmlSecBase64Ctx, + *xmlSecBase64CtxPtr; + +XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate (int encode, + int columns); +XMLSEC_EXPORT void xmlSecBase64CtxDestroy (xmlSecBase64CtxPtr ctx); +XMLSEC_EXPORT int xmlSecBase64CtxInitialize (xmlSecBase64CtxPtr ctx, + int encode, + int columns); +XMLSEC_EXPORT void xmlSecBase64CtxFinalize (xmlSecBase64CtxPtr ctx); +XMLSEC_EXPORT int xmlSecBase64CtxUpdate (xmlSecBase64CtxPtr ctx, + const xmlSecByte *in, + xmlSecSize inSize, + xmlSecByte *out, + xmlSecSize outSize); +XMLSEC_EXPORT int xmlSecBase64CtxFinal (xmlSecBase64CtxPtr ctx, + xmlSecByte *out, + xmlSecSize outSize); + +/** + * Standalone routine to do base64 encode/decode "at once" + */ +XMLSEC_EXPORT xmlChar* xmlSecBase64Encode (const xmlSecByte *buf, + xmlSecSize len, + int columns); +XMLSEC_EXPORT int xmlSecBase64Decode (const xmlChar* str, + xmlSecByte *buf, + xmlSecSize len); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_BASE64_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_bn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_bn.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,101 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Simple Big Numbers processing. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_BN_H__ +#define __XMLSEC_BN_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" + +typedef xmlSecBuffer xmlSecBn, + *xmlSecBnPtr; + +/** + * xmlSecBnFormat: + * @xmlSecBnBase64: the base64 decoded binary blob. + * @xmlSecBnHex: the hex number. + * @xmlSecBnDec: the decimal number. + * + * The big numbers formats. + */ +typedef enum { + xmlSecBnBase64, + xmlSecBnHex, + xmlSecBnDec +} xmlSecBnFormat; + +XMLSEC_EXPORT xmlSecBnPtr xmlSecBnCreate (xmlSecSize size); +XMLSEC_EXPORT void xmlSecBnDestroy (xmlSecBnPtr bn); +XMLSEC_EXPORT int xmlSecBnInitialize (xmlSecBnPtr bn, + xmlSecSize size); +XMLSEC_EXPORT void xmlSecBnFinalize (xmlSecBnPtr bn); +XMLSEC_EXPORT xmlSecByte* xmlSecBnGetData (xmlSecBnPtr bn); +XMLSEC_EXPORT int xmlSecBnSetData (xmlSecBnPtr bn, + const xmlSecByte* data, + xmlSecSize size); +XMLSEC_EXPORT xmlSecSize xmlSecBnGetSize (xmlSecBnPtr bn); +XMLSEC_EXPORT void xmlSecBnZero (xmlSecBnPtr bn); + +XMLSEC_EXPORT int xmlSecBnFromString (xmlSecBnPtr bn, + const xmlChar* str, + xmlSecSize base); +XMLSEC_EXPORT xmlChar* xmlSecBnToString (xmlSecBnPtr bn, + xmlSecSize base); +XMLSEC_EXPORT int xmlSecBnFromHexString (xmlSecBnPtr bn, + const xmlChar* str); +XMLSEC_EXPORT xmlChar* xmlSecBnToHexString (xmlSecBnPtr bn); + +XMLSEC_EXPORT int xmlSecBnFromDecString (xmlSecBnPtr bn, + const xmlChar* str); +XMLSEC_EXPORT xmlChar* xmlSecBnToDecString (xmlSecBnPtr bn); + +XMLSEC_EXPORT int xmlSecBnMul (xmlSecBnPtr bn, + int multiplier); +XMLSEC_EXPORT int xmlSecBnDiv (xmlSecBnPtr bn, + int divider, + int* mod); +XMLSEC_EXPORT int xmlSecBnAdd (xmlSecBnPtr bn, + int delta); +XMLSEC_EXPORT int xmlSecBnReverse (xmlSecBnPtr bn); +XMLSEC_EXPORT int xmlSecBnCompare (xmlSecBnPtr bn, + const xmlSecByte* data, + xmlSecSize dataSize); +XMLSEC_EXPORT int xmlSecBnCompareReverse (xmlSecBnPtr bn, + const xmlSecByte* data, + xmlSecSize dataSize); +XMLSEC_EXPORT int xmlSecBnGetNodeValue (xmlSecBnPtr bn, + xmlNodePtr cur, + xmlSecBnFormat format, + int reverse); +XMLSEC_EXPORT int xmlSecBnSetNodeValue (xmlSecBnPtr bn, + xmlNodePtr cur, + xmlSecBnFormat format, + int reverse, + int addLineBreaks); +XMLSEC_EXPORT int xmlSecBnBlobSetNodeValue (const xmlSecByte* data, + xmlSecSize dataSize, + xmlNodePtr cur, + xmlSecBnFormat format, + int reverse, + int addLineBreaks); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_BN_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_buffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_buffer.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,110 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Memory buffer. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_BUFFER_H__ +#define __XMLSEC_BUFFER_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" + +typedef struct _xmlSecBuffer xmlSecBuffer, + *xmlSecBufferPtr; + + +/** + * xmlSecAllocMode: + * @xmlSecAllocModeExact: the memory allocation mode that minimizes total + * allocated memory size. + * @xmlSecAllocModeDouble: the memory allocation mode that tries to minimize + * the number of malloc calls. + * + * The memory allocation mode (used by @xmlSecBuffer and @xmlSecList). + */ +typedef enum { + xmlSecAllocModeExact = 0, + xmlSecAllocModeDouble +} xmlSecAllocMode; + +/***************************************************************************** + * + * xmlSecBuffer + * + ****************************************************************************/ + +/** + * xmlSecBuffer: + * @data: the pointer to buffer data. + * @size: the current data size. + * @maxSize: the max data size (allocated buffer size). + * @allocMode: the buffer memory allocation mode. + * + * Binary data buffer. + */ +struct _xmlSecBuffer { + xmlSecByte* data; + xmlSecSize size; + xmlSecSize maxSize; + xmlSecAllocMode allocMode; +}; + +XMLSEC_EXPORT void xmlSecBufferSetDefaultAllocMode (xmlSecAllocMode defAllocMode, + xmlSecSize defInitialSize); + +XMLSEC_EXPORT xmlSecBufferPtr xmlSecBufferCreate (xmlSecSize size); +XMLSEC_EXPORT void xmlSecBufferDestroy (xmlSecBufferPtr buf); +XMLSEC_EXPORT int xmlSecBufferInitialize (xmlSecBufferPtr buf, + xmlSecSize size); +XMLSEC_EXPORT void xmlSecBufferFinalize (xmlSecBufferPtr buf); +XMLSEC_EXPORT xmlSecByte* xmlSecBufferGetData (xmlSecBufferPtr buf); +XMLSEC_EXPORT int xmlSecBufferSetData (xmlSecBufferPtr buf, + const xmlSecByte* data, + xmlSecSize size); +XMLSEC_EXPORT xmlSecSize xmlSecBufferGetSize (xmlSecBufferPtr buf); +XMLSEC_EXPORT int xmlSecBufferSetSize (xmlSecBufferPtr buf, + xmlSecSize size); +XMLSEC_EXPORT xmlSecSize xmlSecBufferGetMaxSize (xmlSecBufferPtr buf); +XMLSEC_EXPORT int xmlSecBufferSetMaxSize (xmlSecBufferPtr buf, + xmlSecSize size); +XMLSEC_EXPORT void xmlSecBufferEmpty (xmlSecBufferPtr buf); +XMLSEC_EXPORT int xmlSecBufferAppend (xmlSecBufferPtr buf, + const xmlSecByte* data, + xmlSecSize size); +XMLSEC_EXPORT int xmlSecBufferPrepend (xmlSecBufferPtr buf, + const xmlSecByte* data, + xmlSecSize size); +XMLSEC_EXPORT int xmlSecBufferRemoveHead (xmlSecBufferPtr buf, + xmlSecSize size); +XMLSEC_EXPORT int xmlSecBufferRemoveTail (xmlSecBufferPtr buf, + xmlSecSize size); + +XMLSEC_EXPORT int xmlSecBufferReadFile (xmlSecBufferPtr buf, + const char* filename); + +XMLSEC_EXPORT int xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, + xmlNodePtr node, + int columns); + +XMLSEC_EXPORT xmlOutputBufferPtr xmlSecBufferCreateOutputBuffer (xmlSecBufferPtr buf); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_BUFFER_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_config.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Configuration file for XMLSec component +* +*/ + +#ifndef __XMLSEC_CONFIG_H__ +#define __XMLSEC_CONFIG_H__ + +#define HAVE_STDLIB_H +#define HAVE_CTYPE_H +#define HAVE_MALLOC_H +#define HAVE_STDIO_H +#define HAVE_STRING_H +#define HAVE_MEMORY_H +#define XMLSEC_NO_CRYPTO_DYNAMIC_LOADING +#define XMLSEC_CRYPTO_SYMBIANCRYPTO +#define XMLSEC_NO_XSLT +#define HAVE_SNPRINTF +#define HAVE_VSNPRINTF + +#endif /* __XMLSEC_CONFIG_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_crypto.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_crypto.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,77 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Crypto engine selection. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_CRYPTO_H__ +#define __XMLSEC_CRYPTO_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" + +/* include nothing if we compile xmlsec library itself */ +#ifndef IN_XMLSEC +#ifndef IN_XMLSEC_CRYPTO + +#if defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) +#error Dynamic loading for xmlsec-crypto libraries is disabled during library compilation +#endif /* defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */ + +#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING +#include "xmlsec_app.h" +#else /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ +#ifdef XMLSEC_CRYPTO_OPENSSL +#include +#include +#include +#include +#else /* XMLSEC_CRYPTO_OPENSSL */ +#ifdef XMLSEC_CRYPTO_GNUTLS +#include +#include +#include +#else /* XMLSEC_CRYPTO_GNUTLS */ +#ifdef XMLSEC_CRYPTO_MSCRYPTO +#include +#include +#include +#include +#else /* XMLSEC_CRYPTO_MSCRYPTO */ +#ifdef XMLSEC_CRYPTO_NSS +#include +#include +#include +#include +#else /* XMLSEC_CRYPTO_NSS */ +#ifdef XMLSEC_CRYPTO_SYMBIANCRYPTO +#include "xmlsecc_app.h" +#include "xmlsecc_crypto.h" +#include "xmlsecc_symbols.h" +#else /* XMLSEC_CRYPTO_SYMBIANCRYPTO */ +#error No crypto library defined +#endif /* XMLSEC_CRYPTO_GNUTLS */ +#endif /* XMLSEC_CRYPTO_MSCRYPTO */ +#endif /* XMLSEC_CRYPTO_NSS */ +#endif /* XMLSEC_CRYPTO_SYMBIANCRYPTO */ +#endif /* XMLSEC_CRYPTO_OPENSSL */ +#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ + +#endif /* IN_XMLSEC_CRYPTO */ +#endif /* IN_XMLSEC */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_CRYPTO_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_dl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_dl.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,57 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_DL_H__ +#define __XMLSEC_DL_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +typedef struct _xmlSecCryptoDLFunctions xmlSecCryptoDLFunctions, + *xmlSecCryptoDLFunctionsPtr; + +XMLSEC_EXPORT int xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms + (xmlSecCryptoDLFunctionsPtr functions); + +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" + +/** + * Dynamic load functions + */ +XMLSEC_EXPORT int xmlSecCryptoDLInit (void); +XMLSEC_EXPORT int xmlSecCryptoDLShutdown (void); + +XMLSEC_EXPORT int xmlSecCryptoDLLoadLibrary (const xmlChar* crypto); +XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto); +XMLSEC_EXPORT int xmlSecCryptoDLUnloadLibrary (const xmlChar* crypto); + +XMLSEC_EXPORT int xmlSecCryptoDLSetFunctions (xmlSecCryptoDLFunctionsPtr functions); +XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetFunctions (void); + +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_APP_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_error_flag.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_error_flag.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Functions handling OOM situations. +* +*/ + + +#ifndef _XMLSEC_ERROR_FLAG_H +#define _XMLSEC_ERROR_FLAG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_exports.h" + +XMLSEC_EXPORT void xmlSecSetErrorFlag(int error); +XMLSEC_EXPORT void xmlSecResetErrorFlag(); +XMLSEC_EXPORT int xmlSecCheckErrorFlag(); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // _XMLSEC_ERROR_FLAG_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_errors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_errors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,507 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Error codes and error reporting functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_ERRORS_H__ +#define __XMLSEC_ERRORS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +/*************************************************************** + * + * Error codes + * + **************************************************************/ +/** + * XMLSEC_ERRORS_R_XMLSEC_FAILED: + * + * An XMLSec function failed (error subject is the failed function). + */ +#define XMLSEC_ERRORS_R_XMLSEC_FAILED 1 + +/** + * XMLSEC_ERRORS_R_MALLOC_FAILED: + * + * Failed to allocate memory error. + */ +#define XMLSEC_ERRORS_R_MALLOC_FAILED 2 + +/** + * XMLSEC_ERRORS_R_STRDUP_FAILED: + * + * Failed to duplicate string error. + */ +#define XMLSEC_ERRORS_R_STRDUP_FAILED 3 + +/** + * XMLSEC_ERRORS_R_CRYPTO_FAILED: + * + * Crypto (OpenSSL) function failed (error subject is the failed function). + */ +#define XMLSEC_ERRORS_R_CRYPTO_FAILED 4 + +/** + * XMLSEC_ERRORS_R_XML_FAILED: + * + * LibXML function failed (error subject is the failed function). + */ +#define XMLSEC_ERRORS_R_XML_FAILED 5 + +/** + * XMLSEC_ERRORS_R_XSLT_FAILED: + * + * LibXSLT function failed (error subject is the failed function). + */ +#define XMLSEC_ERRORS_R_XSLT_FAILED 6 + +/** + * XMLSEC_ERRORS_R_IO_FAILED: + * + * IO operation failed. + */ +#define XMLSEC_ERRORS_R_IO_FAILED 7 + +/** + * XMLSEC_ERRORS_R_DISABLED: + * + * The feature is disabled during compilation. + * Check './configure --help' for details on how to + * enable it. + */ +#define XMLSEC_ERRORS_R_DISABLED 8 + +/** + * XMLSEC_ERRORS_R_NOT_IMPLEMENTED: + * + * Feature is not implemented. + */ +#define XMLSEC_ERRORS_R_NOT_IMPLEMENTED 9 + +/** + * XMLSEC_ERRORS_R_INVALID_SIZE: + * + * Invalid size. + */ +#define XMLSEC_ERRORS_R_INVALID_SIZE 11 + +/** + * XMLSEC_ERRORS_R_INVALID_DATA: + * + * Invalid data. + */ +#define XMLSEC_ERRORS_R_INVALID_DATA 12 + +/** + * XMLSEC_ERRORS_R_INVALID_RESULT: + * + * Invalid result. + */ +#define XMLSEC_ERRORS_R_INVALID_RESULT 13 + +/** + * XMLSEC_ERRORS_R_INVALID_TYPE: + * + * Invalid type. + */ +#define XMLSEC_ERRORS_R_INVALID_TYPE 14 + +/** + * XMLSEC_ERRORS_R_INVALID_OPERATION: + * + * Invalid operation. + */ +#define XMLSEC_ERRORS_R_INVALID_OPERATION 15 + +/** + * XMLSEC_ERRORS_R_INVALID_STATUS: + * + * Invalid status. + */ +#define XMLSEC_ERRORS_R_INVALID_STATUS 16 + +/** + * XMLSEC_ERRORS_R_INVALID_FORMAT: + * + * Invalid format. + */ +#define XMLSEC_ERRORS_R_INVALID_FORMAT 17 + +/** + * XMLSEC_ERRORS_R_DATA_NOT_MATCH: + * + * The data do not match our expectation. + */ +#define XMLSEC_ERRORS_R_DATA_NOT_MATCH 18 + +/** + * XMLSEC_ERRORS_R_INVALID_NODE: + * + * Invalid node (error subject is the node name). + */ +#define XMLSEC_ERRORS_R_INVALID_NODE 21 + +/** + * XMLSEC_ERRORS_R_INVALID_NODE_CONTENT: + * + * Invalid node content (error subject is the node name). + */ +#define XMLSEC_ERRORS_R_INVALID_NODE_CONTENT 22 + +/** + * XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE: + * + * Invalid node attribute (error subject is the node name). + */ +#define XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE 23 + +/** + * XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE: + * + * Missing node attribute (error subject is the node name). + */ +#define XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE 25 + +/** + * XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT: + * + * Node already present, + */ +#define XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT 26 + +/** + * XMLSEC_ERRORS_R_UNEXPECTED_NODE: + * + * Unexpected node (error subject is the node name). + */ +#define XMLSEC_ERRORS_R_UNEXPECTED_NODE 27 + +/** + * XMLSEC_ERRORS_R_NODE_NOT_FOUND: + * + * Node not found (error subject is the required node name). + */ +#define XMLSEC_ERRORS_R_NODE_NOT_FOUND 28 + +/** + * XMLSEC_ERRORS_R_INVALID_TRANSFORM: + * + * This transform is invlaid here. + */ +#define XMLSEC_ERRORS_R_INVALID_TRANSFORM 31 + +/** + * XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY: + * + * Key is invalid for this transform. + */ +#define XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY 32 + +/** + * XMLSEC_ERRORS_R_INVALID_URI_TYPE: + * + * Invalid URI type. + */ +#define XMLSEC_ERRORS_R_INVALID_URI_TYPE 33 + +/** + * XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED: + * + * The transform requires the input document to be the same as context. + */ +#define XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED 34 + +/** + * XMLSEC_ERRORS_R_TRANSFORM_DISABLED: + * + * The transform is disabled. + */ +#define XMLSEC_ERRORS_R_TRANSFORM_DISABLED 35 + +/** + * XMLSEC_ERRORS_R_INVALID_KEY_DATA: + * + * Key data is invalid. + */ +#define XMLSEC_ERRORS_R_INVALID_KEY_DATA 41 + +/** + * XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND: + * + * Data is not found (error subject is the data name). + */ +#define XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND 42 + +/** + * XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST: + * + * The key data is already exist. + */ +#define XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST 43 + +/** + * XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE: + * + * Invalid key size. + */ +#define XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE 44 + +/** + * XMLSEC_ERRORS_R_KEY_NOT_FOUND: + * + * Key not found. + */ +#define XMLSEC_ERRORS_R_KEY_NOT_FOUND 45 + +/** + * XMLSEC_ERRORS_R_KEYDATA_DISABLED: + * + * The key data type disabled. + */ +#define XMLSEC_ERRORS_R_KEYDATA_DISABLED 46 + +/** + * XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL: + * + * Max allowed retrievals level reached. + */ +#define XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL 51 + +/** + * XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH: + * + * The retrieved key data type does not match the one specified + * in the node. + */ +#define XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH 52 + +/** + * XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL: + * + * Max EncryptedKey level reached. + */ +#define XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL 61 + +/** + * XMLSEC_ERRORS_R_CERT_VERIFY_FAILED: + * + * Certificate verification failed. + */ +#define XMLSEC_ERRORS_R_CERT_VERIFY_FAILED 71 + +/** + * XMLSEC_ERRORS_R_CERT_NOT_FOUND: + * + * Requested certificate is not found. + */ +#define XMLSEC_ERRORS_R_CERT_NOT_FOUND 72 + +/** + * XMLSEC_ERRORS_R_CERT_REVOKED: + * + * The certificate is revoked. + */ +#define XMLSEC_ERRORS_R_CERT_REVOKED 73 + +/** + * XMLSEC_ERRORS_R_CERT_ISSUER_FAILED: + * + * Failed to get certificate issuer. + */ +#define XMLSEC_ERRORS_R_CERT_ISSUER_FAILED 74 + +/** + * XMLSEC_ERRORS_R_CERT_NOT_YET_VALID: + * + * "Not valid before" verification failed. + */ +#define XMLSEC_ERRORS_R_CERT_NOT_YET_VALID 75 + +/** + * XMLSEC_ERRORS_R_CERT_HAS_EXPIRED: + * + * "Not valid after" verification failed. + */ +#define XMLSEC_ERRORS_R_CERT_HAS_EXPIRED 76 + +/** + * XMLSEC_ERRORS_R_DSIG_NO_REFERENCES: + * + * The nodes not found. + */ +#define XMLSEC_ERRORS_R_DSIG_NO_REFERENCES 81 + +/** + * XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE: + * + * The validation failed. + */ +#define XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE 82 + +/** + * XMLSEC_ERRORS_R_ASSERTION: + * + * Invalid assertion. + */ +#define XMLSEC_ERRORS_R_ASSERTION 100 + +/** + * XMLSEC_ERRORS_MAX_NUMBER: + * + * The maximum xmlsec errors number. + */ +#define XMLSEC_ERRORS_MAX_NUMBER 256 + + + +/******************************************************************* + * + * Error functions + * + *******************************************************************/ +/** + * xmlSecErrorsCallback: + * @file: the error location file name (__FILE__ macro). + * @line: the error location line number (__LINE__ macro). + * @func: the error location function name (__FUNCTION__ macro). + * @errorObject: the error specific error object + * @errorSubject: the error specific error subject. + * @reason: the error code. + * @msg: the additional error message. + * + * The errors reporting callback function. + */ +typedef void (*xmlSecErrorsCallback) (const char* file, + int line, + const char* func, + const char* errorObject, + const char* errorSubject, + int reason, + const char* msg); + + +XMLSEC_EXPORT void xmlSecErrorsInit (void); +XMLSEC_EXPORT void xmlSecErrorsShutdown (void); +XMLSEC_EXPORT void xmlSecErrorsSetCallback (xmlSecErrorsCallback callback); +XMLSEC_EXPORT void xmlSecErrorsDefaultCallback (const char* file, + int line, + const char* func, + const char* errorObject, + const char* errorSubject, + int reason, + const char* msg); +XMLSEC_EXPORT void xmlSecErrorsDefaultCallbackEnableOutput + (int enabled); + +XMLSEC_EXPORT int xmlSecErrorsGetCode (xmlSecSize pos); +XMLSEC_EXPORT const char* xmlSecErrorsGetMsg (xmlSecSize pos); + + + +/* __FUNCTION__ is defined for MSC compiler < MS VS .NET 2003 */ +#if defined(_MSC_VER) && (_MSC_VER >= 1300) +#define __XMLSEC_FUNCTION__ __FUNCTION__ +#endif /* _MSC_VER */ + +/* fallback for __FUNCTION__ */ +#if !defined(__XMLSEC_FUNCTION__) +#define __XMLSEC_FUNCTION__ "" +#endif /*!defined(__XMLSEC_FUNCTION__) */ + +/** + * XMLSEC_ERRORS_HERE: + * + * The macro that specifies the location (file, line and function) + * for the xmlSecError() function. + */ +#define XMLSEC_ERRORS_HERE __FILE__,__LINE__,__XMLSEC_FUNCTION__ +#ifdef __GNUC__ +#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE __attribute__ ((format (printf, 7, 8))) +#else /* __GNUC__ */ +#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE +#endif /* __GNUC__ */ + +/** + * xmlSecErrorsSafeString: + * @str: the string. + * + * Macro. Returns @str if it is not NULL or pointer to "NULL" otherwise. + */ +#define xmlSecErrorsSafeString(str) \ + (((str) != NULL) ? ((char*)(str)) : (char*)"NULL") + +/** + * XMLSEC_ERRORS_NO_MESSAGE: + * + * Empty error message " ". + */ +#define XMLSEC_ERRORS_NO_MESSAGE " " + + +XMLSEC_EXPORT void xmlSecError (const char* file, + int line, + const char* func, + const char* errorObject, + const char* errorSubject, + int reason, + const char* msg, ...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE; + + + +/********************************************************************** + * + * Assertions + * + **********************************************************************/ +/** + * xmlSecAssert: + * @p: the expression. + * + * Macro. Verifies that @p is true and calls return() otherwise. + */ +#define xmlSecAssert( p ) \ + if(!( p ) ) { \ + xmlSecError(XMLSEC_ERRORS_HERE, \ + NULL, \ + #p, \ + XMLSEC_ERRORS_R_ASSERTION, \ + XMLSEC_ERRORS_NO_MESSAGE); \ + return; \ + } + +/** + * xmlSecAssert2: + * @p: the expression. + * @ret: the return value. + * + * Macro. Verifies that @p is true and calls return(@ret) otherwise. + */ +#define xmlSecAssert2( p, ret ) \ + if(!( p ) ) { \ + xmlSecError(XMLSEC_ERRORS_HERE, \ + NULL, \ + #p, \ + XMLSEC_ERRORS_R_ASSERTION, \ + XMLSEC_ERRORS_NO_MESSAGE); \ + return(ret); \ + } + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_ERRORS_H__ */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_exports.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_exports.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,137 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Export macro declarations for Win32 platform. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_EXPORTS_H__ +#define __XMLSEC_EXPORTS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +/* Now, the export orgy begins. The following we must do for the + Windows platform with MSVC compiler. */ + +#if !defined XMLSEC_EXPORT +# if defined _MSC_VER + /* if we compile libxmlsec itself: */ +# if defined(IN_XMLSEC) +# if !defined(XMLSEC_STATIC) +# define XMLSEC_EXPORT __declspec(dllexport) +# else +# define XMLSEC_EXPORT extern +# endif + /* if a client program includes this file: */ +# else +# if !defined(XMLSEC_STATIC) +# define XMLSEC_EXPORT __declspec(dllimport) +# else +# define XMLSEC_EXPORT +# endif +# endif + /* This holds on all other platforms/compilers, which are easier to + handle in regard to this. */ +# else +# define XMLSEC_EXPORT +# endif +#endif + +#if !defined XMLSEC_CRYPTO_EXPORT +# if defined _MSC_VER + /* if we compile libxmlsec itself: */ +# if defined(IN_XMLSEC_CRYPTO) +# if !defined(XMLSEC_STATIC) +# define XMLSEC_CRYPTO_EXPORT __declspec(dllexport) +# else +# define XMLSEC_CRYPTO_EXPORT extern +# endif + /* if a client program includes this file: */ +# else +# if !defined(XMLSEC_STATIC) +# define XMLSEC_CRYPTO_EXPORT __declspec(dllimport) +# else +# define XMLSEC_CRYPTO_EXPORT +# endif +# endif + /* This holds on all other platforms/compilers, which are easier to + handle in regard to this. */ +# else +# define XMLSEC_CRYPTO_EXPORT +# endif +#endif + +#if !defined XMLSEC_EXPORT_VAR +# if defined _MSC_VER + /* if we compile libxmlsec itself: */ +# if defined(IN_XMLSEC) +# if !defined(XMLSEC_STATIC) +# define XMLSEC_EXPORT_VAR __declspec(dllexport) extern +# else +# define XMLSEC_EXPORT_VAR extern +# endif + /* if we compile libxmlsec-crypto itself: */ +# elif defined(IN_XMLSEC_CRYPTO) +# define XMLSEC_EXPORT_VAR extern + /* if a client program includes this file: */ +# else +# if !defined(XMLSEC_STATIC) +# define XMLSEC_EXPORT_VAR __declspec(dllimport) extern +# else +# define XMLSEC_EXPORT_VAR extern +# endif +# endif + /* This holds on all other platforms/compilers, which are easier to + handle in regard to this. */ +# else +# define XMLSEC_EXPORT_VAR extern +# endif +#endif + +/* Added for Symbian WINSCW/ARM */ +#ifdef __SYMBIAN32__ +# undef XMLSEC_EXPORT +# if defined(IN_XMLSEC1) +# define XMLSEC_EXPORT EXPORT_C +# else +# define XMLSEC_EXPORT IMPORT_C +# endif +# undef XMLSEC_EXPORT_VAR +//Venus: variables will not exported through XMLSEC_EXPORT_VAR, use XMLSEC_EXPORT_VAR2 instead +# if defined(__MARM_ARMV5__) +# define XMLSEC_EXPORT_VAR static +# else +# define XMLSEC_EXPORT_VAR +# endif +# if defined(IN_XMLSEC) || defined(__MARM_ARMV5__) +# define XMLSEC_EXPORT_VAR2 __declspec(dllexport) extern +# else +# define XMLSEC_EXPORT_VAR2 __declspec(dllimport) extern +# endif +# define XMLSEC_GLOBAL_CONST xmlSecGetGlobalConsts()-> +#endif + +#ifdef __SYMBIAN32__ +# undef XMLSEC_CRYPTO_EXPORT +# if defined(IN_XMLSEC_CRYPTO1) +# define XMLSEC_CRYPTO_EXPORT EXPORT_C +# else +# define XMLSEC_CRYPTO_EXPORT IMPORT_C +# endif +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_EXPORTS_H__ */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_globals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,26 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Internal header only used during the compilation, + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#ifndef __XMLSEC_GLOBALS_H__ +#define __XMLSEC_GLOBALS_H__ + +/** + * Use autoconf defines if present. + */ +#ifdef HAVE_CONFIG_H +#include "xmlsec_config.h" +#endif /* HAVE_CONFIG_H */ + +#define IN_XMLSEC +#define XMLSEC_PRIVATE + +#endif /* __XMLSEC_GLOBALS_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_io.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_io.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,55 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Input uri transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_IO_H__ +#define __XMLSEC_IO_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_transforms.h" + +XMLSEC_EXPORT int xmlSecIOInit (void); +XMLSEC_EXPORT void xmlSecIOShutdown (void); +XMLSEC_EXPORT void xmlSecIOCleanupCallbacks (void); +XMLSEC_EXPORT int xmlSecIORegisterDefaultCallbacks (void); +XMLSEC_EXPORT int xmlSecIORegisterCallbacks (xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); + +/******************************************************************** + * + * Input URI transform + * + *******************************************************************/ +/** + * xmlSecTransformInputURIId: + * + * The Input URI transform id. + */ +#define xmlSecTransformInputURIId \ + xmlSecTransformInputURIGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInputURIGetKlass (void); +XMLSEC_EXPORT int xmlSecTransformInputURIOpen (xmlSecTransformPtr transform, + const xmlChar* uri); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_IO_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_keyinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_keyinfo.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,284 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * element processing + * (http://www.w3.org/TR/xmlSec-core/#sec-KeyInfo: + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_KEYINFO_H__ +#define __XMLSEC_KEYINFO_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_list.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" + +/** + * Hi level functions + */ +XMLSEC_EXPORT int xmlSecKeyInfoNodeRead (xmlNodePtr keyInfoNode, + xmlSecKeyPtr key, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyInfoNodeWrite (xmlNodePtr keyInfoNode, + xmlSecKeyPtr key, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +/** + * xmlSecKeyInfoMode: + * @xmlSecKeyInfoModeRead: read element. + * @xmlSecKeyInfoModeWrite: write element. + * + * The @xmlSecKeyInfoCtx operation mode (read or write). + */ +typedef enum { + xmlSecKeyInfoModeRead = 0, + xmlSecKeyInfoModeWrite +} xmlSecKeyInfoMode; + +/** + * XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND: + * + * If flag is set then we will continue reading + * element even when key is already found. + */ +#define XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND 0x00000001 + +/** + * XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD: + * + * If flag is set then we abort if an unknown + * child is found. + */ +#define XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD 0x00000002 + +/** + * XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN: + * + * If flags is set then we abort if an unknown key name + * (content of element) is found. + */ +#define XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN 0x00000004 + +/** + * XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD: + * + * If flags is set then we abort if an unknown + * child is found. + */ +#define XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD 0x00000008 + +/** + * XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF: + * + * If flag is set then we abort if an unknown href attribute + * of element is found. + */ +#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF 0x00000010 + +/** + * XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF: + * + * If flag is set then we abort if an href attribute + * element does not match the real key data type. + */ +#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF 0x00000020 + +/** + * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD: + * + * If flags is set then we abort if an unknown + * child is found. + */ +#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD 0x00000100 + +/** + * XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS: + * + * If flag is set then we'll load certificates from + * element without verification. + */ +#define XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS 0x00000200 + +/** + * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT: + * + * If flag is set then we'll stop when we could not resolve reference + * to certificate from , or + * elements. + */ +#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT 0x00000400 + +/** + * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT: + * + * If the flag is set then we'll stop when element + * processing does not return a verified certificate. + */ +#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT 0x00000800 + +/** + * XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION: + * + * If the flag is set then we'll stop when element + * processing fails. + */ +#define XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION 0x00001000 + +/** + * XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE: + * + * If the flag is set then we'll stop when we found an empty node. + * Otherwise we just ignore it. + */ +#define XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE 0x00002000 + +/** + * XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS: + * + * If the flag is set then we'll skip strict checking of certs and CRLs + */ +#define XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS 0x00004000 + +/** + * xmlSecKeyInfoCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto + * never touch this). + * @flags: the bit mask for flags that control processin. + * @flags2: reserved for future. + * @mode: do we read or write element. + * @keysMngr: the pointer to current keys manager. + * @enabledKeyData: the list of enabled @xmlSecKeyDataId (if list is + * empty then all data ids are enabled). + * @base64LineSize: the max columns size for base64 encoding. + * @retrievalMethodCtx: the transforms context for + * element processing. + * @maxRetrievalMethodLevel: the max recursion level when processing + * element; default level is 1 + * (see also @curRetrievalMethodLevel). + * @encCtx: the encryption context for element + * processing. + * @maxEncryptedKeyLevel: the max recursion level when processing + * element; default level is 1 + * (see @curEncryptedKeyLevel). + * @certsVerificationTime: the time to use for X509 certificates verification + * ("not valid before" and "not valid after" checks); + * if @certsVerificationTime is equal to 0 (default) + * then we verify certificates against the system's + * clock "now". + * @certsVerificationDepth: the max certifications chain length (default is 9). + * @pgpReserved: reserved for PGP. + * @curRetrievalMethodLevel: the current element + * processing level (see @maxRetrievalMethodLevel). + * @curEncryptedKeyLevel: the current element + * processing level (see @maxEncryptedKeyLevel). + * @keyReq: the current key requirements. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The reading or writing context. + */ +struct _xmlSecKeyInfoCtx { + void* userData; + unsigned int flags; + unsigned int flags2; + xmlSecKeysMngrPtr keysMngr; + xmlSecKeyInfoMode mode; + xmlSecPtrList enabledKeyData; + int base64LineSize; + + /* RetrievalMethod */ + xmlSecTransformCtx retrievalMethodCtx; + int maxRetrievalMethodLevel; + +#ifndef XMLSEC_NO_XMLENC + /* EncryptedKey */ + xmlSecEncCtxPtr encCtx; + int maxEncryptedKeyLevel; +#endif /* XMLSEC_NO_XMLENC */ + +#ifndef XMLSEC_NO_X509 + /* x509 certificates */ + time_t certsVerificationTime; + int certsVerificationDepth; +#endif /* XMLSEC_NO_X509 */ + + /* PGP */ + void* pgpReserved; + + /* internal data */ + int curRetrievalMethodLevel; + int curEncryptedKeyLevel; + xmlSecKeyReq keyReq; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecKeyInfoCtxPtr xmlSecKeyInfoCtxCreate (xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecKeyInfoCtxDestroy (xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyInfoCtxInitialize (xmlSecKeyInfoCtxPtr keyInfoCtx, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecKeyInfoCtxFinalize (xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT void xmlSecKeyInfoCtxReset (xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyInfoCtxCopyUserPref (xmlSecKeyInfoCtxPtr dst, + xmlSecKeyInfoCtxPtr src); +XMLSEC_EXPORT int xmlSecKeyInfoCtxCreateEncCtx (xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugDump (xmlSecKeyInfoCtxPtr keyInfoCtx, + FILE* output); +XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugXmlDump (xmlSecKeyInfoCtxPtr keyInfoCtx, + FILE* output); +/** + * xmlSecKeyDataNameId + * + * The processing class. + */ +#define xmlSecKeyDataNameId xmlSecKeyDataNameGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataNameGetKlass (void); + +/** + * xmlSecKeyDataValueId + * + * The processing class. + */ +#define xmlSecKeyDataValueId xmlSecKeyDataValueGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataValueGetKlass (void); + +/** + * xmlSecKeyDataRetrievalMethodId + * + * The processing class. + */ +#define xmlSecKeyDataRetrievalMethodId xmlSecKeyDataRetrievalMethodGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRetrievalMethodGetKlass(void); + +#ifndef XMLSEC_NO_XMLENC +/** + * xmlSecKeyDataEncryptedKeyId + * + * The processing class. + */ +#define xmlSecKeyDataEncryptedKeyId xmlSecKeyDataEncryptedKeyGetKlass() +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataEncryptedKeyGetKlass(void); +#endif /* XMLSEC_NO_XMLENC */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_KEYINFO_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_keys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_keys.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,277 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Keys. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_KEYS_H__ +#define __XMLSEC_KEYS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#include "xmlsec_config.h" + +#include "xmlsec_xmlsec.h" +#include "xmlsec_list.h" +#include "xmlsec_keysdata.h" + + +/** + * xmlSecKeyUsage: + * + * The key usage. + */ +typedef unsigned int xmlSecKeyUsage; + +/** + * xmlSecKeyUsageSign: + * + * Key can be used in any way. + + */ +#define xmlSecKeyUsageSign 0x00000001 + +/** + * xmlSecKeyUsageVerify: + * + * Key for signing. + */ +#define xmlSecKeyUsageVerify 0x00000002 + +/** + * xmlSecKeyUsageEncrypt: + * + * Key for signature verification. + */ +#define xmlSecKeyUsageEncrypt 0x00000004 + +/** + * xmlSecKeyUsageDecrypt: + * + * An encryption key. + */ +#define xmlSecKeyUsageDecrypt 0x00000008 + +/** + * xmlSecKeyUsageKeyExchange: + * + * The key is used for key exchange. + */ +#define xmlSecKeyUsageKeyExchange 0x00000010 + +/** + * xmlSecKeyUsageAny: + * + * A decryption key. + */ +#define xmlSecKeyUsageAny 0xFFFFFFFF + + +/************************************************************************** + * + * xmlSecKeyUseWith + * + *************************************************************************/ +typedef struct _xmlSecKeyUseWith xmlSecKeyUseWith, *xmlSecKeyUseWithPtr; +XMLSEC_EXPORT int xmlSecKeyUseWithInitialize (xmlSecKeyUseWithPtr keyUseWith); +XMLSEC_EXPORT void xmlSecKeyUseWithFinalize (xmlSecKeyUseWithPtr keyUseWith); +XMLSEC_EXPORT void xmlSecKeyUseWithReset (xmlSecKeyUseWithPtr keyUseWith); +XMLSEC_EXPORT int xmlSecKeyUseWithCopy (xmlSecKeyUseWithPtr dst, + xmlSecKeyUseWithPtr src); +XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithCreate (const xmlChar* application, + const xmlChar* identifier); +XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithDuplicate (xmlSecKeyUseWithPtr keyUseWith); +XMLSEC_EXPORT void xmlSecKeyUseWithDestroy (xmlSecKeyUseWithPtr keyUseWith); +XMLSEC_EXPORT int xmlSecKeyUseWithSet (xmlSecKeyUseWithPtr keyUseWith, + const xmlChar* application, + const xmlChar* identifier); +XMLSEC_EXPORT void xmlSecKeyUseWithDebugDump (xmlSecKeyUseWithPtr keyUseWith, + FILE* output); +XMLSEC_EXPORT void xmlSecKeyUseWithDebugXmlDump (xmlSecKeyUseWithPtr keyUseWith, + FILE* output); + +/** + * xmlSecKeyUseWith: + * @application: the application. + * @identifier: the identifier. + * + * Information about application and user of the key. + */ +struct _xmlSecKeyUseWith { + xmlChar* application; + xmlChar* identifier; + + void* reserved1; + void* reserved2; +}; + +/** + * xmlSecKeyUseWithPtrListId: + * + * The keys list klass. + */ +#define xmlSecKeyUseWithPtrListId xmlSecKeyUseWithPtrListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyUseWithPtrListGetKlass (void); + +/************************************************************************** + * + * xmlSecKeyReq - what key are we looking for? + * + *************************************************************************/ +typedef struct _xmlSecKeyReq xmlSecKeyReq, *xmlSecKeyReqPtr; + +/** + * xmlSecKeyReq: + * @keyId: the desired key value klass. + * @keyType: the desired key type. + * @keyUsage: the desired key usage. + * @keyBitsSize: the desired key size (in bits!). + * @keyUseWith: the desired key use with application/identifier information. + + * The key requirements information. + */ +struct _xmlSecKeyReq { + xmlSecKeyDataId keyId; + xmlSecKeyDataType keyType; + xmlSecKeyUsage keyUsage; + xmlSecSize keyBitsSize; + xmlSecPtrList keyUseWithList; + + void* reserved1; + void* eserved2; +}; + +XMLSEC_EXPORT int xmlSecKeyReqInitialize (xmlSecKeyReqPtr keyReq); +XMLSEC_EXPORT void xmlSecKeyReqFinalize (xmlSecKeyReqPtr keyReq); +XMLSEC_EXPORT void xmlSecKeyReqReset (xmlSecKeyReqPtr keyReq); +XMLSEC_EXPORT int xmlSecKeyReqCopy (xmlSecKeyReqPtr dst, + xmlSecKeyReqPtr src); +XMLSEC_EXPORT int xmlSecKeyReqMatchKey (xmlSecKeyReqPtr keyReq, + xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecKeyReqMatchKeyValue (xmlSecKeyReqPtr keyReq, + xmlSecKeyDataPtr value); +XMLSEC_EXPORT void xmlSecKeyReqDebugDump (xmlSecKeyReqPtr keyReq, + FILE* output); +XMLSEC_EXPORT void xmlSecKeyReqDebugXmlDump (xmlSecKeyReqPtr keyReq, + FILE* output); + +/** + * xmlSecKey: + * @name: the key name. + * @value: the key value. + * @dataList: the key data list. + * @usage: the key usage. + * @notValidBefore: the start key validity interval. + * @notValidAfter: the end key validity interval. + * + * The key. + */ +struct _xmlSecKey { + xmlChar* name; + xmlSecKeyDataPtr value; + xmlSecPtrListPtr dataList; + xmlSecKeyUsage usage; + time_t notValidBefore; + time_t notValidAfter; +}; + +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyCreate (void); +XMLSEC_EXPORT void xmlSecKeyDestroy (xmlSecKeyPtr key); +XMLSEC_EXPORT void xmlSecKeyEmpty (xmlSecKeyPtr key); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyDuplicate (xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecKeyCopy (xmlSecKeyPtr keyDst, + xmlSecKeyPtr keySrc); + +XMLSEC_EXPORT const xmlChar* xmlSecKeyGetName (xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecKeySetName (xmlSecKeyPtr key, + const xmlChar* name); + +XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyGetType (xmlSecKeyPtr key); + +XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetValue (xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecKeySetValue (xmlSecKeyPtr key, + xmlSecKeyDataPtr value); + +XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetData (xmlSecKeyPtr key, + xmlSecKeyDataId dataId); +XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyEnsureData (xmlSecKeyPtr key, + xmlSecKeyDataId dataId); +XMLSEC_EXPORT int xmlSecKeyAdoptData (xmlSecKeyPtr key, + xmlSecKeyDataPtr data); + +XMLSEC_EXPORT void xmlSecKeyDebugDump (xmlSecKeyPtr key, + FILE *output); +XMLSEC_EXPORT void xmlSecKeyDebugXmlDump (xmlSecKeyPtr key, + FILE *output); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerate (xmlSecKeyDataId dataId, + xmlSecSize sizeBits, + xmlSecKeyDataType type); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerateByName (const xmlChar* name, + xmlSecSize sizeBits, + xmlSecKeyDataType type); + + +XMLSEC_EXPORT int xmlSecKeyMatch (xmlSecKeyPtr key, + const xmlChar *name, + xmlSecKeyReqPtr keyReq); + +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBuffer (xmlSecKeyDataId dataId, + xmlSecBuffer* buffer); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBinaryFile (xmlSecKeyDataId dataId, + const char* filename); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId, + const xmlSecByte* data, + xmlSecSize dataSize); + + +/** + * xmlSecKeyIsValid: + * @key: the pointer to key. + * + * Macro. Returns 1 if @key is not NULL and @key->id is not NULL + * or 0 otherwise. + */ +#define xmlSecKeyIsValid(key) \ + ((( key ) != NULL) && \ + (( key )->value != NULL) && \ + ((( key )->value->id) != NULL)) +/** + * xmlSecKeyCheckId: + * @key: the pointer to key. + * @keyId: the key Id. + * + * Macro. Returns 1 if @key is valid and @key's id is equal to @keyId. + */ +#define xmlSecKeyCheckId(key, keyId) \ + (xmlSecKeyIsValid(( key )) && \ + ((( key )->value->id) == ( keyId ))) + + +/*********************************************************************** + * + * Keys list + * + **********************************************************************/ +/** + * xmlSecKeyPtrListId: + * + * The keys list klass. + */ +#define xmlSecKeyPtrListId xmlSecKeyPtrListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyPtrListGetKlass (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_KEYS_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_keysdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_keysdata.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,837 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Key data. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_KEYSDATA_H__ +#define __XMLSEC_KEYSDATA_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_list.h" + +/** + * Forward declarations + */ +typedef const struct _xmlSecKeyDataKlass xmlSecKeyDataKlass, + *xmlSecKeyDataId; +typedef const struct _xmlSecKeyDataStoreKlass xmlSecKeyDataStoreKlass, + *xmlSecKeyDataStoreId; +typedef struct _xmlSecKeyDataList xmlSecKeyDataList, + *xmlSecKeyDataListPtr; + + +/************************************************************************** + * + * xmlSecKeyDataUsage + * + *************************************************************************/ +/** + * xmlSecKeyDataUsage: + * + * The bits mask that determines possible keys data usage. + */ +typedef unsigned int xmlSecKeyDataUsage; + +/** + * xmlSecKeyDataUsageUnknown: + * + * The key data usage is unknown. + */ +#define xmlSecKeyDataUsageUnknown 0x00000 + +/** + * xmlSecKeyDataUsageKeyInfoNodeRead: + * + * The key data could be read from a child. + */ +#define xmlSecKeyDataUsageKeyInfoNodeRead 0x00001 + +/** + * xmlSecKeyDataUsageKeyInfoNodeWrite: + * + * The key data could be written to a child. + */ +#define xmlSecKeyDataUsageKeyInfoNodeWrite 0x00002 + +/** + * xmlSecKeyDataUsageKeyValueNodeRead: + * + * The key data could be read from a child. + */ +#define xmlSecKeyDataUsageKeyValueNodeRead 0x00004 + +/** + * xmlSecKeyDataUsageKeyValueNodeWrite: + * + * The key data could be written to a child. + */ +#define xmlSecKeyDataUsageKeyValueNodeWrite 0x00008 + +/** + * xmlSecKeyDataUsageRetrievalMethodNodeXml: + * + * The key data could be retrieved using node + * in XML format. + */ +#define xmlSecKeyDataUsageRetrievalMethodNodeXml 0x00010 + +/** + * xmlSecKeyDataUsageRetrievalMethodNodeBin: + * + * The key data could be retrieved using node + * in binary format. + */ +#define xmlSecKeyDataUsageRetrievalMethodNodeBin 0x00020 + +/** + * xmlSecKeyDataUsageAny: + * + * Any key data usage. + */ +#define xmlSecKeyDataUsageAny 0xFFFFF + +/** + * xmlSecKeyDataUsageKeyInfoNode: + * + * The key data could be read and written from/to a child. + */ +#define xmlSecKeyDataUsageKeyInfoNode \ + (xmlSecKeyDataUsageKeyInfoNodeRead | xmlSecKeyDataUsageKeyInfoNodeWrite) + +/** + * xmlSecKeyDataUsageKeyValueNode: + * + * The key data could be read and written from/to a child. + */ +#define xmlSecKeyDataUsageKeyValueNode \ + (xmlSecKeyDataUsageKeyValueNodeRead | xmlSecKeyDataUsageKeyValueNodeWrite) + +/** + * xmlSecKeyDataUsageRetrievalMethodNode: + * + * The key data could be retrieved using node + * in any format. + */ +#define xmlSecKeyDataUsageRetrievalMethodNode \ + (xmlSecKeyDataUsageRetrievalMethodNodeXml | xmlSecKeyDataUsageRetrievalMethodNodeBin) + +/************************************************************************** + * + * xmlSecKeyDataType + * + *************************************************************************/ +/** + * xmlSecKeyDataType: + * + * The key data type (public/private, session/permanet, etc.). + */ +typedef unsigned int xmlSecKeyDataType; + +/** + * xmlSecKeyDataTypeUnknown: + * + * The key data type is unknown (same as #xmlSecKeyDataTypeNone). + */ +#define xmlSecKeyDataTypeUnknown 0x0000 + +/** + * xmlSecKeyDataTypeNone: + * + * The key data type is unknown (same as #xmlSecKeyDataTypeUnknown). + */ +#define xmlSecKeyDataTypeNone xmlSecKeyDataTypeUnknown + +/** + * xmlSecKeyDataTypePublic: + * + * The key data contain a public key. + */ +#define xmlSecKeyDataTypePublic 0x0001 + +/** + * xmlSecKeyDataTypePrivate: + * + * The key data contain a private key. + */ +#define xmlSecKeyDataTypePrivate 0x0002 + +/** + * xmlSecKeyDataTypeSymmetric: + * + * The key data contain a symmetric key. + */ +#define xmlSecKeyDataTypeSymmetric 0x0004 + +/** + * xmlSecKeyDataTypeSession: + * + * The key data contain session key (one time key, not stored in keys manager). + */ +#define xmlSecKeyDataTypeSession 0x0008 + +/** + * xmlSecKeyDataTypePermanent: + * + * The key data contain permanent key (stored in keys manager). + */ +#define xmlSecKeyDataTypePermanent 0x0010 + +/** + * xmlSecKeyDataTypeTrusted: + * + * The key data is trusted. + */ +#define xmlSecKeyDataTypeTrusted 0x0100 + +/** + * xmlSecKeyDataTypeAny: + * + * Any key data. + */ +#define xmlSecKeyDataTypeAny 0xFFFF + +/************************************************************************** + * + * xmlSecKeyDataFormat + * + *************************************************************************/ +/** + * xmlSecKeyDataFormat: + * @xmlSecKeyDataFormatUnknown: the key data format is unknown. + * @xmlSecKeyDataFormatBinary: the binary key data. + * @xmlSecKeyDataFormatPem: the PEM key data (cert or public/private key). + * @xmlSecKeyDataFormatDer: the DER key data (cert or public/private key). + * @xmlSecKeyDataFormatPkcs8Pem: the PKCS#8 PEM private key. + * @xmlSecKeyDataFormatPkcs8Der: the PKCS#8 DER private key. + * @xmlSecKeyDataFormatPkcs12: the PKCS12 format (bag of keys and certs) + * @xmlSecKeyDataFormatCertPem: the PEM cert. + * @xmlSecKeyDataFormatCertDer: the DER cert. + * + * The key data format (binary, der, pem, etc.). + */ +typedef enum { + xmlSecKeyDataFormatUnknown = 0, + xmlSecKeyDataFormatBinary, + xmlSecKeyDataFormatPem, + xmlSecKeyDataFormatDer, + xmlSecKeyDataFormatPkcs8Pem, + xmlSecKeyDataFormatPkcs8Der, + xmlSecKeyDataFormatPkcs12, + xmlSecKeyDataFormatCertPem, + xmlSecKeyDataFormatCertDer +} xmlSecKeyDataFormat; + +/************************************************************************** + * + * Global xmlSecKeyDataIds methods + * + *************************************************************************/ +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecKeyDataIdsGet (void); +XMLSEC_EXPORT int xmlSecKeyDataIdsInit (void); +XMLSEC_EXPORT void xmlSecKeyDataIdsShutdown (void); +XMLSEC_EXPORT int xmlSecKeyDataIdsRegisterDefault (void); +XMLSEC_EXPORT int xmlSecKeyDataIdsRegister (xmlSecKeyDataId id); + +/************************************************************************** + * + * xmlSecKeyData + * + *************************************************************************/ +/** + * xmlSecKeyData: + * @id: the data id (#xmlSecKeyDataId). + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The key data: key value (crypto material), x509 data, pgp data, etc. + */ +struct _xmlSecKeyData { + xmlSecKeyDataId id; + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataCreate (xmlSecKeyDataId id); +XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataDuplicate (xmlSecKeyDataPtr data); +XMLSEC_EXPORT void xmlSecKeyDataDestroy (xmlSecKeyDataPtr data); +XMLSEC_EXPORT int xmlSecKeyDataGenerate (xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type); +XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyDataGetType (xmlSecKeyDataPtr data); +XMLSEC_EXPORT xmlSecSize xmlSecKeyDataGetSize (xmlSecKeyDataPtr data); +XMLSEC_EXPORT const xmlChar* xmlSecKeyDataGetIdentifier (xmlSecKeyDataPtr data); +XMLSEC_EXPORT void xmlSecKeyDataDebugDump (xmlSecKeyDataPtr data, + FILE *output); +XMLSEC_EXPORT void xmlSecKeyDataDebugXmlDump (xmlSecKeyDataPtr data, + FILE *output); +XMLSEC_EXPORT int xmlSecKeyDataXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataBinRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + const xmlSecByte* buf, + xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataBinWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlSecByte** buf, + xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); + + +/** + * xmlSecKeyDataGetName: + * @data: the pointer to key data. + * + * Macro. Returns the key data name. + */ +#define xmlSecKeyDataGetName(data) \ + ((xmlSecKeyDataIsValid((data))) ? \ + xmlSecKeyDataKlassGetName((data)->id) : NULL) + +/** + * xmlSecKeyDataIsValid: + * @data: the pointer to data. + * + * Macro. Returns 1 if @data is not NULL and @data->id is not NULL + * or 0 otherwise. + */ +#define xmlSecKeyDataIsValid(data) \ + ((( data ) != NULL) && \ + (( data )->id != NULL) && \ + (( data )->id->klassSize >= sizeof(xmlSecKeyDataKlass)) && \ + (( data )->id->objSize >= sizeof(xmlSecKeyData)) && \ + (( data )->id->name != NULL)) +/** + * xmlSecKeyDataCheckId: + * @data: the pointer to data. + * @dataId: the data Id. + * + * Macro. Returns 1 if @data is valid and @data's id is equal to @dataId. + */ +#define xmlSecKeyDataCheckId(data, dataId) \ + (xmlSecKeyDataIsValid(( data )) && \ + ((( data )->id) == ( dataId ))) + +/** + * xmlSecKeyDataCheckUsage: + * @data: the pointer to data. + * @usg: the data usage. + * + * Macro. Returns 1 if @data is valid and could be used for @usg. + */ +#define xmlSecKeyDataCheckUsage(data, usg) \ + (xmlSecKeyDataIsValid(( data )) && \ + (((( data )->id->usage) & ( usg )) != 0)) + +/** + * xmlSecKeyDataCheckSize: + * @data: the pointer to data. + * @size: the expected size. + * + * Macro. Returns 1 if @data is valid and @data's object has at least @size bytes. + */ +#define xmlSecKeyDataCheckSize(data, size) \ + (xmlSecKeyDataIsValid(( data )) && \ + (( data )->id->objSize >= size)) + +/************************************************************************** + * + * xmlSecKeyDataKlass + * + *************************************************************************/ +/** + * xmlSecKeyDataIdUnknown: + * + * The "unknown" id. + */ +#define xmlSecKeyDataIdUnknown ((xmlSecKeyDataId)NULL) + +/** + * xmlSecKeyDataInitMethod: + * @data: the pointer to key data. + * + * Key data specific initialization method. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataInitMethod) (xmlSecKeyDataPtr data); + +/** + * xmlSecKeyDataDuplicateMethod: + * @dst: the pointer to destination key data. + * @src: the poiniter to source key data. + * + * Key data specific duplication (copy) method. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); + +/** + * xmlSecKeyDataFinalizeMethod: + * @data: the data. + * + * Key data specific finalization method. All the objects and resources allocated + * by the key data object must be freed inside this method. + */ +typedef void (*xmlSecKeyDataFinalizeMethod) (xmlSecKeyDataPtr data); + +/** + * xmlSecKeyDataXmlReadMethod: + * @id: the data id. + * @key: the key. + * @node: the pointer to data's value XML node. + * @keyInfoCtx: the node processing context. + * + * Key data specific method for reading XML node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataXmlReadMethod) (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +/** + * xmlSecKeyDataXmlWriteMethod: + * @id: the data id. + * @key: the key. + * @node: the pointer to data's value XML node. + * @keyInfoCtx: the node processing context. + * + * Key data specific method for writing XML node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataXmlWriteMethod) (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +/** + * xmlSecKeyDataBinReadMethod: + * @id: the data id. + * @key: the key. + * @buf: the input buffer. + * @bufSize: the buffer size. + * @keyInfoCtx: the node processing context. + * + * Key data specific method for reading binary buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataBinReadMethod) (xmlSecKeyDataId id, + xmlSecKeyPtr key, + const xmlSecByte* buf, + xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +/** + * xmlSecKeyDataBinWriteMethod: + * @id: the data id. + * @key: the key. + * @buf: the output buffer. + * @bufSize: the buffer size. + * @keyInfoCtx: the node processing context. + * + * Key data specific method for reading binary buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataBinWriteMethod) (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlSecByte** buf, + xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +/** + * xmlSecKeyDataGenerateMethod: + * @data: the pointer to key data. + * @sizeBits: the key data specific size. + * @type: the required key type (session/permanent, etc.) + * + * Key data specific method for generating new key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataGenerateMethod) (xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type); + +/** + * xmlSecKeyDataGetTypeMethod: + * @data: the data. + * + * Key data specific method to get the key type. + * + * Returns the key type. + */ +typedef xmlSecKeyDataType (*xmlSecKeyDataGetTypeMethod) (xmlSecKeyDataPtr data); + +/** + * xmlSecKeyDataGetSizeMethod: + * @data: the pointer to key data. + * + * Key data specific method to get the key size. + * + * Returns the key size in bits. + */ +typedef xmlSecSize (*xmlSecKeyDataGetSizeMethod) (xmlSecKeyDataPtr data); + +/** + * xmlSecKeyDataGetIdentifierMethod: + * @data: the pointer to key data. + * + * Key data specific method to get the key data identifier string (for example, + * X509 data identifier is the subject of the verified cert). + * + * Returns the identifier string or NULL if an error occurs. + */ +typedef const xmlChar* (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data); + +/** + * xmlSecKeyDataDebugDumpMethod: + * @data: the data. + * @output: the FILE to print debug info (should be open for writing). + * + * Key data specific method for printing debug info. + */ +typedef void (*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPtr data, + FILE* output); + +/** + * xmlSecKeyDataKlass: + * @klassSize: the klass size. + * @objSize: the object size. + * @name: the object name. + * @usage: the allowed data usage. + * @href: the identification string (href). + * @dataNodeName: the data's XML node name. + * @dataNodeNs: the data's XML node namespace. + * @initialize: the initialization method. + * @duplicate: the duplicate (copy) method. + * @finalize: the finalization (destroy) method. + * @generate: the new data generation method. + * @getType: the method to access data's type information. + * @getSize: the method to access data's size. + * @getIdentifier: the method to access data's string identifier. + * @xmlRead: the method for reading data from XML node. + * @xmlWrite: the method for writing data to XML node. + * @binRead: the method for reading data from a binary buffer. + * @binWrite: the method for writing data to binary buffer. + * @debugDump: the method for printing debug data information. + * @debugXmlDump: the method for printing debug data information in XML format. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The data id (klass). + */ +struct _xmlSecKeyDataKlass { + xmlSecSize klassSize; + xmlSecSize objSize; + + /* data */ + const xmlChar* name; + xmlSecKeyDataUsage usage; + const xmlChar* href; + const xmlChar* dataNodeName; + const xmlChar* dataNodeNs; + + /* constructors/destructor */ + xmlSecKeyDataInitMethod initialize; + xmlSecKeyDataDuplicateMethod duplicate; + xmlSecKeyDataFinalizeMethod finalize; + xmlSecKeyDataGenerateMethod generate; + + /* get info */ + xmlSecKeyDataGetTypeMethod getType; + xmlSecKeyDataGetSizeMethod getSize; + xmlSecKeyDataGetIdentifierMethod getIdentifier; + + /* read/write */ + xmlSecKeyDataXmlReadMethod xmlRead; + xmlSecKeyDataXmlWriteMethod xmlWrite; + xmlSecKeyDataBinReadMethod binRead; + xmlSecKeyDataBinWriteMethod binWrite; + + /* debug */ + xmlSecKeyDataDebugDumpMethod debugDump; + xmlSecKeyDataDebugDumpMethod debugXmlDump; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +/** + * xmlSecKeyDataKlassGetName: + * @klass: the data klass. + * + * Macro. Returns data klass name. + */ +#define xmlSecKeyDataKlassGetName(klass) \ + (((klass)) ? ((klass)->name) : NULL) + +/*********************************************************************** + * + * Key Data list + * + **********************************************************************/ +/** + * xmlSecKeyDataListId: + * + * + * The key data klasses list klass id. + */ +#define xmlSecKeyDataListId xmlSecKeyDataListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataListGetKlass (void); + +/*********************************************************************** + * + * Key Data Ids list + * + **********************************************************************/ +/** + * xmlSecKeyDataIdListId: + * + * + * The key data list klass id. + */ +#define xmlSecKeyDataIdListId xmlSecKeyDataIdListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataIdListGetKlass (void); +XMLSEC_EXPORT int xmlSecKeyDataIdListFind (xmlSecPtrListPtr list, + xmlSecKeyDataId dataId); +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByNode (xmlSecPtrListPtr list, + const xmlChar* nodeName, + const xmlChar* nodeNs, + xmlSecKeyDataUsage usage); +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByHref (xmlSecPtrListPtr list, + const xmlChar* href, + xmlSecKeyDataUsage usage); +XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByName (xmlSecPtrListPtr list, + const xmlChar* name, + xmlSecKeyDataUsage usage); +XMLSEC_EXPORT void xmlSecKeyDataIdListDebugDump (xmlSecPtrListPtr list, + FILE* output); +XMLSEC_EXPORT void xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list, + FILE* output); + +/************************************************************************** + * + * xmlSecKeyDataBinary + * + * key (xmlSecBuffer) is located after xmlSecKeyData structure + * + *************************************************************************/ +/** + * xmlSecKeyDataBinarySize: + * + * The binary key data object size. + */ +#define xmlSecKeyDataBinarySize \ + (sizeof(xmlSecKeyData) + sizeof(xmlSecBuffer)) + +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueInitialize (xmlSecKeyDataPtr data); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueDuplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +XMLSEC_EXPORT void xmlSecKeyDataBinaryValueFinalize (xmlSecKeyDataPtr data); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + const xmlSecByte* buf, + xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlSecByte** buf, + xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugDump (xmlSecKeyDataPtr data, + FILE* output); +XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugXmlDump (xmlSecKeyDataPtr data, + FILE* output); + +XMLSEC_EXPORT xmlSecSize xmlSecKeyDataBinaryValueGetSize (xmlSecKeyDataPtr data); +XMLSEC_EXPORT xmlSecBufferPtr xmlSecKeyDataBinaryValueGetBuffer (xmlSecKeyDataPtr data); +XMLSEC_EXPORT int xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize); + +/************************************************************************** + * + * xmlSecKeyDataStore + * + *************************************************************************/ +/** + * xmlSecKeyDataStore: + * @id: the store id (#xmlSecKeyDataStoreId). + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The key data store. Key data store holds common key data specific information + * required for key data processing. For example, X509 data store may hold + * information about trusted (root) certificates. + */ +struct _xmlSecKeyDataStore { + xmlSecKeyDataStoreId id; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeyDataStoreCreate (xmlSecKeyDataStoreId id); +XMLSEC_EXPORT void xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store); + +/** + * xmlSecKeyDataStoreGetName: + * @store: the pointer to store. + * + * Macro. Returns key data store name. + */ +#define xmlSecKeyDataStoreGetName(store) \ + ((xmlSecKeyDataStoreIsValid((store))) ? \ + xmlSecKeyDataStoreKlassGetName((store)->id) : NULL) + +/** + * xmlSecKeyDataStoreIsValid: + * @store: the pointer to store. + * + * Macro. Returns 1 if @store is not NULL and @store->id is not NULL + * or 0 otherwise. + */ +#define xmlSecKeyDataStoreIsValid(store) \ + ((( store ) != NULL) && ((( store )->id) != NULL)) +/** + * xmlSecKeyDataStoreCheckId: + * @store: the pointer to store. + * @storeId: the store Id. + * + * Macro. Returns 1 if @store is valid and @store's id is equal to @storeId. + */ +#define xmlSecKeyDataStoreCheckId(store, storeId) \ + (xmlSecKeyDataStoreIsValid(( store )) && \ + ((( store )->id) == ( storeId ))) + +/** + * xmlSecKeyDataStoreCheckSize: + * @store: the pointer to store. + * @size: the expected size. + * + * Macro. Returns 1 if @data is valid and @stores's object has at least @size bytes. + */ +#define xmlSecKeyDataStoreCheckSize(store, size) \ + (xmlSecKeyDataStoreIsValid(( store )) && \ + (( store )->id->objSize >= size)) + + +/************************************************************************** + * + * xmlSecKeyDataStoreKlass + * + *************************************************************************/ +/** + * xmlSecKeyDataStoreIdUnknown: + * + * The "unknown" id. + */ +#define xmlSecKeyDataStoreIdUnknown NULL + +/** + * xmlSecKeyDataStoreInitializeMethod: + * @store: the data store. + * + * Key data store specific initialization method. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyDataStoreInitializeMethod) (xmlSecKeyDataStorePtr store); + +/** + * xmlSecKeyDataStoreFinalizeMethod: + * @store: the data store. + * + * Key data store specific finalization (destroy) method. + */ +typedef void (*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store); + +/** + * xmlSecKeyDataStoreKlass: + * @klassSize: the data store klass size. + * @objSize: the data store obj size. + * @name: the store's name. + * @initialize: the store's initialization method. + * @finalize: the store's finalization (destroy) method. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The data store id (klass). + */ +struct _xmlSecKeyDataStoreKlass { + xmlSecSize klassSize; + xmlSecSize objSize; + + /* data */ + const xmlChar* name; + + /* constructors/destructor */ + xmlSecKeyDataStoreInitializeMethod initialize; + xmlSecKeyDataStoreFinalizeMethod finalize; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +/** + * xmlSecKeyDataStoreKlassGetName: + * @klass: the pointer to store klass. + * + * Macro. Returns store klass name. + */ +#define xmlSecKeyDataStoreKlassGetName(klass) \ + (((klass)) ? ((klass)->name) : NULL) + +/*********************************************************************** + * + * Key Data Store list + * + **********************************************************************/ +/** + * xmlSecKeyDataStorePtrListId: + * + * The data store list id (klass). + */ +#define xmlSecKeyDataStorePtrListId xmlSecKeyDataStorePtrListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataStorePtrListGetKlass (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_KEYSDATA_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_keysmngr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_keysmngr.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,267 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Keys Manager + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_KEYSMGMR_H__ +#define __XMLSEC_KEYSMGMR_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +#include "xmlsec_xmlsec.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keyinfo.h" + +typedef const struct _xmlSecKeyKlass xmlSecKeyKlass, + *xmlSecKeyId; +typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass, + *xmlSecKeyStoreId; + + +/**************************************************************************** + * + * Keys Manager + * + ***************************************************************************/ +XMLSEC_EXPORT xmlSecKeysMngrPtr xmlSecKeysMngrCreate (void); +XMLSEC_EXPORT void xmlSecKeysMngrDestroy (xmlSecKeysMngrPtr mngr); + +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrFindKey (xmlSecKeysMngrPtr mngr, + const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +XMLSEC_EXPORT int xmlSecKeysMngrAdoptKeysStore (xmlSecKeysMngrPtr mngr, + xmlSecKeyStorePtr store); +XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeysMngrGetKeysStore (xmlSecKeysMngrPtr mngr); + +XMLSEC_EXPORT int xmlSecKeysMngrAdoptDataStore (xmlSecKeysMngrPtr mngr, + xmlSecKeyDataStorePtr store); +XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeysMngrGetDataStore (xmlSecKeysMngrPtr mngr, + xmlSecKeyDataStoreId id); + +/** + * xmlSecGetKeyCallback: + * @keyInfoNode: the pointer to node. + * @keyInfoCtx: the pointer to node processing context. + * + * Reads the node @keyInfoNode and extracts the key. + * + * Returns the pointer to key or NULL if the key is not found or + * an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecGetKeyCallback) (xmlNodePtr keyInfoNode, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +/** + * xmlSecKeysMngr: + * @keysStore: the key store (list of keys known to keys manager). + * @storesList: the list of key data stores known to keys manager. + * @getKey: the callback used to read node. + * + * The keys manager structure. + */ +struct _xmlSecKeysMngr { + xmlSecKeyStorePtr keysStore; + xmlSecPtrList storesList; + xmlSecGetKeyCallback getKey; +}; + + +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrGetKey (xmlNodePtr keyInfoNode, + xmlSecKeyInfoCtxPtr keyInfoCtx); + + +/************************************************************************** + * + * xmlSecKeyStore + * + *************************************************************************/ +/** + * xmlSecKeyStore: + * @id: the store id (#xmlSecKeyStoreId). + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The keys store. + */ +struct _xmlSecKeyStore { + xmlSecKeyStoreId id; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeyStoreCreate (xmlSecKeyStoreId id); +XMLSEC_EXPORT void xmlSecKeyStoreDestroy (xmlSecKeyStorePtr store); +XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyStoreFindKey (xmlSecKeyStorePtr store, + const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx); +/** + * xmlSecKeyStoreGetName: + * @store: the pointer to store. + * + * Macro. Returns key store name. + */ +#define xmlSecKeyStoreGetName(store) \ + ((xmlSecKeyStoreIsValid((store))) ? \ + xmlSecKeyStoreKlassGetName((store)->id) : NULL) + +/** + * xmlSecKeyStoreIsValid: + * @store: the pointer to store. + * + * Macro. Returns 1 if @store is not NULL and @store->id is not NULL + * or 0 otherwise. + */ +#define xmlSecKeyStoreIsValid(store) \ + ((( store ) != NULL) && ((( store )->id) != NULL)) +/** + * xmlSecKeyStoreCheckId: + * @store: the pointer to store. + * @storeId: the store Id. + * + * Macro. Returns 1 if @store is valid and @store's id is equal to @storeId. + */ +#define xmlSecKeyStoreCheckId(store, storeId) \ + (xmlSecKeyStoreIsValid(( store )) && \ + ((( store )->id) == ( storeId ))) + +/** + * xmlSecKeyStoreCheckSize: + * @store: the pointer to store. + * @size: the expected size. + * + * Macro. Returns 1 if @store is valid and @stores's object has at least @size bytes. + */ +#define xmlSecKeyStoreCheckSize(store, size) \ + (xmlSecKeyStoreIsValid(( store )) && \ + (( store )->id->objSize >= size)) + + +/************************************************************************** + * + * xmlSecKeyStoreKlass + * + *************************************************************************/ +/** + * xmlSecKeyStoreIdUnknown: + * + * The "unknown" id. + */ +#define xmlSecKeyStoreIdUnknown ((xmlSecKeyDataStoreId)NULL) + +/** + * xmlSecKeyStoreInitializeMethod: + * @store: the store. + * + * Keys store specific initialization method. + * + * Returns 0 on success or a negative value if an error occurs. + */ +typedef int (*xmlSecKeyStoreInitializeMethod) (xmlSecKeyStorePtr store); + +/** + * xmlSecKeyStoreFinalizeMethod: + * @store: the store. + * + * Keys store specific finalization (destroy) method. + */ +typedef void (*xmlSecKeyStoreFinalizeMethod) (xmlSecKeyStorePtr store); + +/** + * xmlSecKeyStoreFindKeyMethod: + * @store: the store. + * @name: the desired key name. + * @keyInfoCtx: the pointer to key info context. + * + * Keys store specific find method. The caller is responsible for destroying + * the returned key using #xmlSecKeyDestroy method. + * + * Returns the pointer to a key or NULL if key is not found or an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecKeyStoreFindKeyMethod) (xmlSecKeyStorePtr store, + const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +/** + * xmlSecKeyStoreKlass: + * @klassSize: the store klass size. + * @objSize: the store obj size. + * @name: the store's name. + * @initialize: the store's initialization method. + * @finalize: the store's finalization (destroy) method. + * @findKey: the store's find method. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The keys store id (klass). + */ +struct _xmlSecKeyStoreKlass { + xmlSecSize klassSize; + xmlSecSize objSize; + + /* data */ + const xmlChar* name; + + /* constructors/destructor */ + xmlSecKeyStoreInitializeMethod initialize; + xmlSecKeyStoreFinalizeMethod finalize; + xmlSecKeyStoreFindKeyMethod findKey; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +/** + * xmlSecKeyStoreKlassGetName: + * @klass: the pointer to store klass. + * + * Macro. Returns store klass name. + */ +#define xmlSecKeyStoreKlassGetName(klass) \ + (((klass)) ? ((klass)->name) : NULL) + + +/**************************************************************************** + * + * Simple Keys Store + * + ***************************************************************************/ +/** + * xmlSecSimpleKeysStoreId: + * + * A simple keys store klass id. + */ +#define xmlSecSimpleKeysStoreId xmlSecSimpleKeysStoreGetKlass() +XMLSEC_EXPORT xmlSecKeyStoreId xmlSecSimpleKeysStoreGetKlass (void); +XMLSEC_EXPORT int xmlSecSimpleKeysStoreAdoptKey (xmlSecKeyStorePtr store, + xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecSimpleKeysStoreLoad (xmlSecKeyStorePtr store, + const char *uri, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT int xmlSecSimpleKeysStoreSave (xmlSecKeyStorePtr store, + const char *filename, + xmlSecKeyDataType type); +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecSimpleKeysStoreGetKeys (xmlSecKeyStorePtr store); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_KEYSMGMR_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_list.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,195 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * List of pointers. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_LIST_H__ +#define __XMLSEC_LIST_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" + +typedef const struct _xmlSecPtrListKlass xmlSecPtrListKlass, + *xmlSecPtrListId; +typedef struct _xmlSecPtrList xmlSecPtrList, + *xmlSecPtrListPtr; + +/** + * xmlSecPtrList: + * @id: the list items description. + * @data: the list data. + * @use: the current list size. + * @max: the max (allocated) list size. + * @allocMode: the memory allocation mode. + * + * The pointers list. + */ +struct _xmlSecPtrList { + xmlSecPtrListId id; + + xmlSecPtr* data; + xmlSecSize use; + xmlSecSize max; + xmlSecAllocMode allocMode; +}; + +XMLSEC_EXPORT void xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, + xmlSecSize defInitialSize); + + +XMLSEC_EXPORT int xmlSecPtrListInitialize (xmlSecPtrListPtr list, + xmlSecPtrListId id); +XMLSEC_EXPORT void xmlSecPtrListFinalize (xmlSecPtrListPtr list); +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListCreate (xmlSecPtrListId id); +XMLSEC_EXPORT void xmlSecPtrListDestroy (xmlSecPtrListPtr list); +XMLSEC_EXPORT void xmlSecPtrListEmpty (xmlSecPtrListPtr list); + +XMLSEC_EXPORT int xmlSecPtrListCopy (xmlSecPtrListPtr dst, + xmlSecPtrListPtr src); +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListDuplicate (xmlSecPtrListPtr list); + +XMLSEC_EXPORT xmlSecSize xmlSecPtrListGetSize (xmlSecPtrListPtr list); +XMLSEC_EXPORT xmlSecPtr xmlSecPtrListGetItem (xmlSecPtrListPtr list, + xmlSecSize pos); +XMLSEC_EXPORT int xmlSecPtrListAdd (xmlSecPtrListPtr list, + xmlSecPtr item); +XMLSEC_EXPORT int xmlSecPtrListSet (xmlSecPtrListPtr list, + xmlSecPtr item, + xmlSecSize pos); +XMLSEC_EXPORT int xmlSecPtrListRemove (xmlSecPtrListPtr list, + xmlSecSize pos); +XMLSEC_EXPORT void xmlSecPtrListDebugDump (xmlSecPtrListPtr list, + FILE* output); +XMLSEC_EXPORT void xmlSecPtrListDebugXmlDump (xmlSecPtrListPtr list, + FILE* output); + +/** + * xmlSecPtrListGetName: + * @list: the ponter to list. + * + * Macro. Returns lists's name. + */ +#define xmlSecPtrListGetName(list) \ + (((list) != NULL) ? xmlSecPtrListKlassGetName((list)->id) : NULL) + +/** + * xmlSecPtrListIsValid: + * @list: the pointer to list. + * + * Macro. Returns 1 if @list is not NULL and @list->id is not NULL + * or 0 otherwise. + */ +#define xmlSecPtrListIsValid(list) \ + ((( list ) != NULL) && ((( list )->id) != NULL)) +/** + * xmlSecPtrListCheckId: + * @list: the pointer to list. + * @dataId: the list Id. + * + * Macro. Returns 1 if @list is valid and @list's id is equal to @dataId. + */ +#define xmlSecPtrListCheckId(list, dataId) \ + (xmlSecPtrListIsValid(( list )) && \ + ((( list )->id) == ( dataId ))) + + +/************************************************************************** + * + * List klass + * + *************************************************************************/ +/** + * xmlSecPtrListIdUnknown: + * + * The "unknown" id. + */ +#define xmlSecPtrListIdUnknown NULL + +/** + * xmlSecPtrDuplicateItemMethod: + * @ptr: the poinetr to list item. + * + * Duplicates item @ptr. + * + * Returns pointer to new item copy or NULL if an error occurs. + */ +typedef xmlSecPtr (*xmlSecPtrDuplicateItemMethod) (xmlSecPtr ptr); + +/** + * xmlSecPtrDestroyItemMethod: + * @ptr: the poinetr to list item. + * + * Destroys list item @ptr. + */ +typedef void (*xmlSecPtrDestroyItemMethod) (xmlSecPtr ptr); + +/** + * xmlSecPtrDebugDumpItemMethod: + * @ptr: the poinetr to list item. + * @output: the output FILE. + * + * Prints debug information about @item to @output. + */ +typedef void (*xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr, + FILE* output); + +/** + * xmlSecPtrListKlass: + * @name: the list klass name. + * @duplicateItem: the duplciate item method. + * @destroyItem: the destroy item method. + * @debugDumpItem: the debug dump item method. + * @debugXmlDumpItem: the debug dump item in xml format method. + * + * List klass. + */ +struct _xmlSecPtrListKlass { + const xmlChar* name; + xmlSecPtrDuplicateItemMethod duplicateItem; + xmlSecPtrDestroyItemMethod destroyItem; + xmlSecPtrDebugDumpItemMethod debugDumpItem; + xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; +}; + +/** + * xmlSecPtrListKlassGetName: + * @klass: the list klass. + *2 + + * Macro. Returns the list klass name. + */ +#define xmlSecPtrListKlassGetName(klass) \ + (((klass) != NULL) ? ((klass)->name) : NULL) + +/************************************************************************** + * + * xmlSecStringListKlass + * + *************************************************************************/ +/** + * xmlSecStringListId: + * + * Strings list klass. + */ +#define xmlSecStringListId \ + xmlSecStringListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecStringListGetKlass (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_LIST_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_membuf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_membuf.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,45 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Memory buffer transform + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_MEMBUF_H__ +#define __XMLSEC_MEMBUF_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_transforms.h" + +/******************************************************************** + * + * Memory Buffer transform + * + *******************************************************************/ +/** + * xmlSecTransformMemBufId: + * + * The Memory Buffer transform klass. + */ +#define xmlSecTransformMemBufId \ + xmlSecTransformMemBufGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMemBufGetKlass (void); +XMLSEC_EXPORT xmlSecBufferPtr xmlSecTransformMemBufGetBuffer (xmlSecTransformPtr transform); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MEMBUF_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_nodeset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_nodeset.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,140 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Enchanced nodes Set + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_NODESET_H__ +#define __XMLSEC_NODESET_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" + +typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr; + +/** + * xmlSecNodeSetType: + * @xmlSecNodeSetNormal: nodes set = nodes in the list. + * @xmlSecNodeSetInvert: nodes set = all document nodes minus nodes in the list. + * @xmlSecNodeSetTree: nodes set = nodes in the list and all their subtress. + * @xmlSecNodeSetTreeWithoutComments: nodes set = nodes in the list and + * all their subtress but no comment nodes. + * @xmlSecNodeSetTreeInvert: nodes set = all document nodes minus nodes in the + * list and all their subtress. + * @xmlSecNodeSetTreeWithoutCommentsInvert: nodes set = all document nodes + * minus (nodes in the list and all their subtress + * plus all comment nodes). + * @xmlSecNodeSetList: nodes set = all nodes in the chidren list of nodes sets. + * + * The basic nodes sets types. + */ +typedef enum { + xmlSecNodeSetNormal = 0, + xmlSecNodeSetInvert, + xmlSecNodeSetTree, + xmlSecNodeSetTreeWithoutComments, + xmlSecNodeSetTreeInvert, + xmlSecNodeSetTreeWithoutCommentsInvert, + xmlSecNodeSetList +} xmlSecNodeSetType; + +/** + * xmlSecNodeSetOp: + * @xmlSecNodeSetIntersection: intersection. + * @xmlSecNodeSetSubtraction: subtraction. + * @xmlSecNodeSetUnion: union. + * + * The simple nodes sets operations. + */ +typedef enum { + xmlSecNodeSetIntersection = 0, + xmlSecNodeSetSubtraction, + xmlSecNodeSetUnion +} xmlSecNodeSetOp; + +/** + * xmlSecNodeSet: + * @nodes: the nodes list. + * @doc: the parent XML document. + * @destroyDoc: the flag: if set to 1 then @doc will + * be destroyed when node set is destroyed. + * @type: the nodes set type. + * @op: the operation type. + * @next: the next nodes set. + * @prev: the previous nodes set. + * @children: the children list (valid only if type + * equal to #xmlSecNodeSetList). + * + * The enchanced nodes set. + */ +struct _xmlSecNodeSet { + xmlNodeSetPtr nodes; + xmlDocPtr doc; + int destroyDoc; + xmlSecNodeSetType type; + xmlSecNodeSetOp op; + xmlSecNodeSetPtr next; + xmlSecNodeSetPtr prev; + xmlSecNodeSetPtr children; +}; + +/** + * xmlSecNodeSetWalkCallback: + * @nset: the pointer to #xmlSecNodeSet structure. + * @cur: the pointer current XML node. + * @parent: the pointer to the @cur parent node. + * @data: the pointer to application specific data. + * + * The callback function called once per each node in the nodes set. + * + * Returns 0 on success or a negative value if an error occurs + * an walk procedure should be interrupted. + */ +typedef int (*xmlSecNodeSetWalkCallback) (xmlSecNodeSetPtr nset, + xmlNodePtr cur, + xmlNodePtr parent, + void* data); + +XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetCreate (xmlDocPtr doc, + xmlNodeSetPtr nodes, + xmlSecNodeSetType type); +XMLSEC_EXPORT void xmlSecNodeSetDestroy (xmlSecNodeSetPtr nset); +XMLSEC_EXPORT void xmlSecNodeSetDocDestroy (xmlSecNodeSetPtr nset); +XMLSEC_EXPORT int xmlSecNodeSetContains (xmlSecNodeSetPtr nset, + xmlNodePtr node, + xmlNodePtr parent); +XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAdd (xmlSecNodeSetPtr nset, + xmlSecNodeSetPtr newNSet, + xmlSecNodeSetOp op); +XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAddList (xmlSecNodeSetPtr nset, + xmlSecNodeSetPtr newNSet, + xmlSecNodeSetOp op); +XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetGetChildren(xmlDocPtr doc, + const xmlNodePtr parent, + int withComments, + int invert); +XMLSEC_EXPORT int xmlSecNodeSetWalk (xmlSecNodeSetPtr nset, + xmlSecNodeSetWalkCallback walkFunc, + void* data); +XMLSEC_EXPORT int xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, + xmlOutputBufferPtr out); +XMLSEC_EXPORT void xmlSecNodeSetDebugDump (xmlSecNodeSetPtr nset, + FILE *output); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_NODESET_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_parser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_parser.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,52 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * XML Parser transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_PARSER_H__ +#define __XMLSEC_PARSER_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_transforms.h" + + +XMLSEC_EXPORT xmlDocPtr xmlSecParseFile (const char *filename); +XMLSEC_EXPORT xmlDocPtr xmlSecParseMemory (const xmlSecByte *buffer, + xmlSecSize size, + int recovery); +XMLSEC_EXPORT xmlDocPtr xmlSecParseMemoryExt (const xmlSecByte *prefix, + xmlSecSize prefixSize, + const xmlSecByte *buffer, + xmlSecSize bufferSize, + const xmlSecByte *postfix, + xmlSecSize postfixSize); + + +/** + * xmlSecTransformXmlParserId: + * + * The XML Parser transform klass. + */ +#define xmlSecTransformXmlParserId \ + xmlSecTransformXmlParserGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXmlParserGetKlass (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_PARSER_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_private.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,504 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * These are internal private declarations. You don't want to use this file + * unless you are building xmlsec or xmlsec- library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_PRIVATE_H__ +#define __XMLSEC_PRIVATE_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_PRIVATE +#error "xmlsec/private.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec- libraries" +#endif /* XMLSEC_PRIVATE */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" + + +/***************************************************************************** + * + * Crypto Init/shutdown + * + ****************************************************************************/ +/** + * xmlSecCryptoInitMethod: + * + * xmlsec-crypto libraryinitialization method. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoInitMethod) (void); +/** + * xmlSecCryptoShutdownMethod: + * + * xmlsec-crypto library shutdown method. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoShutdownMethod) (void); +/** + * xmlSecCryptoKeysMngrInitMethod: + * @mngr: the pointer to keys manager. + * + * Initializes @mngr with xmlsec-crypto library specific data. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoKeysMngrInitMethod) (xmlSecKeysMngrPtr mngr); + +/***************************************************************************** + * + * Key data ids + * + ****************************************************************************/ +/** + * xmlSecCryptoKeyDataGetKlassMethod: + * + * Gets the key data klass. + * + * Returns pointer to key data klass or NULL if an error occurs + * (the xmlsec-crypto library is not loaded or this key data klass is not + * implemented). + */ +typedef xmlSecKeyDataId (*xmlSecCryptoKeyDataGetKlassMethod) (void); + +/***************************************************************************** + * + * Key data store ids + * + ****************************************************************************/ +/** + * xmlSecCryptoKeyDataStoreGetKlassMethod: + * + * Gets the key data store klass. + * + * Returns pointer to key data store klass or NULL if an error occurs + * (the xmlsec-crypto library is not loaded or this key data store klass is not + * implemented). + */ +typedef xmlSecKeyDataStoreId (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void); + +/***************************************************************************** + * + * Crypto transforms ids + * + ****************************************************************************/ +/** + * xmlSecCryptoTransformGetKlassMethod: + * + * Gets the transform klass. + * + * Returns pointer to transform klass or NULL if an error occurs + * (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +typedef xmlSecTransformId (*xmlSecCryptoTransformGetKlassMethod) (void); + +/***************************************************************************** + * + * High level routines form xmlsec command line utility + * + ****************************************************************************/ +/** + * xmlSecCryptoAppInitMethod: + * @config: the path to crypto library configuration. + * + * General crypto engine initialization. This function is used + * by XMLSec command line utility and called before + * @xmlSecInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppInitMethod) (const char* config); +/** + * xmlSecCryptoAppShutdownMethod: + * + * General crypto engine shutdown. This function is used + * by XMLSec command line utility and called after + * @xmlSecShutdown function. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppShutdownMethod) (void); +/** + * xmlSecCryptoAppDefaultKeysMngrInitMethod: + * @mngr: the pointer to keys manager. + * + * Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId + * and a default crypto key data stores. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppDefaultKeysMngrInitMethod) + (xmlSecKeysMngrPtr mngr); +/** + * xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod: + * @mngr: the pointer to keys manager. + * @key: the pointer to key. + * + * Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit + * function. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod) + (xmlSecKeysMngrPtr mngr, + xmlSecKeyPtr key); +/** + * xmlSecCryptoAppDefaultKeysMngrLoadMethod: + * @mngr: the pointer to keys manager. + * @uri: the uri. + * + * Loads XML keys file from @uri to the keys manager @mngr created + * with #xmlSecCryptoAppDefaultKeysMngrInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppDefaultKeysMngrLoadMethod) + (xmlSecKeysMngrPtr mngr, + const char* uri); +/** + * xmlSecCryptoAppDefaultKeysMngrSaveMethod: + * @mngr: the pointer to keys manager. + * @filename: the destination filename. + * @type: the type of keys to save (public/private/symmetric). + * + * Saves keys from @mngr to XML keys file. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppDefaultKeysMngrSaveMethod) + (xmlSecKeysMngrPtr mngr, + const char* filename, + xmlSecKeyDataType type); +/** + * xmlSecCryptoAppKeysMngrCertLoadMethod: + * @mngr: the keys manager. + * @filename: the certificate file. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate in @filename + * trusted or not. + * + * Reads cert from @filename and adds to the list of trusted or known + * untrusted certs in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecKeysMngrPtr mngr, + const char *filename, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +/** + * xmlSecCryptoAppKeysMngrCertLoadMemoryMethod: + * @mngr: the keys manager. + * @data: the key data. + * @dataSize: the key data size. + * @format: the certificate format. + * @type: the flag that indicates is the certificate in @data + * trusted or not. + * + * Reads cert from @data and adds to the list of trusted or known + * untrusted certs in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppKeysMngrCertLoadMemoryMethod)(xmlSecKeysMngrPtr mngr, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +/** + * xmlSecCryptoAppKeyLoadMethod: + * @filename: the key filename. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the a file. + * + * Returns pointer to the key or NULL if an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMethod) (const char *filename, + xmlSecKeyDataFormat format, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); + + +/** + * xmlSecCryptoAppKeyLoadMethod: + * @filename: the key filename. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the a file. + * + * Returns pointer to the key or NULL if an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadWithNameMethod) (const char *filename, + xmlSecKeyDataFormat format, + const char *keyname, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); + + +/** + * xmlSecCryptoAppKeyLoadMemoryMethod: + * @data: the key data. + * @dataSize: the key data size. + * @format: the key data format. + * @pwd: the key data password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the binary data buffer. + * + * Returns pointer to the key or NULL if an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMemoryMethod) (const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); + + +/** + * xmlSecCryptoAppPkcs12LoadMethod: + * @filename: the PKCS12 key filename. + * @pwd: the PKCS12 file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 file. + * For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMethod) (const char* filename, + const char* pwd, + void* pwdCallback, + void* pwdCallbackCtx); +/** + * xmlSecCryptoAppPkcs12LoadMemoryMethod: + * @data: the pkcs12 data. + * @dataSize: the pkcs12 data size. + * @pwd: the PKCS12 data password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 binary data. + * For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMemoryMethod)(const xmlSecByte* data, + xmlSecSize dataSize, + const char* pwd, + void* pwdCallback, + void* pwdCallbackCtx); +/** + * xmlSecCryptoAppKeyCertLoadMethod: + * @key: the pointer to key. + * @filename: the certificate filename. + * @format: the certificate file format. + * + * Reads the certificate from $@filename and adds it to key. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppKeyCertLoadMethod) (xmlSecKeyPtr key, + const char* filename, + xmlSecKeyDataFormat format); + +/** + * xmlSecCryptoAppKeyCertLoadMemoryMethod: + * @key: the pointer to key. + * @data: the cert data. + * @dataSize: the cert data size. + * @format: the certificate data format. + * + * Reads the certificate from binary @data buffer and adds it to key. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSecKeyPtr key, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format); +/** + * xmlSecCryptoDLFunctions: + * @cryptoInit: the xmlsec-crypto library initialization method. + * @cryptoShutdown: the xmlsec-crypto library shutdown method. + * @cryptoKeysMngrInit: the xmlsec-crypto library keys manager init method. + * @keyDataAesGetKlass: the method to get pointer to AES key data klass. + * @keyDataDesGetKlass: the method to get pointer to DES key data klass. + * @keyDataDsaGetKlass: the method to get pointer to DSA key data klass. + * @keyDataHmacGetKlass: the method to get pointer to HMAC key data klass. + * @keyDataRsaGetKlass: the method to get pointer to RSA key data klass. + * @keyDataX509GetKlass: the method to get pointer to X509 key data klass. + * @keyDataRawX509CertGetKlass: the method to get pointer to raw X509 cert key data klass. + * @x509StoreGetKlass: the method to get pointer to X509 key data store. + * @transformAes128CbcGetKlass: the method to get pointer to AES 128 encryption transform. + * @transformAes192CbcGetKlass: the method to get pointer to AES 192 encryption transform. + * @transformAes256CbcGetKlass: the method to get pointer to AES 256 encryption transform. + * @transformKWAes128GetKlass: the method to get pointer to AES 128 key wrapper transform. + * @transformKWAes192GetKlass: the method to get pointer to AES 192 key wrapper transform. + * @transformKWAes256GetKlass: the method to get pointer to AES 256 key wrapper transform. + * @transformDes3CbcGetKlass: the method to get pointer to Triple DES encryption transform. + * @transformKWDes3GetKlass: the method to get pointer to Triple DES key wrapper transform. + * @transformDsaSha1GetKlass: the method to get pointer to DSA-SHA1 signature transform. + * @transformHmacMd5GetKlass: the method to get pointer to HMAC-MD5 transform. + * @transformHmacRipemd160GetKlass: the method to get pointer to HMAC-RIPEMD160 transform. + * @transformHmacSha1GetKlass: the method to get pointer to HMAC-SHA1 transform. + * @transformHmacSha224GetKlass: the method to get pointer to HMAC-SHA224 transform. + * @transformHmacSha256GetKlass: the method to get pointer to HMAC-SHA256 transform. + * @transformHmacSha384GetKlass: the method to get pointer to HMAC-SHA384 transform. + * @transformHmacSha512GetKlass: the method to get pointer to HMAC-SHA512 transform. + * @transformMd5GetKlass: the method to get pointer to MD5 digest transform. + * @transformRipemd160GetKlass: the method to get pointer to RIPEMD160 digest transform. + * @transformRsaMd5GetKlass: the method to get pointer to RSA-MD5 signature transform. + * @transformRsaRipemd160GetKlass: the method to get pointer to RSA-RIPEMD160 signature transform. + * @transformRsaSha1GetKlass: the method to get pointer to RSA-SHA1 signature transform. + * @transformRsaSha224GetKlass: the method to get pointer to RSA-SHA224 signature transform. + * @transformRsaSha256GetKlass: the method to get pointer to RSA-SHA256 signature transform. + * @transformRsaSha384GetKlass: the method to get pointer to RSA-SHA384 signature transform. + * @transformRsaSha512GetKlass: the method to get pointer to RSA-SHA512 signature transform. + * @transformRsaPkcs1GetKlass: the method to get pointer to RSA-PKCS1_5 key transport transform. + * @transformRsaOaepGetKlass: the method to get pointer to RSA-OAEP key transport transform. + * @transformSha1GetKlass: the method to get pointer to SHA1 digest transform. + * @transformSha224GetKlass: the method to get pointer to SHA224 digest transform. + * @transformSha256GetKlass: the method to get pointer to SHA256 digest transform. + * @transformSha384GetKlass: the method to get pointer to SHA384 digest transform. + * @transformSha512GetKlass: the method to get pointer to SHA512 digest transform. + * @cryptoAppInit: the default crypto engine initialization method. + * @cryptoAppShutdown: the default crypto engine shutdown method. + * @cryptoAppDefaultKeysMngrInit: the default keys manager init method. + * @cryptoAppDefaultKeysMngrAdoptKey: the default keys manager adopt key method. + * @cryptoAppDefaultKeysMngrLoad: the default keys manager load method. + * @cryptoAppDefaultKeysMngrSave: the default keys manager save method. + * @cryptoAppKeysMngrCertLoad: the default keys manager file cert load method. + * @cryptoAppKeysMngrCertLoadMemory: the default keys manager memory cert load method. + * @cryptoAppKeyLoad: the key file load method. + * @cryptoAppKeyLoadMemory: the meory key load method. + * @cryptoAppPkcs12Load: the pkcs12 file load method. + * @cryptoAppPkcs12LoadMemory: the memory pkcs12 load method. + * @cryptoAppKeyCertLoad: the cert file load method. + * @cryptoAppKeyCertLoadMemory: the memory cert load method. + * @cryptoAppDefaultPwdCallback:the default password callback. + * + * The list of crypto engine functions, key data and transform classes. + */ +struct _xmlSecCryptoDLFunctions { + /** + * Crypto Init/shutdown + */ + xmlSecCryptoInitMethod cryptoInit; + xmlSecCryptoShutdownMethod cryptoShutdown; + xmlSecCryptoKeysMngrInitMethod cryptoKeysMngrInit; + + /** + * Key data ids + */ + xmlSecCryptoKeyDataGetKlassMethod keyDataAesGetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataDesGetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataDsaGetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataHmacGetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataRsaGetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataX509GetKlass; + xmlSecCryptoKeyDataGetKlassMethod keyDataRawX509CertGetKlass; + + /** + * Key data store ids + */ + xmlSecCryptoKeyDataStoreGetKlassMethod x509StoreGetKlass; + + /** + * Crypto transforms ids + */ + xmlSecCryptoTransformGetKlassMethod transformAes128CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes192CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes256CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformKWAes128GetKlass; + xmlSecCryptoTransformGetKlassMethod transformKWAes192GetKlass; + xmlSecCryptoTransformGetKlassMethod transformKWAes256GetKlass; + xmlSecCryptoTransformGetKlassMethod transformDes3CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformKWDes3GetKlass; + xmlSecCryptoTransformGetKlassMethod transformDsaSha1GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacMd5GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacRipemd160GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacSha1GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacSha224GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacSha256GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacSha384GetKlass; + xmlSecCryptoTransformGetKlassMethod transformHmacSha512GetKlass; + xmlSecCryptoTransformGetKlassMethod transformMd5GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRipemd160GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaMd5GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaRipemd160GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaSha1GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaSha224GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaSha256GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaSha384GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaSha512GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaPkcs1GetKlass; + xmlSecCryptoTransformGetKlassMethod transformRsaOaepGetKlass; + xmlSecCryptoTransformGetKlassMethod transformSha1GetKlass; + xmlSecCryptoTransformGetKlassMethod transformSha224GetKlass; + xmlSecCryptoTransformGetKlassMethod transformSha256GetKlass; + xmlSecCryptoTransformGetKlassMethod transformSha384GetKlass; + xmlSecCryptoTransformGetKlassMethod transformSha512GetKlass; + + /** + * High level routines form xmlsec command line utility + */ + xmlSecCryptoAppInitMethod cryptoAppInit; + xmlSecCryptoAppShutdownMethod cryptoAppShutdown; + xmlSecCryptoAppDefaultKeysMngrInitMethod cryptoAppDefaultKeysMngrInit; + xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod cryptoAppDefaultKeysMngrAdoptKey; + xmlSecCryptoAppDefaultKeysMngrLoadMethod cryptoAppDefaultKeysMngrLoad; + xmlSecCryptoAppDefaultKeysMngrSaveMethod cryptoAppDefaultKeysMngrSave; + xmlSecCryptoAppKeysMngrCertLoadMethod cryptoAppKeysMngrCertLoad; + xmlSecCryptoAppKeysMngrCertLoadMemoryMethod cryptoAppKeysMngrCertLoadMemory; + xmlSecCryptoAppKeyLoadMethod cryptoAppKeyLoad; + xmlSecCryptoAppKeyLoadWithNameMethod cryptoAppKeyLoadWithName; //Venus: add for Symbian + xmlSecCryptoAppKeyLoadMemoryMethod cryptoAppKeyLoadMemory; + xmlSecCryptoAppPkcs12LoadMethod cryptoAppPkcs12Load; + xmlSecCryptoAppPkcs12LoadMemoryMethod cryptoAppPkcs12LoadMemory; + xmlSecCryptoAppKeyCertLoadMethod cryptoAppKeyCertLoad; + xmlSecCryptoAppKeyCertLoadMemoryMethod cryptoAppKeyCertLoadMemory; + void* cryptoAppDefaultPwdCallback; +}; + +#include +#define xmlSecStrPrintf xmlStrPrintf +#define xmlSecStrVPrintf xmlStrVPrintf + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_PRIVATE_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_privatexkms.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_privatexkms.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,121 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Key Management Specification v 2.0" implementation + * http://www.w3.org/TR/xkms2/ + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + */ +#ifndef __XMLSEC_PRIVATE_XKMS_H__ +#define __XMLSEC_PRIVATE_XKMS_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_PRIVATE +#error "xmlsec/private/xkms.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec- libraries" +#endif /* XMLSEC_PRIVATE */ + +#ifndef XMLSEC_NO_XKMS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" +#include "xmlsec_xkms.h" + +/************************************************************************ + * + * XKMS RespondWith Klass + * + ************************************************************************/ +typedef int (*xmlSecXkmsRespondWithNodeReadMethod) (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +typedef int (*xmlSecXkmsRespondWithNodeWriteMethod) (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +struct _xmlSecXkmsRespondWithKlass { + const xmlChar* valueName; + const xmlChar* valueNs; + + const xmlChar* nodeName; + const xmlChar* nodeNs; + + xmlSecXkmsRespondWithNodeReadMethod readNode; + xmlSecXkmsRespondWithNodeWriteMethod writeNode; + + void* reserved1; + void* reserved2; +}; + +#define xmlSecXkmsRespondWithKlassGetName(id) \ + ((((id) != NULL) && ((id)->valueName != NULL)) ? (id)->valueName : NULL) + +/************************************************************************ + * + * XKMS ServerRequest Klass + * + ************************************************************************/ +typedef int (*xmlSecXkmsServerRequestNodeReadMethod) + (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +typedef int (*xmlSecXkmsServerRequestExecuteMethod) + (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx); +typedef int (*xmlSecXkmsServerRequestNodeWriteMethod) + (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +struct _xmlSecXkmsServerRequestKlass { + const xmlChar* name; + const xmlChar* requestNodeName; + const xmlChar* requestNodeNs; + const xmlChar* resultNodeName; + const xmlChar* resultNodeNs; + xmlSecBitMask flags; + + xmlSecXkmsServerRequestNodeReadMethod readNode; + xmlSecXkmsServerRequestNodeWriteMethod writeNode; + xmlSecXkmsServerRequestExecuteMethod execute; + + void* reserved1; + void* reserved2; +}; + +#define xmlSecXkmsServerRequestKlassGetName(id) \ + ((((id) != NULL) && ((id)->name != NULL)) ? (id)->name : NULL) + + +/************************************************************************ + * + * XKMS ServerRequest Klass flags + * + ************************************************************************/ +/** + * XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND: + * + * The server request klass is allowed in xkms:CompoundRequest element. + */ +#define XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND 0x00000001 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_XKMS */ + +#endif /* __XMLSEC_PRIVATE_XKMS_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_soap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_soap.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,131 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Simple SOAP messages parsing/creation. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SOAP_H__ +#define __XMLSEC_SOAP_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_SOAP + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_xmlsec.h" + + +/*********************************************************************** + * + * SOAP 1.1 + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11CreateEnvelope (xmlDocPtr doc); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11EnsureHeader (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddBodyEntry (xmlNodePtr envNode, + xmlNodePtr entryNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddFaultEntry (xmlNodePtr envNode, + const xmlChar* faultCodeHref, + const xmlChar* faultCodeLocalPart, + const xmlChar* faultString, + const xmlChar* faultActor); +XMLSEC_EXPORT int xmlSecSoap11CheckEnvelope (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetHeader (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBody (xmlNodePtr envNode); +XMLSEC_EXPORT xmlSecSize xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBodyEntry (xmlNodePtr envNode, + xmlSecSize pos); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode); + + +/*********************************************************************** + * + * SOAP 1.2 + * + **********************************************************************/ +/** + * xmlSecSoap12FaultCode: + * @xmlSecSoap12FaultCodeUnknown: The fault code is not available. + * @xmlSecSoap12FaultCodeVersionMismatch: The faulting node found an + * invalid element information + * item instead of the expected + * Envelope element information item. + * @xmlSecSoap12FaultCodeMustUnderstand: An immediate child element + * information item of the SOAP + * Header element information item + * targeted at the faulting node + * that was not understood by the + * faulting node contained a SOAP + * mustUnderstand attribute + * information item with a value of "true" + * @xmlSecSoap12FaultCodeDataEncodingUnknown: A SOAP header block or SOAP + * body child element information + * item targeted at the faulting + * SOAP node is scoped with a data + * encoding that the faulting node + * does not support. + * @xmlSecSoap12FaultCodeSender: The message was incorrectly + * formed or did not contain the + * appropriate information in order + * to succeed. + * @xmlSecSoap12FaultCodeReceiver: The message could not be processed + * for reasons attributable to the + * processing of the message rather + * than to the contents of the + * message itself. + * + * The values of the child element information item of the + * element information item (http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultcodes). + */ +typedef enum { + xmlSecSoap12FaultCodeUnknown = 0, + xmlSecSoap12FaultCodeVersionMismatch, + xmlSecSoap12FaultCodeMustUnderstand, + xmlSecSoap12FaultCodeDataEncodingUnknown, + xmlSecSoap12FaultCodeSender, + xmlSecSoap12FaultCodeReceiver +} xmlSecSoap12FaultCode; + +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12CreateEnvelope (xmlDocPtr doc); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12EnsureHeader (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddBodyEntry (xmlNodePtr envNode, + xmlNodePtr entryNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultEntry (xmlNodePtr envNode, + xmlSecSoap12FaultCode faultCode, + const xmlChar* faultReasonText, + const xmlChar* faultReasonLang, + const xmlChar* faultNodeURI, + const xmlChar* faultRole); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultSubcode (xmlNodePtr faultNode, + const xmlChar* subCodeHref, + const xmlChar* subCodeName); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultReasonText (xmlNodePtr faultNode, + const xmlChar* faultReasonText, + const xmlChar* faultReasonLang); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultDetailEntry (xmlNodePtr faultNode, + xmlNodePtr detailEntryNode); +XMLSEC_EXPORT int xmlSecSoap12CheckEnvelope (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetHeader (xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBody (xmlNodePtr envNode); +XMLSEC_EXPORT xmlSecSize xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBodyEntry (xmlNodePtr envNode, + xmlSecSize pos); +XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetFaultEntry (xmlNodePtr envNode); + + +#endif /* XMLSEC_NO_SOAP */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_SOAP_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_strings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_strings.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2297 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * All the string constans. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_STRINGS_H__ +#define __XMLSEC_STRINGS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" + + +#ifdef __SYMBIAN32__ +/* Venus: defining global strings in Symbian */ + +typedef struct _xmlSecGlobalConstData xmlSecGlobalConstData; + +struct _xmlSecGlobalConstData{ + + +/************************************************************************* + * + * Global Namespaces + * + ************************************************************************/ +const xmlChar* const xmlSecNs; +const xmlChar* const xmlSecDSigNs; +const xmlChar* const xmlSecEncNs; +const xmlChar* const xmlSecXkmsNs; +const xmlChar* const xmlSecXPathNs; +const xmlChar* const xmlSecXPath2Ns; +const xmlChar* const xmlSecXPointerNs; +const xmlChar* const xmlSecSoap11Ns; +const xmlChar* const xmlSecSoap12Ns; + +/************************************************************************* + * + * DSig Nodes + * + ************************************************************************/ +const xmlChar* const xmlSecNodeSignature; +const xmlChar* const xmlSecNodeSignedInfo; +const xmlChar* const xmlSecNodeSignatureValue; +const xmlChar* const xmlSecNodeCanonicalizationMethod; +const xmlChar* const xmlSecNodeSignatureMethod; +const xmlChar* const xmlSecNodeDigestMethod; +const xmlChar* const xmlSecNodeDigestValue; +const xmlChar* const xmlSecNodeObject; +const xmlChar* const xmlSecNodeManifest; +const xmlChar* const xmlSecNodeSignatureProperties; + +/************************************************************************* + * + * Encryption Nodes + * + ************************************************************************/ +const xmlChar* const xmlSecNodeEncryptedData; +const xmlChar* const xmlSecNodeEncryptionMethod; +const xmlChar* const xmlSecNodeEncryptionProperties; +const xmlChar* const xmlSecNodeEncryptionProperty; +const xmlChar* const xmlSecNodeCipherData; +const xmlChar* const xmlSecNodeCipherValue; +const xmlChar* const xmlSecNodeCipherReference; +const xmlChar* const xmlSecNodeReferenceList; +const xmlChar* const xmlSecNodeDataReference; +const xmlChar* const xmlSecNodeKeyReference; +const xmlChar* const xmlSecNodeCarriedKeyName; + +const xmlChar* const xmlSecTypeEncContent; +const xmlChar* const xmlSecTypeEncElement; + +/************************************************************************* + * + * XKMS nodes, attributes and value strings + * + ************************************************************************/ +#ifndef XMLSEC_NO_XKMS +const xmlChar* const xmlSecXkmsServerRequestResultName; +const xmlChar* const xmlSecXkmsServerRequestStatusName; +const xmlChar* const xmlSecXkmsServerRequestLocateName; +const xmlChar* const xmlSecXkmsServerRequestValidateName; +const xmlChar* const xmlSecXkmsServerRequestCompoundName; + +const xmlChar* const xmlSecNodeResult; +const xmlChar* const xmlSecNodeStatusRequest; +const xmlChar* const xmlSecNodeStatusResult; +const xmlChar* const xmlSecNodeLocateRequest; +const xmlChar* const xmlSecNodeLocateResult; +const xmlChar* const xmlSecNodeValidateRequest; +const xmlChar* const xmlSecNodeValidateResult; +const xmlChar* const xmlSecNodeCompoundRequest; +const xmlChar* const xmlSecNodeCompoundResult; + +const xmlChar* const xmlSecNodeMessageExtension; +const xmlChar* const xmlSecNodeOpaqueClientData; +const xmlChar* const xmlSecNodeResponseMechanism; +const xmlChar* const xmlSecNodeRespondWith; +const xmlChar* const xmlSecNodePendingNotification; +const xmlChar* const xmlSecNodeQueryKeyBinding; +const xmlChar* const xmlSecNodeKeyUsage; +const xmlChar* const xmlSecNodeUseKeyWith; +const xmlChar* const xmlSecNodeTimeInstant; +const xmlChar* const xmlSecNodeRequestSignatureValue; +const xmlChar* const xmlSecNodeUnverifiedKeyBinding; +const xmlChar* const xmlSecNodeValidityInterval; +const xmlChar* const xmlSecNodeStatus; +const xmlChar* const xmlSecNodeValidReason; +const xmlChar* const xmlSecNodeInvalidReason; +const xmlChar* const xmlSecNodeIndeterminateReason; + + +const xmlChar* const xmlSecAttrService; +const xmlChar* const xmlSecAttrNonce; +const xmlChar* const xmlSecAttrOriginalRequestId; +const xmlChar* const xmlSecAttrResponseLimit; +const xmlChar* const xmlSecAttrMechanism; +const xmlChar* const xmlSecAttrIdentifier; +const xmlChar* const xmlSecAttrApplication; +const xmlChar* const xmlSecAttrResultMajor; +const xmlChar* const xmlSecAttrResultMinor; +const xmlChar* const xmlSecAttrRequestId; +const xmlChar* const xmlSecAttrNotBefore; +const xmlChar* const xmlSecAttrNotOnOrAfter; +const xmlChar* const xmlSecAttrTime; +const xmlChar* const xmlSecAttrStatusValue; + +const xmlChar* const xmlSecResponseMechanismPending; +const xmlChar* const xmlSecResponseMechanismRepresent; +const xmlChar* const xmlSecResponseMechanismRequestSignatureValue; + +const xmlChar* const xmlSecRespondWithKeyName; +const xmlChar* const xmlSecRespondWithKeyValue; +const xmlChar* const xmlSecRespondWithX509Cert; +const xmlChar* const xmlSecRespondWithX509Chain; +const xmlChar* const xmlSecRespondWithX509CRL; +const xmlChar* const xmlSecRespondWithOCSP; +const xmlChar* const xmlSecRespondWithRetrievalMethod; +const xmlChar* const xmlSecRespondWithPGP; +const xmlChar* const xmlSecRespondWithPGPWeb; +const xmlChar* const xmlSecRespondWithSPKI; +const xmlChar* const xmlSecRespondWithPrivateKey; + +const xmlChar* const xmlSecStatusResultSuccess; +const xmlChar* const xmlSecStatusResultFailed; +const xmlChar* const xmlSecStatusResultPending; + +const xmlChar* const xmlSecKeyUsageEncryption; +const xmlChar* const xmlSecKeyUsageSignature; +const xmlChar* const xmlSecKeyUsageExchange; + +const xmlChar* const xmlSecKeyBindingStatusValid; +const xmlChar* const xmlSecKeyBindingStatusInvalid; +const xmlChar* const xmlSecKeyBindingStatusIndeterminate; + +const xmlChar* const xmlSecKeyBindingReasonIssuerTrust; +const xmlChar* const xmlSecKeyBindingReasonRevocationStatus; +const xmlChar* const xmlSecKeyBindingReasonValidityInterval; +const xmlChar* const xmlSecKeyBindingReasonSignature; + +const xmlChar* const xmlSecResultMajorCodeSuccess; +const xmlChar* const xmlSecResultMajorCodeVersionMismatch; +const xmlChar* const xmlSecResultMajorCodeSender; +const xmlChar* const xmlSecResultMajorCodeReceiver; +const xmlChar* const xmlSecResultMajorCodeRepresent; +const xmlChar* const xmlSecResultMajorCodePending; + +const xmlChar* const xmlSecResultMinorCodeNoMatch; +const xmlChar* const xmlSecResultMinorCodeTooManyResponses; +const xmlChar* const xmlSecResultMinorCodeIncomplete; +const xmlChar* const xmlSecResultMinorCodeFailure; +const xmlChar* const xmlSecResultMinorCodeRefused; +const xmlChar* const xmlSecResultMinorCodeNoAuthentication; +const xmlChar* const xmlSecResultMinorCodeMessageNotSupported; +const xmlChar* const xmlSecResultMinorCodeUnknownResponseId; +const xmlChar* const xmlSecResultMinorCodeNotSynchronous; + +const xmlChar* const xmlSecXkmsSoapFaultReasonLang; +const xmlChar* const xmlSecXkmsSoapFaultReasonUnsupportedVersion; +const xmlChar* const xmlSecXkmsSoapFaultReasonUnableToProcess; +const xmlChar* const xmlSecXkmsSoapFaultReasonServiceUnavailable; +const xmlChar* const xmlSecXkmsSoapFaultReasonMessageNotSupported; +const xmlChar* const xmlSecXkmsSoapFaultReasonMessageInvalid; + +const xmlChar* const xmlSecXkmsSoapSubcodeValueMessageNotSupported; +const xmlChar* const xmlSecXkmsSoapSubcodeValueBadMessage; + +const xmlChar* const xmlSecXkmsFormatStrPlain; +const xmlChar* const xmlSecXkmsFormatStrSoap11; +const xmlChar* const xmlSecXkmsFormatStrSoap12; + +#endif /* XMLSEC_NO_XKMS */ + +/************************************************************************* + * + * KeyInfo and Transform Nodes + * + ************************************************************************/ +const xmlChar* const xmlSecNodeKeyInfo; +const xmlChar* const xmlSecNodeReference; +const xmlChar* const xmlSecNodeTransforms; +const xmlChar* const xmlSecNodeTransform; + +/************************************************************************* + * + * Attributes + * + ************************************************************************/ +const xmlChar* const xmlSecAttrId; +const xmlChar* const xmlSecAttrURI; +const xmlChar* const xmlSecAttrType; +const xmlChar* const xmlSecAttrMimeType; +const xmlChar* const xmlSecAttrEncoding; +const xmlChar* const xmlSecAttrAlgorithm; +const xmlChar* const xmlSecAttrTarget; +const xmlChar* const xmlSecAttrFilter; +const xmlChar* const xmlSecAttrRecipient; + +/************************************************************************* + * + * AES strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameAESKeyValue; +const xmlChar* const xmlSecNodeAESKeyValue; +const xmlChar* const xmlSecHrefAESKeyValue; + +const xmlChar* const xmlSecNameAes128Cbc; +const xmlChar* const xmlSecHrefAes128Cbc; + +const xmlChar* const xmlSecNameAes192Cbc; +const xmlChar* const xmlSecHrefAes192Cbc; + +const xmlChar* const xmlSecNameAes256Cbc; +const xmlChar* const xmlSecHrefAes256Cbc; + +const xmlChar* const xmlSecNameKWAes128; +const xmlChar* const xmlSecHrefKWAes128; + +const xmlChar* const xmlSecNameKWAes192; +const xmlChar* const xmlSecHrefKWAes192; + +const xmlChar* const xmlSecNameKWAes256; +const xmlChar* const xmlSecHrefKWAes256; + +/************************************************************************* + * + * BASE64 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameBase64; +const xmlChar* const xmlSecHrefBase64; + +/************************************************************************* + * + * C14N strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameC14N; +const xmlChar* const xmlSecHrefC14N; + +const xmlChar* const xmlSecNameC14NWithComments; +const xmlChar* const xmlSecHrefC14NWithComments; + +const xmlChar* const xmlSecNameExcC14N; +const xmlChar* const xmlSecHrefExcC14N; + +const xmlChar* const xmlSecNameExcC14NWithComments; +const xmlChar* const xmlSecHrefExcC14NWithComments; + +const xmlChar* const xmlSecNsExcC14N; +const xmlChar* const xmlSecNsExcC14NWithComments; + +const xmlChar* const xmlSecNodeInclusiveNamespaces; +const xmlChar* const xmlSecAttrPrefixList; + +/************************************************************************* + * + * DES strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameDESKeyValue; +const xmlChar* const xmlSecNodeDESKeyValue; +const xmlChar* const xmlSecHrefDESKeyValue; + +const xmlChar* const xmlSecNameDes3Cbc; +const xmlChar* const xmlSecHrefDes3Cbc; + +const xmlChar* const xmlSecNameKWDes3; +const xmlChar* const xmlSecHrefKWDes3; + +/************************************************************************* + * + * DSA strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameDSAKeyValue; +const xmlChar* const xmlSecNodeDSAKeyValue; +const xmlChar* const xmlSecHrefDSAKeyValue; + +const xmlChar* const xmlSecNodeDSAP; +const xmlChar* const xmlSecNodeDSAQ; +const xmlChar* const xmlSecNodeDSAG; +const xmlChar* const xmlSecNodeDSAJ; +const xmlChar* const xmlSecNodeDSAX; +const xmlChar* const xmlSecNodeDSAY; +const xmlChar* const xmlSecNodeDSASeed; +const xmlChar* const xmlSecNodeDSAPgenCounter; + + +const xmlChar* const xmlSecNameDsaSha1; +const xmlChar* const xmlSecHrefDsaSha1; + +/************************************************************************* + * + * EncryptedKey + * + ************************************************************************/ +const xmlChar* const xmlSecNameEncryptedKey; +const xmlChar* const xmlSecNodeEncryptedKey; +const xmlChar* const xmlSecHrefEncryptedKey; + +/************************************************************************* + * + * Enveloped transform strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameEnveloped; +const xmlChar* const xmlSecHrefEnveloped; + +/************************************************************************* + * + * HMAC strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameHMACKeyValue; +const xmlChar* const xmlSecNodeHMACKeyValue; +const xmlChar* const xmlSecHrefHMACKeyValue; + +const xmlChar* const xmlSecNodeHMACOutputLength; + +const xmlChar* const xmlSecNameHmacMd5; +const xmlChar* const xmlSecHrefHmacMd5; + +const xmlChar* const xmlSecNameHmacRipemd160; +const xmlChar* const xmlSecHrefHmacRipemd160; + +const xmlChar* const xmlSecNameHmacSha1; +const xmlChar* const xmlSecHrefHmacSha1; + +const xmlChar* const xmlSecNameHmacSha224; +const xmlChar* const xmlSecHrefHmacSha224; + +const xmlChar* const xmlSecNameHmacSha256; +const xmlChar* const xmlSecHrefHmacSha256; + +const xmlChar* const xmlSecNameHmacSha384; +const xmlChar* const xmlSecHrefHmacSha384; + +const xmlChar* const xmlSecNameHmacSha512; +const xmlChar* const xmlSecHrefHmacSha512; + +/************************************************************************* + * + * KeyName strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameKeyName; +const xmlChar* const xmlSecNodeKeyName; + +/************************************************************************* + * + * KeyValue strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameKeyValue; +const xmlChar* const xmlSecNodeKeyValue; + +/************************************************************************* + * + * Memory Buffer strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameMemBuf; + +/************************************************************************* + * + * MD5 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameMd5; +const xmlChar* const xmlSecHrefMd5; + +/************************************************************************* + * + * RetrievalMethod + * + ************************************************************************/ +const xmlChar* const xmlSecNameRetrievalMethod; +const xmlChar* const xmlSecNodeRetrievalMethod; + +/************************************************************************* + * + * RIPEMD160 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameRipemd160; +const xmlChar* const xmlSecHrefRipemd160; + +/************************************************************************* + * + * RSA strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameRSAKeyValue; +const xmlChar* const xmlSecNodeRSAKeyValue; +const xmlChar* const xmlSecHrefRSAKeyValue; + +const xmlChar* const xmlSecNodeRSAModulus; +const xmlChar* const xmlSecNodeRSAExponent; +const xmlChar* const xmlSecNodeRSAPrivateExponent; + +const xmlChar* const xmlSecNameRsaMd5; +const xmlChar* const xmlSecHrefRsaMd5; + +const xmlChar* const xmlSecNameRsaRipemd160; +const xmlChar* const xmlSecHrefRsaRipemd160; + +const xmlChar* const xmlSecNameRsaSha1; +const xmlChar* const xmlSecHrefRsaSha1; + +const xmlChar* const xmlSecNameRsaSha224; +const xmlChar* const xmlSecHrefRsaSha224; + +const xmlChar* const xmlSecNameRsaSha256; +const xmlChar* const xmlSecHrefRsaSha256; + +const xmlChar* const xmlSecNameRsaSha384; +const xmlChar* const xmlSecHrefRsaSha384; + +const xmlChar* const xmlSecNameRsaSha512; +const xmlChar* const xmlSecHrefRsaSha512; + +const xmlChar* const xmlSecNameRsaPkcs1; +const xmlChar* const xmlSecHrefRsaPkcs1; + +const xmlChar* const xmlSecNameRsaOaep; +const xmlChar* const xmlSecHrefRsaOaep; +const xmlChar* const xmlSecNodeRsaOAEPparams; + +/************************************************************************* + * + * SHA1 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameSha1; +const xmlChar* const xmlSecHrefSha1; + +const xmlChar* const xmlSecNameSha224; +const xmlChar* const xmlSecHrefSha224; + +const xmlChar* const xmlSecNameSha256; +const xmlChar* const xmlSecHrefSha256; + +const xmlChar* const xmlSecNameSha384; +const xmlChar* const xmlSecHrefSha384; + +const xmlChar* const xmlSecNameSha512; +const xmlChar* const xmlSecHrefSha512; + +/************************************************************************* + * + * X509 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameX509Data; +const xmlChar* const xmlSecNodeX509Data; +const xmlChar* const xmlSecHrefX509Data; + +const xmlChar* const xmlSecNodeX509Certificate; +const xmlChar* const xmlSecNodeX509CRL; +const xmlChar* const xmlSecNodeX509SubjectName; +const xmlChar* const xmlSecNodeX509IssuerSerial; +const xmlChar* const xmlSecNodeX509IssuerName; +const xmlChar* const xmlSecNodeX509SerialNumber; +const xmlChar* const xmlSecNodeX509SKI; + +const xmlChar* const xmlSecNameRawX509Cert; +const xmlChar* const xmlSecHrefRawX509Cert; + +const xmlChar* const xmlSecNameX509Store; + +/************************************************************************* + * + * PGP strings + * + ************************************************************************/ +const xmlChar* const xmlSecNamePGPData; +const xmlChar* const xmlSecNodePGPData; +const xmlChar* const xmlSecHrefPGPData; + +/************************************************************************* + * + * SPKI strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameSPKIData; +const xmlChar* const xmlSecNodeSPKIData; +const xmlChar* const xmlSecHrefSPKIData; + +/************************************************************************* + * + * XPath/XPointer strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameXPath; +const xmlChar* const xmlSecNodeXPath; + +const xmlChar* const xmlSecNameXPath2; +const xmlChar* const xmlSecNodeXPath2; +const xmlChar* const xmlSecXPath2FilterIntersect; +const xmlChar* const xmlSecXPath2FilterSubtract; +const xmlChar* const xmlSecXPath2FilterUnion; +const xmlChar* const xmlSecNameXPointer; +const xmlChar* const xmlSecNodeXPointer; + +/************************************************************************* + * + * Xslt strings + * + ************************************************************************/ +const xmlChar* const xmlSecNameXslt; +const xmlChar* const xmlSecHrefXslt; + +#ifndef XMLSEC_NO_SOAP +/************************************************************************* + * + * SOAP 1.1/1.2 strings + * + ************************************************************************/ +const xmlChar* const xmlSecNodeEnvelope; +const xmlChar* const xmlSecNodeHeader; +const xmlChar* const xmlSecNodeBody; +const xmlChar* const xmlSecNodeFault; +const xmlChar* const xmlSecNodeFaultCode; +const xmlChar* const xmlSecNodeFaultString; +const xmlChar* const xmlSecNodeFaultActor; +const xmlChar* const xmlSecNodeFaultDetail; +const xmlChar* const xmlSecNodeCode; +const xmlChar* const xmlSecNodeReason; +const xmlChar* const xmlSecNodeNode; +const xmlChar* const xmlSecNodeRole; +const xmlChar* const xmlSecNodeDetail; +const xmlChar* const xmlSecNodeValue; +const xmlChar* const xmlSecNodeSubcode; +const xmlChar* const xmlSecNodeText; + +const xmlChar* const xmlSecSoapFaultCodeVersionMismatch; +const xmlChar* const xmlSecSoapFaultCodeMustUnderstand; +const xmlChar* const xmlSecSoapFaultCodeClient; +const xmlChar* const xmlSecSoapFaultCodeServer; +const xmlChar* const xmlSecSoapFaultCodeReceiver; +const xmlChar* const xmlSecSoapFaultCodeSender; +const xmlChar* const xmlSecSoapFaultDataEncodningUnknown; + + +#endif /* XMLSEC_NO_SOAP */ + +/************************************************************************* + * + * Utility strings + * + ************************************************************************/ +const xmlChar* const xmlSecStringEmpty; +const xmlChar* const xmlSecStringCR; + +}; //struct _xmlSecGlobalConstData + +XMLSEC_EXPORT_VAR2 const xmlSecGlobalConstData xmlSecGlobalConsts; + +/************************************************************************* + * + * Venus: The following section defines xmlsec global strings for xmlsec dll in + * Symbian. We cannot use global const struct with exported function + * (next section) to access the global strings, because of constant + * static data initialization. Compilation errors will be resulted. + * + ************************************************************************/ +#ifdef IN_XMLSEC +/************************************************************************* + * + * Global Namespaces + * + ************************************************************************/ +#define xmlSecNs BAD_CAST "http://www.aleksey.com/xmlsec/2002" +#define xmlSecDSigNs BAD_CAST "http://www.w3.org/2000/09/xmldsig#" +#define xmlSecEncNs BAD_CAST "http://www.w3.org/2001/04/xmlenc#" +#define xmlSecXkmsNs BAD_CAST "http://www.w3.org/2002/03/xkms#" +#define xmlSecXPathNs BAD_CAST "http://www.w3.org/TR/1999/REC-xpath-19991116" +#define xmlSecXPath2Ns BAD_CAST "http://www.w3.org/2002/06/xmldsig-filter2" +#define xmlSecXPointerNs BAD_CAST "http://www.w3.org/2001/04/xmldsig-more/xptr" +#define xmlSecSoap11Ns BAD_CAST "http://schemas.xmlsoap.org/soap/envelope/" +#define xmlSecSoap12Ns BAD_CAST "http://www.w3.org/2002/06/soap-envelope" + +/************************************************************************* + * + * DSig Nodes + * + ************************************************************************/ +#define xmlSecNodeSignature BAD_CAST "Signature" +#define xmlSecNodeSignedInfo BAD_CAST "SignedInfo" +#define xmlSecNodeCanonicalizationMethod BAD_CAST "CanonicalizationMethod" +#define xmlSecNodeSignatureMethod BAD_CAST "SignatureMethod" +#define xmlSecNodeSignatureValue BAD_CAST "SignatureValue" +#define xmlSecNodeDigestMethod BAD_CAST "DigestMethod" +#define xmlSecNodeDigestValue BAD_CAST "DigestValue" +#define xmlSecNodeObject BAD_CAST "Object" +#define xmlSecNodeManifest BAD_CAST "Manifest" +#define xmlSecNodeSignatureProperties BAD_CAST "SignatureProperties" + +/************************************************************************* + * + * Encryption Nodes + * + ************************************************************************/ +#define xmlSecNodeEncryptedData BAD_CAST "EncryptedData" +#define xmlSecNodeEncryptionMethod BAD_CAST "EncryptionMethod" +#define xmlSecNodeEncryptionProperties BAD_CAST "EncryptionProperties" +#define xmlSecNodeEncryptionProperty BAD_CAST "EncryptionProperty" +#define xmlSecNodeCipherData BAD_CAST "CipherData" +#define xmlSecNodeCipherValue BAD_CAST "CipherValue" +#define xmlSecNodeCipherReference BAD_CAST "CipherReference" +#define xmlSecNodeReferenceList BAD_CAST "ReferenceList" +#define xmlSecNodeDataReference BAD_CAST "DataReference" +#define xmlSecNodeKeyReference BAD_CAST "KeyReference" + +#define xmlSecNodeCarriedKeyName BAD_CAST "CarriedKeyName" + +#define xmlSecTypeEncContent BAD_CAST "http://www.w3.org/2001/04/xmlenc#Content" +#define xmlSecTypeEncElement BAD_CAST "http://www.w3.org/2001/04/xmlenc#Element" + +/************************************************************************* + * + * XKMS Nodes + * + ************************************************************************/ +#ifndef XMLSEC_NO_XKMS +#define xmlSecXkmsServerRequestResultName BAD_CAST "result-response" +#define xmlSecXkmsServerRequestStatusName BAD_CAST "status-request" +#define xmlSecXkmsServerRequestLocateName BAD_CAST "locate-request" +#define xmlSecXkmsServerRequestValidateName BAD_CAST "validate-request" +#define xmlSecXkmsServerRequestCompoundName BAD_CAST "compound-request" + +#define xmlSecNodeResult BAD_CAST "Result" +#define xmlSecNodeStatusRequest BAD_CAST "StatusRequest" +#define xmlSecNodeStatusResult BAD_CAST "StatusResult" +#define xmlSecNodeLocateRequest BAD_CAST "LocateRequest" +#define xmlSecNodeLocateResult BAD_CAST "LocateResult" +#define xmlSecNodeValidateRequest BAD_CAST "ValidateRequest" +#define xmlSecNodeValidateResult BAD_CAST "ValidateResult" +#define xmlSecNodeCompoundRequest BAD_CAST "CompoundRequest" +#define xmlSecNodeCompoundResult BAD_CAST "CompoundResult" + +#define xmlSecNodeMessageExtension BAD_CAST "MessageExtension" +#define xmlSecNodeOpaqueClientData BAD_CAST "OpaqueClientData" +#define xmlSecNodeResponseMechanism BAD_CAST "ResponseMechanism" +#define xmlSecNodeRespondWith BAD_CAST "RespondWith" +#define xmlSecNodePendingNotification BAD_CAST "PendingNotification" +#define xmlSecNodeQueryKeyBinding BAD_CAST "QueryKeyBinding" +#define xmlSecNodeKeyUsage BAD_CAST "KeyUsage" +#define xmlSecNodeUseKeyWith BAD_CAST "UseKeyWith" +#define xmlSecNodeTimeInstant BAD_CAST "TimeInstant" +#define xmlSecNodeRequestSignatureValue BAD_CAST "RequestSignatureValue" +#define xmlSecNodeUnverifiedKeyBinding BAD_CAST "UnverifiedKeyBinding" +#define xmlSecNodeValidityInterval BAD_CAST "ValidityInterval" +#define xmlSecNodeStatus BAD_CAST "Status" +#define xmlSecNodeValidReason BAD_CAST "ValidReason" +#define xmlSecNodeInvalidReason BAD_CAST "InvalidReason" +#define xmlSecNodeIndeterminateReason BAD_CAST "IndeterminateReason" + +#define xmlSecAttrService BAD_CAST "Service" +#define xmlSecAttrNonce BAD_CAST "Nonce" +#define xmlSecAttrOriginalRequestId BAD_CAST "OriginalRequestId" +#define xmlSecAttrResponseLimit BAD_CAST "ResponseLimit" +#define xmlSecAttrMechanism BAD_CAST "Mechanism[" +#define xmlSecAttrIdentifier BAD_CAST "Identifier" +#define xmlSecAttrApplication BAD_CAST "Application" +#define xmlSecAttrResultMajor BAD_CAST "ResultMajor" +#define xmlSecAttrResultMinor BAD_CAST "ResultMinor" +#define xmlSecAttrRequestId BAD_CAST "RequestId" +#define xmlSecAttrNotBefore BAD_CAST "NotBefore" +#define xmlSecAttrNotOnOrAfter BAD_CAST "NotOnOrAfter" +#define xmlSecAttrTime BAD_CAST "Time" +#define xmlSecAttrStatusValue BAD_CAST "StatusValue" + +#define xmlSecResponseMechanismPending BAD_CAST "Pending" +#define xmlSecResponseMechanismRepresent BAD_CAST "Represent" +#define xmlSecResponseMechanismRequestSignatureValue BAD_CAST "RequestSignatureValue" + +#define xmlSecRespondWithKeyName BAD_CAST "KeyName" +#define xmlSecRespondWithKeyValue BAD_CAST "KeyValue" +#define xmlSecRespondWithX509Cert BAD_CAST "X509Cert" +#define xmlSecRespondWithX509Chain BAD_CAST "X509Chain" +#define xmlSecRespondWithX509CRL BAD_CAST "X509CRL" +#define xmlSecRespondWithOCSP BAD_CAST "OCSP" +#define xmlSecRespondWithRetrievalMethod BAD_CAST "RetrievalMethod" +#define xmlSecRespondWithPGP BAD_CAST "PGP" +#define xmlSecRespondWithPGPWeb BAD_CAST "PGPWeb" +#define xmlSecRespondWithSPKI BAD_CAST "SPKI" +#define xmlSecRespondWithPrivateKey BAD_CAST "PrivateKey" + +#define xmlSecStatusResultSuccess BAD_CAST "Success" +#define xmlSecStatusResultFailed BAD_CAST "Failed" +#define xmlSecStatusResultPending BAD_CAST "Pending" + +#define xmlSecKeyUsageEncryption BAD_CAST "Encryption" +#define xmlSecKeyUsageSignature BAD_CAST "Signature" +#define xmlSecKeyUsageExchange BAD_CAST "Exchange" + +#define xmlSecKeyBindingStatusValid BAD_CAST "Valid" +#define xmlSecKeyBindingStatusInvalid BAD_CAST "Invalid" +#define xmlSecKeyBindingStatusIndeterminate BAD_CAST "Indeterminate" + +#define xmlSecKeyBindingReasonIssuerTrust BAD_CAST "IssuerTrust" +#define xmlSecKeyBindingReasonRevocationStatus BAD_CAST "RevocationStatus" +#define xmlSecKeyBindingReasonValidityInterval BAD_CAST "ValidityInterval" +#define xmlSecKeyBindingReasonSignature BAD_CAST "Signature" + +#define xmlSecResultMajorCodeSuccess BAD_CAST "Success" +#define xmlSecResultMajorCodeVersionMismatch BAD_CAST "VersionMismatch" +#define xmlSecResultMajorCodeSender BAD_CAST "Sender" +#define xmlSecResultMajorCodeReceiver BAD_CAST "Receiver" +#define xmlSecResultMajorCodeRepresent BAD_CAST "Represent" +#define xmlSecResultMajorCodePending BAD_CAST "Pending" + +#define xmlSecResultMinorCodeNoMatch BAD_CAST "NoMatch" +#define xmlSecResultMinorCodeTooManyResponses BAD_CAST "TooManyResponses" +#define xmlSecResultMinorCodeIncomplete BAD_CAST "Incomplete" +#define xmlSecResultMinorCodeFailure BAD_CAST "Failure" +#define xmlSecResultMinorCodeRefused BAD_CAST "Refused" +#define xmlSecResultMinorCodeNoAuthentication BAD_CAST "NoAuthentication" +#define xmlSecResultMinorCodeMessageNotSupported BAD_CAST "MessageNotSupported" +#define xmlSecResultMinorCodeUnknownResponseId BAD_CAST "UnknownResponseId" +#define xmlSecResultMinorCodeNotSynchronous BAD_CAST "NotSynchronous" + +#define xmlSecXkmsSoapSubcodeValueMessageNotSupported BAD_CAST "MessageNotSupported" +#define xmlSecXkmsSoapSubcodeValueBadMessage BAD_CAST "BadMessage" + +#define xmlSecXkmsSoapFaultReasonLang BAD_CAST "en" +#define xmlSecXkmsSoapFaultReasonUnsupportedVersion BAD_CAST "Unsupported SOAP version" +#define xmlSecXkmsSoapFaultReasonUnableToProcess BAD_CAST "Unable to process %s" +#define xmlSecXkmsSoapFaultReasonServiceUnavailable BAD_CAST "Service temporarily unable" +#define xmlSecXkmsSoapFaultReasonMessageNotSupported BAD_CAST "%s message not supported" +#define xmlSecXkmsSoapFaultReasonMessageInvalid BAD_CAST "%s message invalid" + +#define xmlSecXkmsFormatStrPlain BAD_CAST "plain" +#define xmlSecXkmsFormatStrSoap11 BAD_CAST "soap-1.1" +#define xmlSecXkmsFormatStrSoap12 BAD_CAST "soap-1.2" + +#endif /* XMLSEC_NO_XKMS */ + +/************************************************************************* + * + * KeyInfo Nodes + * + ************************************************************************/ +#define xmlSecNodeKeyInfo BAD_CAST "KeyInfo" +#define xmlSecNodeReference BAD_CAST "Reference" +#define xmlSecNodeTransforms BAD_CAST "Transforms" +#define xmlSecNodeTransform BAD_CAST "Transform" + +/************************************************************************* + * + * Attributes + * + ************************************************************************/ +#define xmlSecAttrId BAD_CAST "Id" +#define xmlSecAttrURI BAD_CAST "URI" +#define xmlSecAttrType BAD_CAST "Type" +#define xmlSecAttrMimeType BAD_CAST "MimeType" +#define xmlSecAttrEncoding BAD_CAST "Encoding" +#define xmlSecAttrAlgorithm BAD_CAST "Algorithm" +#define xmlSecAttrFilter BAD_CAST "Filter" +#define xmlSecAttrRecipient BAD_CAST "Recipient" +#define xmlSecAttrTarget BAD_CAST "Target" + +/************************************************************************* + * + * AES strings + * + ************************************************************************/ +#define xmlSecNameAESKeyValue BAD_CAST "aes" +#define xmlSecNodeAESKeyValue BAD_CAST "AESKeyValue" +#define xmlSecHrefAESKeyValue BAD_CAST "http://www.aleksey.com/xmlsec/2002#AESKeyValue" + +#define xmlSecNameAes128Cbc BAD_CAST "aes128-cbc" +#define xmlSecHrefAes128Cbc BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes128-cbc" + +#define xmlSecNameAes192Cbc BAD_CAST "aes192-cbc" +#define xmlSecHrefAes192Cbc BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes192-cbc" + +#define xmlSecNameAes256Cbc BAD_CAST "aes256-cbc" +#define xmlSecHrefAes256Cbc BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes256-cbc" + +#define xmlSecNameKWAes128 BAD_CAST "kw-aes128" +#define xmlSecHrefKWAes128 BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes128" + +#define xmlSecNameKWAes192 BAD_CAST "kw-aes192" +#define xmlSecHrefKWAes192 BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes192" + +#define xmlSecNameKWAes256 BAD_CAST "kw-aes256" +#define xmlSecHrefKWAes256 BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes256" + +/************************************************************************* + * + * BASE64 strings + * + ************************************************************************/ +#define xmlSecNameBase64 BAD_CAST "base64" +#define xmlSecHrefBase64 BAD_CAST "http://www.w3.org/2000/09/xmldsig#base64" + +/************************************************************************* + * + * C14N strings + * + ************************************************************************/ +#define xmlSecNameC14N BAD_CAST "c14n" +#define xmlSecHrefC14N BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" + +#define xmlSecNameC14NWithComments BAD_CAST "c14n-with-comments" +#define xmlSecHrefC14NWithComments BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" + +#define xmlSecNameExcC14N BAD_CAST "exc-c14n" +#define xmlSecHrefExcC14N BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#" + +#define xmlSecNameExcC14NWithComments BAD_CAST "exc-c14n-with-comments" +#define xmlSecHrefExcC14NWithComments BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#WithComments" + +#define xmlSecNsExcC14N BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#" +#define xmlSecNsExcC14NWithComments BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#WithComments" + +#define xmlSecNodeInclusiveNamespaces BAD_CAST "InclusiveNamespaces" +#define xmlSecAttrPrefixList BAD_CAST "PrefixList" +/************************************************************************* + * + * DES strings + * + ************************************************************************/ +#define xmlSecNameDESKeyValue BAD_CAST "des" +#define xmlSecNodeDESKeyValue BAD_CAST "DESKeyValue" +#define xmlSecHrefDESKeyValue BAD_CAST "http://www.aleksey.com/xmlsec/2002#DESKeyValue" + +#define xmlSecNameDes3Cbc BAD_CAST "tripledes-cbc" +#define xmlSecHrefDes3Cbc BAD_CAST "http://www.w3.org/2001/04/xmlenc#tripledes-cbc" + +#define xmlSecNameKWDes3 BAD_CAST "kw-tripledes" +#define xmlSecHrefKWDes3 BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-tripledes" + +/************************************************************************* + * + * DSA strings + * + ************************************************************************/ +#define xmlSecNameDSAKeyValue BAD_CAST "dsa" +#define xmlSecNodeDSAKeyValue BAD_CAST "DSAKeyValue" +#define xmlSecHrefDSAKeyValue BAD_CAST "http://www.w3.org/2000/09/xmldsig#DSAKeyValue" +#define xmlSecNodeDSAP BAD_CAST "P" +#define xmlSecNodeDSAQ BAD_CAST "Q" +#define xmlSecNodeDSAG BAD_CAST "G" +#define xmlSecNodeDSAJ BAD_CAST "J" +#define xmlSecNodeDSAX BAD_CAST "X" +#define xmlSecNodeDSAY BAD_CAST "Y" +#define xmlSecNodeDSASeed BAD_CAST "Seed" +#define xmlSecNodeDSAPgenCounter BAD_CAST "PgenCounter" + +#define xmlSecNameDsaSha1 BAD_CAST "dsa-sha1" +#define xmlSecHrefDsaSha1 BAD_CAST "http://www.w3.org/2000/09/xmldsig#dsa-sha1" + +/************************************************************************* + * + * EncryptedKey + * + ************************************************************************/ +#define xmlSecNameEncryptedKey BAD_CAST "enc-key" +#define xmlSecNodeEncryptedKey BAD_CAST "EncryptedKey" +#define xmlSecHrefEncryptedKey BAD_CAST "http://www.w3.org/2001/04/xmlenc#EncryptedKey" + +/************************************************************************* + * + * Enveloped transform strings + * + ************************************************************************/ +#define xmlSecNameEnveloped BAD_CAST "enveloped-signature" +#define xmlSecHrefEnveloped BAD_CAST "http://www.w3.org/2000/09/xmldsig#enveloped-signature" + +/************************************************************************* + * + * HMAC strings + * + ************************************************************************/ +#define xmlSecNameHMACKeyValue BAD_CAST "hmac" +#define xmlSecNodeHMACKeyValue BAD_CAST "HMACKeyValue" +#define xmlSecHrefHMACKeyValue BAD_CAST "http://www.aleksey.com/xmlsec/2002#HMACKeyValue" + +#define xmlSecNodeHMACOutputLength BAD_CAST "HMACOutputLength" + +#define xmlSecNameHmacMd5 BAD_CAST "hmac-md5" +#define xmlSecHrefHmacMd5 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-md5" + +#define xmlSecNameHmacRipemd160 BAD_CAST "hmac-ripemd160" +#define xmlSecHrefHmacRipemd160 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160" + +#define xmlSecNameHmacSha1 BAD_CAST "hmac-sha1" +#define xmlSecHrefHmacSha1 BAD_CAST "http://www.w3.org/2000/09/xmldsig#hmac-sha1" + +#define xmlSecNameHmacSha224 BAD_CAST "hmac-sha224" +#define xmlSecHrefHmacSha224 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224" + +#define xmlSecNameHmacSha256 BAD_CAST "hmac-sha256" +#define xmlSecHrefHmacSha256 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256" + +#define xmlSecNameHmacSha384 BAD_CAST "hmac-sha384" +#define xmlSecHrefHmacSha384 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384" + +#define xmlSecNameHmacSha512 BAD_CAST "hmac-sha512" +#define xmlSecHrefHmacSha512 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512" + +/************************************************************************* + * + * KeyName strings + * + ************************************************************************/ +#define xmlSecNameKeyName BAD_CAST "key-name" +#define xmlSecNodeKeyName BAD_CAST "KeyName" + +/************************************************************************* + * + * KeyValue strings + * + ************************************************************************/ +#define xmlSecNameKeyValue BAD_CAST "key-value" +#define xmlSecNodeKeyValue BAD_CAST "KeyValue" + +/************************************************************************* + * + * Memory Buffer strings + * + ************************************************************************/ +#define xmlSecNameMemBuf BAD_CAST "membuf-transform" + +/************************************************************************* + * + * MD5 strings + * + ************************************************************************/ +#define xmlSecNameMd5 BAD_CAST "md5" +#define xmlSecHrefMd5 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#md5" + +/************************************************************************* + * + * RetrievalMethod + * + ************************************************************************/ +#define xmlSecNameRetrievalMethod BAD_CAST "retrieval-method" +#define xmlSecNodeRetrievalMethod BAD_CAST "RetrievalMethod" + +/************************************************************************* + * + * RIPEMD160 strings + * + ************************************************************************/ +#define xmlSecNameRipemd160 BAD_CAST "ripemd160" +#define xmlSecHrefRipemd160 BAD_CAST "http://www.w3.org/2001/04/xmlenc#ripemd160" + +/************************************************************************* + * + * RSA strings + * + ************************************************************************/ +#define xmlSecNameRSAKeyValue BAD_CAST "rsa" +#define xmlSecNodeRSAKeyValue BAD_CAST "RSAKeyValue" +#define xmlSecHrefRSAKeyValue BAD_CAST "http://www.w3.org/2000/09/xmldsig#RSAKeyValue" +#define xmlSecNodeRSAModulus BAD_CAST "Modulus" +#define xmlSecNodeRSAExponent BAD_CAST "Exponent" +#define xmlSecNodeRSAPrivateExponent BAD_CAST "PrivateExponent" + +#define xmlSecNameRsaMd5 BAD_CAST "rsa-md5" +#define xmlSecHrefRsaMd5 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-md5" + +#define xmlSecNameRsaRipemd160 BAD_CAST "rsa-ripemd160" +#define xmlSecHrefRsaRipemd160 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160" + +#define xmlSecNameRsaSha1 BAD_CAST "rsa-sha1" +#define xmlSecHrefRsaSha1 BAD_CAST "http://www.w3.org/2000/09/xmldsig#rsa-sha1" + +#define xmlSecNameRsaSha224 BAD_CAST "rsa-sha224" +#define xmlSecHrefRsaSha224 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224" + +#define xmlSecNameRsaSha256 BAD_CAST "rsa-sha256" +#define xmlSecHrefRsaSha256 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" + +#define xmlSecNameRsaSha384 BAD_CAST "rsa-sha384" +#define xmlSecHrefRsaSha384 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384" + +#define xmlSecNameRsaSha512 BAD_CAST "rsa-sha512" +#define xmlSecHrefRsaSha512 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512" + +#define xmlSecNameRsaPkcs1 BAD_CAST "rsa-1_5" +#define xmlSecHrefRsaPkcs1 BAD_CAST "http://www.w3.org/2001/04/xmlenc#rsa-1_5" + +#define xmlSecNameRsaOaep BAD_CAST "rsa-oaep-mgf1p" +#define xmlSecHrefRsaOaep BAD_CAST "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p" +#define xmlSecNodeRsaOAEPparams BAD_CAST "OAEPparams" + +/************************************************************************* + * + * SHA1 strings + * + ************************************************************************/ +#define xmlSecNameSha1 BAD_CAST "sha1" +#define xmlSecHrefSha1 BAD_CAST "http://www.w3.org/2000/09/xmldsig#sha1" + +#define xmlSecNameSha224 BAD_CAST "sha224" +#define xmlSecHrefSha224 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#sha224" + +#define xmlSecNameSha256 BAD_CAST "sha256" +#define xmlSecHrefSha256 BAD_CAST "http://www.w3.org/2001/04/xmlenc#sha256" + +#define xmlSecNameSha384 BAD_CAST "sha384" +#define xmlSecHrefSha384 BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#sha384" + +#define xmlSecNameSha512 BAD_CAST "sha512" +#define xmlSecHrefSha512 BAD_CAST "http://www.w3.org/2001/04/xmlenc#sha512" + +/************************************************************************* + * + * X509 strings + * + ************************************************************************/ +#define xmlSecNameX509Data BAD_CAST "x509" +#define xmlSecNodeX509Data BAD_CAST "X509Data" +#define xmlSecHrefX509Data BAD_CAST "http://www.w3.org/2000/09/xmldsig#X509Data" + +#define xmlSecNodeX509Certificate BAD_CAST "X509Certificate" +#define xmlSecNodeX509CRL BAD_CAST "X509CRL" +#define xmlSecNodeX509SubjectName BAD_CAST "X509SubjectName" +#define xmlSecNodeX509IssuerSerial BAD_CAST "X509IssuerSerial" +#define xmlSecNodeX509IssuerName BAD_CAST "X509IssuerName" +#define xmlSecNodeX509SerialNumber BAD_CAST "X509SerialNumber" +#define xmlSecNodeX509SKI BAD_CAST "X509SKI" + +#define xmlSecNameRawX509Cert BAD_CAST "raw-x509-cert" +#define xmlSecHrefRawX509Cert BAD_CAST "http://www.w3.org/2000/09/xmldsig#rawX509Certificate" + +#define xmlSecNameX509Store BAD_CAST "x509-store" + +/************************************************************************* + * + * PGP strings + * + ************************************************************************/ +#define xmlSecNamePGPData BAD_CAST "pgp" +#define xmlSecNodePGPData BAD_CAST "PGPData" +#define xmlSecHrefPGPData BAD_CAST "http://www.w3.org/2000/09/xmldsig#PGPData" + +/************************************************************************* + * + * SPKI strings + * + ************************************************************************/ +#define xmlSecNameSPKIData BAD_CAST "spki" +#define xmlSecNodeSPKIData BAD_CAST "SPKIData" +#define xmlSecHrefSPKIData BAD_CAST "http://www.w3.org/2000/09/xmldsig#SPKIData" + +/************************************************************************* + * + * XPath/XPointer strings + * + ************************************************************************/ +#define xmlSecNameXPath BAD_CAST "xpath" +#define xmlSecNodeXPath BAD_CAST "XPath" + +#define xmlSecNameXPath2 BAD_CAST "xpath2" +#define xmlSecNodeXPath2 BAD_CAST "XPath" +#define xmlSecXPath2FilterIntersect BAD_CAST "intersect" +#define xmlSecXPath2FilterSubtract BAD_CAST "subtract" +#define xmlSecXPath2FilterUnion BAD_CAST "union" + +#define xmlSecNameXPointer BAD_CAST "xpointer" +#define xmlSecNodeXPointer BAD_CAST "XPointer" + +/************************************************************************* + * + * Xslt strings + * + ************************************************************************/ +#define xmlSecNameXslt BAD_CAST "xslt" +#define xmlSecHrefXslt BAD_CAST "http://www.w3.org/TR/1999/REC-xslt-19991116" + +#ifndef XMLSEC_NO_SOAP +/************************************************************************* + * + * SOAP 1.1/1.2 strings + * + ************************************************************************/ +#define xmlSecNodeEnvelope BAD_CAST "Envelope" +#define xmlSecNodeHeader BAD_CAST "Header" +#define xmlSecNodeBody BAD_CAST "Body" +#define xmlSecNodeFault BAD_CAST "Fault" +#define xmlSecNodeFaultCode BAD_CAST "faultcode" +#define xmlSecNodeFaultString BAD_CAST "faultstring" +#define xmlSecNodeFaultActor BAD_CAST "faultactor" +#define xmlSecNodeFaultDetail BAD_CAST "detail" +#define xmlSecNodeCode BAD_CAST "Code" +#define xmlSecNodeReason BAD_CAST "Reason" +#define xmlSecNodeNode BAD_CAST "Node" +#define xmlSecNodeRole BAD_CAST "Role" +#define xmlSecNodeDetail BAD_CAST "Detail" +#define xmlSecNodeValue BAD_CAST "Value" +#define xmlSecNodeSubcode BAD_CAST "Subcode" +#define xmlSecNodeText BAD_CAST "Text" + + +#define xmlSecSoapFaultCodeVersionMismatch BAD_CAST "VersionMismatch" +#define xmlSecSoapFaultCodeMustUnderstand BAD_CAST "MustUnderstand" +#define xmlSecSoapFaultCodeClient BAD_CAST "Client" +#define xmlSecSoapFaultCodeServer BAD_CAST "Server" +#define xmlSecSoapFaultCodeReceiver BAD_CAST "Receiver" +#define xmlSecSoapFaultCodeSender BAD_CAST "Sender" +#define xmlSecSoapFaultDataEncodningUnknown BAD_CAST "DataEncodingUnknown" + + +#endif /* XMLSEC_NO_SOAP */ + +/************************************************************************* + * + * Utility strings + * + ************************************************************************/ +#define xmlSecStringEmpty BAD_CAST "" +#define xmlSecStringCR BAD_CAST "\n" + +#endif // IN_XMLSEC + + +/************************************************************************* + * + * Venus: The following section defines xmlsec global strings for other dlls in + * Symbian. We could use the previous section also, but using + * the following method (global const struct with exported function) + * could save some memory. + * + ************************************************************************/ +#if !defined(IN_XMLSEC) +/************************************************************************* + * + * Global Namespaces + * + ************************************************************************/ +#define xmlSecNs (XMLSEC_GLOBAL_CONST xmlSecNs) +#define xmlSecDSigNs (XMLSEC_GLOBAL_CONST xmlSecDSigNs) +#define xmlSecEncNs (XMLSEC_GLOBAL_CONST xmlSecEncNs) +#define xmlSecXkmsNs (XMLSEC_GLOBAL_CONST xmlSecXkmsNs) +#define xmlSecXPathNs (XMLSEC_GLOBAL_CONST xmlSecXPathNs) +#define xmlSecXPath2Ns (XMLSEC_GLOBAL_CONST xmlSecXPath2Ns) +#define xmlSecXPointerNs (XMLSEC_GLOBAL_CONST xmlSecXPointerNs) +#define xmlSecSoap11Ns (XMLSEC_GLOBAL_CONST xmlSecSoap11Ns) +#define xmlSecSoap12Ns (XMLSEC_GLOBAL_CONST xmlSecSoap12Ns) + +/************************************************************************* + * + * DSig Nodes + * + ************************************************************************/ +#define xmlSecNodeSignature (XMLSEC_GLOBAL_CONST xmlSecNodeSignature) +#define xmlSecNodeSignedInfo (XMLSEC_GLOBAL_CONST xmlSecNodeSignedInfo) +#define xmlSecNodeSignatureValue (XMLSEC_GLOBAL_CONST xmlSecNodeSignatureValue) +#define xmlSecNodeCanonicalizationMethod (XMLSEC_GLOBAL_CONST xmlSecNodeCanonicalizationMethod) +#define xmlSecNodeSignatureMethod (XMLSEC_GLOBAL_CONST xmlSecNodeSignatureMethod) +#define xmlSecNodeDigestMethod (XMLSEC_GLOBAL_CONST xmlSecNodeDigestMethod) +#define xmlSecNodeDigestValue (XMLSEC_GLOBAL_CONST xmlSecNodeDigestValue) +#define xmlSecNodeObject (XMLSEC_GLOBAL_CONST xmlSecNodeObject) +#define xmlSecNodeManifest (XMLSEC_GLOBAL_CONST xmlSecNodeManifest) +#define xmlSecNodeSignatureProperties (XMLSEC_GLOBAL_CONST xmlSecNodeSignatureProperties) + + +/************************************************************************* + * + * Encryption Nodes + * + ************************************************************************/ +#define xmlSecNodeEncryptedData (XMLSEC_GLOBAL_CONST xmlSecNodeEncryptedData) +#define xmlSecNodeEncryptionMethod (XMLSEC_GLOBAL_CONST xmlSecNodeEncryptionMethod) +#define xmlSecNodeEncryptionProperties (XMLSEC_GLOBAL_CONST xmlSecNodeEncryptionProperties) +#define xmlSecNodeEncryptionProperty (XMLSEC_GLOBAL_CONST xmlSecNodeEncryptionProperty) +#define xmlSecNodeCipherData (XMLSEC_GLOBAL_CONST xmlSecNodeCipherData) +#define xmlSecNodeCipherValue (XMLSEC_GLOBAL_CONST xmlSecNodeCipherValue) +#define xmlSecNodeCipherReference (XMLSEC_GLOBAL_CONST xmlSecNodeCipherReference) +#define xmlSecNodeReferenceList (XMLSEC_GLOBAL_CONST xmlSecNodeReferenceList) +#define xmlSecNodeDataReference (XMLSEC_GLOBAL_CONST xmlSecNodeDataReference) +#define xmlSecNodeKeyReference (XMLSEC_GLOBAL_CONST xmlSecNodeKeyReference) +#define xmlSecNodeCarriedKeyName (XMLSEC_GLOBAL_CONST xmlSecNodeCarriedKeyName) + +#define xmlSecTypeEncContent (XMLSEC_GLOBAL_CONST xmlSecTypeEncContent) +#define xmlSecTypeEncElement (XMLSEC_GLOBAL_CONST xmlSecTypeEncElement) + +/************************************************************************* + * + * XKMS nodes, attributes and value strings + * + ************************************************************************/ +#ifndef XMLSEC_NO_XKMS +#define xmlSecXkmsServerRequestResultName (XMLSEC_GLOBAL_CONST xmlSecXkmsServerRequestResultName) +#define xmlSecXkmsServerRequestStatusName (XMLSEC_GLOBAL_CONST xmlSecXkmsServerRequestStatusName) +#define xmlSecXkmsServerRequestLocateName (XMLSEC_GLOBAL_CONST xmlSecXkmsServerRequestLocateName) +#define xmlSecXkmsServerRequestValidateName (XMLSEC_GLOBAL_CONST xmlSecXkmsServerRequestValidateName) +#define xmlSecXkmsServerRequestCompoundName (XMLSEC_GLOBAL_CONST xmlSecXkmsServerRequestCompoundName) + +#define xmlSecNodeResult (XMLSEC_GLOBAL_CONST xmlSecNodeResult) +#define xmlSecNodeStatusRequest (XMLSEC_GLOBAL_CONST xmlSecNodeStatusRequest) +#define xmlSecNodeStatusResult (XMLSEC_GLOBAL_CONST xmlSecNodeStatusResult) +#define xmlSecNodeLocateRequest (XMLSEC_GLOBAL_CONST xmlSecNodeLocateRequest) +#define xmlSecNodeLocateResult (XMLSEC_GLOBAL_CONST xmlSecNodeLocateResult) +#define xmlSecNodeValidateRequest (XMLSEC_GLOBAL_CONST xmlSecNodeValidateRequest) +#define xmlSecNodeValidateResult (XMLSEC_GLOBAL_CONST xmlSecNodeValidateResult) +#define xmlSecNodeCompoundRequest (XMLSEC_GLOBAL_CONST xmlSecNodeCompoundRequest) +#define xmlSecNodeCompoundResult (XMLSEC_GLOBAL_CONST xmlSecNodeCompoundResult) + +#define xmlSecNodeMessageExtension (XMLSEC_GLOBAL_CONST xmlSecNodeMessageExtension) +#define xmlSecNodeOpaqueClientData (XMLSEC_GLOBAL_CONST xmlSecNodeOpaqueClientData) +#define xmlSecNodeResponseMechanism (XMLSEC_GLOBAL_CONST xmlSecNodeResponseMechanism) +#define xmlSecNodeRespondWith (XMLSEC_GLOBAL_CONST xmlSecNodeRespondWith) +#define xmlSecNodePendingNotification (XMLSEC_GLOBAL_CONST xmlSecNodePendingNotification) +#define xmlSecNodeQueryKeyBinding (XMLSEC_GLOBAL_CONST xmlSecNodeQueryKeyBinding) +#define xmlSecNodeKeyUsage (XMLSEC_GLOBAL_CONST xmlSecNodeKeyUsage) +#define xmlSecNodeUseKeyWith (XMLSEC_GLOBAL_CONST xmlSecNodeUseKeyWith) +#define xmlSecNodeTimeInstant (XMLSEC_GLOBAL_CONST xmlSecNodeTimeInstant) +#define xmlSecNodeRequestSignatureValue (XMLSEC_GLOBAL_CONST xmlSecNodeRequestSignatureValue) +#define xmlSecNodeUnverifiedKeyBinding (XMLSEC_GLOBAL_CONST xmlSecNodeUnverifiedKeyBinding) +#define xmlSecNodeValidityInterval (XMLSEC_GLOBAL_CONST xmlSecNodeValidityInterval) +#define xmlSecNodeStatus (XMLSEC_GLOBAL_CONST xmlSecNodeStatus) +#define xmlSecNodeValidReason (XMLSEC_GLOBAL_CONST xmlSecNodeValidReason) +#define xmlSecNodeInvalidReason (XMLSEC_GLOBAL_CONST xmlSecNodeInvalidReason) +#define xmlSecNodeIndeterminateReason (XMLSEC_GLOBAL_CONST xmlSecNodeIndeterminateReason) + + +#define xmlSecAttrService (XMLSEC_GLOBAL_CONST xmlSecAttrService ) +#define xmlSecAttrNonce (XMLSEC_GLOBAL_CONST xmlSecAttrNonce ) +#define xmlSecAttrOriginalRequestId (XMLSEC_GLOBAL_CONST xmlSecAttrOriginalRequestId ) +#define xmlSecAttrResponseLimit (XMLSEC_GLOBAL_CONST xmlSecAttrResponseLimit ) +#define xmlSecAttrMechanism (XMLSEC_GLOBAL_CONST xmlSecAttrMechanism ) +#define xmlSecAttrIdentifier (XMLSEC_GLOBAL_CONST xmlSecAttrIdentifier ) +#define xmlSecAttrApplication (XMLSEC_GLOBAL_CONST xmlSecAttrApplication ) +#define xmlSecAttrResultMajor (XMLSEC_GLOBAL_CONST xmlSecAttrResultMajor ) +#define xmlSecAttrResultMinor (XMLSEC_GLOBAL_CONST xmlSecAttrResultMinor ) +#define xmlSecAttrRequestId (XMLSEC_GLOBAL_CONST xmlSecAttrRequestId ) +#define xmlSecAttrNotBefore (XMLSEC_GLOBAL_CONST xmlSecAttrNotBefore ) +#define xmlSecAttrNotOnOrAfter (XMLSEC_GLOBAL_CONST xmlSecAttrNotOnOrAfter ) +#define xmlSecAttrTime (XMLSEC_GLOBAL_CONST xmlSecAttrTime ) +#define xmlSecAttrStatusValue (XMLSEC_GLOBAL_CONST xmlSecAttrStatusValue ) + +#define xmlSecResponseMechanismPending (XMLSEC_GLOBAL_CONST xmlSecResponseMechanismPending ) +#define xmlSecResponseMechanismRepresent (XMLSEC_GLOBAL_CONST xmlSecResponseMechanismRepresent ) +#define xmlSecResponseMechanismRequestSignatureValue (XMLSEC_GLOBAL_CONST xmlSecResponseMechanismRequestSignatureValue ) + +#define xmlSecRespondWithKeyName (XMLSEC_GLOBAL_CONST xmlSecRespondWithKeyName ) +#define xmlSecRespondWithKeyValue (XMLSEC_GLOBAL_CONST xmlSecRespondWithKeyValue ) +#define xmlSecRespondWithX509Cert (XMLSEC_GLOBAL_CONST xmlSecRespondWithX509Cert ) +#define xmlSecRespondWithX509Chain (XMLSEC_GLOBAL_CONST xmlSecRespondWithX509Chain ) +#define xmlSecRespondWithX509CRL (XMLSEC_GLOBAL_CONST xmlSecRespondWithX509CRL ) +#define xmlSecRespondWithOCSP (XMLSEC_GLOBAL_CONST xmlSecRespondWithOCSP ) +#define xmlSecRespondWithRetrievalMethod (XMLSEC_GLOBAL_CONST xmlSecRespondWithRetrievalMethod ) +#define xmlSecRespondWithPGP (XMLSEC_GLOBAL_CONST xmlSecRespondWithPGP ) +#define xmlSecRespondWithPGPWeb (XMLSEC_GLOBAL_CONST xmlSecRespondWithPGPWeb ) +#define xmlSecRespondWithSPKI (XMLSEC_GLOBAL_CONST xmlSecRespondWithSPKI ) +#define xmlSecRespondWithPrivateKey (XMLSEC_GLOBAL_CONST xmlSecRespondWithPrivateKey ) + +#define xmlSecStatusResultSuccess (XMLSEC_GLOBAL_CONST xmlSecStatusResultSuccess ) +#define xmlSecStatusResultFailed (XMLSEC_GLOBAL_CONST xmlSecStatusResultFailed ) +#define xmlSecStatusResultPending (XMLSEC_GLOBAL_CONST xmlSecStatusResultPending ) + +#define xmlSecKeyUsageEncryption (XMLSEC_GLOBAL_CONST xmlSecKeyUsageEncryption ) +#define xmlSecKeyUsageSignature (XMLSEC_GLOBAL_CONST xmlSecKeyUsageSignature ) +#define xmlSecKeyUsageExchange (XMLSEC_GLOBAL_CONST xmlSecKeyUsageExchange ) + +#define xmlSecKeyBindingStatusValid (XMLSEC_GLOBAL_CONST xmlSecKeyBindingStatusValid ) +#define xmlSecKeyBindingStatusInvalid (XMLSEC_GLOBAL_CONST xmlSecKeyBindingStatusInvalid ) +#define xmlSecKeyBindingStatusIndeterminate (XMLSEC_GLOBAL_CONST xmlSecKeyBindingStatusIndeterminate ) + +#define xmlSecKeyBindingReasonIssuerTrust (XMLSEC_GLOBAL_CONST xmlSecKeyBindingReasonIssuerTrust ) +#define xmlSecKeyBindingReasonRevocationStatus (XMLSEC_GLOBAL_CONST xmlSecKeyBindingReasonRevocationStatus ) +#define xmlSecKeyBindingReasonValidityInterval (XMLSEC_GLOBAL_CONST xmlSecKeyBindingReasonValidityInterval ) +#define xmlSecKeyBindingReasonSignature (XMLSEC_GLOBAL_CONST xmlSecKeyBindingReasonSignature ) + +#define xmlSecResultMajorCodeSuccess (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodeSuccess ) +#define xmlSecResultMajorCodeVersionMismatch (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodeVersionMismatch ) +#define xmlSecResultMajorCodeSender (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodeSender ) +#define xmlSecResultMajorCodeReceiver (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodeReceiver ) +#define xmlSecResultMajorCodeRepresent (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodeRepresent ) +#define xmlSecResultMajorCodePending (XMLSEC_GLOBAL_CONST xmlSecResultMajorCodePending ) + +#define xmlSecResultMinorCodeNoMatch (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeNoMatch ) +#define xmlSecResultMinorCodeTooManyResponses (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeTooManyResponses ) +#define xmlSecResultMinorCodeIncomplete (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeIncomplete ) +#define xmlSecResultMinorCodeFailure (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeFailure ) +#define xmlSecResultMinorCodeRefused (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeRefused ) +#define xmlSecResultMinorCodeNoAuthentication (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeNoAuthentication ) +#define xmlSecResultMinorCodeMessageNotSupported (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeMessageNotSupported ) +#define xmlSecResultMinorCodeUnknownResponseId (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeUnknownResponseId ) +#define xmlSecResultMinorCodeNotSynchronous (XMLSEC_GLOBAL_CONST xmlSecResultMinorCodeNotSynchronous ) + +#define xmlSecXkmsSoapFaultReasonLang (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonLang ) +#define xmlSecXkmsSoapFaultReasonUnsupportedVersion (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonUnsupportedVersion ) +#define xmlSecXkmsSoapFaultReasonUnableToProcess (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonUnableToProcess ) +#define xmlSecXkmsSoapFaultReasonServiceUnavailable (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonServiceUnavailable ) +#define xmlSecXkmsSoapFaultReasonMessageNotSupported (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonMessageNotSupported ) +#define xmlSecXkmsSoapFaultReasonMessageInvalid (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapFaultReasonMessageInvalid ) + +#define xmlSecXkmsSoapSubcodeValueMessageNotSupported (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapSubcodeValueMessageNotSupported ) +#define xmlSecXkmsSoapSubcodeValueBadMessage (XMLSEC_GLOBAL_CONST xmlSecXkmsSoapSubcodeValueBadMessage ) + +#define xmlSecXkmsFormatStrPlain (XMLSEC_GLOBAL_CONST xmlSecXkmsFormatStrPlain ) +#define xmlSecXkmsFormatStrSoap11 (XMLSEC_GLOBAL_CONST xmlSecXkmsFormatStrSoap11 ) +#define xmlSecXkmsFormatStrSoap12 (XMLSEC_GLOBAL_CONST xmlSecXkmsFormatStrSoap12 ) + +#endif /* XMLSEC_NO_XKMS */ + +/************************************************************************* + * + * KeyInfo and Transform Nodes + * + ************************************************************************/ +#define xmlSecNodeKeyInfo (XMLSEC_GLOBAL_CONST xmlSecNodeKeyInfo ) +#define xmlSecNodeReference (XMLSEC_GLOBAL_CONST xmlSecNodeReference ) +#define xmlSecNodeTransforms (XMLSEC_GLOBAL_CONST xmlSecNodeTransforms ) +#define xmlSecNodeTransform (XMLSEC_GLOBAL_CONST xmlSecNodeTransform ) + +/************************************************************************* + * + * Attributes + * + ************************************************************************/ +#define xmlSecAttrId (XMLSEC_GLOBAL_CONST xmlSecAttrId ) +#define xmlSecAttrURI (XMLSEC_GLOBAL_CONST xmlSecAttrURI ) +#define xmlSecAttrType (XMLSEC_GLOBAL_CONST xmlSecAttrType ) +#define xmlSecAttrMimeType (XMLSEC_GLOBAL_CONST xmlSecAttrMimeType ) +#define xmlSecAttrEncoding (XMLSEC_GLOBAL_CONST xmlSecAttrEncoding ) +#define xmlSecAttrAlgorithm (XMLSEC_GLOBAL_CONST xmlSecAttrAlgorithm ) +#define xmlSecAttrTarget (XMLSEC_GLOBAL_CONST xmlSecAttrTarget ) +#define xmlSecAttrFilter (XMLSEC_GLOBAL_CONST xmlSecAttrFilter ) +#define xmlSecAttrRecipient (XMLSEC_GLOBAL_CONST xmlSecAttrRecipient ) + +/************************************************************************* + * + * AES strings + * + ************************************************************************/ +#define xmlSecNameAESKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameAESKeyValue ) +#define xmlSecNodeAESKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeAESKeyValue ) +#define xmlSecHrefAESKeyValue (XMLSEC_GLOBAL_CONST xmlSecHrefAESKeyValue ) + +#define xmlSecNameAes128Cbc (XMLSEC_GLOBAL_CONST xmlSecNameAes128Cbc ) +#define xmlSecHrefAes128Cbc (XMLSEC_GLOBAL_CONST xmlSecHrefAes128Cbc ) + +#define xmlSecNameAes192Cbc (XMLSEC_GLOBAL_CONST xmlSecNameAes192Cbc ) +#define xmlSecHrefAes192Cbc (XMLSEC_GLOBAL_CONST xmlSecHrefAes192Cbc ) + +#define xmlSecNameAes256Cbc (XMLSEC_GLOBAL_CONST xmlSecNameAes256Cbc ) +#define xmlSecHrefAes256Cbc (XMLSEC_GLOBAL_CONST xmlSecHrefAes256Cbc ) + +#define xmlSecNameKWAes128 (XMLSEC_GLOBAL_CONST xmlSecNameKWAes128 ) +#define xmlSecHrefKWAes128 (XMLSEC_GLOBAL_CONST xmlSecHrefKWAes128 ) + +#define xmlSecNameKWAes192 (XMLSEC_GLOBAL_CONST xmlSecNameKWAes192 ) +#define xmlSecHrefKWAes192 (XMLSEC_GLOBAL_CONST xmlSecHrefKWAes192 ) + +#define xmlSecNameKWAes256 (XMLSEC_GLOBAL_CONST xmlSecNameKWAes256 ) +#define xmlSecHrefKWAes256 (XMLSEC_GLOBAL_CONST xmlSecHrefKWAes256 ) + +/************************************************************************* + * + * BASE64 strings + * + ************************************************************************/ +#define xmlSecNameBase64 (XMLSEC_GLOBAL_CONST xmlSecNameBase64 ) +#define xmlSecHrefBase64 (XMLSEC_GLOBAL_CONST xmlSecHrefBase64 ) + +/************************************************************************* + * + * C14N strings + * + ************************************************************************/ +#define xmlSecNameC14N (XMLSEC_GLOBAL_CONST xmlSecNameC14N ) +#define xmlSecHrefC14N (XMLSEC_GLOBAL_CONST xmlSecHrefC14N ) + +#define xmlSecNameC14NWithComments (XMLSEC_GLOBAL_CONST xmlSecNameC14NWithComments ) +#define xmlSecHrefC14NWithComments (XMLSEC_GLOBAL_CONST xmlSecHrefC14NWithComments ) + +#define xmlSecNameExcC14N (XMLSEC_GLOBAL_CONST xmlSecNameExcC14N ) +#define xmlSecHrefExcC14N (XMLSEC_GLOBAL_CONST xmlSecHrefExcC14N ) + +#define xmlSecNameExcC14NWithComments (XMLSEC_GLOBAL_CONST xmlSecNameExcC14NWithComments ) +#define xmlSecHrefExcC14NWithComments (XMLSEC_GLOBAL_CONST xmlSecHrefExcC14NWithComments ) + +#define xmlSecNsExcC14N (XMLSEC_GLOBAL_CONST xmlSecNsExcC14N ) +#define xmlSecNsExcC14NWithComments (XMLSEC_GLOBAL_CONST xmlSecNsExcC14NWithComments ) + +#define xmlSecNodeInclusiveNamespaces (XMLSEC_GLOBAL_CONST xmlSecNodeInclusiveNamespaces ) +#define xmlSecAttrPrefixList (XMLSEC_GLOBAL_CONST xmlSecAttrPrefixList ) + +/************************************************************************* + * + * DES strings + * + ************************************************************************/ +#define xmlSecNameDESKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameDESKeyValue ) +#define xmlSecNodeDESKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeDESKeyValue ) +#define xmlSecHrefDESKeyValue (XMLSEC_GLOBAL_CONST xmlSecHrefDESKeyValue ) + +#define xmlSecNameDes3Cbc (XMLSEC_GLOBAL_CONST xmlSecNameDes3Cbc ) +#define xmlSecHrefDes3Cbc (XMLSEC_GLOBAL_CONST xmlSecHrefDes3Cbc ) + +#define xmlSecNameKWDes3 (XMLSEC_GLOBAL_CONST xmlSecNameKWDes3 ) +#define xmlSecHrefKWDes3 (XMLSEC_GLOBAL_CONST xmlSecHrefKWDes3 ) + +/************************************************************************* + * + * DSA strings + * + ************************************************************************/ +#define xmlSecNameDSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameDSAKeyValue ) +#define xmlSecNodeDSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeDSAKeyValue ) +#define xmlSecHrefDSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecHrefDSAKeyValue ) + +#define xmlSecNodeDSAP (XMLSEC_GLOBAL_CONST xmlSecNodeDSAP ) +#define xmlSecNodeDSAQ (XMLSEC_GLOBAL_CONST xmlSecNodeDSAQ ) +#define xmlSecNodeDSAG (XMLSEC_GLOBAL_CONST xmlSecNodeDSAG ) +#define xmlSecNodeDSAJ (XMLSEC_GLOBAL_CONST xmlSecNodeDSAJ ) +#define xmlSecNodeDSAX (XMLSEC_GLOBAL_CONST xmlSecNodeDSAX ) +#define xmlSecNodeDSAY (XMLSEC_GLOBAL_CONST xmlSecNodeDSAY ) +#define xmlSecNodeDSASeed (XMLSEC_GLOBAL_CONST xmlSecNodeDSASeed ) +#define xmlSecNodeDSAPgenCounter (XMLSEC_GLOBAL_CONST xmlSecNodeDSAPgenCounter ) + + +#define xmlSecNameDsaSha1 (XMLSEC_GLOBAL_CONST xmlSecNameDsaSha1 ) +#define xmlSecHrefDsaSha1 (XMLSEC_GLOBAL_CONST xmlSecHrefDsaSha1 ) + +/************************************************************************* + * + * EncryptedKey + * + ************************************************************************/ +#define xmlSecNameEncryptedKey (XMLSEC_GLOBAL_CONST xmlSecNameEncryptedKey ) +#define xmlSecNodeEncryptedKey (XMLSEC_GLOBAL_CONST xmlSecNodeEncryptedKey ) +#define xmlSecHrefEncryptedKey (XMLSEC_GLOBAL_CONST xmlSecHrefEncryptedKey ) + +/************************************************************************* + * + * Enveloped transform strings + * + ************************************************************************/ +#define xmlSecNameEnveloped (XMLSEC_GLOBAL_CONST xmlSecNameEnveloped ) +#define xmlSecHrefEnveloped (XMLSEC_GLOBAL_CONST xmlSecHrefEnveloped ) + +/************************************************************************* + * + * HMAC strings + * + ************************************************************************/ +#define xmlSecNameHMACKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameHMACKeyValue ) +#define xmlSecNodeHMACKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeHMACKeyValue ) +#define xmlSecHrefHMACKeyValue (XMLSEC_GLOBAL_CONST xmlSecHrefHMACKeyValue ) + +#define xmlSecNodeHMACOutputLength (XMLSEC_GLOBAL_CONST xmlSecNodeHMACOutputLength ) + +#define xmlSecNameHmacMd5 (XMLSEC_GLOBAL_CONST xmlSecNameHmacMd5 ) +#define xmlSecHrefHmacMd5 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacMd5 ) + +#define xmlSecNameHmacRipemd160 (XMLSEC_GLOBAL_CONST xmlSecNameHmacRipemd160 ) +#define xmlSecHrefHmacRipemd160 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacRipemd160 ) + +#define xmlSecNameHmacSha1 (XMLSEC_GLOBAL_CONST xmlSecNameHmacSha1 ) +#define xmlSecHrefHmacSha1 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacSha1 ) + +#define xmlSecNameHmacSha224 (XMLSEC_GLOBAL_CONST xmlSecNameHmacSha224 ) +#define xmlSecHrefHmacSha224 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacSha224 ) + +#define xmlSecNameHmacSha256 (XMLSEC_GLOBAL_CONST xmlSecNameHmacSha256 ) +#define xmlSecHrefHmacSha256 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacSha256 ) + +#define xmlSecNameHmacSha384 (XMLSEC_GLOBAL_CONST xmlSecNameHmacSha384 ) +#define xmlSecHrefHmacSha384 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacSha384 ) + +#define xmlSecNameHmacSha512 (XMLSEC_GLOBAL_CONST xmlSecNameHmacSha512 ) +#define xmlSecHrefHmacSha512 (XMLSEC_GLOBAL_CONST xmlSecHrefHmacSha512 ) + +/************************************************************************* + * + * KeyName strings + * + ************************************************************************/ +#define xmlSecNameKeyName (XMLSEC_GLOBAL_CONST xmlSecNameKeyName ) +#define xmlSecNodeKeyName (XMLSEC_GLOBAL_CONST xmlSecNodeKeyName ) + +/************************************************************************* + * + * KeyValue strings + * + ************************************************************************/ +#define xmlSecNameKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameKeyValue ) +#define xmlSecNodeKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeKeyValue ) + +/************************************************************************* + * + * Memory Buffer strings + * + ************************************************************************/ +#define xmlSecNameMemBuf (XMLSEC_GLOBAL_CONST xmlSecNameMemBuf ) + +/************************************************************************* + * + * MD5 strings + * + ************************************************************************/ +#define xmlSecNameMd5 (XMLSEC_GLOBAL_CONST xmlSecNameMd5 ) +#define xmlSecHrefMd5 (XMLSEC_GLOBAL_CONST xmlSecHrefMd5 ) + +/************************************************************************* + * + * RetrievalMethod + * + ************************************************************************/ +#define xmlSecNameRetrievalMethod (XMLSEC_GLOBAL_CONST xmlSecNameRetrievalMethod ) +#define xmlSecNodeRetrievalMethod (XMLSEC_GLOBAL_CONST xmlSecNodeRetrievalMethod ) + +/************************************************************************* + * + * RIPEMD160 strings + * + ************************************************************************/ +#define xmlSecNameRipemd160 (XMLSEC_GLOBAL_CONST xmlSecNameRipemd160 ) +#define xmlSecHrefRipemd160 (XMLSEC_GLOBAL_CONST xmlSecHrefRipemd160 ) + +/************************************************************************* + * + * RSA strings + * + ************************************************************************/ +#define xmlSecNameRSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecNameRSAKeyValue ) +#define xmlSecNodeRSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecNodeRSAKeyValue ) +#define xmlSecHrefRSAKeyValue (XMLSEC_GLOBAL_CONST xmlSecHrefRSAKeyValue ) + +#define xmlSecNodeRSAModulus (XMLSEC_GLOBAL_CONST xmlSecNodeRSAModulus ) +#define xmlSecNodeRSAExponent (XMLSEC_GLOBAL_CONST xmlSecNodeRSAExponent ) +#define xmlSecNodeRSAPrivateExponent (XMLSEC_GLOBAL_CONST xmlSecNodeRSAPrivateExponent ) + +#define xmlSecNameRsaMd5 (XMLSEC_GLOBAL_CONST xmlSecNameRsaMd5 ) +#define xmlSecHrefRsaMd5 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaMd5 ) + +#define xmlSecNameRsaRipemd160 (XMLSEC_GLOBAL_CONST xmlSecNameRsaRipemd160 ) +#define xmlSecHrefRsaRipemd160 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaRipemd160 ) + +#define xmlSecNameRsaSha1 (XMLSEC_GLOBAL_CONST xmlSecNameRsaSha1 ) +#define xmlSecHrefRsaSha1 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaSha1 ) + +#define xmlSecNameRsaSha224 (XMLSEC_GLOBAL_CONST xmlSecNameRsaSha224 ) +#define xmlSecHrefRsaSha224 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaSha224 ) + +#define xmlSecNameRsaSha256 (XMLSEC_GLOBAL_CONST xmlSecNameRsaSha256 ) +#define xmlSecHrefRsaSha256 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaSha256 ) + +#define xmlSecNameRsaSha384 (XMLSEC_GLOBAL_CONST xmlSecNameRsaSha384 ) +#define xmlSecHrefRsaSha384 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaSha384 ) + +#define xmlSecNameRsaSha512 (XMLSEC_GLOBAL_CONST xmlSecNameRsaSha512 ) +#define xmlSecHrefRsaSha512 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaSha512 ) + +#define xmlSecNameRsaPkcs1 (XMLSEC_GLOBAL_CONST xmlSecNameRsaPkcs1 ) +#define xmlSecHrefRsaPkcs1 (XMLSEC_GLOBAL_CONST xmlSecHrefRsaPkcs1 ) + +#define xmlSecNameRsaOaep (XMLSEC_GLOBAL_CONST xmlSecNameRsaOaep ) +#define xmlSecHrefRsaOaep (XMLSEC_GLOBAL_CONST xmlSecHrefRsaOaep ) +#define xmlSecNodeRsaOAEPparams (XMLSEC_GLOBAL_CONST xmlSecNodeRsaOAEPparams ) + +/************************************************************************* + * + * SHA1 strings + * + ************************************************************************/ +#define xmlSecNameSha1 (XMLSEC_GLOBAL_CONST xmlSecNameSha1 ) +#define xmlSecHrefSha1 (XMLSEC_GLOBAL_CONST xmlSecHrefSha1 ) + +#define xmlSecNameSha224 (XMLSEC_GLOBAL_CONST xmlSecNameSha224 ) +#define xmlSecHrefSha224 (XMLSEC_GLOBAL_CONST xmlSecHrefSha224 ) + +#define xmlSecNameSha256 (XMLSEC_GLOBAL_CONST xmlSecNameSha256 ) +#define xmlSecHrefSha256 (XMLSEC_GLOBAL_CONST xmlSecHrefSha256 ) + +#define xmlSecNameSha384 (XMLSEC_GLOBAL_CONST xmlSecNameSha384 ) +#define xmlSecHrefSha384 (XMLSEC_GLOBAL_CONST xmlSecHrefSha384 ) + +#define xmlSecNameSha512 (XMLSEC_GLOBAL_CONST xmlSecNameSha512 ) +#define xmlSecHrefSha512 (XMLSEC_GLOBAL_CONST xmlSecHrefSha512 ) + +/************************************************************************* + * + * X509 strings + * + ************************************************************************/ +#define xmlSecNameX509Data (XMLSEC_GLOBAL_CONST xmlSecNameX509Data ) +#define xmlSecNodeX509Data (XMLSEC_GLOBAL_CONST xmlSecNodeX509Data ) +#define xmlSecHrefX509Data (XMLSEC_GLOBAL_CONST xmlSecHrefX509Data ) + +#define xmlSecNodeX509Certificate (XMLSEC_GLOBAL_CONST xmlSecNodeX509Certificate ) +#define xmlSecNodeX509CRL (XMLSEC_GLOBAL_CONST xmlSecNodeX509CRL ) +#define xmlSecNodeX509SubjectName (XMLSEC_GLOBAL_CONST xmlSecNodeX509SubjectName ) +#define xmlSecNodeX509IssuerSerial (XMLSEC_GLOBAL_CONST xmlSecNodeX509IssuerSerial ) +#define xmlSecNodeX509IssuerName (XMLSEC_GLOBAL_CONST xmlSecNodeX509IssuerName ) +#define xmlSecNodeX509SerialNumber (XMLSEC_GLOBAL_CONST xmlSecNodeX509SerialNumber ) +#define xmlSecNodeX509SKI (XMLSEC_GLOBAL_CONST xmlSecNodeX509SKI ) + +#define xmlSecNameRawX509Cert (XMLSEC_GLOBAL_CONST xmlSecNameRawX509Cert ) +#define xmlSecHrefRawX509Cert (XMLSEC_GLOBAL_CONST xmlSecHrefRawX509Cert ) + +#define xmlSecNameX509Store (XMLSEC_GLOBAL_CONST xmlSecNameX509Store ) + +/************************************************************************* + * + * PGP strings + * + ************************************************************************/ +#define xmlSecNamePGPData (XMLSEC_GLOBAL_CONST xmlSecNamePGPData ) +#define xmlSecNodePGPData (XMLSEC_GLOBAL_CONST xmlSecNodePGPData ) +#define xmlSecHrefPGPData (XMLSEC_GLOBAL_CONST xmlSecHrefPGPData ) + +/************************************************************************* + * + * SPKI strings + * + ************************************************************************/ +#define xmlSecNameSPKIData (XMLSEC_GLOBAL_CONST xmlSecNameSPKIData ) +#define xmlSecNodeSPKIData (XMLSEC_GLOBAL_CONST xmlSecNodeSPKIData ) +#define xmlSecHrefSPKIData (XMLSEC_GLOBAL_CONST xmlSecHrefSPKIData ) + +/************************************************************************* + * + * XPath/XPointer strings + * + ************************************************************************/ +#define xmlSecNameXPath (XMLSEC_GLOBAL_CONST xmlSecNameXPath ) +#define xmlSecNodeXPath (XMLSEC_GLOBAL_CONST xmlSecNodeXPath ) + +#define xmlSecNameXPath2 (XMLSEC_GLOBAL_CONST xmlSecNameXPath2 ) +#define xmlSecNodeXPath2 (XMLSEC_GLOBAL_CONST xmlSecNodeXPath2 ) +#define xmlSecXPath2FilterIntersect (XMLSEC_GLOBAL_CONST xmlSecXPath2FilterIntersect ) +#define xmlSecXPath2FilterSubtract (XMLSEC_GLOBAL_CONST xmlSecXPath2FilterSubtract ) +#define xmlSecXPath2FilterUnion (XMLSEC_GLOBAL_CONST xmlSecXPath2FilterUnion ) +#define xmlSecNameXPointer (XMLSEC_GLOBAL_CONST xmlSecNameXPointer ) +#define xmlSecNodeXPointer (XMLSEC_GLOBAL_CONST xmlSecNodeXPointer ) + +/************************************************************************* + * + * Xslt strings + * + ************************************************************************/ +#define xmlSecNameXslt (XMLSEC_GLOBAL_CONST xmlSecNameXslt ) +#define xmlSecHrefXslt (XMLSEC_GLOBAL_CONST xmlSecHrefXslt ) + +#ifndef XMLSEC_NO_SOAP +/************************************************************************* + * + * SOAP 1.1/1.2 strings + * + ************************************************************************/ +#define xmlSecNodeEnvelope (XMLSEC_GLOBAL_CONST xmlSecNodeEnvelope ) +#define xmlSecNodeHeader (XMLSEC_GLOBAL_CONST xmlSecNodeHeader ) +#define xmlSecNodeBody (XMLSEC_GLOBAL_CONST xmlSecNodeBody ) +#define xmlSecNodeFault (XMLSEC_GLOBAL_CONST xmlSecNodeFault ) +#define xmlSecNodeFaultCode (XMLSEC_GLOBAL_CONST xmlSecNodeFaultCode ) +#define xmlSecNodeFaultString (XMLSEC_GLOBAL_CONST xmlSecNodeFaultString ) +#define xmlSecNodeFaultActor (XMLSEC_GLOBAL_CONST xmlSecNodeFaultActor ) +#define xmlSecNodeFaultDetail (XMLSEC_GLOBAL_CONST xmlSecNodeFaultDetail ) +#define xmlSecNodeCode (XMLSEC_GLOBAL_CONST xmlSecNodeCode ) +#define xmlSecNodeReason (XMLSEC_GLOBAL_CONST xmlSecNodeReason ) +#define xmlSecNodeNode (XMLSEC_GLOBAL_CONST xmlSecNodeNode ) +#define xmlSecNodeRole (XMLSEC_GLOBAL_CONST xmlSecNodeRole ) +#define xmlSecNodeDetail (XMLSEC_GLOBAL_CONST xmlSecNodeDetail ) +#define xmlSecNodeValue (XMLSEC_GLOBAL_CONST xmlSecNodeValue ) +#define xmlSecNodeSubcode (XMLSEC_GLOBAL_CONST xmlSecNodeSubcode ) +#define xmlSecNodeText (XMLSEC_GLOBAL_CONST xmlSecNodeText ) + +#define xmlSecSoapFaultCodeVersionMismatch (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeVersionMismatch ) +#define xmlSecSoapFaultCodeMustUnderstand (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeMustUnderstand ) +#define xmlSecSoapFaultCodeClient (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeClient ) +#define xmlSecSoapFaultCodeServer (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeServer ) +#define xmlSecSoapFaultCodeReceiver (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeReceiver ) +#define xmlSecSoapFaultCodeSender (XMLSEC_GLOBAL_CONST xmlSecSoapFaultCodeSender ) +#define xmlSecSoapFaultDataEncodningUnknown (XMLSEC_GLOBAL_CONST xmlSecSoapFaultDataEncodningUnknown ) + + +#endif /* XMLSEC_NO_SOAP */ + +/************************************************************************* + * + * Utility strings + * + ************************************************************************/ +#define xmlSecStringEmpty (XMLSEC_GLOBAL_CONST xmlSecStringEmpty ) +#define xmlSecStringCR (XMLSEC_GLOBAL_CONST xmlSecStringCR ) + +#endif //!defined(IN_XMLSEC) + + +XMLSEC_EXPORT const xmlSecGlobalConstData* xmlSecGetGlobalConsts(); + +#endif // __SYMBIAN32__ + + +#if !defined(__SYMBIAN32__) +/* Defining strings for non-Symbian platform */ + +/************************************************************************* + * + * Global Namespaces + * + ************************************************************************/ + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecDSigNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecEncNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPathNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2Ns[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPointerNs[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoap11Ns[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoap12Ns[]; + + +/************************************************************************* + * + * DSig Nodes + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSignature[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSignedInfo[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSignatureValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCanonicalizationMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSignatureMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDigestMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDigestValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeObject[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeManifest[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSignatureProperties[]; + +/************************************************************************* + * + * Encryption Nodes + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEncryptedData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEncryptionMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEncryptionProperties[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEncryptionProperty[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCipherData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCipherValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCipherReference[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeReferenceList[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDataReference[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeKeyReference[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCarriedKeyName[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecTypeEncContent[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecTypeEncElement[]; + +/************************************************************************* + * + * XKMS nodes, attributes and value strings + * + ************************************************************************/ +#ifndef XMLSEC_NO_XKMS +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsServerRequestResultName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsServerRequestStatusName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsServerRequestLocateName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsServerRequestValidateName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsServerRequestCompoundName[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeResult[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeStatusRequest[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeStatusResult[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeLocateRequest[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeLocateResult[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeValidateRequest[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeValidateResult[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCompoundRequest[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCompoundResult[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeMessageExtension[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeOpaqueClientData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeResponseMechanism[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRespondWith[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodePendingNotification[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeQueryKeyBinding[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeKeyUsage[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeUseKeyWith[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeTimeInstant[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRequestSignatureValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeUnverifiedKeyBinding[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeValidityInterval[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeStatus[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeValidReason[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeInvalidReason[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeIndeterminateReason[]; + + +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrService[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrNonce[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrOriginalRequestId[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrResponseLimit[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrMechanism[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrIdentifier[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrApplication[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrResultMajor[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrResultMinor[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrRequestId[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrNotBefore[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrNotOnOrAfter[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrTime[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrStatusValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecResponseMechanismPending[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResponseMechanismRepresent[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResponseMechanismRequestSignatureValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithKeyName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithX509Cert[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithX509Chain[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithX509CRL[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithOCSP[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithRetrievalMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithPGP[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithPGPWeb[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithSPKI[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecRespondWithPrivateKey[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecStatusResultSuccess[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecStatusResultFailed[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecStatusResultPending[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyUsageEncryption[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyUsageSignature[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyUsageExchange[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingStatusValid[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingStatusInvalid[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingStatusIndeterminate[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingReasonIssuerTrust[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingReasonRevocationStatus[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingReasonValidityInterval[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecKeyBindingReasonSignature[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodeSuccess[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodeVersionMismatch[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodeSender[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodeReceiver[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodeRepresent[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMajorCodePending[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeNoMatch[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeTooManyResponses[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeIncomplete[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeFailure[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeRefused[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeNoAuthentication[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeMessageNotSupported[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeUnknownResponseId[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecResultMinorCodeNotSynchronous[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonLang[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonUnsupportedVersion[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonUnableToProcess[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonServiceUnavailable[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonMessageNotSupported[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapFaultReasonMessageInvalid[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapSubcodeValueMessageNotSupported[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsSoapSubcodeValueBadMessage[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsFormatStrPlain[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsFormatStrSoap11[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXkmsFormatStrSoap12[]; + +#endif /* XMLSEC_NO_XKMS */ + +/************************************************************************* + * + * KeyInfo and Transform Nodes + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeKeyInfo[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeReference[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeTransforms[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeTransform[]; + +/************************************************************************* + * + * Attributes + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrId[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrURI[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrType[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrMimeType[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrEncoding[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrAlgorithm[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrTarget[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrFilter[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrRecipient[]; + +/************************************************************************* + * + * AES strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAESKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeAESKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAESKeyValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes128Cbc[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes128Cbc[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes192Cbc[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes192Cbc[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes256Cbc[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes256Cbc[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKWAes128[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefKWAes128[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKWAes192[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefKWAes192[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKWAes256[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefKWAes256[]; + +/************************************************************************* + * + * BASE64 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameBase64[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefBase64[]; + +/************************************************************************* + * + * C14N strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameC14N[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefC14N[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameC14NWithComments[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefC14NWithComments[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameExcC14N[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefExcC14N[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameExcC14NWithComments[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefExcC14NWithComments[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNsExcC14N[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNsExcC14NWithComments[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeInclusiveNamespaces[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecAttrPrefixList[]; + +/************************************************************************* + * + * DES strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameDESKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDESKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefDESKeyValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameDes3Cbc[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefDes3Cbc[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKWDes3[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefKWDes3[]; + +/************************************************************************* + * + * DSA strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameDSAKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefDSAKeyValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAP[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAQ[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAG[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAJ[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAX[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAY[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSASeed[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDSAPgenCounter[]; + + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameDsaSha1[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefDsaSha1[]; + +/************************************************************************* + * + * EncryptedKey + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameEncryptedKey[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEncryptedKey[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefEncryptedKey[]; + +/************************************************************************* + * + * Enveloped transform strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameEnveloped[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefEnveloped[]; + +/************************************************************************* + * + * HMAC strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHMACKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeHMACKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHMACKeyValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeHMACOutputLength[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacMd5[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacMd5[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacRipemd160[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacRipemd160[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacSha1[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacSha1[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacSha224[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacSha224[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacSha256[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacSha256[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacSha384[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacSha384[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameHmacSha512[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefHmacSha512[]; + +/************************************************************************* + * + * KeyName strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKeyName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeKeyName[]; + +/************************************************************************* + * + * KeyValue strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeKeyValue[]; + +/************************************************************************* + * + * Memory Buffer strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameMemBuf[]; + +/************************************************************************* + * + * MD5 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameMd5[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefMd5[]; + +/************************************************************************* + * + * RetrievalMethod + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRetrievalMethod[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRetrievalMethod[]; + +/************************************************************************* + * + * RIPEMD160 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRipemd160[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRipemd160[]; + +/************************************************************************* + * + * RSA strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRSAKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRSAKeyValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRSAKeyValue[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRSAModulus[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRSAExponent[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRSAPrivateExponent[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaMd5[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaMd5[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaRipemd160[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaRipemd160[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaSha1[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaSha1[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaSha224[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaSha224[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaSha256[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaSha256[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaSha384[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaSha384[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaSha512[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaSha512[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaPkcs1[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaPkcs1[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRsaOaep[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRsaOaep[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRsaOAEPparams[]; + +/************************************************************************* + * + * SHA1 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSha1[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSha1[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSha224[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSha224[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSha256[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSha256[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSha384[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSha384[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSha512[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSha512[]; + +/************************************************************************* + * + * X509 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameX509Data[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509Data[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefX509Data[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509Certificate[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509CRL[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509SubjectName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509IssuerSerial[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509IssuerName[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509SerialNumber[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeX509SKI[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRawX509Cert[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRawX509Cert[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameX509Store[]; + +/************************************************************************* + * + * PGP strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNamePGPData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodePGPData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefPGPData[]; + +/************************************************************************* + * + * SPKI strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameSPKIData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSPKIData[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefSPKIData[]; + +/************************************************************************* + * + * XPath/XPointer strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXPath[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeXPath[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXPath2[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeXPath2[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2FilterIntersect[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2FilterSubtract[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2FilterUnion[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXPointer[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeXPointer[]; + +/************************************************************************* + * + * Xslt strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXslt[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefXslt[]; + +#ifndef XMLSEC_NO_SOAP +/************************************************************************* + * + * SOAP 1.1/1.2 strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeEnvelope[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeHeader[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeBody[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeFault[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeFaultCode[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeFaultString[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeFaultActor[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeFaultDetail[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeCode[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeReason[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeNode[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRole[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeDetail[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeValue[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeSubcode[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeText[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeVersionMismatch[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeMustUnderstand[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeClient[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeServer[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeReceiver[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultCodeSender[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecSoapFaultDataEncodningUnknown[]; + + +#endif /* XMLSEC_NO_SOAP */ + +/************************************************************************* + * + * Utility strings + * + ************************************************************************/ +XMLSEC_EXPORT_VAR const xmlChar xmlSecStringEmpty[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecStringCR[]; + +#endif //!defined(__SYMBIAN32__) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_STRINGS_H__ */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_templates.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_templates.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,169 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * KeyInfo node processing + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_TEMPLATES_H__ +#define __XMLSEC_TEMPALTES_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_transforms.h" + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureCreate (xmlDocPtr doc, + xmlSecTransformId c14nMethodId, + xmlSecTransformId signMethodId, + const xmlChar *id); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureEnsureKeyInfo (xmlNodePtr signNode, + const xmlChar *id); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddReference (xmlNodePtr signNode, + xmlSecTransformId digestMethodId, + const xmlChar *id, + const xmlChar *uri, + const xmlChar *type); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddObject (xmlNodePtr signNode, + const xmlChar *id, + const xmlChar *mimeType, + const xmlChar *encoding); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetSignMethodNode (xmlNodePtr signNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetC14NMethodNode (xmlNodePtr signNode); + +XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceAddTransform (xmlNodePtr referenceNode, + xmlSecTransformId transformId); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddSignProperties (xmlNodePtr objectNode, + const xmlChar *id, + const xmlChar *target); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddManifest (xmlNodePtr objectNode, + const xmlChar *id); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplManifestAddReference (xmlNodePtr manifestNode, + xmlSecTransformId digestMethodId, + const xmlChar *id, + const xmlChar *uri, + const xmlChar *type); + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataCreate (xmlDocPtr doc, + xmlSecTransformId encMethodId, + const xmlChar *id, + const xmlChar *type, + const xmlChar *mimeType, + const xmlChar *encoding); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureKeyInfo (xmlNodePtr encNode, + const xmlChar *id); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureEncProperties (xmlNodePtr encNode, + const xmlChar *id); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataAddEncProperty (xmlNodePtr encNode, + const xmlChar *id, + const xmlChar *target); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherValue (xmlNodePtr encNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherReference (xmlNodePtr encNode, + const xmlChar *uri); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataGetEncMethodNode (xmlNodePtr encNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplCipherReferenceAddTransform (xmlNodePtr cipherReferenceNode, + xmlSecTransformId transformId); + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, + const xmlChar *uri); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encNode, + const xmlChar *uri); + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyName (xmlNodePtr keyInfoNode, + const xmlChar* name); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyValue (xmlNodePtr keyInfoNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddX509Data (xmlNodePtr keyInfoNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddRetrievalMethod (xmlNodePtr keyInfoNode, + const xmlChar *uri, + const xmlChar *type); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplRetrievalMethodAddTransform (xmlNodePtr retrMethodNode, + xmlSecTransformId transformId); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddEncryptedKey (xmlNodePtr keyInfoNode, + xmlSecTransformId encMethodId, + const xmlChar *id, + const xmlChar *type, + const xmlChar *recipient); + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddIssuerSerial (xmlNodePtr x509DataNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSubjectName (xmlNodePtr x509DataNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSKI (xmlNodePtr x509DataNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCertificate (xmlNodePtr x509DataNode); +XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCRL (xmlNodePtr x509DataNode); + +/*********************************************************************** + * + * node + * + **********************************************************************/ +XMLSEC_EXPORT int xmlSecTmplTransformAddHmacOutputLength (xmlNodePtr transformNode, + xmlSecSize bitsLen); +XMLSEC_EXPORT int xmlSecTmplTransformAddRsaOaepParam (xmlNodePtr transformNode, + const xmlSecByte *buf, + xmlSecSize size); +XMLSEC_EXPORT int xmlSecTmplTransformAddXsltStylesheet (xmlNodePtr transformNode, + const xmlChar *xslt); +XMLSEC_EXPORT int xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode, + const xmlChar *prefixList); +XMLSEC_EXPORT int xmlSecTmplTransformAddXPath (xmlNodePtr transformNode, + const xmlChar *expression, + const xmlChar **nsList); +XMLSEC_EXPORT int xmlSecTmplTransformAddXPath2 (xmlNodePtr transformNode, + const xmlChar* type, + const xmlChar *expression, + const xmlChar **nsList); +XMLSEC_EXPORT int xmlSecTmplTransformAddXPointer (xmlNodePtr transformNode, + const xmlChar *expression, + const xmlChar **nsList); +/*********************************************************************** + * + * Template properties + * + **********************************************************************/ + +XMLSEC_EXPORT void xmlSetNewLineFlag(int aNewLine); + +int xmlGetNewLineFlag(); + +XMLSEC_EXPORT void xmlSetPrefix(unsigned char* aPref); + +unsigned char* xmlGetPrefix(); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_KEYINFO_TEMPLATES_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_transforms.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_transforms.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,987 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * The transforms engine + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_TRANSFORMS_H__ +#define __XMLSEC_TRANSFORMS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include "xmlsec_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_list.h" +#include "xmlsec_nodeset.h" +#include "xmlsec_keys.h" + +typedef const struct _xmlSecTransformKlass xmlSecTransformKlass, + *xmlSecTransformId; +/** + * XMLSEC_TRANSFORM_BINARY_CHUNK: + * + * The binary data chunks size. XMLSec processes binary data one chunk + * at a time. Changing this impacts xmlsec memory usage and performance. + */ +#define XMLSEC_TRANSFORM_BINARY_CHUNK 64 + +/********************************************************************** + * + * Hi-level functions + * + *********************************************************************/ +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecTransformIdsGet (void); +XMLSEC_EXPORT int xmlSecTransformIdsInit (void); +XMLSEC_EXPORT void xmlSecTransformIdsShutdown (void); +XMLSEC_EXPORT int xmlSecTransformIdsRegisterDefault(void); +XMLSEC_EXPORT int xmlSecTransformIdsRegister (xmlSecTransformId id); + +/** + * xmlSecTransformStatus: + * @xmlSecTransformStatusNone: the status unknown. + * @xmlSecTransformStatusWorking: the transform is executed. + * @xmlSecTransformStatusFinished: the transform finished + * @xmlSecTransformStatusOk: the transform succeeded. + * @xmlSecTransformStatusFail: the transform failed (an error occur). + * + * The transform execution status. + */ +typedef enum { + xmlSecTransformStatusNone = 0, + xmlSecTransformStatusWorking, + xmlSecTransformStatusFinished, + xmlSecTransformStatusOk, + xmlSecTransformStatusFail +} xmlSecTransformStatus; + +/** + * xmlSecTransformMode: + * @xmlSecTransformModeNone: the mode is unknown. + * @xmlSecTransformModePush: pushing data thru transform. + * @xmlSecTransformModePop: popping data from transform. + * + * The transform operation mode + */ +typedef enum { + xmlSecTransformModeNone = 0, + xmlSecTransformModePush, + xmlSecTransformModePop +} xmlSecTransformMode; + +/** + * xmlSecTransformOperation: + * @xmlSecTransformOperationNone: the operation is unknown. + * @xmlSecTransformOperationEncode: the encode operation (for base64 transform). + * @xmlSecTransformOperationDecode: the decode operation (for base64 transform). + * @xmlSecTransformOperationSign: the sign or digest operation. + * @xmlSecTransformOperationVerify: the verification of signature or digest operation. + * @xmlSecTransformOperationEncrypt: the encryption operation. + * @xmlSecTransformOperationDecrypt: the decryption operation. + * + * The transform operation. + */ +typedef enum { + xmlSecTransformOperationNone = 0, + xmlSecTransformOperationEncode, + xmlSecTransformOperationDecode, + xmlSecTransformOperationSign, + xmlSecTransformOperationVerify, + xmlSecTransformOperationEncrypt, + xmlSecTransformOperationDecrypt +} xmlSecTransformOperation; + +/************************************************************************** + * + * xmlSecTransformUriType: + * + *************************************************************************/ +/** + * xmlSecTransformUriType: + * + * URI transform type bit mask. + */ +typedef unsigned int xmlSecTransformUriType; + +/** + * xmlSecTransformUriTypeNone: + * + * The URI type is unknown or not set. + */ +#define xmlSecTransformUriTypeNone 0x0000 + +/** + * xmlSecTransformUriTypeEmpty: + * + * The empty URI ("") type. + */ +#define xmlSecTransformUriTypeEmpty 0x0001 + +/** + * xmlSecTransformUriTypeSameDocument: + * + * The smae document ("#...") but not empty ("") URI type. + */ +#define xmlSecTransformUriTypeSameDocument 0x0002 + +/** + * xmlSecTransformUriTypeLocal: + * + * The local URI ("file:///....") type. + */ +#define xmlSecTransformUriTypeLocal 0x0004 + +/** + * xmlSecTransformUriTypeRemote: + * + * The remote URI type. + */ +#define xmlSecTransformUriTypeRemote 0x0008 + +/** + * xmlSecTransformUriTypeAny: + * + * Any URI type. + */ +#define xmlSecTransformUriTypeAny 0xFFFF + +XMLSEC_EXPORT int xmlSecTransformUriTypeCheck (xmlSecTransformUriType type, + const xmlChar* uri); +/************************************************************************** + * + * xmlSecTransformDataType + * + *************************************************************************/ +/** + * xmlSecTransformDataType: + * + * Transform data type bit mask. + */ +typedef xmlSecByte xmlSecTransformDataType; + +/** + * xmlSecTransformDataTypeUnknown: + * + * The transform data type is unknown or nor data expected. + */ +#define xmlSecTransformDataTypeUnknown 0x0000 + +/** + * xmlSecTransformDataTypeBin: + * + * The binary transform data. + */ +#define xmlSecTransformDataTypeBin 0x0001 + +/** + * xmlSecTransformDataTypeXml: + * + * The xml transform data. + */ +#define xmlSecTransformDataTypeXml 0x0002 + +/************************************************************************** + * + * xmlSecTransformUsage + * + *************************************************************************/ +/** + * xmlSecTransformUsage: + * + * The transform usage bit mask. + */ +typedef unsigned int xmlSecTransformUsage; + +/** + * xmlSecTransformUsageUnknown: + * + * Transforms usage is unknown or undefined. + */ +#define xmlSecTransformUsageUnknown 0x0000 + +/** + * xmlSecTransformUsageDSigTransform: + * + * Transform could be used in . + */ +#define xmlSecTransformUsageDSigTransform 0x0001 + +/** + * xmlSecTransformUsageC14NMethod: + * + * Transform could be used in . + */ +#define xmlSecTransformUsageC14NMethod 0x0002 + +/** + * xmlSecTransformUsageDigestMethod: + * + * Transform could be used in . + */ +#define xmlSecTransformUsageDigestMethod 0x0004 + +/** + * xmlSecTransformUsageSignatureMethod: + * + * Transform could be used in . + */ +#define xmlSecTransformUsageSignatureMethod 0x0008 + +/** + * xmlSecTransformUsageEncryptionMethod: + * + * Transform could be used in . + */ +#define xmlSecTransformUsageEncryptionMethod 0x0010 + +/** + * xmlSecTransformUsageAny: + * + * Transform could be used for operation. + */ +#define xmlSecTransformUsageAny 0xFFFF + +/************************************************************************** + * + * xmlSecTransformCtx + * + *************************************************************************/ +/** + * xmlSecTransformCtxPreExecuteCallback: + * @transformCtx: the pointer to transform's context. + * + * The callback called after creating transforms chain but before + * starting data processing. Application can use this callback to + * do additional transforms chain verification or modification and + * aborting transforms execution (if necessary). + * + * Returns 0 on success and a negative value otherwise (in this case, + * transforms chain will not be executed and xmlsec processing stops). + */ +typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecTransformCtxPtr transformCtx); + +/** + * XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK: + * + * If this flag is set then URI ID references are resolved directly + * without using XPointers. This allows one to sign/verify Visa3D + * documents that don't follow XML, XPointer and XML DSig specifications. + */ +#define XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK 0x00000001 + +/** + * xmlSecTransformCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto never + * touch this). + * @flags: the bit mask flags to control transforms execution + * (reserved for the future). + * @flags2: the bit mask flags to control transforms execution + * (reserved for the future). + * @enabledUris: the allowed transform data source uri types. + * @enabledTransforms: the list of enabled transforms; if list is empty (default) + * then all registered transforms are enabled. + * @preExecCallback: the callback called after preparing transform chain + * and right before actual data processing; application + * can use this callback to change transforms parameters, + * insert additional transforms in the chain or do + * additional validation (and abort transform execution + * if needed). + * @result: the pointer to transforms result buffer. + * @status: the transforms chain processng status. + * @uri: the data source URI without xpointer expression. + * @xptrExpr: the xpointer expression from data source URI (if any). + * @first: the first transform in the chain. + * @last: the last transform in the chain. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The transform execution context. + */ +struct _xmlSecTransformCtx { + /* user settings */ + void* userData; + unsigned int flags; + unsigned int flags2; + xmlSecTransformUriType enabledUris; + xmlSecPtrList enabledTransforms; + xmlSecTransformCtxPreExecuteCallback preExecCallback; + + /* results */ + xmlSecBufferPtr result; + xmlSecTransformStatus status; + xmlChar* uri; + xmlChar* xptrExpr; + xmlSecTransformPtr first; + xmlSecTransformPtr last; + + /* for the future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecTransformCtxPtr xmlSecTransformCtxCreate (void); +XMLSEC_EXPORT void xmlSecTransformCtxDestroy (xmlSecTransformCtxPtr ctx); +XMLSEC_EXPORT int xmlSecTransformCtxInitialize (xmlSecTransformCtxPtr ctx); +XMLSEC_EXPORT void xmlSecTransformCtxFinalize (xmlSecTransformCtxPtr ctx); +XMLSEC_EXPORT void xmlSecTransformCtxReset (xmlSecTransformCtxPtr ctx); +XMLSEC_EXPORT int xmlSecTransformCtxCopyUserPref (xmlSecTransformCtxPtr dst, + xmlSecTransformCtxPtr src); +XMLSEC_EXPORT int xmlSecTransformCtxSetUri (xmlSecTransformCtxPtr ctx, + const xmlChar* uri, + xmlNodePtr hereNode); +XMLSEC_EXPORT int xmlSecTransformCtxAppend (xmlSecTransformCtxPtr ctx, + xmlSecTransformPtr transform); +XMLSEC_EXPORT int xmlSecTransformCtxPrepend (xmlSecTransformCtxPtr ctx, + xmlSecTransformPtr transform); +XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, + xmlSecTransformId id); +XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, + xmlSecTransformId id); +XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxNodeRead (xmlSecTransformCtxPtr ctx, + xmlNodePtr node, + xmlSecTransformUsage usage); +XMLSEC_EXPORT int xmlSecTransformCtxNodesListRead (xmlSecTransformCtxPtr ctx, + xmlNodePtr node, + xmlSecTransformUsage usage); +XMLSEC_EXPORT int xmlSecTransformCtxPrepare (xmlSecTransformCtxPtr ctx, + xmlSecTransformDataType inputDataType); +XMLSEC_EXPORT int xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx, + const xmlSecByte* data, + xmlSecSize dataSize); +XMLSEC_EXPORT int xmlSecTransformCtxUriExecute (xmlSecTransformCtxPtr ctx, + const xmlChar* uri); +XMLSEC_EXPORT int xmlSecTransformCtxXmlExecute (xmlSecTransformCtxPtr ctx, + xmlSecNodeSetPtr nodes); +XMLSEC_EXPORT int xmlSecTransformCtxExecute (xmlSecTransformCtxPtr ctx, + xmlDocPtr doc); +XMLSEC_EXPORT void xmlSecTransformCtxDebugDump (xmlSecTransformCtxPtr ctx, + FILE* output); +XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecTransformCtxPtr ctx, + FILE* output); + + +/************************************************************************** + * + * xmlSecTransform + * + *************************************************************************/ +/** + * xmlSecTransform: + * @id: the transform id (pointer to #xmlSecTransformId). + * @operation: the transform's opertaion. + * @status: the current status. + * @hereNode: the pointer to transform's node. + * @next: the pointer to next transform in the chain. + * @prev: the pointer to previous transform in the chain. + * @inBuf: the input binary data buffer. + * @outBuf: the output binary data buffer. + * @inNodes: the input XML nodes. + * @outNodes: the output XML nodes. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The transform structure. + */ +struct _xmlSecTransform { + xmlSecTransformId id; + xmlSecTransformOperation operation; + xmlSecTransformStatus status; + xmlNodePtr hereNode; + + /* transforms chain */ + xmlSecTransformPtr next; + xmlSecTransformPtr prev; + + /* binary data */ + xmlSecBuffer inBuf; + xmlSecBuffer outBuf; + + /* xml data */ + xmlSecNodeSetPtr inNodes; + xmlSecNodeSetPtr outNodes; + + /* reserved for the future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCreate (xmlSecTransformId id); +XMLSEC_EXPORT void xmlSecTransformDestroy (xmlSecTransformPtr transform); +XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformNodeRead (xmlNodePtr node, + xmlSecTransformUsage usage, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformPump (xmlSecTransformPtr left, + xmlSecTransformPtr right, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformSetKey (xmlSecTransformPtr transform, + xmlSecKeyPtr key); +XMLSEC_EXPORT int xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, + xmlSecKeyReqPtr keyReq); +XMLSEC_EXPORT int xmlSecTransformVerify (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformGetDataType(xmlSecTransformPtr transform, + xmlSecTransformMode mode, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformPushBin (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + int final, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformPopBin (xmlSecTransformPtr transform, + xmlSecByte* data, + xmlSecSize maxDataSize, + xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformPushXml (xmlSecTransformPtr transform, + xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformPopXml (xmlSecTransformPtr transform, + xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT void xmlSecTransformDebugDump(xmlSecTransformPtr transform, + FILE* output); +XMLSEC_EXPORT void xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, + FILE* output); +/** + * xmlSecTransformGetName: + * @transform: the pointer to transform. + * + * Macro. Returns transform name. + */ +#define xmlSecTransformGetName(transform) \ + ((xmlSecTransformIsValid((transform))) ? \ + xmlSecTransformKlassGetName((transform)->id) : NULL) + +/** + * xmlSecTransformIsValid: + * @transform: the pointer to transform. + * + * Macro. Returns 1 if the @transform is valid or 0 otherwise. + */ +#define xmlSecTransformIsValid(transform) \ + ((( transform ) != NULL) && \ + (( transform )->id != NULL) && \ + (( transform )->id->klassSize >= sizeof(xmlSecTransformKlass)) && \ + (( transform )->id->objSize >= sizeof(xmlSecTransform)) && \ + (( transform )->id->name != NULL)) + +/** + * xmlSecTransformCheckType: + * @transform: the pointer to transform. + * @t: the transform type. + * + * Macro. Returns 1 if the @transform is valid and has specified type @t + * or 0 otherwise. + */ +#define xmlSecTransformCheckType(transform, t) \ + (xmlSecTransformIsValid(( transform )) && \ + ((( transform )->id->type) == ( t ))) + +/** + * xmlSecTransformCheckId: + * @transform: the pointer to transform. + * @i: the transform id. + * + * Macro. Returns 1 if the @transform is valid and has specified id @i + * or 0 otherwise. + */ +#define xmlSecTransformCheckId(transform, i) \ + (xmlSecTransformIsValid(( transform )) && \ + ((((const xmlSecTransformId) (( transform )->id))) == ( i ))) + +/** + * xmlSecTransformCheckSize: + * @transform: the pointer to transform. + * @size: the transform object size. + * + * Macro. Returns 1 if the @transform is valid and has at least @size + * bytes or 0 otherwise. + */ +#define xmlSecTransformCheckSize(transform, size) \ + (xmlSecTransformIsValid(( transform )) && \ + ((( transform )->id->objSize) >= ( size ))) + + +/************************************************************************ + * + * Operations on transforms chain + * + ************************************************************************/ +XMLSEC_EXPORT int xmlSecTransformConnect (xmlSecTransformPtr left, + xmlSecTransformPtr right, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT void xmlSecTransformRemove (xmlSecTransformPtr transform); + +/************************************************************************ + * + * Default callbacks, most of the transforms can use them + * + ************************************************************************/ +XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, + xmlSecTransformMode mode, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + int final, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, + xmlSecByte* data, + xmlSecSize maxDataSize, + xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, + xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT int xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, + xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx); + +/************************************************************************ + * + * IO buffers for transforms + * + ************************************************************************/ +XMLSEC_EXPORT xmlOutputBufferPtr xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, + xmlSecTransformCtxPtr transformCtx); +XMLSEC_EXPORT xmlParserInputBufferPtr xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, + xmlSecTransformCtxPtr transformCtx); + +/************************************************************************ + * + * Transform Klass + * + ************************************************************************/ +/** + * xmlSecTransformInitializeMethod: + * @transform: the pointer to transform object. + * + * The transform specific initialization method. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformInitializeMethod) (xmlSecTransformPtr transform); + +/** + * xmlSecTransformFinalizeMethod: + * @transform: the pointer to transform object. + * + * The transform specific destroy method. + */ +typedef void (*xmlSecTransformFinalizeMethod) (xmlSecTransformPtr transform); + +/** + * xmlSecTransformGetDataTypeMethod: + * @transform: the pointer to transform object. + * @mode: the mode. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to query information about transform + * data type in specified mode @mode. + * + * Returns transform data type. + */ +typedef xmlSecTransformDataType (*xmlSecTransformGetDataTypeMethod)(xmlSecTransformPtr transform, + xmlSecTransformMode mode, + xmlSecTransformCtxPtr transformCtx); + +/** + * xmlSecTransformNodeReadMethod: + * @transform: the pointer to transform object. + * @node: the pointer to node. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to read the transform data from + * the @node. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformNodeReadMethod) (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); + +/** + * xmlSecTransformNodeWriteMethod: + * @transform: the pointer to transform object. + * @node: the pointer to node. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to write transform information to an XML node @node. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformNodeWriteMethod) (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); + +/** + * xmlSecTransformSetKeyRequirementsMethod: + * @transform: the pointer to transform object. + * @keyReq: the pointer to key requirements structure. + * + * Transform specific method to set transform's key requirements. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform, + xmlSecKeyReqPtr keyReq); + +/** + * xmlSecTransformSetKeyMethod: + * @transform: the pointer to transform object. + * @key: the pointer to key. + * + * The transform specific method to set the key for use. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformSetKeyMethod) (xmlSecTransformPtr transform, + xmlSecKeyPtr key); + +/** + * xmlSecTransformVerifyMethod: + * @transform: the pointer to transform object. + * @data: the input buffer. + * @dataSize: the size of input buffer @data. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to verify transform processing results + * (used by digest and signature transforms). This method sets @status + * member of the #xmlSecTransform structure to either #xmlSecTransformStatusOk + * if verification succeeded or #xmlSecTransformStatusFail otherwise. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformVerifyMethod) (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx); +/** + * xmlSecTransformPushBinMethod: + * @transform: the pointer to transform object. + * @data: the input binary data, + * @dataSize: the input data size. + * @final: the flag: if set to 1 then it's the last + * data chunk. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to process data from @data and push + * result to the next transform in the chain. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformPushBinMethod) (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + int final, + xmlSecTransformCtxPtr transformCtx); +/** + * xmlSecTransformPopBinMethod: + * @transform: the pointer to transform object. + * @data: the buffer to store result data. + * @maxDataSize: the size of the buffer @data. + * @dataSize: the pointer to returned data size. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to pop data from previous transform + * in the chain and return result in the @data buffer. The size of returned + * data is placed in the @dataSize. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformPopBinMethod) (xmlSecTransformPtr transform, + xmlSecByte* data, + xmlSecSize maxDataSize, + xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx); +/** + * xmlSecTransformPushXmlMethod: + * @transform: the pointer to transform object. + * @nodes: the input nodes. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to process @nodes and push result to the next + * transform in the chain. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformPushXmlMethod) (xmlSecTransformPtr transform, + xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx); +/** + * xmlSecTransformPopXmlMethod: + * @transform: the pointer to transform object. + * @nodes: the pointer to store popinter to result nodes. + * @transformCtx: the pointer to transform context object. + * + * The transform specific method to pop data from previous transform in the chain, + * process the data and return result in @nodes. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformPopXmlMethod) (xmlSecTransformPtr transform, + xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx); +/** + * xmlSecTransformExecuteMethod: + * @transform: the pointer to transform object. + * @last: the flag: if set to 1 then it's the last data chunk. + * @transformCtx: the pointer to transform context object. + * + * Transform specific method to process a chunk of data. + * + * Returns 0 on success or a negative value otherwise. + */ +typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +/** + * xmlSecTransformKlass: + * @klassSize: the transform klass structure size. + * @objSize: the transform object size. + * @name: the transform's name. + * @href: the transform's identification string (href). + * @usage: the allowed transforms usages. + * @initialize: the initialization method. + * @finalize: the finmalization (destroy) function. + * @readNode: the XML node read method. + * @writeNode: the XML node write method. + * @setKeyReq: the set key requirements method. + * @setKey: the set key method. + * @verify: the verify method (for digest and signature transforms). + * @getDataType: the input/output data type query method. + * @pushBin: the binary data "push thru chain" processing method. + * @popBin: the binary data "pop from chain" procesing method. + * @pushXml: the XML data "push thru chain" processing method. + * @popXml: the XML data "pop from chain" procesing method. + * @execute: the low level data processing method used by default + * implementations of @pushBin, @popBin, @pushXml and @popXml. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The transform klass desccription structure. + */ + +struct _xmlSecTransformKlass { + /* data */ + xmlSecSize klassSize; + xmlSecSize objSize; + const xmlChar* name; + const xmlChar* href; + xmlSecTransformUsage usage; + + /* methods */ + xmlSecTransformInitializeMethod initialize; + xmlSecTransformFinalizeMethod finalize; + + xmlSecTransformNodeReadMethod readNode; + xmlSecTransformNodeWriteMethod writeNode; + + xmlSecTransformSetKeyRequirementsMethod setKeyReq; + xmlSecTransformSetKeyMethod setKey; + xmlSecTransformVerifyMethod verify; + xmlSecTransformGetDataTypeMethod getDataType; + + xmlSecTransformPushBinMethod pushBin; + xmlSecTransformPopBinMethod popBin; + xmlSecTransformPushXmlMethod pushXml; + xmlSecTransformPopXmlMethod popXml; + + /* low level method */ + xmlSecTransformExecuteMethod execute; + + /* reserved for future */ + void* reserved0; + void* reserved1; +}; + +/** + * xmlSecTransformKlassGetName: + * @klass: the transofrm's klass. + * + * Macro. Returns transform klass name. + */ +#define xmlSecTransformKlassGetName(klass) \ + (((klass)) ? ((klass)->name) : NULL) + +/*********************************************************************** + * + * Transform Ids list + * + **********************************************************************/ +/** + * xmlSecTransformIdListId: + * + * Transform klasses list klass. + */ +#define xmlSecTransformIdListId xmlSecTransformIdListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecTransformIdListGetKlass (void); +XMLSEC_EXPORT int xmlSecTransformIdListFind (xmlSecPtrListPtr list, + xmlSecTransformId transformId); +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByHref (xmlSecPtrListPtr list, + const xmlChar* href, + xmlSecTransformUsage usage); +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByName (xmlSecPtrListPtr list, + const xmlChar* name, + xmlSecTransformUsage usage); +XMLSEC_EXPORT void xmlSecTransformIdListDebugDump (xmlSecPtrListPtr list, + FILE* output); +XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, + FILE* output); + + +/******************************************************************** + * + * XML Sec Library Transform Ids + * + *******************************************************************/ +/** + * xmlSecTransformIdUnknown: + * + * The "unknown" transform id (NULL). + */ +#define xmlSecTransformIdUnknown ((xmlSecTransformId)NULL) + +/** + * xmlSecTransformBase64Id: + * + * The base64 encode transform klass. + */ +#define xmlSecTransformBase64Id \ + xmlSecTransformBase64GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformBase64GetKlass (void); +XMLSEC_EXPORT void xmlSecTransformBase64SetLineSize (xmlSecTransformPtr transform, + xmlSecSize lineSize); +/** + * xmlSecTransformInclC14NId: + * + * The regular (inclusive) C14N without comments transform klass. + */ +#define xmlSecTransformInclC14NId \ + xmlSecTransformInclC14NGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass (void); + +/** + * xmlSecTransformInclC14NWithCommentsId: + * + * The regular (inclusive) C14N with comments transform klass. + */ +#define xmlSecTransformInclC14NWithCommentsId \ + xmlSecTransformInclC14NWithCommentsGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void); + +/** + * xmlSecTransformExclC14NId + * + * The exclusive C14N without comments transform klass. + */ +#define xmlSecTransformExclC14NId \ + xmlSecTransformExclC14NGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass (void); + +/** + * xmlSecTransformExclC14NWithCommentsId: + * + * The exclusive C14N with comments transform klass. + */ +#define xmlSecTransformExclC14NWithCommentsId \ + xmlSecTransformExclC14NWithCommentsGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void); + +/** + * xmlSecTransformEnvelopedId: + * + * The "enveloped" transform klass. + */ +#define xmlSecTransformEnvelopedId \ + xmlSecTransformEnvelopedGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass (void); + +/** + * xmlSecTransformXPathId: + * + * The XPath transform klass. + */ +#define xmlSecTransformXPathId \ + xmlSecTransformXPathGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass (void); + +/** + * xmlSecTransformXPath2Id: + * + * The XPath2 transform klass. + */ +#define xmlSecTransformXPath2Id \ + xmlSecTransformXPath2GetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass (void); + +/** + * xmlSecTransformXPointerId: + * + * The XPointer transform klass. + */ +#define xmlSecTransformXPointerId \ + xmlSecTransformXPointerGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPointerGetKlass (void); +XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform, + const xmlChar* expr, + xmlSecNodeSetType nodeSetType, + xmlNodePtr hereNode); +#ifndef XMLSEC_NO_XSLT +/** + * xmlSecTransformXsltId: + * + * The XSLT transform klass. + */ +#define xmlSecTransformXsltId \ + xmlSecTransformXsltGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass (void); +#endif /* XMLSEC_NO_XSLT */ + +/** + * xmlSecTransformRemoveXmlTagsC14NId: + * + * The "remove all xml tags" transform klass (used before base64 transforms). + */ +#define xmlSecTransformRemoveXmlTagsC14NId \ + xmlSecTransformRemoveXmlTagsC14NGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void); + +/** + * xmlSecTransformVisa3DHackId: + * + * Selects node subtree by given node id string. The only reason why we need this + * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows + * something like "#12345" in the URI attribute. Since we couldn't evaluate such + * expressions thru XPath/XPointer engine, + */ +#define xmlSecTransformVisa3DHackId \ + xmlSecTransformVisa3DHackGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformVisa3DHackGetKlass (void); +XMLSEC_EXPORT int xmlSecTransformVisa3DHackSetID (xmlSecTransformPtr transform, + const xmlChar* id); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_TRANSFORMS_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_version.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_version.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,64 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Version information + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_VERSION_H__ +#define __XMLSEC_VERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsec_config.h" + +/** + * XMLSEC_VERSION: + * + * The library version string in the format + * "..". + */ +#define XMLSEC_VERSION "1.2.9" + +/** + * XMLSEC_VERSION_MAJOR: + * + * The library major version number. + */ +#define XMLSEC_VERSION_MAJOR 1 + +/** + * XMLSEC_VERSION_MINOR: + * + * The library minor version number. + */ +#define XMLSEC_VERSION_MINOR 2 + +/** + * XMLSEC_VERSION_SUBMINOR: + * + * The library sub-minor version number. + */ +#define XMLSEC_VERSION_SUBMINOR 9 + +/** + * XMLSEC_VERSION_INFO: + * + * The library version info string in the format + * "+::". + */ +#define XMLSEC_VERSION_INFO "3:9:2" + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_VERSION_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_x509.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_x509.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,81 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_X509_H__ +#define __XMLSEC_X509_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_X509 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" + +/** + * XMLSEC_X509DATA_CERTIFICATE_NODE: + * + * node found or would be written back. + */ +#define XMLSEC_X509DATA_CERTIFICATE_NODE 0x00000001 +/** + * XMLSEC_X509DATA_SUBJECTNAME_NODE: + * + * node found or would be written back. + */ +#define XMLSEC_X509DATA_SUBJECTNAME_NODE 0x00000002 +/** + * XMLSEC_X509DATA_ISSUERSERIAL_NODE: + * + * node found or would be written back. + */ +#define XMLSEC_X509DATA_ISSUERSERIAL_NODE 0x00000004 +/** + * XMLSEC_X509DATA_SKI_NODE: + * + * node found or would be written back. + */ +#define XMLSEC_X509DATA_SKI_NODE 0x00000008 +/** + * XMLSEC_X509DATA_CRL_NODE: + * + * node found or would be written back. + */ +#define XMLSEC_X509DATA_CRL_NODE 0x00000010 +/** + * XMLSEC_X509DATA_DEFAULT: + * + * Default set of nodes to write in case of empty + * node template. + */ +#define XMLSEC_X509DATA_DEFAULT \ + (XMLSEC_X509DATA_CERTIFICATE_NODE | XMLSEC_X509DATA_CRL_NODE) + +XMLSEC_EXPORT int xmlSecX509DataGetNodeContent (xmlNodePtr node, + int deleteChildren, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_X509 */ + +#endif /* __XMLSEC_X509_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_xkms.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_xkms.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,653 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Key Management Specification v 2.0" implementation + * http://www.w3.org/TR/xkms2/ + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_XKMS_H__ +#define __XMLSEC_XKMS_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XKMS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" + +/************************************************************************ + * + * Forward declarations. These internal xmlsec library structures are + * declared in "xmlsec/private/xkms.h" file. + * + ************************************************************************/ +typedef struct _xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKlass, + *xmlSecXkmsRespondWithId; + +typedef struct _xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestKlass, + *xmlSecXkmsServerRequestId; + + +/** + * xmlSecXkmsResultMajor: + * @xmlSecXkmsResultMajorSuccess: The operation succeeded. + * @xmlSecXkmsResultMajorVersionMismatch: The service does not support + * the protocol version specified + * in the request. + * @xmlSecXkmsResultMajorSender: An error occurred that was due + * to the message sent by the sender. + * @xmlSecXkmsResultMajorReceiver: An error occurred at the receiver. + * @xmlSecXkmsResultMajorRepresent: The service has not acted on the + * request. In order for the request + * to be acted upon the request MUST + * be represented with the specified + * nonce in accordance with the two + * phase protocol. + * @xmlSecXkmsResultMajorPending: The request has been accepted + * for processing and the service + * will return the result asynchronously. + * + * The values for ResultMajor attribute. + */ +typedef enum { + xmlSecXkmsResultMajorSuccess = 0, + xmlSecXkmsResultMajorVersionMismatch, + xmlSecXkmsResultMajorSender, + xmlSecXkmsResultMajorReceiver, + xmlSecXkmsResultMajorRepresent, + xmlSecXkmsResultMajorPending +} xmlSecXkmsResultMajor; + +/** + * xmlSecXkmsResultMinor: + * @xmlSecXkmsResultMinorNone: No minor result code available. + * @xmlSecXkmsResultMinorNoMatch: No match was found for the search + * prototype provided. + * @xmlSecXkmsResultMinorTooManyResponses: The request resulted in the + * number of responses that + * exceeded either the ResponseLimit + * value specified in the request or + * some other limit determined by + * the service. The service MAY + * either return a subset of the + * possible responses or none at all. + * @xmlSecXkmsResultMinorIncomplete: Only part of the information + * requested could be provided. + * @xmlSecXkmsResultMinorFailure: The service attempted to perform + * the request but the operation + * failed for unspecified reasons. + * @xmlSecXkmsResultMinorRefused: The operation was refused. The + * service did not attempt to + * perform the request. + * @xmlSecXkmsResultMinorNoAuthentication: The operation was refused + * because the necessary authentication + * information was incorrect or missing. + * @xmlSecXkmsResultMinorMessageNotSupported: The receiver does not implement + * the specified operation. + * @xmlSecXkmsResultMinorUnknownResponseId: The ResponseId for which pending + * status was requested is unknown to + * the service. + * @xmlSecXkmsResultMinorSynchronous: The receiver does not support + * synchronous processing of this + * type of request. + * + * The values for ResultMinor attribute. + */ +typedef enum { + xmlSecXkmsResultMinorNone = 0, + xmlSecXkmsResultMinorNoMatch, + xmlSecXkmsResultMinorTooManyResponses, + xmlSecXkmsResultMinorIncomplete, + xmlSecXkmsResultMinorFailure, + xmlSecXkmsResultMinorRefused, + xmlSecXkmsResultMinorNoAuthentication, + xmlSecXkmsResultMinorMessageNotSupported, + xmlSecXkmsResultMinorUnknownResponseId, + xmlSecXkmsResultMinorSynchronous +} xmlSecXkmsResultMinor; + +/** + * xmlSecXkmsKeyBindingStatus: + * @xmlSecXkmsKeyBindingStatusNone: The key status is not available. + * @xmlSecXkmsKeyBindingStatusValid: The key is valid. + * @xmlSecXkmsKeyBindingStatusInvalid: The key is not valid. + * @xmlSecXkmsKeyBindingStatusIndeterminate: Could not determine key status. + * + * The values for key binding StatusValue attribute. + */ +typedef enum { + xmlSecXkmsKeyBindingStatusNone, + xmlSecXkmsKeyBindingStatusValid, + xmlSecXkmsKeyBindingStatusInvalid, + xmlSecXkmsKeyBindingStatusIndeterminate +} xmlSecXkmsKeyBindingStatus; + +/** + * xmlSecXkmsServerFormat: + * @xmlSecXkmsServerFormatUnknown: The format is unknown. + * @xmlSecXkmsServerFormatPlain: The request/response are not enveloped. + * @xmlSecXkmsServerFormatSoap1_1: The request/response are SOAP 1.1 encapsulated + * @xmlSecXkmsServerFormatSoap1_2: The request/response are SOAP 1.2 encapsulated. + * + * The xkms server request/response format. + */ +typedef enum { + xmlSecXkmsServerFormatUnknown = 0, + xmlSecXkmsServerFormatPlain, + xmlSecXkmsServerFormatSoap11, + xmlSecXkmsServerFormatSoap12 +} xmlSecXkmsServerFormat; + +XMLSEC_EXPORT xmlSecXkmsServerFormat xmlSecXkmsServerFormatFromString + (const xmlChar* str); +XMLSEC_EXPORT const xmlChar* xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format); + +/************************************************************************ + * + * XKMS requests server side processing klass + * + ************************************************************************/ +/** + * xmlSecXkmsServerCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries + * never touches this). + * @flags: the XML Encryption processing flags. + * @flags2: the XML Encryption processing flags. + * @keyInfoReadCtx: the reading key context. + * @keyInfoWriteCtx: the writing key context (not used for signature verification). + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * XKMS context. + */ +struct _xmlSecXkmsServerCtx { + /* these data user can set before performing the operation */ + void* userData; + xmlSecBitMask flags; + xmlSecBitMask flags2; + xmlSecKeyInfoCtx keyInfoReadCtx; + xmlSecKeyInfoCtx keyInfoWriteCtx; + xmlSecPtrList enabledRespondWithIds; + xmlSecPtrList enabledServerRequestIds; + xmlChar* expectedService; + xmlChar* idPrefix; + xmlSecSize idLen; + + /* these data are returned */ + xmlSecPtrList keys; + xmlSecXkmsResultMajor resultMajor; + xmlSecXkmsResultMinor resultMinor; + xmlSecXkmsServerRequestId requestId; + xmlChar* id; + xmlChar* service; + xmlChar* nonce; + xmlChar* originalRequestId; + xmlChar* pendingNotificationMechanism; + xmlChar* pendingNotificationIdentifier; + int responseLimit; + xmlSecBitMask responseMechanismMask; + xmlSecPtrListPtr compoundRequestContexts; + + /* these are internal data, nobody should change that except us */ + xmlNodePtr requestNode; + xmlNodePtr opaqueClientDataNode; + xmlNodePtr firtsMsgExtNode; + xmlNodePtr keyInfoNode; + xmlSecPtrList respWithList; + + /* reserved for future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecXkmsServerCtxPtr xmlSecXkmsServerCtxCreate (xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecXkmsServerCtxDestroy (xmlSecXkmsServerCtxPtr ctx); +XMLSEC_EXPORT int xmlSecXkmsServerCtxInitialize (xmlSecXkmsServerCtxPtr ctx, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecXkmsServerCtxFinalize (xmlSecXkmsServerCtxPtr ctx); +XMLSEC_EXPORT void xmlSecXkmsServerCtxReset (xmlSecXkmsServerCtxPtr ctx); +XMLSEC_EXPORT int xmlSecXkmsServerCtxCopyUserPref (xmlSecXkmsServerCtxPtr dst, + xmlSecXkmsServerCtxPtr src); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxProcess (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecXkmsServerFormat format, + xmlDocPtr doc); +XMLSEC_EXPORT int xmlSecXkmsServerCtxRequestRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, + xmlDocPtr doc); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecXkmsServerFormat format); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrap (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecXkmsServerFormat format, + xmlDocPtr doc); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxFatalErrorResponseCreate + (xmlSecXkmsServerCtxPtr ctx, + xmlSecXkmsServerFormat format, + xmlDocPtr doc); +XMLSEC_EXPORT void xmlSecXkmsServerCtxSetResult (xmlSecXkmsServerCtxPtr ctx, + xmlSecXkmsResultMajor resultMajor, + xmlSecXkmsResultMinor resultMinor); +XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugDump (xmlSecXkmsServerCtxPtr ctx, + FILE* output); +XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugXmlDump (xmlSecXkmsServerCtxPtr ctx, + FILE* output); + +/************************************************************************ + * + * xmlSecXkmsServerCtxPtr list + * + ************************************************************************/ +/** + * xmlSecXkmsServerCtxPtrListId: + * + * zmlSecXkmsServerCtx klasses list klass. + */ +#define xmlSecXkmsServerCtxPtrListId xmlSecXkmsServerCtxPtrListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass + (void); + +/************************************************************************ + * + * xmlSecXkmsServerCtxFlags + * + ************************************************************************/ +/** + * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM + * + * If flag is set then we abort if an unknown + * value is found. + */ +#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM 0x00000001 + +/** + * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH + * + * If flag is set then we abort if an unknown + * value is found. + */ +#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH 0x00000002 + +/** + * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE + * + * If flag is set then we abort if an unknown + * value is found. + */ +#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE 0x00000004 + +/************************************************************************ + * + * XKMS ResponseMechanism element values. + * + ************************************************************************/ +/** + * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT: + * + * XKMS ResponseMechanism element value. The requestor is prepared to + * accept a response that uses asynchronous processing, i.e. the service + * MAY return the MajorResult code Pending. + */ +#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING 0x00000001 + +/** + * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT: + * + * XKMS ResponseMechanism element value. The requestor is prepared to + * accept a response that uses the two phase protocol, i.e. the service + * MAY return the MajorResult code Represent. + */ +#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT 0x00000002 + +/** + * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE: + * + * XKMS ResponseMechanism element value. The requestor is prepared to + * accept a response that carries a element. + */ +#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE 0x00000004 + +/************************************************************************ + * + * XKMS ResponseLimit element values + * + ************************************************************************/ +/** + * XMLSEC_XKMS_NO_RESPONSE_LIMIT: + * + * The ResponseLimit is not specified. + */ +#define XMLSEC_XKMS_NO_RESPONSE_LIMIT -1 + + +/************************************************************************ + * + * XKMS KeyBinding reason values + * + ************************************************************************/ +/** + * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST: + * + * The issuer of the information on which the key binding is based is + * considered to be trustworthy by the XKMS service. + * + * X.509 Equivalents + * - Valid: Certificate path anchored by trusted root successfully constructed. + * - Invalid: Certificate path could not be constructed to a trusted root. + */ +#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST 0x00000001 + +/** + * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS: + * + * The XKMS service has affirmatively verified the status of the + * key binding with an authoritative source + * + * X.509 Equivalents + * - Valid: Certificate status validated using CRL or OCSP. + * - Invalid: Certificate status returned revoked or suspended. + */ +#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS 0x00000002 + +/** + * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL: + * + * The requested time instant was within the validity interval of + * the key binding + * + * X.509 Equivalents + * - Valid: The certificate chain was valid at the requested time instant. + * - Invalid: The requested time instant was before or after the certificate + * chain validity interval. + */ +#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL 0x00000004 + +/** + * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE: + * + * Signature on signed data provided by the client in the element was + * successfully verified. + * + * X.509 Equivalents + * - Valid: Certificate Signature verified. + * - Invalid: Certificate Signature verification failed. + */ +#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE 0x00000008 + + +/************************************************************************ + * + * XKMS RespondWith Klass + * + ************************************************************************/ +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsRespondWithIdsGet (void); +XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsInit (void); +XMLSEC_EXPORT void xmlSecXkmsRespondWithIdsShutdown(void); +XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegisterDefault + (void); +XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id); +XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeWrite (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugDump (xmlSecXkmsRespondWithId id, + FILE* output); +XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugXmlDump + (xmlSecXkmsRespondWithId id, + FILE* output); +XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeRead + (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeWrite + (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +/************************************************************************ + * + * XKMS RespondWith Klass List + * + ************************************************************************/ +/** + * xmlSecXkmsRespondWithIdListId: + * + * XKMS RespondWith klasses list klass. + */ +#define xmlSecXkmsRespondWithIdListId xmlSecXkmsRespondWithIdListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsRespondWithIdListGetKlass + (void); +XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListFind (xmlSecPtrListPtr list, + xmlSecXkmsRespondWithId id); +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithIdListFindByNodeValue + (xmlSecPtrListPtr list, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); + +/******************************************************************** + * + * XML Sec Library RespondWith Ids + * + *******************************************************************/ +/** + * xmlSecXkmsRespondWithIdUnknown: + * + * The "unknown" RespondWith id (NULL). + */ +#define xmlSecXkmsRespondWithIdUnknown NULL + +/** + * xmlSecXkmsRespondWithKeyNameId: + * + * The respond with KeyName klass. + */ +#define xmlSecXkmsRespondWithKeyNameId \ + xmlSecXkmsRespondWithKeyNameGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyNameGetKlass(void); + +/** + * xmlSecXkmsRespondWithKeyValueId: + * + * The respond with KeyValue klass. + */ +#define xmlSecXkmsRespondWithKeyValueId \ + xmlSecXkmsRespondWithKeyValueGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyValueGetKlass(void); + +/** + * xmlSecXkmsRespondWithPrivateKeyId: + * + * The respond with PrivateKey klass. + */ +#define xmlSecXkmsRespondWithPrivateKeyId \ + xmlSecXkmsRespondWithPrivateKeyGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPrivateKeyGetKlass(void); + +/** + * xmlSecXkmsRespondWithRetrievalMethodId: + * + * The respond with RetrievalMethod klass. + */ +#define xmlSecXkmsRespondWithRetrievalMethodId \ + xmlSecXkmsRespondWithRetrievalMethodGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithRetrievalMethodGetKlass(void); + +/** + * xmlSecXkmsRespondWithX509CertId: + * + * The respond with X509Cert klass. + */ +#define xmlSecXkmsRespondWithX509CertId \ + xmlSecXkmsRespondWithX509CertGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CertGetKlass(void); + +/** + * xmlSecXkmsRespondWithX509ChainId: + * + * The respond with X509Chain klass. + */ +#define xmlSecXkmsRespondWithX509ChainId \ + xmlSecXkmsRespondWithX509ChainGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509ChainGetKlass(void); + +/** + * xmlSecXkmsRespondWithX509CRLId: + * + * The respond with X509CRL klass. + */ +#define xmlSecXkmsRespondWithX509CRLId \ + xmlSecXkmsRespondWithX509CRLGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CRLGetKlass(void); + + +/** + * xmlSecXkmsRespondWithPGPId: + * + * The respond with PGP klass. + */ +#define xmlSecXkmsRespondWithPGPId \ + xmlSecXkmsRespondWithPGPGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPGPGetKlass(void); + +/** + * xmlSecXkmsRespondWithSPKIId: + * + * The respond with SPKI klass. + */ +#define xmlSecXkmsRespondWithSPKIId \ + xmlSecXkmsRespondWithSPKIGetKlass() +XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithSPKIGetKlass(void); + + +/************************************************************************ + * + * XKMS ServerRequest Klass + * + ************************************************************************/ +XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsServerRequestIdsGet (void); +XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsInit (void); +XMLSEC_EXPORT void xmlSecXkmsServerRequestIdsShutdown + (void); +XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegisterDefault + (void); +XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegister + (xmlSecXkmsServerRequestId id); +XMLSEC_EXPORT int xmlSecXkmsServerRequestNodeRead (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecXkmsServerRequestExecute (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx); +XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlDocPtr doc, + xmlNodePtr node); +XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id, + FILE* output); +XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugXmlDump + (xmlSecXkmsServerRequestId id, + FILE* output); + +/************************************************************************ + * + * XKMS ServerRequest Klass List + * + ************************************************************************/ +/** + * xmlSecXkmsServerRequestIdListId: + * + * XKMS ServerRequest klasses list klass. + */ +#define xmlSecXkmsServerRequestIdListId xmlSecXkmsServerRequestIdListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerRequestIdListGetKlass + (void); +XMLSEC_EXPORT int xmlSecXkmsServerRequestIdListFind + (xmlSecPtrListPtr list, + xmlSecXkmsServerRequestId id); +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByName + (xmlSecPtrListPtr list, + const xmlChar* name); +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByNode + (xmlSecPtrListPtr list, + xmlNodePtr node); + +/** + * xmlSecXkmsServerRequestIdUnknown: + * + * The "unknown" ServerRequest id (NULL). + */ +#define xmlSecXkmsServerRequestIdUnknown NULL + +/** + * xmlSecXkmsServerRequestResultId: + * + * The Result response klass. + */ +#define xmlSecXkmsServerRequestResultId \ + xmlSecXkmsServerRequestResultGetKlass() +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(void); + +/** + * xmlSecXkmsServerRequestStatusId: + * + * The StatusRequest klass. + */ +#define xmlSecXkmsServerRequestStatusId \ + xmlSecXkmsServerRequestStatusGetKlass() +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(void); + +/** + * xmlSecXkmsServerRequestCompoundId: + * + * The CompoundRequest klass. + */ +#define xmlSecXkmsServerRequestCompoundId \ + xmlSecXkmsServerRequestCompoundGetKlass() +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(void); + +/** + * xmlSecXkmsServerRequestLocateId: + * + * The LocateRequest klass. + */ +#define xmlSecXkmsServerRequestLocateId \ + xmlSecXkmsServerRequestLocateGetKlass() +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(void); + +/** + * xmlSecXkmsServerRequestValidateId: + * + * The ValidateRequest klass. + */ +#define xmlSecXkmsServerRequestValidateId \ + xmlSecXkmsServerRequestValidateGetKlass() +XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestValidateGetKlass(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_XKMS */ + +#endif /* __XMLSEC_XKMS_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_xmldsig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_xmldsig.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,281 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Digital Signature" implementation + * http://www.w3.org/TR/xmldsig-core/ + * http://www.w3.org/Signature/Overview.html + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_XMLDSIG_H__ +#define __XMLSEC_XMLDSIG_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XMLDSIG + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_list.h" +#include "xmlsec_buffer.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" + +typedef struct _xmlSecDSigReferenceCtx xmlSecDSigReferenceCtx, + *xmlSecDSigReferenceCtxPtr; + +/** + * xmlSecDSigStatus: + * @xmlSecDSigStatusUnknown: the status is unknow. + * @xmlSecDSigStatusSucceeded: the processing succeeded. + * @xmlSecDSigStatusInvalid: the processing failed. + * + * XML Digital signature processing status. + */ +typedef enum { + xmlSecDSigStatusUnknown = 0, + xmlSecDSigStatusSucceeded, + xmlSecDSigStatusInvalid +} xmlSecDSigStatus; + +/************************************************************************** + * + * xmlSecDSigCtx + * + *************************************************************************/ + +/** + * XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS: + * + * If this flag is set then nodes will not be processed. + */ +#define XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS 0x00000001 + +/** + * XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES: + * + * If this flag is set then pre-digest buffer for child + * of element will be stored in #xmlSecDSigCtx. + */ +#define XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES 0x00000002 + +/** + * XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES: + * + * If this flag is set then pre-digest buffer for child + * of element will be stored in #xmlSecDSigCtx. + */ +#define XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES 0x00000004 + +/** + * XMLSEC_DSIG_FLAGS_STORE_SIGNATURE: + * + * If this flag is set then pre-signature buffer for + * element processing will be stored in #xmlSecDSigCtx. + */ +#define XMLSEC_DSIG_FLAGS_STORE_SIGNATURE 0x00000008 + +/** + * XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK: + * + * If this flag is set then URI ID references are resolved directly + * without using XPointers. This allows one to sign/verify Visa3D + * documents that don't follow XML, XPointer and XML DSig specifications. + */ +#define XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK 0x00000010 + +/** + * xmlSecDSigCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries + * never touches this). + * @flags: the XML Digital Signature processing flags. + * @flags2: the XML Digital Signature processing flags. + * @keyInfoReadCtx: the reading key context. + * @keyInfoWriteCtx: the writing key context (not used for signature verification). + * @transformCtx: the node processing context. + * @enabledReferenceUris: the URI types allowed for node. + * @enabledReferenceTransforms: the list of transforms allowed in node. + * @referencePreExecuteCallback:the callback for node processing. + * @defSignMethodId: the default signing method klass. + * @defC14NMethodId: the default c14n method klass. + * @defDigestMethodId: the default digest method klass. + * @signKey: the signature key; application may set #signKey + * before calling #xmlSecDSigCtxSign or #xmlSecDSigCtxVerify + * functions. + * @operation: the operation: sign or verify. + * @result: the pointer to signature (not valid for signature verificaction). + * @status: the procesisng status. + * @signMethod: the pointer to signature transform. + * @c14nMethod: the pointer to c14n transform. + * @preSignMemBufMethod: the pointer to binary buffer right before signature + * (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE flag is set). + * @signValueNode: the pointer to node. + * @id: the pointer to Id attribute of node. + * @signedInfoReferences: the list of references in node. + * @manifestReferences: the list of references in nodes. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * XML DSig processing context. + */ +struct _xmlSecDSigCtx { + /* these data user can set before performing the operation */ + void* userData; + unsigned int flags; + unsigned int flags2; + xmlSecKeyInfoCtx keyInfoReadCtx; + xmlSecKeyInfoCtx keyInfoWriteCtx; + xmlSecTransformCtx transformCtx; + xmlSecTransformUriType enabledReferenceUris; + xmlSecPtrListPtr enabledReferenceTransforms; + xmlSecTransformCtxPreExecuteCallback referencePreExecuteCallback; + xmlSecTransformId defSignMethodId; + xmlSecTransformId defC14NMethodId; + xmlSecTransformId defDigestMethodId; + + /* these data are returned */ + xmlSecKeyPtr signKey; + xmlSecTransformOperation operation; + xmlSecBufferPtr result; + xmlSecDSigStatus status; + xmlSecTransformPtr signMethod; + xmlSecTransformPtr c14nMethod; + xmlSecTransformPtr preSignMemBufMethod; + xmlNodePtr signValueNode; + xmlChar* id; + xmlSecPtrList signedInfoReferences; + xmlSecPtrList manifestReferences; + + /* reserved for future */ + void* reserved0; + void* reserved1; +}; + +/* constructor/destructor */ +XMLSEC_EXPORT xmlSecDSigCtxPtr xmlSecDSigCtxCreate (xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecDSigCtxDestroy (xmlSecDSigCtxPtr dsigCtx); +XMLSEC_EXPORT int xmlSecDSigCtxInitialize (xmlSecDSigCtxPtr dsigCtx, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecDSigCtxFinalize (xmlSecDSigCtxPtr dsigCtx); +XMLSEC_EXPORT int xmlSecDSigCtxSign (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr tmpl); +XMLSEC_EXPORT int xmlSecDSigCtxVerify (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, + xmlSecTransformId transformId); +XMLSEC_EXPORT int xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx, + xmlSecTransformId transformId); +XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigCtxGetPreSignBuffer (xmlSecDSigCtxPtr dsigCtx); +XMLSEC_EXPORT void xmlSecDSigCtxDebugDump (xmlSecDSigCtxPtr dsigCtx, + FILE* output); +XMLSEC_EXPORT void xmlSecDSigCtxDebugXmlDump (xmlSecDSigCtxPtr dsigCtx, + FILE* output); + + +/************************************************************************** + * + * xmlSecDSigReferenceCtx + * + *************************************************************************/ +/** + * xmlSecDSigReferenceOrigin: + * @xmlSecDSigReferenceOriginSignedInfo:reference in node. + * @xmlSecDSigReferenceOriginManifest: reference node. + * + * The possible node locations: in the + * node or in the node. + */ +typedef enum { + xmlSecDSigReferenceOriginSignedInfo, + xmlSecDSigReferenceOriginManifest +} xmlSecDSigReferenceOrigin; + +/** + * xmlSecDSigReferenceCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries + * never touches this). + * @dsigCtx: the pointer to "parent" processing context. + * @origin: the signature origin ( or ). + * @transformCtx: the reference processing transforms context. + * @digestMethod: the pointer to digest transform. + * @result: the pointer to digest result. + * @status: the reference processing status. + * @preDigestMemBufMethod: the pointer to binary buffer right before digest + * (valid only if either + * #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or + * #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flags are set). + * @id: the node ID attribute. + * @uri: the node URI attribute. + * @type: the node Type attribute. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * The processing context. + */ +struct _xmlSecDSigReferenceCtx { + void* userData; + xmlSecDSigCtxPtr dsigCtx; + xmlSecDSigReferenceOrigin origin; + xmlSecTransformCtx transformCtx; + xmlSecTransformPtr digestMethod; + + xmlSecBufferPtr result; + xmlSecDSigStatus status; + xmlSecTransformPtr preDigestMemBufMethod; + xmlChar* id; + xmlChar* uri; + xmlChar* type; + + /* reserved for future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecDSigReferenceCtxPtr xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, + xmlSecDSigReferenceOrigin origin); +XMLSEC_EXPORT void xmlSecDSigReferenceCtxDestroy (xmlSecDSigReferenceCtxPtr dsigRefCtx); +XMLSEC_EXPORT int xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, + xmlSecDSigCtxPtr dsigCtx, + xmlSecDSigReferenceOrigin origin); +XMLSEC_EXPORT void xmlSecDSigReferenceCtxFinalize (xmlSecDSigReferenceCtxPtr dsigRefCtx); +XMLSEC_EXPORT int xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, + xmlNodePtr node); +XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigReferenceCtxGetPreDigestBuffer + (xmlSecDSigReferenceCtxPtr dsigRefCtx); +XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugDump (xmlSecDSigReferenceCtxPtr dsigRefCtx, + FILE* output); +XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, + FILE* output); + +/************************************************************************** + * + * xmlSecDSigReferenceCtxListKlass + * + *************************************************************************/ +/** + * xmlSecDSigReferenceCtxListId: + * + * The references list klass. + */ +#define xmlSecDSigReferenceCtxListId \ + xmlSecDSigReferenceCtxListGetKlass() +XMLSEC_EXPORT xmlSecPtrListId xmlSecDSigReferenceCtxListGetKlass(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_XMLDSIG */ + +#endif /* __XMLSEC_XMLDSIG_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_xmlenc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_xmlenc.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,157 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Encryption" implementation + * http://www.w3.org/TR/xmlenc-core + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_XMLENC_H__ +#define __XMLSEC_XMLENC_H__ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XMLENC + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" + +/** + * xmlEncCtxMode: + * @xmlEncCtxModeEncryptedData: the element procesing. + * @xmlEncCtxModeEncryptedKey: the element processing. + * + * The #xmlSecEncCtx mode. + */ +typedef enum { + xmlEncCtxModeEncryptedData = 0, + xmlEncCtxModeEncryptedKey +} xmlEncCtxMode; + +/** + * xmlSecEncCtx: + * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries + * never touches this). + * @flags: the XML Encryption processing flags. + * @flags2: the XML Encryption processing flags. + * @mode: the mode. + * @keyInfoReadCtx: the reading key context. + * @keyInfoWriteCtx: the writing key context (not used for signature verification). + * @transformCtx: the transforms processing context. + * @defEncMethodId: the default encryption method (used if + * node is not present). + * @encKey: the signature key; application may set #encKey + * before calling encryption/decryption functions. + * @operation: the operation: encrypt or decrypt. + * @result: the pointer to signature (not valid for signature verificaction). + * @resultBase64Encoded: the flag: if set then result in #result is base64 encoded. + * @resultReplaced: the flag: if set then resulted + * or node is added to the document. + * @encMethod: the pointer to encryption transform. + * @id: the ID attribute of + * or node. + * @type: the Type attribute of + * or node. + * @mimeType: the MimeType attribute of + * or node. + * @encoding: the Encoding attributeof + * or node. + * @recipient: the Recipient attribute of node.. + * @carriedKeyName: the CarriedKeyName attribute of node. + * @encDataNode: the pointer to + * or node. + * @encMethodNode: the pointer to node. + * @keyInfoNode: the pointer to node. + * @cipherValueNode: the pointer to node. + * @reserved0: reserved for the future. + * @reserved1: reserved for the future. + * + * XML Encrypiton context. + */ +struct _xmlSecEncCtx { + /* these data user can set before performing the operation */ + void* userData; + unsigned int flags; + unsigned int flags2; + xmlEncCtxMode mode; + xmlSecKeyInfoCtx keyInfoReadCtx; + xmlSecKeyInfoCtx keyInfoWriteCtx; + xmlSecTransformCtx transformCtx; + xmlSecTransformId defEncMethodId; + + /* these data are returned */ + xmlSecKeyPtr encKey; + xmlSecTransformOperation operation; + xmlSecBufferPtr result; + int resultBase64Encoded; + int resultReplaced; + xmlSecTransformPtr encMethod; + + /* attributes from EncryptedData or EncryptedKey */ + xmlChar* id; + xmlChar* type; + xmlChar* mimeType; + xmlChar* encoding; + xmlChar* recipient; + xmlChar* carriedKeyName; + + /* these are internal data, nobody should change that except us */ + xmlNodePtr encDataNode; + xmlNodePtr encMethodNode; + xmlNodePtr keyInfoNode; + xmlNodePtr cipherValueNode; + + /* reserved for future */ + void* reserved0; + void* reserved1; +}; + +XMLSEC_EXPORT xmlSecEncCtxPtr xmlSecEncCtxCreate (xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecEncCtxDestroy (xmlSecEncCtxPtr encCtx); +XMLSEC_EXPORT int xmlSecEncCtxInitialize (xmlSecEncCtxPtr encCtx, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_EXPORT void xmlSecEncCtxFinalize (xmlSecEncCtxPtr encCtx); +XMLSEC_EXPORT int xmlSecEncCtxCopyUserPref (xmlSecEncCtxPtr dst, + xmlSecEncCtxPtr src); +XMLSEC_EXPORT void xmlSecEncCtxReset (xmlSecEncCtxPtr encCtx); +XMLSEC_EXPORT int xmlSecEncCtxBinaryEncrypt (xmlSecEncCtxPtr encCtx, + xmlNodePtr tmpl, + const xmlSecByte* data, + xmlSecSize dataSize); +XMLSEC_EXPORT int xmlSecEncCtxXmlEncrypt (xmlSecEncCtxPtr encCtx, + xmlNodePtr tmpl, + xmlNodePtr node); +XMLSEC_EXPORT int xmlSecEncCtxUriEncrypt (xmlSecEncCtxPtr encCtx, + xmlNodePtr tmpl, + const xmlChar *uri); +XMLSEC_EXPORT int xmlSecEncCtxDecrypt (xmlSecEncCtxPtr encCtx, + xmlNodePtr node); +XMLSEC_EXPORT xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer (xmlSecEncCtxPtr encCtx, + xmlNodePtr node ); +XMLSEC_EXPORT void xmlSecEncCtxDebugDump (xmlSecEncCtxPtr encCtx, + FILE* output); +XMLSEC_EXPORT void xmlSecEncCtxDebugXmlDump (xmlSecEncCtxPtr encCtx, + FILE* output); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_XMLENC */ + +#endif /* __XMLSEC_XMLENC_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_xmlsec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_xmlsec.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,149 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * General functions and forward declarations. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_H__ +#define __XMLSEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "xmlsec_config.h" +#include "xmlsec_version.h" +#include "xmlsec_exports.h" +#include "xmlsec_strings.h" + +//added for symbian port +#include + +/*********************************************************************** + * + * Basic types to make ports to exotic platforms easier + * + ***********************************************************************/ +/** + * xmlSecPtr: + * + * Void pointer. + */ +typedef void* xmlSecPtr; + +#ifdef XMLSEC_NO_SIZE_T +#define xmlSecSize unsigned int +#else /* XMLSEC_NO_SIZE_T */ +#define xmlSecSize size_t +#endif /* XMLSEC_NO_SIZE_T */ + +/** + * xmlSecByte: + * + * One byte. Should be typedef instead of define + * but it will break ABI + */ +#define xmlSecByte unsigned char + +/*********************************************************************** + * + * Forward declarations + * + ***********************************************************************/ +typedef struct _xmlSecKeyData xmlSecKeyData, *xmlSecKeyDataPtr; +typedef struct _xmlSecKeyDataStore xmlSecKeyDataStore, *xmlSecKeyDataStorePtr; +typedef struct _xmlSecKeyInfoCtx xmlSecKeyInfoCtx, *xmlSecKeyInfoCtxPtr; +typedef struct _xmlSecKey xmlSecKey, *xmlSecKeyPtr; +typedef struct _xmlSecKeyStore xmlSecKeyStore, *xmlSecKeyStorePtr; +typedef struct _xmlSecKeysMngr xmlSecKeysMngr, *xmlSecKeysMngrPtr; +typedef struct _xmlSecTransform xmlSecTransform, *xmlSecTransformPtr; +typedef struct _xmlSecTransformCtx xmlSecTransformCtx, *xmlSecTransformCtxPtr; + +#ifndef XMLSEC_NO_XMLDSIG +typedef struct _xmlSecDSigCtx xmlSecDSigCtx, *xmlSecDSigCtxPtr; +#endif /* XMLSEC_NO_XMLDSIG */ + +#ifndef XMLSEC_NO_XMLENC +typedef struct _xmlSecEncCtx xmlSecEncCtx, *xmlSecEncCtxPtr; +#endif /* XMLSEC_NO_XMLENC */ + +#ifndef XMLSEC_NO_XKMS +typedef struct _xmlSecXkmsServerCtx xmlSecXkmsServerCtx, *xmlSecXkmsServerCtxPtr; +#endif /* XMLSEC_NO_XKMS */ + +XMLSEC_EXPORT int xmlSecInit (void); +XMLSEC_EXPORT int xmlSecShutdown (void); + + + +/*********************************************************************** + * + * Version checking + * + ***********************************************************************/ +/** + * xmlSecCheckVersionExact: + * + * Macro. Returns 1 if the loaded xmlsec library version exactly matches + * the one used to compile the caller, 0 if it does not or a negative + * value if an error occurs. + */ +#define xmlSecCheckVersionExact() \ + xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionExact) + +/** + * xmlSecCheckVersion: + * + * Macro. Returns 1 if the loaded xmlsec library version ABI compatible with + * the one used to compile the caller, 0 if it does not or a negative + * value if an error occurs. + */ +#define xmlSecCheckVersion() \ + xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionABICompatible) + +/** + * xmlSecCheckVersionMode: + * @xmlSecCheckVersionExact: the version should match exactly. + * @xmlSecCheckVersionABICompatible: the version should be ABI compatible. + * + * The xmlsec library version mode. + */ +typedef enum { + xmlSecCheckVersionExact = 0, + xmlSecCheckVersionABICompatible +} xmlSecCheckVersionMode; + +XMLSEC_EXPORT int xmlSecCheckVersionExt (int major, + int minor, + int subminor, + xmlSecCheckVersionMode mode); + +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_H__ */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/inc/xmlsec_xmltree.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/inc/xmlsec_xmltree.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,221 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Common XML utility functions + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_TREE_H__ +#define __XMLSEC_TREE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsec_config.h" +#include +#include +#include "xmlsec_xmlsec.h" + +/** + * xmlSecNodeGetName: + * @node: the pointer to node. + * + * Macro. Returns node's name. + */ +#define xmlSecNodeGetName(node) \ + (((node)) ? ((const char*)((node)->name)) : NULL) + +XMLSEC_EXPORT const xmlChar* xmlSecGetNodeNsHref (const xmlNodePtr cur); +XMLSEC_EXPORT int xmlSecCheckNodeName (const xmlNodePtr cur, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecGetNextElementNode(xmlNodePtr cur); +XMLSEC_EXPORT xmlNodePtr xmlSecFindChild (const xmlNodePtr parent, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecFindParent (const xmlNodePtr cur, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecFindNode (const xmlNodePtr parent, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecAddChild (xmlNodePtr parent, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecAddChildNode (xmlNodePtr parent, + xmlNodePtr child); +XMLSEC_EXPORT xmlNodePtr xmlSecAddNextSibling (xmlNodePtr node, + const xmlChar *name, + const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecAddPrevSibling (xmlNodePtr node, + const xmlChar *name, + const xmlChar *ns); + +XMLSEC_EXPORT int xmlSecReplaceNode (xmlNodePtr node, + xmlNodePtr newNode); +XMLSEC_EXPORT int xmlSecReplaceContent (xmlNodePtr node, + xmlNodePtr newNode); +XMLSEC_EXPORT int xmlSecReplaceNodeBuffer (xmlNodePtr node, + const xmlSecByte *buffer, + xmlSecSize size); + +XMLSEC_EXPORT void xmlSecAddIDs (xmlDocPtr doc, + xmlNodePtr cur, + const xmlChar** ids); +XMLSEC_EXPORT int xmlSecGenerateAndAddID (xmlNodePtr node, + const xmlChar* attrName, + const xmlChar* prefix, + xmlSecSize len); +XMLSEC_EXPORT xmlChar* xmlSecGenerateID (const xmlChar* prefix, + xmlSecSize len); + +XMLSEC_EXPORT xmlDocPtr xmlSecCreateTree (const xmlChar* rootNodeName, + const xmlChar* rootNodeNs); +XMLSEC_EXPORT int xmlSecIsEmptyNode (xmlNodePtr node); +XMLSEC_EXPORT int xmlSecIsEmptyString (const xmlChar* str); +XMLSEC_EXPORT xmlChar* xmlSecGetQName (xmlNodePtr node, + const xmlChar* href, + const xmlChar* local); + +/** + * xmlSecIsHex: + * @c: the character. + * + * Macro. Returns 1 if @c is a hex digit or 0 other wise. + */ +#define xmlSecIsHex(c) \ + (( (('0' <= (c)) && ((c) <= '9')) || \ + (('a' <= (c)) && ((c) <= 'f')) || \ + (('A' <= (c)) && ((c) <= 'F')) ) ? 1 : 0) + +/** + * xmlSecGetHex: + * @c: the character, + * + * Macro. Returns the hex value of the @c. + */ +#define xmlSecGetHex(c) \ + ( (('0' <= (c)) && ((c) <= '9')) ? (c) - '0' : \ + ( (('a' <= (c)) && ((c) <= 'f')) ? (c) - 'a' + 10 : \ + ( (('A' <= (c)) && ((c) <= 'F')) ? (c) - 'A' + 10 : 0 ))) + +/************************************************************************* + * + * QName <-> Integer mapping + * + ************************************************************************/ +typedef struct _xmlSecQName2IntegerInfo xmlSecQName2IntegerInfo, + *xmlSecQName2IntegerInfoPtr; +typedef const struct _xmlSecQName2IntegerInfo* xmlSecQName2IntegerInfoConstPtr; + +struct _xmlSecQName2IntegerInfo { + const xmlChar* qnameHref; + const xmlChar* qnameLocalPart; + int intValue; +}; +XMLSEC_EXPORT xmlSecQName2IntegerInfoConstPtr xmlSecQName2IntegerGetInfo + (xmlSecQName2IntegerInfoConstPtr info, + int intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerGetInteger (xmlSecQName2IntegerInfoConstPtr info, + const xmlChar* qnameHref, + const xmlChar* qnameLocalPart, + int* intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerGetIntegerFromString + (xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + const xmlChar* qname, + int* intValue); +XMLSEC_EXPORT xmlChar* xmlSecQName2IntegerGetStringFromInteger + (xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + int intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerNodeRead (xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + int* intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerNodeWrite (xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + const xmlChar* nodeName, + const xmlChar* nodeNs, + int intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + const xmlChar* attrName, + int* intValue); +XMLSEC_EXPORT int xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, + const xmlChar* attrName, + int intValue); +XMLSEC_EXPORT void xmlSecQName2IntegerDebugDump (xmlSecQName2IntegerInfoConstPtr info, + int intValue, + const xmlChar* name, + FILE* output); +XMLSEC_EXPORT void xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, + int intValue, + const xmlChar* name, + FILE* output); + +/************************************************************************* + * + * QName <-> Bits mask mapping + * + ************************************************************************/ +typedef unsigned int xmlSecBitMask; +typedef struct _xmlSecQName2BitMaskInfo xmlSecQName2BitMaskInfo, + *xmlSecQName2BitMaskInfoPtr; +typedef const struct _xmlSecQName2BitMaskInfo* xmlSecQName2BitMaskInfoConstPtr; + +struct _xmlSecQName2BitMaskInfo { + const xmlChar* qnameHref; + const xmlChar* qnameLocalPart; + xmlSecBitMask mask; +}; + +XMLSEC_EXPORT xmlSecQName2BitMaskInfoConstPtr xmlSecQName2BitMaskGetInfo + (xmlSecQName2BitMaskInfoConstPtr info, + xmlSecBitMask mask); +XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMask (xmlSecQName2BitMaskInfoConstPtr info, + const xmlChar* qnameLocalPart, + const xmlChar* qnameHref, + xmlSecBitMask* mask); +XMLSEC_EXPORT int xmlSecQName2BitMaskNodesRead (xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr* node, + const xmlChar* nodeName, + const xmlChar* nodeNs, + int stopOnUnknown, + xmlSecBitMask* mask); +XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMaskFromString + (xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr node, + const xmlChar* qname, + xmlSecBitMask* mask); +XMLSEC_EXPORT xmlChar* xmlSecQName2BitMaskGetStringFromBitMask + (xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr node, + xmlSecBitMask mask); +XMLSEC_EXPORT int xmlSecQName2BitMaskNodesWrite (xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr node, + const xmlChar* nodeName, + const xmlChar* nodeNs, + xmlSecBitMask mask); +XMLSEC_EXPORT void xmlSecQName2BitMaskDebugDump (xmlSecQName2BitMaskInfoConstPtr info, + xmlSecBitMask mask, + const xmlChar* name, + FILE* output); +XMLSEC_EXPORT void xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, + xmlSecBitMask mask, + const xmlChar* name, + FILE* output); + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_TREE_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/rom/xmlsec.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/rom/xmlsec.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for XMLSec component +* +*/ + + +#ifndef __XMLSEC_IBY__ +#define __XMLSEC_IBY__ + +file=ABI_DIR\BUILD_DIR\xmlsec.dll SHARED_LIB_DIR\xmlsec.dll + +#endif //__XMLSEC_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/Copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/Copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,59 @@ +xmlsec, xmlsec-openssl, xmlsec-gnutls libraries +------------------------------------------------------------------------------ + +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + + +xmlsec-nss library +------------------------------------------------------------------------------ +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. +Copyright (c) 2003 America Online, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Portions of the Software were created using source code and/or APIs +governed by the Mozilla Public License (MPL). The MPL is available +at http://www.mozilla.org/MPL/MPL-1.1.html. The MPL permits such +portions to be distributed with code not governed by MPL, as long +as the requirements of MPL are fulfilled for such portions. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_app.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_app.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1458 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + +#include "xmlsec_globals.h" + +#include +#include +#include +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_app.h" +#include "xmlsec_list.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_private.h" +#include "xmlsec_errors.h" + + +/****************************************************************************** + * + * Crypto Init/shutdown + * + *****************************************************************************/ +/** + * xmlSecCryptoInit: + * + * XMLSec library specific crypto engine initialization. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoInit(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoInit == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoInit", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoInit()); +} + +/** + * xmlSecCryptoShutdown: + * + * XMLSec library specific crypto engine shutdown. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoShutdown(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoShutdown == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoShutdown", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoShutdown()); +} + +/** + * xmlSecCryptoKeysMngrInit: + * @mngr: the pointer to keys manager. + * + * Adds crypto specific key data stores in keys manager. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoKeysMngrInit == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoKeysMngrInit", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoKeysMngrInit(mngr)); +} + +/****************************************************************************** + * + * Key data ids + * + *****************************************************************************/ +/** + * xmlSecKeyDataAesGetKlass: + * + * The AES key data klass. + * + * Returns AES key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the AES key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataAesGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataAesGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataAesId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataAesGetKlass()); +} + +/** + * xmlSecKeyDataDesGetKlass: + * + * The DES key data klass. + * + * Returns DES key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the DES key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataDesGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDesGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataDesId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataDesGetKlass()); +} + +/** + * xmlSecKeyDataDsaGetKlass: + * + * The DSA key data klass. + * + * Returns DSA key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the DSA key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataDsaGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDsaGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataDsaId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataDsaGetKlass()); +} + +/** + * xmlSecKeyDataHmacGetKlass: + * + * The HMAC key data klass. + * + * Returns HMAC key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the HMAC key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataHmacGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataHmacGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataHmacId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataHmacGetKlass()); +} + +/** + * xmlSecKeyDataRsaGetKlass: + * + * The RSA key data klass. + * + * Returns RSA key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the RSA key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataRsaGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRsaGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataRsaId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataRsaGetKlass()); +} + +/** + * xmlSecKeyDataX509GetKlass: + * + * The X509 key data klass. + * + * Returns X509 key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the X509 key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataX509GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataX509GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataX509Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataX509GetKlass()); +} + +/** + * xmlSecKeyDataRawX509CertGetKlass: + * + * The raw X509 cert key data klass. + * + * Returns raw x509 cert key data klass or NULL if an error occurs + * (xmlsec-crypto library is not loaded or the raw X509 cert key data + * klass is not implemented). + */ +xmlSecKeyDataId +xmlSecKeyDataRawX509CertGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRawX509CertGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "keyDataRawX509CertId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyDataIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->keyDataRawX509CertGetKlass()); +} + +/****************************************************************************** + * + * Key data store ids + * + *****************************************************************************/ +/** + * xmlSecX509StoreGetKlass: + * + * The X509 certificates key data store klass. + * + * Returns pointer to X509 certificates key data store klass or NULL if + * an error occurs (xmlsec-crypto library is not loaded or the raw X509 + * cert key data klass is not implemented). + */ +xmlSecKeyDataStoreId +xmlSecX509StoreGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->x509StoreGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "x509StoreId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecKeyStoreIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->x509StoreGetKlass()); +} + +/****************************************************************************** + * + * Crypto transforms ids + * + *****************************************************************************/ +/** + * xmlSecTransformAes128CbcGetKlass: + * + * AES 128 CBC encryption transform klass. + * + * Returns pointer to AES 128 CBC encryption transform or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformAes128CbcGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes128CbcGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformAes128CbcId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformAes128CbcGetKlass()); +} + +/** + * xmlSecTransformAes192CbcGetKlass: + * + * AES 192 CBC encryption transform klass. + * + * Returns pointer to AES 192 CBC encryption transform or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformAes192CbcGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes192CbcGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformAes192CbcId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformAes192CbcGetKlass()); +} + +/** + * xmlSecTransformAes256CbcGetKlass: + * + * AES 256 CBC encryption transform klass. + * + * Returns pointer to AES 256 CBC encryption transform or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformAes256CbcGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes256CbcGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformAes256CbcId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformAes256CbcGetKlass()); +} + +/** + * xmlSecTransformKWAes128GetKlass: + * + * The AES-128 kew wrapper transform klass. + * + * Returns AES-128 kew wrapper transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformKWAes128GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes128GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformKWAes128Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformKWAes128GetKlass()); +} + +/** + * xmlSecTransformKWAes192GetKlass: + * + * The AES-192 kew wrapper transform klass. + * + * Returns AES-192 kew wrapper transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformKWAes192GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes192GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformKWAes192Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformKWAes192GetKlass()); +} + +/** + * xmlSecTransformKWAes256GetKlass: + * + * The AES-256 kew wrapper transform klass. + * + * Returns AES-256 kew wrapper transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformKWAes256GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes256GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformKWAes256Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformKWAes256GetKlass()); +} + +/** + * xmlSecTransformDes3CbcGetKlass: + * + * Triple DES CBC encryption transform klass. + * + * Returns pointer to Triple DES encryption transform or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformDes3CbcGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDes3CbcGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformDes3CbcId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformDes3CbcGetKlass()); +} + +/** + * xmlSecTransformKWDes3GetKlass: + * + * The Triple DES key wrapper transform klass. + * + * Returns Triple DES key wrapper transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformKWDes3GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWDes3GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformKWDes3Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformKWDes3GetKlass()); +} + +/** + * xmlSecTransformDsaSha1GetKlass: + * + * The DSA-SHA1 signature transform klass. + * + * Returns DSA-SHA1 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformDsaSha1GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDsaSha1GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformDsaSha1Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformDsaSha1GetKlass()); +} + +/** + * xmlSecTransformHmacMd5GetKlass: + * + * The HMAC-MD5 transform klass. + * + * Returns the HMAC-MD5 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacMd5GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacMd5GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacMd5Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacMd5GetKlass()); +} + +/** + * xmlSecTransformHmacRipemd160GetKlass: + * + * The HMAC-RIPEMD160 transform klass. + * + * Returns the HMAC-RIPEMD160 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacRipemd160GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacRipemd160GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacRipemd160Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacRipemd160GetKlass()); +} + +/** + * xmlSecTransformHmacSha1GetKlass: + * + * The HMAC-SHA1 transform klass. + * + * Returns the HMAC-SHA1 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacSha1GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha1GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacSha1Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacSha1GetKlass()); +} + +/** + * xmlSecTransformHmacSha224GetKlass: + * + * The HMAC-SHA224 transform klass. + * + * Returns the HMAC-SHA224 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacSha224GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha224GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacSha224Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacSha224GetKlass()); +} + +/** + * xmlSecTransformHmacSha256GetKlass: + * + * The HMAC-SHA256 transform klass. + * + * Returns the HMAC-SHA256 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacSha256GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha256GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacSha256Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacSha256GetKlass()); +} + +/** + * xmlSecTransformHmacSha384GetKlass: + * + * The HMAC-SHA384 transform klass. + * + * Returns the HMAC-SHA384 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacSha384GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha384GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacSha384Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacSha384GetKlass()); +} + +/** + * xmlSecTransformHmacSha512GetKlass: + * + * The HMAC-SHA512 transform klass. + * + * Returns the HMAC-SHA512 transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformHmacSha512GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha512GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformHmacSha512Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformHmacSha512GetKlass()); +} + +/** + * xmlSecTransformMd5GetKlass: + * + * MD5 digest transform klass. + * + * Returns pointer to MD5 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformMd5GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformMd5GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformMd5Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformMd5GetKlass()); +} + +/** + * xmlSecTransformRipemd160GetKlass: + * + * RIPEMD-160 digest transform klass. + * + * Returns pointer to RIPEMD-160 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRipemd160GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRipemd160GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRipemd160Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRipemd160GetKlass()); +} + +/** + * xmlSecTransformRsaMd5GetKlass: + * + * The RSA-MD5 signature transform klass. + * + * Returns RSA-MD5 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaMd5GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaMd5GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaMd5Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaMd5GetKlass()); +} + +/** + * xmlSecTransformRsaRipemd160GetKlass: + * + * The RSA-RIPEMD160 signature transform klass. + * + * Returns RSA-RIPEMD160 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaRipemd160GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaRipemd160GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaRipemd160Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaRipemd160GetKlass()); +} + +/** + * xmlSecTransformRsaSha1GetKlass: + * + * The RSA-SHA1 signature transform klass. + * + * Returns RSA-SHA1 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaSha1GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha1GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaSha1Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaSha1GetKlass()); +} + +/** + * xmlSecTransformRsaSha224GetKlass: + * + * The RSA-SHA224 signature transform klass. + * + * Returns RSA-SHA224 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaSha224GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha224GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaSha224Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaSha224GetKlass()); +} + +/** + * xmlSecTransformRsaSha256GetKlass: + * + * The RSA-SHA256 signature transform klass. + * + * Returns RSA-SHA256 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaSha256GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha256GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaSha256Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaSha256GetKlass()); +} + +/** + * xmlSecTransformRsaSha384GetKlass: + * + * The RSA-SHA384 signature transform klass. + * + * Returns RSA-SHA384 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaSha384GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha384GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaSha384Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaSha384GetKlass()); +} + +/** + * xmlSecTransformRsaSha512GetKlass: + * + * The RSA-SHA512 signature transform klass. + * + * Returns RSA-SHA512 signature transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaSha512GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha512GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaSha512Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaSha512GetKlass()); +} + +/** + * xmlSecTransformRsaPkcs1GetKlass: + * + * The RSA-PKCS1 key transport transform klass. + * + * Returns RSA-PKCS1 key transport transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaPkcs1GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaPkcs1GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaPkcs1Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaPkcs1GetKlass()); +} + +/** + * xmlSecTransformRsaOaepGetKlass: + * + * The RSA-OAEP key transport transform klass. + * + * Returns RSA-OAEP key transport transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformRsaOaepGetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaOaepGetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformRsaOaepId", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformRsaOaepGetKlass()); +} + +/** + * xmlSecTransformSha1GetKlass: + * + * SHA-1 digest transform klass. + * + * Returns pointer to SHA-1 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformSha1GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha1GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformSha1Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformSha1GetKlass()); +} + +/** + * xmlSecTransformSha224GetKlass: + * + * SHA224 digest transform klass. + * + * Returns pointer to SHA224 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformSha224GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha224GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformSha224Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformSha224GetKlass()); +} + +/** + * xmlSecTransformSha256GetKlass: + * + * SHA256 digest transform klass. + * + * Returns pointer to SHA256 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformSha256GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha256GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformSha256Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformSha256GetKlass()); +} + +/** + * xmlSecTransformSha384GetKlass: + * + * SHA384 digest transform klass. + * + * Returns pointer to SHA384 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformSha384GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha384GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformSha384Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformSha384GetKlass()); +} + +/** + * xmlSecTransformSha512GetKlass: + * + * SHA512 digest transform klass. + * + * Returns pointer to SHA512 digest transform klass or NULL if an error + * occurs (the xmlsec-crypto library is not loaded or this transform is not + * implemented). + */ +xmlSecTransformId +xmlSecTransformSha512GetKlass(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha512GetKlass == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "transformSha512Id", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecTransformIdUnknown); + } + + return(xmlSecCryptoDLGetFunctions()->transformSha512GetKlass()); +} + +/****************************************************************************** + * + * High level routines form xmlsec command line utility + * + *****************************************************************************/ +/** + * xmlSecCryptoAppInit: + * @config: the path to crypto library configuration. + * + * General crypto engine initialization. This function is used + * by XMLSec command line utility and called before + * @xmlSecInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppInit(const char* config) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppInit == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppInit", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppInit(config)); +} + + +/** + * xmlSecCryptoAppShutdown: + * + * General crypto engine shutdown. This function is used + * by XMLSec command line utility and called after + * @xmlSecShutdown function. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppShutdown(void) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppShutdown == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppShutdown", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppShutdown()); +} + +/** + * xmlSecCryptoAppDefaultKeysMngrInit: + * @mngr: the pointer to keys manager. + * + * Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId + * and a default crypto key data stores. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrInit == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppDefaultKeysMngrInit", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrInit(mngr)); +} + +/** + * xmlSecCryptoAppDefaultKeysMngrAdoptKey: + * @mngr: the pointer to keys manager. + * @key: the pointer to key. + * + * Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit + * function. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrAdoptKey == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppDefaultKeysMngrAdoptKey", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrAdoptKey(mngr, key)); +} + +/** + * xmlSecCryptoAppDefaultKeysMngrLoad: + * @mngr: the pointer to keys manager. + * @uri: the uri. + * + * Loads XML keys file from @uri to the keys manager @mngr created + * with #xmlSecCryptoAppDefaultKeysMngrInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrLoad == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppDefaultKeysMngrLoad", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrLoad(mngr, uri)); +} + +/** + * xmlSecCryptoAppDefaultKeysMngrSave: + * @mngr: the pointer to keys manager. + * @filename: the destination filename. + * @type: the type of keys to save (public/private/symmetric). + * + * Saves keys from @mngr to XML keys file. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, + xmlSecKeyDataType type) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrSave == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppDefaultKeysMngrSave", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrSave(mngr, filename, type)); +} + +/** + * xmlSecCryptoAppKeysMngrCertLoad: + * @mngr: the keys manager. + * @filename: the certificate file. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate in @filename + * trusted or not. + * + * Reads cert from @filename and adds to the list of trusted or known + * untrusted certs in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, + xmlSecKeyDataFormat format, xmlSecKeyDataType type) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoad == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeysMngrCertLoad", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoad(mngr, filename, format, type)); +} + +/** + * xmlSecCryptoAppKeysMngrCertLoadMemory: + * @mngr: the keys manager. + * @data: the certificate binary data. + * @dataSize: the certificate binary data size. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate trusted or not. + * + * Reads cert from binary buffer @data and adds to the list of trusted or known + * untrusted certs in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data, + xmlSecSize dataSize, xmlSecKeyDataFormat format, + xmlSecKeyDataType type) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoadMemory == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeysMngrCertLoadMemory", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoadMemory(mngr, data, dataSize, format, type)); +} + +/** + * xmlSecCryptoAppKeyLoad: + * @filename: the key filename. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the a file. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format, + const char *pwd, void* pwdCallback, void* pwdCallbackCtx) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeyLoad", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad(filename, format, pwd, pwdCallback, pwdCallbackCtx)); +} + +/** + * xmlSecCryptoAppKeyLoadWithName: + * @filename: the key filename. + * @format: the key file format. + * @keyname: the assigned key name + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the a file. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecCryptoAppKeyLoadWithName(const char *filename, xmlSecKeyDataFormat format, const char* keyname, + const char *pwd, void* pwdCallback, void* pwdCallbackCtx) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeyLoad", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadWithName(filename, format, keyname, pwd, pwdCallback, pwdCallbackCtx)); +} + +/** + * xmlSecCryptoAppKeyLoadMemory: + * @data: the binary key data. + * @dataSize: the size of binary key. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the memory buffer. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format, + const char *pwd, void* pwdCallback, void* pwdCallbackCtx) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeyLoadMemory", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory(data, dataSize, format, pwd, pwdCallback, pwdCallbackCtx)); +} + +/** + * xmlSecCryptoAppPkcs12Load: + * @filename: the PKCS12 key filename. + * @pwd: the PKCS12 file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 file. + * For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallback, + void* pwdCallbackCtx) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12Load == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppPkcs12Load", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx)); +} + +/** + * xmlSecCryptoAppPkcs12LoadMemory: + * @data: the PKCS12 binary data. + * @dataSize: the PKCS12 binary data size. + * @pwd: the PKCS12 file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 data in memory buffer. + * For uniformity, call xmlSecCryptoAppKeyLoadMemory instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, + const char *pwd, void* pwdCallback, + void* pwdCallbackCtx) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12LoadMemory == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppPkcs12LoadMemory", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12LoadMemory(data, dataSize, pwd, pwdCallback, pwdCallbackCtx)); +} + +/** + * xmlSecCryptoAppKeyCertLoad: + * @key: the pointer to key. + * @filename: the certificate filename. + * @format: the certificate file format. + * + * Reads the certificate from $@filename and adds it to key. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeyCertLoad", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad(key, filename, format)); +} + +/** + * xmlSecCryptoAppKeyCertLoadMemory: + * @key: the pointer to key. + * @data: the certificate binary data. + * @dataSize: the certificate binary data size. + * @format: the certificate file format. + * + * Reads the certificate from memory buffer and adds it to key. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, + xmlSecKeyDataFormat format) { + if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoadMemory == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "cryptoAppKeyCertLoadMemory", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoadMemory(key, data, dataSize, format)); +} + +/** + * xmlSecCryptoAppGetDefaultPwdCallback: + * + * Gets default password callback. + * + * Returns default password callback. + */ +void* +xmlSecCryptoAppGetDefaultPwdCallback(void) { + if(xmlSecCryptoDLGetFunctions() == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultPwdCallback); +} + +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_base64.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_base64.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1020 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Base64 encode/decode transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include + + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_base64.h" +#include "xmlsec_errors.h" + + +/* + * the table to map numbers to base64 + */ +static const xmlSecByte base64[] = +{ +/* 0 1 2 3 4 5 6 7 */ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', /* 0 */ + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', /* 1 */ + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', /* 2 */ + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', /* 3 */ + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', /* 4 */ + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', /* 5 */ + 'w', 'x', 'y', 'z', '0', '1', '2', '3', /* 6 */ + '4', '5', '6', '7', '8', '9', '+', '/' /* 7 */ +}; + + +/* few macros to simplify the code */ +#define xmlSecBase64Encode1(a) (((a) >> 2) & 0x3F) +#define xmlSecBase64Encode2(a, b) ((((a) << 4) & 0x30) + (((b) >> 4) & 0x0F)) +#define xmlSecBase64Encode3(b, c) ((((b) << 2) & 0x3c) + (((c) >> 6) & 0x03)) +#define xmlSecBase64Encode4(c) ((c) & 0x3F) + +#define xmlSecBase64Decode1(a, b) (((a) << 2) | (((b) & 0x3F) >> 4)) +#define xmlSecBase64Decode2(b, c) (((b) << 4) | (((c) & 0x3F) >> 2)) +#define xmlSecBase64Decode3(c, d) (((c) << 6) | ((d) & 0x3F)) + +#define xmlSecIsBase64Char(ch) ((((ch) >= 'A') && ((ch) <= 'Z')) || \ + (((ch) >= 'a') && ((ch) <= 'z')) || \ + (((ch) >= '0') && ((ch) <= '9')) || \ + ((ch) == '+') || ((ch) == '/')) +#define xmlSecIsBase64Space(ch) (((ch) == ' ') || ((ch) == '\t') || \ + ((ch) == '\x0d') || ((ch) == '\x0a')) + + + +/*********************************************************************** + * + * Base64 Context + * + ***********************************************************************/ +typedef enum { + xmlSecBase64StatusConsumeAndNext = 0, + xmlSecBase64StatusConsumeAndRepeat, + xmlSecBase64StatusNext, + xmlSecBase64StatusDone, + xmlSecBase64StatusFailed +} xmlSecBase64Status; + +struct _xmlSecBase64Ctx { + int encode; + int inByte; + int inPos; + xmlSecSize linePos; + xmlSecSize columns; + int finished; +}; + +static xmlSecBase64Status xmlSecBase64CtxEncodeByte (xmlSecBase64CtxPtr ctx, + xmlSecByte inByte, + xmlSecByte* outByte); +static xmlSecBase64Status xmlSecBase64CtxEncodeByteFinal (xmlSecBase64CtxPtr ctx, + xmlSecByte* outByte); +static xmlSecBase64Status xmlSecBase64CtxDecodeByte (xmlSecBase64CtxPtr ctx, + xmlSecByte inByte, + xmlSecByte* outByte); +static int xmlSecBase64CtxEncode (xmlSecBase64CtxPtr ctx, + const xmlSecByte* inBuf, + xmlSecSize inBufSize, + xmlSecSize* inBufResSize, + xmlSecByte* outBuf, + xmlSecSize outBufSize, + xmlSecSize* outBufResSize); +static int xmlSecBase64CtxEncodeFinal (xmlSecBase64CtxPtr ctx, + xmlSecByte* outBuf, + xmlSecSize outBufSize, + xmlSecSize* outBufResSize); +static int xmlSecBase64CtxDecode (xmlSecBase64CtxPtr ctx, + const xmlSecByte* inBuf, + xmlSecSize inBufSize, + xmlSecSize* inBufResSize, + xmlSecByte* outBuf, + xmlSecSize outBufSize, + xmlSecSize* outBufResSize); +static int xmlSecBase64CtxDecodeIsFinished (xmlSecBase64CtxPtr ctx); + +/** + * xmlSecBase64CtxCreate: + * @encode: the encode/decode flag (1 - encode, 0 - decode) + * @columns: the max line length. + * + * Allocates and initializes new base64 context. + * + * Returns a pointer to newly created #xmlSecBase64Ctx structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecBase64CtxPtr +xmlSecBase64CtxCreate(int encode, int columns) { + xmlSecBase64CtxPtr ctx; + int ret; + + /* + * Allocate a new xmlSecBase64CtxPtr and fill the fields. + */ + ctx = (xmlSecBase64CtxPtr) xmlMalloc(sizeof(xmlSecBase64Ctx)); + if (ctx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecBase64Ctx)=%d", + sizeof(xmlSecBase64Ctx)); + return(NULL); + } + + ret = xmlSecBase64CtxInitialize(ctx, encode, columns); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBase64CtxDestroy(ctx); + return(NULL); + } + return(ctx); +} + +/** + * xmlSecBase64CtxDestroy: + * @ctx: the pointer to #xmlSecBase64Ctx structure. + * + * Destroys base64 context. + */ +EXPORT_C +void +xmlSecBase64CtxDestroy(xmlSecBase64CtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + xmlSecBase64CtxFinalize(ctx); + xmlFree(ctx); +} + +/** + * xmlSecBase64CtxInitialize: + * @ctx: the pointer to #xmlSecBase64Ctx structure, + * @encode: the encode/decode flag (1 - encode, 0 - decode) + * @columns: the max line length. + * + * Initializes new base64 context. + * + * Returns 0 on success and a negative value otherwise. + */ +EXPORT_C +int +xmlSecBase64CtxInitialize(xmlSecBase64CtxPtr ctx, int encode, int columns) { + xmlSecAssert2(ctx != NULL, -1); + + memset(ctx, 0, sizeof(xmlSecBase64Ctx)); + + ctx->encode = encode; + ctx->columns = columns; + return(0); +} + +/** + * xmlSecBase64CtxFinalize: + * @ctx: the pointer to #xmlSecBase64Ctx structure, + * + * Frees all the resources allocated by @ctx. + */ +EXPORT_C +void +xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + memset(ctx, 0, sizeof(xmlSecBase64Ctx)); +} + +/** + * xmlSecBase64CtxUpdate: + * @ctx: the pointer to #xmlSecBase64Ctx structure + * @in: the input buffer + * @inSize: the input buffer size + * @out: the output buffer + * @outSize: the output buffer size + * + * Encodes or decodes the next piece of data from input buffer. + * + * Returns the number of bytes written to output buffer or + * -1 if an error occurs. + */ +EXPORT_C +int +xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx, + const xmlSecByte *in, xmlSecSize inSize, + xmlSecByte *out, xmlSecSize outSize) { + xmlSecSize inResSize = 0, outResSize = 0; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(in != NULL, -1); + xmlSecAssert2(out != NULL, -1); + + if(ctx->encode != 0) { + ret = xmlSecBase64CtxEncode(ctx, in, inSize, &inResSize, + out, outSize, &outResSize); + if((ret < 0) || (inResSize != inSize)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxEncode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + ret = xmlSecBase64CtxDecode(ctx, in, inSize, &inResSize, + out, outSize, &outResSize); + if((ret < 0) || (inResSize != inSize)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxDecode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(outResSize); +} + +/** + * xmlSecBase64CtxFinal: + * @ctx: the pointer to #xmlSecBase64Ctx structure + * @out: the output buffer + * @outSize: the output buffer size + * + * Encodes or decodes the last piece of data stored in the context + * and finalizes the result. + * + * Returns the number of bytes written to output buffer or + * -1 if an error occurs. + */ +EXPORT_C +int +xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx, + xmlSecByte *out, xmlSecSize outSize) { + xmlSecSize outResSize = 0; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(out != NULL, -1); + xmlSecAssert2(outSize > 0, -1); + + if(ctx->encode != 0) { + ret = xmlSecBase64CtxEncodeFinal(ctx, out, outSize, &outResSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxEncodeFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "outSize=%d", outSize); + return(-1); + } + } else { + if(!xmlSecBase64CtxDecodeIsFinished(ctx)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxIsFinished", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* add \0 */ + if((outResSize + 1) < outSize) { + out[outResSize] = '\0'; + } + return(outResSize); +} + +static xmlSecBase64Status +xmlSecBase64CtxEncodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte* outByte) { + xmlSecAssert2(ctx != NULL, xmlSecBase64StatusFailed); + xmlSecAssert2(outByte != NULL, xmlSecBase64StatusFailed); + + if((ctx->columns > 0) && (ctx->linePos >= ctx->columns)) { + (*outByte) = '\n'; + ctx->linePos = 0; + return(xmlSecBase64StatusConsumeAndRepeat); + } else if(ctx->inPos == 0) { + /* we just started new block */ + (*outByte) = base64[xmlSecBase64Encode1(inByte)]; + ctx->inByte = inByte; + ++ctx->linePos; + ++ctx->inPos; + return(xmlSecBase64StatusConsumeAndNext); + } else if(ctx->inPos == 1) { + (*outByte) = base64[xmlSecBase64Encode2(ctx->inByte, inByte)]; + ctx->inByte = inByte; + ++ctx->linePos; + ++ctx->inPos; + return(xmlSecBase64StatusConsumeAndNext); + } else if(ctx->inPos == 2) { + (*outByte) = base64[xmlSecBase64Encode3(ctx->inByte, inByte)]; + ctx->inByte = inByte; + ++ctx->linePos; + ++ctx->inPos; + return(xmlSecBase64StatusConsumeAndRepeat); + } else if(ctx->inPos == 3) { + (*outByte) = base64[xmlSecBase64Encode4(ctx->inByte)]; + ++ctx->linePos; + ctx->inByte = 0; + ctx->inPos = 0; + return(xmlSecBase64StatusConsumeAndNext); + } + + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "ctx->inPos=%d", ctx->inPos); + return(xmlSecBase64StatusFailed); +} + +static xmlSecBase64Status +xmlSecBase64CtxEncodeByteFinal(xmlSecBase64CtxPtr ctx, xmlSecByte* outByte) { + xmlSecAssert2(ctx != NULL, xmlSecBase64StatusFailed); + xmlSecAssert2(outByte != NULL, xmlSecBase64StatusFailed); + + if(ctx->inPos == 0) { + return(xmlSecBase64StatusDone); + } else if((ctx->columns > 0) && (ctx->linePos >= ctx->columns)) { + (*outByte) = '\n'; + ctx->linePos = 0; + return(xmlSecBase64StatusConsumeAndRepeat); + } else if(ctx->finished == 0) { + ctx->finished = 1; + return(xmlSecBase64CtxEncodeByte(ctx, 0, outByte)); + } else if(ctx->inPos < 3) { + (*outByte) = '='; + ++ctx->inPos; + ++ctx->linePos; + return(xmlSecBase64StatusConsumeAndRepeat); + } else if(ctx->inPos == 3) { + (*outByte) = '='; + ++ctx->linePos; + ctx->inPos = 0; + return(xmlSecBase64StatusConsumeAndRepeat); + } + + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "ctx->inPos=%d", ctx->inPos); + return(xmlSecBase64StatusFailed); +} + +static xmlSecBase64Status +xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte* outByte) { + xmlSecAssert2(ctx != NULL, xmlSecBase64StatusFailed); + xmlSecAssert2(outByte != NULL, xmlSecBase64StatusFailed); + + if((ctx->finished != 0) && (ctx->inPos == 0)) { + return(xmlSecBase64StatusDone); + } if(inByte == '=') { + ctx->finished = 1; + if(ctx->inPos < 2) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "ctx->inPos=%d", ctx->inPos); + return(xmlSecBase64StatusFailed); + } else if(ctx->inPos == 2) { + ++ctx->inPos; + return(xmlSecBase64StatusNext); + } else if(ctx->inPos == 3) { + ctx->inPos = 0; + return(xmlSecBase64StatusNext); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "ctx->inPos=%d", ctx->inPos); + return(xmlSecBase64StatusFailed); + } + } else if(xmlSecIsBase64Space(inByte)) { + return(xmlSecBase64StatusNext); + } else if(!xmlSecIsBase64Char(inByte) || (ctx->finished != 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "inByte=0x%02x", inByte); + return(xmlSecBase64StatusFailed); + } + + /* convert from character to position in base64 array */ + if((inByte >= 'A') && (inByte <= 'Z')) { + inByte = (inByte - 'A'); + } else if((inByte >= 'a') && (inByte <= 'z')) { + inByte = 26 + (inByte - 'a'); + } else if((inByte >= '0') && (inByte <= '9')) { + inByte = 52 + (inByte - '0'); + } else if(inByte == '+') { + inByte = 62; + } else if(inByte == '/') { + inByte = 63; + } + + if(ctx->inPos == 0) { + ctx->inByte = inByte; + ++ctx->inPos; + return(xmlSecBase64StatusNext); + } else if(ctx->inPos == 1) { + (*outByte) = xmlSecBase64Decode1(ctx->inByte, inByte); + ctx->inByte = inByte; + ++ctx->inPos; + return(xmlSecBase64StatusConsumeAndNext); + } else if(ctx->inPos == 2) { + (*outByte) = xmlSecBase64Decode2(ctx->inByte, inByte); + ctx->inByte = inByte; + ++ctx->inPos; + return(xmlSecBase64StatusConsumeAndNext); + } else if(ctx->inPos == 3) { + (*outByte) = xmlSecBase64Decode3(ctx->inByte, inByte); + ctx->inByte = 0; + ctx->inPos = 0; + return(xmlSecBase64StatusConsumeAndNext); + } + + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "ctx->inPos=%d", ctx->inPos); + return(xmlSecBase64StatusFailed); +} + + +static int +xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx, + const xmlSecByte* inBuf, xmlSecSize inBufSize, xmlSecSize* inBufResSize, + xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) { + xmlSecBase64Status status = xmlSecBase64StatusNext; + xmlSecSize inPos, outPos; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(inBuf != NULL, -1); + xmlSecAssert2(inBufResSize != NULL, -1); + xmlSecAssert2(outBuf != NULL, -1); + xmlSecAssert2(outBufResSize != NULL, -1); + + /* encode */ + for(inPos = outPos = 0; (inPos < inBufSize) && (outPos < outBufSize); ) { + status = xmlSecBase64CtxEncodeByte(ctx, inBuf[inPos], &(outBuf[outPos])); + switch(status) { + case xmlSecBase64StatusConsumeAndNext: + ++inPos; + ++outPos; + break; + case xmlSecBase64StatusConsumeAndRepeat: + ++outPos; + break; + case xmlSecBase64StatusNext: + case xmlSecBase64StatusDone: + case xmlSecBase64StatusFailed: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxEncodeByte", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "status=%d", status); + return(-1); + } + } + + (*inBufResSize) = inPos; + (*outBufResSize) = outPos; + + return(0); +} + +static int +xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx, + xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) { + xmlSecBase64Status status = xmlSecBase64StatusNext; + xmlSecSize outPos; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(outBuf != NULL, -1); + xmlSecAssert2(outBufResSize != NULL, -1); + + /* encode final bytes */ + for(outPos = 0; (outPos < outBufSize) && (status != xmlSecBase64StatusDone); ) { + status = xmlSecBase64CtxEncodeByteFinal(ctx, &(outBuf[outPos])); + switch(status) { + case xmlSecBase64StatusConsumeAndNext: + case xmlSecBase64StatusConsumeAndRepeat: + ++outPos; + break; + case xmlSecBase64StatusDone: + break; + case xmlSecBase64StatusNext: + case xmlSecBase64StatusFailed: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxEncodeByteFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "status=%d", status); + return(-1); + } + } + + if(status != xmlSecBase64StatusDone) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "outBufSize=%d", outBufSize); + return(-1); + } + if(outPos < outBufSize) { + outBuf[outPos] = '\0'; /* just in case */ + } + + (*outBufResSize) = outPos; + return(0); +} + + +static int +xmlSecBase64CtxDecode(xmlSecBase64CtxPtr ctx, + const xmlSecByte* inBuf, xmlSecSize inBufSize, xmlSecSize* inBufResSize, + xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) { + xmlSecBase64Status status = xmlSecBase64StatusNext; + xmlSecSize inPos, outPos; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(inBuf != NULL, -1); + xmlSecAssert2(inBufResSize != NULL, -1); + xmlSecAssert2(outBuf != NULL, -1); + xmlSecAssert2(outBufResSize != NULL, -1); + + /* decode */ + for(inPos = outPos = 0; (inPos < inBufSize) && (outPos < outBufSize) && (status != xmlSecBase64StatusDone); ) { + status = xmlSecBase64CtxDecodeByte(ctx, inBuf[inPos], &(outBuf[outPos])); + switch(status) { + case xmlSecBase64StatusConsumeAndNext: + ++inPos; + ++outPos; + break; + case xmlSecBase64StatusConsumeAndRepeat: + ++outPos; + break; + case xmlSecBase64StatusNext: + ++inPos; + break; + case xmlSecBase64StatusDone: + break; + case xmlSecBase64StatusFailed: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxDecodeByte", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "status=%d", status); + return(-1); + } + } + + /* skip spaces at the end */ + while((inPos < inBufSize) && xmlSecIsBase64Space(inBuf[inPos])) { + ++inPos; + } + + (*inBufResSize) = inPos; + (*outBufResSize) = outPos; + + return(0); +} + +static int +xmlSecBase64CtxDecodeIsFinished(xmlSecBase64CtxPtr ctx) { + xmlSecAssert2(ctx != NULL, -1); + + return((ctx->inPos == 0) ? 1 : 0); +} + +/** + * xmlSecBase64Encode: + * @buf: the input buffer. + * @len: the input buffer size. + * @columns: the output max line length (if 0 then no line breaks + * would be inserted) + * + * Encodes the data from input buffer and allocates the string for the result. + * The caller is responsible for freeing returned buffer using + * xmlFree() function. + * + * Returns newly allocated string with base64 encoded data + * or NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) { + xmlSecBase64Ctx ctx; + xmlChar *ptr; + xmlSecSize size; + int size_update, size_final; + int ret; + + xmlSecAssert2(buf != NULL, NULL); + + ret = xmlSecBase64CtxInitialize(&ctx, 1, columns); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* create result buffer */ + size = (4 * len) / 3 + 4; + if(columns > 0) { + size += (size / columns) + 4; + } + ptr = (xmlChar*) xmlMalloc(size); + if(ptr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", size); + xmlSecBase64CtxFinalize(&ctx); + return(NULL); + } + + ret = xmlSecBase64CtxUpdate(&ctx, buf, len, (xmlSecByte*)ptr, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxUpdate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "len=%d", len); + xmlFree(ptr); + xmlSecBase64CtxFinalize(&ctx); + return(NULL); + } + size_update = ret; + + ret = xmlSecBase64CtxFinal(&ctx, ((xmlSecByte*)ptr) + size_update, size - size_update); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(ptr); + xmlSecBase64CtxFinalize(&ctx); + return(NULL); + } + size_final = ret; + ptr[size_update + size_final] = '\0'; + + xmlSecBase64CtxFinalize(&ctx); + return(ptr); +} + +/** + * xmlSecBase64Decode: + * @str: the input buffer with base64 encoded string + * @buf: the output buffer + * @len: the output buffer size + * + * Decodes input base64 encoded string and puts result into + * the output buffer. + * + * Returns the number of bytes written to the output buffer or + * a negative value if an error occurs + */ +EXPORT_C +int +xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) { + xmlSecBase64Ctx ctx; + int size_update; + int size_final; + int ret; + + xmlSecAssert2(str != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + ret = xmlSecBase64CtxInitialize(&ctx, 0, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecBase64CtxUpdate(&ctx, (const xmlSecByte*)str, xmlStrlen(str), buf, len); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxUpdate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBase64CtxFinalize(&ctx); + return(-1); + } + + size_update = ret; + ret = xmlSecBase64CtxFinal(&ctx, buf + size_update, len - size_update); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64CtxFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBase64CtxFinalize(&ctx); + return(-1); + } + size_final = ret; + + xmlSecBase64CtxFinalize(&ctx); + return(size_update + size_final); +} + +/************************************************************** + * + * Base64 Transform + * + * xmlSecBase64Ctx is located after xmlSecTransform + * + **************************************************************/ +#define xmlSecBase64Size \ + (sizeof(xmlSecTransform) + sizeof(xmlSecBase64Ctx)) +#define xmlSecBase64GetCtx(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecBase64Size)) ? \ + (xmlSecBase64CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlSecBase64CtxPtr)NULL) + +static int xmlSecBase64Initialize (xmlSecTransformPtr transform); +static void xmlSecBase64Finalize (xmlSecTransformPtr transform); +static int xmlSecBase64Execute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +static xmlSecTransformKlass xmlSecBase64Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecBase64Size, /* xmlSecSize objSize */ + + xmlSecNameBase64, /* const xmlChar* name; */ + xmlSecHrefBase64, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */ + + xmlSecBase64Initialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecBase64Finalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecBase64Execute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformBase64GetKlass: + * + * The Base64 transform klass (http://www.w3.org/TR/xmldsig-core/#sec-Base-64). + * The normative specification for base64 decoding transforms is RFC 2045 + * (http://www.ietf.org/rfc/rfc2045.txt). The base64 Transform element has + * no content. The input is decoded by the algorithms. This transform is + * useful if an application needs to sign the raw data associated with + * the encoded content of an element. + * + * Returns base64 transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformBase64GetKlass(void) { + return(&xmlSecBase64Klass); +} + +/** + * xmlSecTransformBase64SetLineSize: + * @transform: the pointer to BASE64 encode transform. + * @lineSize: the new max line size. + * + * Sets the max line size to @lineSize. + */ +EXPORT_C +void +xmlSecTransformBase64SetLineSize(xmlSecTransformPtr transform, xmlSecSize lineSize) { + xmlSecBase64CtxPtr ctx; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id)); + + ctx = xmlSecBase64GetCtx(transform); + xmlSecAssert(ctx != NULL); + + ctx->columns = lineSize; +} + +static int +xmlSecBase64Initialize(xmlSecTransformPtr transform) { + xmlSecBase64CtxPtr ctx; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id), -1); + + ctx = xmlSecBase64GetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + transform->operation = xmlSecTransformOperationDecode; + ret = xmlSecBase64CtxInitialize(ctx, 0, XMLSEC_BASE64_LINESIZE); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBase64CtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static void +xmlSecBase64Finalize(xmlSecTransformPtr transform) { + xmlSecBase64CtxPtr ctx; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id)); + + ctx = xmlSecBase64GetCtx(transform); + xmlSecAssert(ctx != NULL); + + xmlSecBase64CtxFinalize(ctx); +} + +static int +xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) { + xmlSecBase64CtxPtr ctx; + xmlSecBufferPtr in, out; + xmlSecSize inSize, outSize, outLen; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationEncode) || (transform->operation == xmlSecTransformOperationDecode), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecBase64GetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + + if(transform->status == xmlSecTransformStatusNone) { + ctx->encode = (transform->operation == xmlSecTransformOperationEncode) ? 1 : 0; + transform->status = xmlSecTransformStatusWorking; + } + + switch(transform->status) { + case xmlSecTransformStatusWorking: + inSize = xmlSecBufferGetSize(in); + outSize = xmlSecBufferGetSize(out); + if(inSize > 0) { + if(ctx->encode != 0) { + outLen = 4 * inSize / 3 + 8; + if(ctx->columns > 0) { + outLen += inSize / ctx->columns + 4; + } + } else { + outLen = 3 * inSize / 4 + 8; + } + ret = xmlSecBufferSetMaxSize(out, outSize + outLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + outLen); + return(-1); + } + + /* encode/decode the next chunk */ + ret = xmlSecBase64CtxUpdate(ctx, xmlSecBufferGetData(in), inSize, + xmlSecBufferGetData(out) + outSize, + outLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBase64CtxUpdate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + outLen = ret; + + /* set correct size */ + ret = xmlSecBufferSetSize(out, outSize + outLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + outLen); + return(-1); + } + + /* remove chunk from input */ + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + } + + if(last) { + outSize = xmlSecBufferGetSize(out); + + ret = xmlSecBufferSetMaxSize(out, outSize + 16); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + 16); + return(-1); + } + + /* add from ctx buffer */ + ret = xmlSecBase64CtxFinal(ctx, xmlSecBufferGetData(out) + outSize, 16); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBase64CtxFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + outLen = ret; + + /* set correct size */ + ret = xmlSecBufferSetSize(out, outSize + outLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + outLen); + return(-1); + } + transform->status = xmlSecTransformStatusFinished; + } + break; + case xmlSecTransformStatusFinished: + /* the only way we can get here is if there is no input */ + xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1); + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + return(0); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_bn.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_bn.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1087 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Big Numbers. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Copyright (C) 2003 Cordys R&D BV, All rights reserved. + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_base64.h" +#include "xmlsec_bn.h" +#include "xmlsec_errors.h" + +/* table for converting hex digits back to bytes */ +static const int xmlSecBnLookupTable[] = +{ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static const char xmlSecBnRevLookupTable[] = +{ + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' +}; + +/***************************************************************************** + * + * xmlSecBn + * + ****************************************************************************/ +/** + * xmlSecBnCreate: + * @size: the initial allocated BN size. + * + * Creates a new BN object. Caller is responsible for destroying it + * by calling @xmlSecBnDestroy function. + * + * Returns the newly BN or a NULL if an error occurs. + */ +EXPORT_C +xmlSecBnPtr +xmlSecBnCreate(xmlSecSize size) { + return(xmlSecBufferCreate(size)); +} + +/** + * xmlSecBnDestroy: + * @bn: the pointer to BN. + * + * Destroys @bn object created with @xmlSecBnCreate function. + */ +EXPORT_C +void +xmlSecBnDestroy(xmlSecBnPtr bn) { + xmlSecBufferDestroy(bn); +} + +/** + * xmlSecBnInitialize: + * @bn: the pointer to BN. + * @size: the initial allocated BN size. + * + * Initializes a BN object. Caller is responsible for destroying it + * by calling @xmlSecBnFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnInitialize(xmlSecBnPtr bn, xmlSecSize size) { + return(xmlSecBufferInitialize(bn, size)); +} + +/** + * xmlSecBnFinalize: + * @bn: the pointer to BN. + * + * Destroys @bn object created with @xmlSecBnInitialize function. + */ +EXPORT_C +void +xmlSecBnFinalize(xmlSecBnPtr bn) { + xmlSecBufferFinalize(bn); +} + +/** + * xmlSecBnGetData: + * @bn: the pointer to BN. + * + * Gets pointer to the binary @bn representation. + * + * Returns pointer to binary BN data or NULL if an error occurs. + */ +EXPORT_C +xmlSecByte* +xmlSecBnGetData(xmlSecBnPtr bn) { + return(xmlSecBufferGetData(bn)); +} + +/** + * xmlSecBnSetData: + * @bn: the pointer to BN. + * @data: the pointer to new BN binary data. + * @size: the size of new BN data. + * + * Sets the value of @bn to @data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnSetData(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize size) { + return(xmlSecBufferSetData(bn, data, size)); +} + +/** + * xmlSecBnGetSize: + * @bn: the pointer to BN. + * + * Gets the size of binary data in @bn. + * + * Returns the size of binary data. + */ +EXPORT_C +xmlSecSize +xmlSecBnGetSize(xmlSecBnPtr bn) { + return(xmlSecBufferGetSize(bn)); +} + +/** + * xmlSecBnZero: + * @bn: the pointer to BN. + * + * Sets the value of @bn to zero. + */ +EXPORT_C +void +xmlSecBnZero(xmlSecBnPtr bn) { + xmlSecBufferEmpty(bn); +} + +/** + * xmlSecBnFromString: + * @bn: the pointer to BN. + * @str: the string with BN. + * @base: the base for @str. + * + * Reads @bn from string @str assuming it has base @base. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) { + xmlSecSize i, len, size; + xmlSecByte ch; + xmlSecByte* data; + int positive; + int nn; + int ret; + + xmlSecAssert2(bn != NULL, -1); + xmlSecAssert2(str != NULL, -1); + xmlSecAssert2(base > 1, -1); + xmlSecAssert2(base <= sizeof(xmlSecBnRevLookupTable), -1); + + /* trivial case */ + len = xmlStrlen(str); + if(len == 0) { + return(0); + } + + /* The result size could not exceed the input string length + * because each char fits inside a byte in all cases :) + * In truth, it would be likely less than 1/2 input string length + * because each byte is represented by 2 chars. If needed, + * buffer size would be increased by Mul/Add functions. + * Finally, we can add one byte for 00 or 10 prefix. + */ + ret = xmlSecBufferSetMaxSize(bn, xmlSecBufferGetSize(bn) + len / 2 + 1 + 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnRevLookupTable", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", len / 2 + 1); + return (-1); + } + + /* figure out if it is positive or negative number */ + positive = 1; + i = 0; + while(i < len) { + ch = str[i++]; + + /* skip spaces */ + if(isspace(ch)) { + continue; + } + + /* check if it is + or - */ + if(ch == '+') { + positive = 1; + break; + } else if(ch == '-') { + positive = 0; + break; + } + + /* otherwise, it must be start of the number */ + nn = xmlSecBnLookupTable[ch]; + if((nn >= 0) && ((xmlSecSize)nn < base)) { + xmlSecAssert2(i > 0, -1); + + /* no sign, positive by default */ + positive = 1; + --i; /* make sure that we will look at this character in next loop */ + break; + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "char=%c;base=%d", + ch, base); + return (-1); + } + } + + /* now parse the number itself */ + while(i < len) { + ch = str[i++]; + if(isspace(ch)) { + continue; + } + + xmlSecAssert2(ch <= sizeof(xmlSecBnLookupTable), -1); + nn = xmlSecBnLookupTable[ch]; + if((nn < 0) || ((xmlSecSize)nn > base)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "char=%c;base=%d", + ch, base); + return (-1); + } + + ret = xmlSecBnMul(bn, base); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnMul", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "base=%d", base); + return (-1); + } + + ret = xmlSecBnAdd(bn, nn); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "base=%d", base); + return (-1); +} + } + + /* check if we need to add 00 prefix, do this for empty bn too */ + data = xmlSecBufferGetData(bn); + size = xmlSecBufferGetSize(bn); + if(((size > 0) && (data[0] > 127)) || (size == 0)) { + ch = 0; + ret = xmlSecBufferPrepend(bn, &ch, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "base=%d", base); + return (-1); + } + } + + /* do 2's compliment and add 1 to represent negative value */ + if(positive == 0) { + data = xmlSecBufferGetData(bn); + size = xmlSecBufferGetSize(bn); + for(i = 0; i < size; ++i) { + data[i] ^= 0xFF; + } + + ret = xmlSecBnAdd(bn, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "base=%d", base); + return (-1); + } + } + + return(0); +} + +/** + * xmlSecBnToString: + * @bn: the pointer to BN. + * @base: the base for returned string. + * + * Writes @bn to string with base @base. Caller is responsible for + * freeing returned string with @xmlFree. + * + * Returns the string represenataion if BN or a NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) { + xmlSecBn bn2; + int positive = 1; + xmlChar* res; + xmlSecSize i, len, size; + xmlSecByte* data; + int ret; + int nn; + xmlChar ch; + + xmlSecAssert2(bn != NULL, NULL); + xmlSecAssert2(base > 1, NULL); + xmlSecAssert2(base <= sizeof(xmlSecBnRevLookupTable), NULL); + + + /* copy bn */ + data = xmlSecBufferGetData(bn); + size = xmlSecBufferGetSize(bn); + ret = xmlSecBnInitialize(&bn2, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return (NULL); + } + + ret = xmlSecBnSetData(&bn2, data, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnSetData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + xmlSecBnFinalize(&bn2); + return (NULL); + } + + /* check if it is a negative number or not */ + data = xmlSecBufferGetData(&bn2); + size = xmlSecBufferGetSize(&bn2); + if((size > 0) && (data[0] > 127)) { + /* subtract 1 and do 2's compliment */ + ret = xmlSecBnAdd(&bn2, -1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + xmlSecBnFinalize(&bn2); + return (NULL); + } + for(i = 0; i < size; ++i) { + data[i] ^= 0xFF; + } + + positive = 0; + } else { + positive = 1; + } + + /* Result string len is + * len = log base (256) * + * Since the smallest base == 2 then we can get away with + * len = 8 * + */ + len = 8 * size + 1 + 1; + res = (xmlChar*)xmlMalloc(len + 1); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "len=%d", len); + xmlSecBnFinalize(&bn2); + return (NULL); + } + memset(res, 0, len + 1); + + for(i = 0; (xmlSecBufferGetSize(&bn2) > 0) && (i < len); i++) { + if(xmlSecBnDiv(&bn2, base, &nn) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnDiv", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "base=%d", base); + xmlFree(res); + xmlSecBnFinalize(&bn2); + return (NULL); + } + xmlSecAssert2((size_t)nn < sizeof(xmlSecBnRevLookupTable), NULL); + res[i] = xmlSecBnRevLookupTable[nn]; + } + xmlSecAssert2(i < len, NULL); + + /* we might have '0' at the beggining, remove it but keep one zero */ + for(len = i; (len > 1) && (res[len - 1] == '0'); len--) + { + }; + res[len] = '\0'; + + /* add "-" for negative numbers */ + if(positive == 0) { + res[len] = '-'; + res[++len] = '\0'; + } + + /* swap the string because we wrote it in reverse order */ + for(i = 0; i < len / 2; i++) { + ch = res[i]; + res[i] = res[len - i - 1]; + res[len - i - 1] = ch; + } + + xmlSecBnFinalize(&bn2); + return(res); +} + +/** + * xmlSecBnFromHexString: + * @bn: the pointer to BN. + * @str: the string with BN. + * + * Reads @bn from hex string @str. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnFromHexString(xmlSecBnPtr bn, const xmlChar* str) { + return(xmlSecBnFromString(bn, str, 16)); +} + +/** + * xmlSecBnToHexString: + * @bn: the pointer to BN. + * + * Writes @bn to hex string. Caller is responsible for + * freeing returned string with @xmlFree. + * + * Returns the string represenataion if BN or a NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecBnToHexString(xmlSecBnPtr bn) { + return(xmlSecBnToString(bn, 16)); +} + +/** + * xmlSecBnFromDecString: + * @bn: the pointer to BN. + * @str: the string with BN. + * + * Reads @bn from decimal string @str. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnFromDecString(xmlSecBnPtr bn, const xmlChar* str) { + return(xmlSecBnFromString(bn, str, 10)); +} + +/** + * xmlSecBnToDecString: + * @bn: the pointer to BN. + * + * Writes @bn to decimal string. Caller is responsible for + * freeing returned string with @xmlFree. + * + * Returns the string represenataion if BN or a NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecBnToDecString(xmlSecBnPtr bn) { + return(xmlSecBnToString(bn, 10)); +} + +/** + * xmlSecBnMul: + * @bn: the pointer to BN. + * @multiplier: the multiplier. + * + * Multiplies @bn with @multiplier. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnMul(xmlSecBnPtr bn, int multiplier) { + xmlSecByte* data; + int over; + xmlSecSize i; + xmlSecByte ch; + int ret; + + xmlSecAssert2(bn != NULL, -1); + xmlSecAssert2(multiplier > 0, -1); + + if(multiplier == 1) { + return(0); + } + + data = xmlSecBufferGetData(bn); + i = xmlSecBufferGetSize(bn); + over = 0; + while(i > 0) { + xmlSecAssert2(data != NULL, -1); + + over = over + multiplier * data[--i]; + data[i] = over % 256; + over = over / 256; + } + + while(over > 0) { + ch = over % 256; + over = over / 256; + + ret = xmlSecBufferPrepend(bn, &ch, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=1"); + return (-1); + } + } + + return(0); +} + +/** + * xmlSecBnDiv: + * @bn: the pointer to BN. + * @divider: the divider + * @mod: the pointer for modulus result. + * + * Divides @bn by @divider and places modulus into @mod. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnDiv(xmlSecBnPtr bn, int divider, int* mod) { + int over; + xmlSecSize i, size; + xmlSecByte* data; + int ret; + + xmlSecAssert2(bn != NULL, -1); + xmlSecAssert2(divider > 0, -1); + xmlSecAssert2(mod != NULL, -1); + + if(divider == 1) { + return(0); + } + + data = xmlSecBufferGetData(bn); + size = xmlSecBufferGetSize(bn); + for(over = 0, i = 0; i < size; i++) { + xmlSecAssert2(data != NULL, -1); + + over = over * 256 + data[i]; + data[i] = over / divider; + over = over % divider; + } + (*mod) = over; + + /* remove leading zeros */ + for(i = 0; i < size; i++) { + xmlSecAssert2(data != NULL, -1); + + if(data[i] != 0) { + break; + } + } + if(i > 0) { + ret = xmlSecBufferRemoveHead(bn, i); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", i); + return (-1); + } + } + return(0); +} + +/** + * xmlSecBnAdd: + * @bn: the pointer to BN. + * @delta: the delta. + * + * Adds @delta to @bn. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnAdd(xmlSecBnPtr bn, int delta) { + int over, tmp; + xmlSecByte* data; + xmlSecSize i; + xmlSecByte ch; + int ret; + + xmlSecAssert2(bn != NULL, -1); + + if(delta == 0) { + return(0); + } + + data = xmlSecBufferGetData(bn); + if(delta > 0) { + for(over = delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0) ;) { + xmlSecAssert2(data != NULL, -1); + + tmp = data[--i]; + over += tmp; + data[i] = over % 256; + over = over / 256; + } + + while(over > 0) { + ch = over % 256; + over = over / 256; + + ret = xmlSecBufferPrepend(bn, &ch, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=1"); + return (-1); + } + } + } else { + for(over = -delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0);) { + xmlSecAssert2(data != NULL, -1); + + tmp = data[--i]; + if(tmp < over) { + data[i] = 0; + over = (over - tmp) / 256; + } else { + data[i] = tmp - over; + over = 0; + } + } + } + return(0); +} + +/** + * xmlSecBnReverse: + * @bn: the pointer to BN. + * + * Reverses bytes order in @bn. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBnReverse(xmlSecBnPtr bn) { + xmlSecByte* data; + xmlSecSize i, j, size; + xmlSecByte ch; + + xmlSecAssert2(bn != NULL, -1); + + data = xmlSecBufferGetData(bn); + size = xmlSecBufferGetSize(bn); + for(i = 0, j = size - 1; i < size / 2; ++i, --j) { + xmlSecAssert2(data != NULL, -1); + + ch = data[i]; + data[i] = data[j]; + data[j] = ch; + } + + return(0); +} + +/** + * xmlSecBnCompare: + * @bn: the pointer to BN. + * @data: the data to compare BN to. + * @dataSize: the @data size. + * + * Compares the @bn with @data. + * + * Returns 0 if data is equal, negative value if @bn is less or positive value if @bn + * is greater than @data. + */ +EXPORT_C +int +xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) { + xmlSecByte* bnData; + xmlSecSize bnSize; + + xmlSecAssert2(bn != NULL, -1); + + bnData = xmlSecBnGetData(bn); + bnSize = xmlSecBnGetSize(bn); + + /* skip zeros in the beggining */ + while((dataSize > 0) && (data != 0) && (data[0] == 0)) { + ++data; + --dataSize; + } + while((bnSize > 0) && (bnData != 0) && (bnData[0] == 0)) { + ++bnData; + --bnSize; + } + + if(((bnData == NULL) || (bnSize == 0)) && ((data == NULL) || (dataSize == 0))) { + return(0); + } else if((bnData == NULL) || (bnSize == 0)) { + return(-1); + } else if((data == NULL) || (dataSize == 0)) { + return(1); + } else if(bnSize < dataSize) { + return(-1); + } else if(bnSize > dataSize) { + return(-1); + } + + xmlSecAssert2(bnData != NULL, -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(bnSize == dataSize, -1); + + return(memcmp(bnData, data, dataSize)); +} + +/** + * xmlSecBnCompareReverse: + * @bn: the pointer to BN. + * @data: the data to compare BN to. + * @dataSize: the @data size. + * + * Compares the @bn with reverse @data. + * + * Returns 0 if data is equal, negative value if @bn is less or positive value if @bn + * is greater than @data. + */ +EXPORT_C +int +xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) { + xmlSecByte* bnData; + xmlSecSize bnSize; + xmlSecSize i, j; + + xmlSecAssert2(bn != NULL, -1); + + bnData = xmlSecBnGetData(bn); + bnSize = xmlSecBnGetSize(bn); + + /* skip zeros in the beggining */ + while((dataSize > 0) && (data != 0) && (data[dataSize - 1] == 0)) { + --dataSize; + } + while((bnSize > 0) && (bnData != 0) && (bnData[0] == 0)) { + ++bnData; + --bnSize; + } + + if(((bnData == NULL) || (bnSize == 0)) && ((data == NULL) || (dataSize == 0))) { + return(0); + } else if((bnData == NULL) || (bnSize == 0)) { + return(-1); + } else if((data == NULL) || (dataSize == 0)) { + return(1); + } else if(bnSize < dataSize) { + return(-1); + } else if(bnSize > dataSize) { + return(-1); + } + + xmlSecAssert2(bnData != NULL, -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(bnSize == dataSize, -1); + for(i = 0, j = dataSize - 1; i < dataSize; ++i, --j) { + if(bnData[i] < data[j]) { + return(-1); + } else if(data[j] < bnData[i]) { + return(1); + } + } + + return(0); +} + +/** + * xmlSecBnGetNodeValue: + * @bn: the pointer to BN. + * @cur: the poitner to an XML node. + * @format: the BN format. + * @reverse: if set then reverse read buffer after reading. + * + * Converts the node content from @format to @bn. + * + * Returns 0 on success and a negative values if an error occurs. + */ +EXPORT_C +int +xmlSecBnGetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int reverse) { + xmlChar* content; + int ret; + + xmlSecAssert2(bn != NULL, -1); + xmlSecAssert2(cur != NULL, -1); + + switch(format) { + case xmlSecBnBase64: + ret = xmlSecBufferBase64NodeContentRead(bn, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferBase64NodeContentRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + break; + case xmlSecBnHex: + content = xmlNodeGetContent(cur); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeGetContent", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ret = xmlSecBnFromHexString(bn, content); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnFromHexString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + xmlFree(content); + break; + case xmlSecBnDec: + content = xmlNodeGetContent(cur); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeGetContent", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ret = xmlSecBnFromDecString(bn, content); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnFromDecString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + xmlFree(content); + break; + } + + if(reverse != 0) { + ret = xmlSecBnReverse(bn); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnReverse", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +/** + * xmlSecBnSetNodeValue: + * @bn: the pointer to BN. + * @cur: the poitner to an XML node. + * @format: the BN format. + * @reverse: the flag that indicates whether to reverse the buffer before writing. + * @addLineBreaks: the flag; it is equal to 1 then linebreaks will be added before and after new buffer content. + * + * Converts the @bn and sets it to node content. + * + * Returns 0 on success and a negative values if an error occurs. + */ +EXPORT_C +int +xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int reverse, int addLineBreaks) { + xmlChar* content; + int ret; + + xmlSecAssert2(bn != NULL, -1); + xmlSecAssert2(cur != NULL, -1); + + if(reverse != 0) { + ret = xmlSecBnReverse(bn); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnReverse", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + if(addLineBreaks) { + xmlNodeAddContent(cur, xmlSecStringCR); + } + + switch(format) { + case xmlSecBnBase64: + ret = xmlSecBufferBase64NodeContentWrite(bn, cur, XMLSEC_BASE64_LINESIZE); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferBase64NodeContentWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + break; + case xmlSecBnHex: + content = xmlSecBnToHexString(bn); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnToHexString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + xmlNodeSetContent(cur, content); + xmlFree(content); + break; + case xmlSecBnDec: + content = xmlSecBnToDecString(bn); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnToDecString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + xmlNodeSetContent(cur, content); + xmlFree(content); + break; + } + + if(addLineBreaks) { + xmlNodeAddContent(cur, xmlSecStringCR); + } + + return(0); +} + +/** + * xmlSecBnBlobSetNodeValue: + * @data: the pointer to BN blob. + * @dataSize: the size of BN blob. + * @cur: the poitner to an XML node. + * @format: the BN format. + * @reverse: the flag that indicates whether to reverse the buffer before writing. + * @addLineBreaks: if the flag is equal to 1 then + * linebreaks will be added before and after + * new buffer content. + * + * Converts the @blob and sets it to node content. + * + * Returns 0 on success and a negative values if an error occurs. + */ +EXPORT_C +int +xmlSecBnBlobSetNodeValue(const xmlSecByte* data, xmlSecSize dataSize, + xmlNodePtr cur, xmlSecBnFormat format, int reverse, + int addLineBreaks) { + xmlSecBn bn; + int ret; + + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(cur != NULL, -1); + + ret = xmlSecBnInitialize(&bn, dataSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecBnSetData(&bn, data, dataSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnSetData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBnFinalize(&bn); + return(-1); + } + + ret = xmlSecBnSetNodeValue(&bn, cur, format, reverse, addLineBreaks); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBnSetNodeValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBnFinalize(&bn); + return(-1); + } + + xmlSecBnFinalize(&bn); + return(0); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_buffer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_buffer.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,709 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Memory buffer. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_base64.h" +#include "xmlsec_buffer.h" +#include "xmlsec_errors.h" + +#include "xmlsec_error_flag.h" + +//added for symbian port +#include "xmlsec_io.h" + +/***************************************************************************** + * + * xmlSecBuffer + * + ****************************************************************************/ +static xmlSecAllocMode gAllocMode = xmlSecAllocModeDouble; +static xmlSecSize gInitialSize = 1024; + +/** + * xmlSecBufferSetDefaultAllocMode: + * @defAllocMode: the new default buffer allocation mode. + * @defInitialSize: the new default buffer minimal intial size. + * + * Sets new global default allocation mode and minimal intial size. + */ +EXPORT_C +void +xmlSecBufferSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInitialSize) { + xmlSecAssert(defInitialSize > 0); + + gAllocMode = defAllocMode; + gInitialSize = defInitialSize; +} + +/** + * xmlSecBufferCreate: + * @size: the intial size. + * + * Allocates and initalizes new memory buffer with given size. + * Caller is responsible for calling #xmlSecBufferDestroy function + * to free the buffer. + * + * Returns pointer to newly allocated buffer or NULL if an error occurs. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecBufferCreate(xmlSecSize size) { + xmlSecBufferPtr buf; + int ret; + + buf = (xmlSecBufferPtr)xmlMalloc(sizeof(xmlSecBuffer)); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecBuffer)=%d", sizeof(xmlSecBuffer)); + return(NULL); + } + + ret = xmlSecBufferInitialize(buf, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + xmlSecBufferDestroy(buf); + return(NULL); + } + return(buf); +} + +/** + * xmlSecBufferDestroy: + * @buf: the pointer to buffer object. + * + * Desrtoys buffer object created with #xmlSecBufferCreate function. + */ +EXPORT_C +void +xmlSecBufferDestroy(xmlSecBufferPtr buf) { + xmlSecAssert(buf != NULL); + + xmlSecBufferFinalize(buf); + xmlFree(buf); +} + +/** + * xmlSecBufferInitialize: + * @buf: the pointer to buffer object. + * @size: the initial buffer size. + * + * Initializes buffer object @buf. Caller is responsible for calling + * #xmlSecBufferFinalize function to free allocated resources. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferInitialize(xmlSecBufferPtr buf, xmlSecSize size) { + xmlSecAssert2(buf != NULL, -1); + + buf->data = NULL; + buf->size = buf->maxSize = 0; + buf->allocMode = gAllocMode; + + return(xmlSecBufferSetMaxSize(buf, size)); +} + +/** + * xmlSecBufferFinalize: + * @buf: the pointer to buffer object. + * + * Frees allocated resource for a buffer intialized with #xmlSecBufferInitialize + * function. + */ +EXPORT_C +void +xmlSecBufferFinalize(xmlSecBufferPtr buf) { + xmlSecAssert(buf != NULL); + + xmlSecBufferEmpty(buf); + if(buf->data != 0) { + xmlFree(buf->data); + } + buf->data = NULL; + buf->size = buf->maxSize = 0; +} + +/** + * xmlSecBufferEmpty: + * @buf: the pointer to buffer object. + * + * Empties the buffer. + */ +EXPORT_C +void +xmlSecBufferEmpty(xmlSecBufferPtr buf) { + xmlSecAssert(buf != NULL); + + if(buf->data != 0) { + xmlSecAssert(buf->maxSize > 0); + + memset(buf->data, 0, buf->maxSize); + } + buf->size = 0; +} + +/** + * xmlSecBufferGetData: + * @buf: the pointer to buffer object. + * + * Gets pointer to buffer's data. + * + * Returns pointer to buffer's data. + */ +EXPORT_C +xmlSecByte* +xmlSecBufferGetData(xmlSecBufferPtr buf) { + xmlSecAssert2(buf != NULL, NULL); + + return(buf->data); +} + +/** + * xmlSecBufferSetData: + * @buf: the pointer to buffer object. + * @data: the data. + * @size: the data size. + * + * Sets the value of the buffer to @data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) { + int ret; + + xmlSecAssert2(buf != NULL, -1); + + xmlSecBufferEmpty(buf); + if(size > 0) { + xmlSecAssert2(data != NULL, -1); + + ret = xmlSecBufferSetMaxSize(buf, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return(-1); + } + + memcpy(buf->data, data, size); + } + + buf->size = size; + return(0); +} + +/** + * xmlSecBufferGetSize: + * @buf: the pointer to buffer object. + * + * Gets the current buffer data size. + * + * Returns the current data size. + */ +EXPORT_C +xmlSecSize +xmlSecBufferGetSize(xmlSecBufferPtr buf) { + xmlSecAssert2(buf != NULL, 0); + + return(buf->size); +} + +/** + * xmlSecBufferSetSize: + * @buf: the pointer to buffer object. + * @size: the new data size. + * + * Sets new buffer data size. If necessary, buffer grows to + * have at least @size bytes. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) { + int ret; + + xmlSecAssert2(buf != NULL, -1); + + ret = xmlSecBufferSetMaxSize(buf, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return(-1); + } + + + buf->size = size; + return(0); +} + +/** + * xmlSecBufferGetMaxSize: + * @buf: the pointer to buffer object. + * + * Gets the maximum (allocated) buffer size. + * + * Returns the maximum (allocated) buffer size. + */ +EXPORT_C +xmlSecSize +xmlSecBufferGetMaxSize(xmlSecBufferPtr buf) { + xmlSecAssert2(buf != NULL, 0); + + return(buf->maxSize); +} + +/** + * xmlSecBufferSetMaxSize: + * @buf: the pointer to buffer object. + * @size: the new maximum size. + * + * Sets new buffer maximum size. If necessary, buffer grows to + * have at least @size bytes. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) { + xmlSecByte* newData; + xmlSecSize newSize = 0; + + xmlSecAssert2(buf != NULL, -1); + if(size <= buf->maxSize) { + return(0); + } + + switch(buf->allocMode) { + case xmlSecAllocModeExact: + newSize = size + 8; + break; + case xmlSecAllocModeDouble: + newSize = 2 * size + 32; + break; + } + + if(newSize < gInitialSize) { + newSize = gInitialSize; + } + + + if(buf->data != NULL) { + newData = (xmlSecByte*)xmlRealloc(buf->data, newSize); + } else { + newData = (xmlSecByte*)xmlMalloc(newSize); + } + if(newData == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", newSize); + return(-1); + } + + buf->data = newData; + buf->maxSize = newSize; + + if(buf->size < buf->maxSize) { + xmlSecAssert2(buf->data != NULL, -1); + memset(buf->data + buf->size, 0, buf->maxSize - buf->size); + } + + return(0); +} + +/** + * xmlSecBufferAppend: + * @buf: the pointer to buffer object. + * @data: the data. + * @size: the data size. + * + * Appends the @data after the current data stored in the buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) { + int ret; + + xmlSecAssert2(buf != NULL, -1); + + if(size > 0) { + xmlSecAssert2(data != NULL, -1); + + ret = xmlSecBufferSetMaxSize(buf, buf->size + size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", buf->size + size); + return(-1); + } + + memcpy(buf->data + buf->size, data, size); + buf->size += size; + } + + return(0); +} + +/** + * xmlSecBufferPrepend: + * @buf: the pointer to buffer object. + * @data: the data. + * @size: the data size. + * + * Prepends the @data before the current data stored in the buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) { + int ret; + + xmlSecAssert2(buf != NULL, -1); + + if(size > 0) { + xmlSecAssert2(data != NULL, -1); + + ret = xmlSecBufferSetMaxSize(buf, buf->size + size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", buf->size + size); + return(-1); + } + + memmove(buf->data + size, buf->data, buf->size); + memcpy(buf->data, data, size); + buf->size += size; + } + + return(0); +} + +/** + * xmlSecBufferRemoveHead: + * @buf: the pointer to buffer object. + * @size: the number of bytes to be removed. + * + * Removes @size bytes from the beginning of the current buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferRemoveHead(xmlSecBufferPtr buf, xmlSecSize size) { + xmlSecAssert2(buf != NULL, -1); + + if(size < buf->size) { + xmlSecAssert2(buf->data != NULL, -1); + + buf->size -= size; + memmove(buf->data, buf->data + size, buf->size); + } else { + buf->size = 0; + } + if(buf->size < buf->maxSize) { + xmlSecAssert2(buf->data != NULL, -1); + memset(buf->data + buf->size, 0, buf->maxSize - buf->size); + } + return(0); +} + +/** + * xmlSecBufferRemoveTail: + * @buf: the pointer to buffer object. + * @size: the number of bytes to be removed. + * + * Removes @size bytes from the end of current buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferRemoveTail(xmlSecBufferPtr buf, xmlSecSize size) { + xmlSecAssert2(buf != NULL, -1); + + if(size < buf->size) { + buf->size -= size; + } else { + buf->size = 0; + } + if(buf->size < buf->maxSize) { + xmlSecAssert2(buf->data != NULL, -1); + memset(buf->data + buf->size, 0, buf->maxSize - buf->size); + } + return(0); +} + +/** + * xmlSecBufferReadFile: + * @buf: the pointer to buffer object. + * @filename: the filename. + * + * Reads the content of the file @filename in the buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) { + xmlSecByte buffer[1024]; + FILE* f; + int ret, len; + + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(filename != NULL, -1); + + f = fopen(filename, "rb"); + if(f == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "fopen", + XMLSEC_ERRORS_R_IO_FAILED, + "filename=%s;errno=%d", + xmlSecErrorsSafeString(filename), + errno); + if ( errno == ENOMEM ) + { + xmlSecSetErrorFlag( -4 ); //KErrNoMemory + } + return(-1); + } + + while(1) { + len = fread(buffer, 1, sizeof(buffer), f); + if(len == 0 && !errno) { + break; + }else if( errno ) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "fread", + XMLSEC_ERRORS_R_IO_FAILED, + "filename=%s;errno=%d", + xmlSecErrorsSafeString(filename), + errno); + if ( errno == ENOMEM ) + { + xmlSecSetErrorFlag( -4 ); //KErrNoMemory + } + fclose(f); + return(-1); + } + + ret = xmlSecBufferAppend(buf, buffer, len); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", + len); + fclose(f); + return(-1); + } + } + + fclose(f); + return(0); +} + +/** + * xmlSecBufferBase64NodeContentRead: + * @buf: the pointer to buffer object. + * @node: the pointer to node. + * + * Reads the content of the @node, base64 decodes it and stores the + * result in the buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) { + xmlChar* content; + xmlSecSize size; + int ret; + + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + content = xmlNodeGetContent(node); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* base64 decode size is less than input size */ + ret = xmlSecBufferSetMaxSize(buf, xmlStrlen(content)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + + ret = xmlSecBase64Decode(content, xmlSecBufferGetData(buf), xmlSecBufferGetMaxSize(buf)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Decode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + size = ret; + + ret = xmlSecBufferSetSize(buf, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + xmlFree(content); + return(-1); + } + xmlFree(content); + + return(0); +} + +/** + * xmlSecBufferBase64NodeContentWrite: + * @buf: the pointer to buffer object. + * @node: the pointer to a node. + * @columns: the max line size fro base64 encoded data. + * + * Sets the content of the @node to the base64 encoded buffer data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int columns) { + xmlChar* content; + + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + content = xmlSecBase64Encode(xmlSecBufferGetData(buf), xmlSecBufferGetSize(buf), columns); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlNodeAddContent(node, content); + xmlFree(content); + + return(0); +} + +/************************************************************************ + * + * IO buffer + * + ************************************************************************/ +static int xmlSecBufferIOWrite (xmlSecBufferPtr buf, + const xmlSecByte *data, + xmlSecSize size); +static int xmlSecBufferIOClose (xmlSecBufferPtr buf); + +/** + * xmlSecBufferCreateOutputBuffer: + * @buf: the pointer to buffer. + * + * Creates new LibXML output buffer to store data in the @buf. Caller is + * responsible for destroying @buf when processing is done. + * + * Returns pointer to newly allocated output buffer or NULL if an error + * occurs. + */ +EXPORT_C +xmlOutputBufferPtr +xmlSecBufferCreateOutputBuffer(xmlSecBufferPtr buf) { + return(xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecBufferIOWrite, + (xmlOutputCloseCallback)xmlSecBufferIOClose, + buf, + NULL)); +} + +static int +xmlSecBufferIOWrite(xmlSecBufferPtr buf, const xmlSecByte *data, xmlSecSize size) { + int ret; + + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(data != NULL, -1); + + ret = xmlSecBufferAppend(buf, data, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return(-1); + } + + return(size); +} + +static int +xmlSecBufferIOClose(xmlSecBufferPtr buf) { + xmlSecAssert2(buf != NULL, -1); + + /* just do nothing */ + return(0); +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_c14n.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_c14n.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,681 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Canonicalization transforms. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_list.h" +#include "xmlsec_transforms.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_errors.h" + + +/****************************************************************************** + * + * C14N transforms + * + * Inclusive namespaces list for ExclC14N (xmlSecStringList) is located + * after xmlSecTransform structure + * + *****************************************************************************/ +#define xmlSecTransformC14NSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecPtrList)) +#define xmlSecTransformC14NGetNsList(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecTransformC14NSize)) ? \ + (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlSecPtrListPtr)NULL) + +#define xmlSecTransformC14NCheckId(transform) \ + (xmlSecTransformInclC14NCheckId((transform)) || \ + xmlSecTransformExclC14NCheckId((transform)) || \ + xmlSecTransformCheckId((transform), xmlSecTransformRemoveXmlTagsC14NId)) +#define xmlSecTransformInclC14NCheckId(transform) \ + (xmlSecTransformCheckId((transform), xmlSecTransformInclC14NId) || \ + xmlSecTransformCheckId((transform), xmlSecTransformInclC14NWithCommentsId)) +#define xmlSecTransformExclC14NCheckId(transform) \ + (xmlSecTransformCheckId((transform), xmlSecTransformExclC14NId) || \ + xmlSecTransformCheckId((transform), xmlSecTransformExclC14NWithCommentsId) ) + + +static int xmlSecTransformC14NInitialize (xmlSecTransformPtr transform); +static void xmlSecTransformC14NFinalize (xmlSecTransformPtr transform); +static int xmlSecTransformC14NNodeRead (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecTransformC14NPushXml (xmlSecTransformPtr transform, + xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecTransformC14NPopBin (xmlSecTransformPtr transform, + xmlSecByte* data, + xmlSecSize maxDataSize, + xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecTransformC14NExecute (xmlSecTransformId id, + xmlSecNodeSetPtr nodes, + xmlChar** nsList, + xmlOutputBufferPtr buf); +static int +xmlSecTransformC14NInitialize(xmlSecTransformPtr transform) { + xmlSecPtrListPtr nsList; + int ret; + + xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1); + + nsList = xmlSecTransformC14NGetNsList(transform); + xmlSecAssert2(nsList != NULL, -1); + + ret = xmlSecPtrListInitialize(nsList, xmlSecStringListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static void +xmlSecTransformC14NFinalize(xmlSecTransformPtr transform) { + xmlSecPtrListPtr nsList; + + xmlSecAssert(xmlSecTransformC14NCheckId(transform)); + + nsList = xmlSecTransformC14NGetNsList(transform); + xmlSecAssert(xmlSecPtrListCheckId(nsList, xmlSecStringListId)); + + xmlSecPtrListFinalize(nsList); +} + +static int +xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr nsList; + xmlNodePtr cur; + xmlChar *list; + xmlChar *p, *n, *tmp; + int ret; + + /* we have something to read only for exclusive c14n transforms */ + xmlSecAssert2(xmlSecTransformExclC14NCheckId(transform), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + nsList = xmlSecTransformC14NGetNsList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(nsList) == 0, -1); + + /* there is only one optional node */ + // Venus: Check type to avoid incorrect casting from xmlDocPtr -> xmlNodePtr + if (node->type == XML_DOCUMENT_NODE) + cur = NULL; + else + cur = xmlSecGetNextElementNode(node->children); + if(cur != NULL) { + if(!xmlSecCheckNodeName(cur, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + list = xmlGetProp(cur, xmlSecAttrPrefixList); + if(list == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecAttrPrefixList), + XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + + /* the list of namespaces is space separated */ + for(p = n = list; ((p != NULL) && ((*p) != '\0')); p = n) { + n = (xmlChar*)xmlStrchr(p, ' '); + if(n != NULL) { + *(n++) = '\0'; + } + + tmp = xmlStrdup(p); + if(tmp == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "len=%d", xmlStrlen(p)); + xmlFree(list); + return(-1); + } + + ret = xmlSecPtrListAdd(nsList, tmp); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(tmp); + xmlFree(list); + return(-1); + } + } + xmlFree(list); + + /* add NULL at the end */ + ret = xmlSecPtrListAdd(nsList, NULL); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecGetNextElementNode(cur->next); + } + + /* check that we have nothing else */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx) { + xmlOutputBufferPtr buf; + xmlSecPtrListPtr nsList; + int ret; + + xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1); + xmlSecAssert2(nodes != NULL, -1); + xmlSecAssert2(nodes->doc != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + /* check/update current transform status */ + switch(transform->status) { + case xmlSecTransformStatusNone: + transform->status = xmlSecTransformStatusWorking; + break; + case xmlSecTransformStatusWorking: + case xmlSecTransformStatusFinished: + return(0); + default: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1); + + /* prepare output buffer: next transform or ourselves */ + if(transform->next != NULL) { + buf = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + buf = xmlSecBufferCreateOutputBuffer(&(transform->outBuf)); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + nsList = xmlSecTransformC14NGetNsList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1); + + ret = xmlSecTransformC14NExecute(transform->id, nodes, (xmlChar**)(nsList->data), buf); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformC14NExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlOutputBufferClose(buf); + return(-1); + } + + ret = xmlOutputBufferClose(buf); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlOutputBufferClose", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + transform->status = xmlSecTransformStatusFinished; + return(0); +} + +static int +xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data, + xmlSecSize maxDataSize, xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr nsList; + xmlSecBufferPtr out; + int ret; + + xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(dataSize != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + out = &(transform->outBuf); + if(transform->status == xmlSecTransformStatusNone) { + xmlOutputBufferPtr buf; + + xmlSecAssert2(transform->inNodes == NULL, -1); + + if(transform->prev == NULL) { + (*dataSize) = 0; + transform->status = xmlSecTransformStatusFinished; + return(0); + } + + /* get xml data from previous transform */ + ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformPopXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* dump everything to internal buffer */ + buf = xmlSecBufferCreateOutputBuffer(out); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + nsList = xmlSecTransformC14NGetNsList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1); + + ret = xmlSecTransformC14NExecute(transform->id, transform->inNodes, (xmlChar**)(nsList->data), buf); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformC14NExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlOutputBufferClose(buf); + return(-1); + } + ret = xmlOutputBufferClose(buf); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlOutputBufferClose", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + transform->status = xmlSecTransformStatusWorking; + } + + if(transform->status == xmlSecTransformStatusWorking) { + xmlSecSize outSize; + + /* return chunk after chunk */ + outSize = xmlSecBufferGetSize(out); + if(outSize > maxDataSize) { + outSize = maxDataSize; + } + if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) { + outSize = XMLSEC_TRANSFORM_BINARY_CHUNK; + } + if(outSize > 0) { + xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1); + + memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize); + ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize); + return(-1); + } + } else if(xmlSecBufferGetSize(out) == 0) { + transform->status = xmlSecTransformStatusFinished; + } + (*dataSize) = outSize; + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no output */ + xmlSecAssert2(xmlSecBufferGetSize(out) == 0, -1); + (*dataSize) = 0; + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + + return(0); +} + +static int +xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar** nsList, + xmlOutputBufferPtr buf) { + int ret; + + xmlSecAssert2(id != xmlSecTransformIdUnknown, -1); + xmlSecAssert2(nodes != NULL, -1); + xmlSecAssert2(nodes->doc != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + /* execute c14n transform */ + if(id == xmlSecTransformInclC14NId) { + ret = xmlC14NExecute(nodes->doc, + (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, + nodes, 0, NULL, 0, buf); + } else if(id == xmlSecTransformInclC14NWithCommentsId) { + ret = xmlC14NExecute(nodes->doc, + (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, + nodes, 0, NULL, 1, buf); + } else if(id == xmlSecTransformExclC14NId) { + ret = xmlC14NExecute(nodes->doc, + (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, + nodes, 1, nsList, 0, buf); + } else if(id == xmlSecTransformExclC14NWithCommentsId) { + ret = xmlC14NExecute(nodes->doc, + (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, + nodes, 1, nsList, 1, buf); + } else if(id == xmlSecTransformRemoveXmlTagsC14NId) { + ret = xmlSecNodeSetDumpTextNodes(nodes, buf); + } else { + /* shoudn't be possible to come here, actually */ + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)), + "xmlC14NExecute", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static xmlSecTransformKlass xmlSecTransformInclC14NKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformC14NSize, /* xmlSecSize objSize */ + + xmlSecNameC14N, /* const xmlChar* name; */ + xmlSecHrefC14N, /* const xmlChar* href; */ + xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, + /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformInclC14NGetKlass: + * + * Inclusive (regular) canonicalization that omits comments transform klass + * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and + * http://www.w3.org/TR/2001/REC-xml-c14n-20010315). + * + * Returns c14n transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformInclC14NGetKlass(void) { + return(&xmlSecTransformInclC14NKlass); +} + +static xmlSecTransformKlass xmlSecTransformInclC14NWithCommentsKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformC14NSize, /* xmlSecSize objSize */ + + /* same as xmlSecTransformId */ + xmlSecNameC14NWithComments, /* const xmlChar* name; */ + xmlSecHrefC14NWithComments, /* const xmlChar* href; */ + xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, + /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod read; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformInclC14NWithCommentsGetKlass: + * + * Inclusive (regular) canonicalization that includes comments transform klass + * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and + * http://www.w3.org/TR/2001/REC-xml-c14n-20010315). + * + * Returns c14n with comments transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformInclC14NWithCommentsGetKlass(void) { + return(&xmlSecTransformInclC14NWithCommentsKlass); +} + +static xmlSecTransformKlass xmlSecTransformExclC14NKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformC14NSize, /* xmlSecSize objSize */ + + xmlSecNameExcC14N, /* const xmlChar* name; */ + xmlSecHrefExcC14N, /* const xmlChar* href; */ + xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, + /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformExclC14NGetKlass: + * + * Exclusive canoncicalization that ommits comments transform klass + * (http://www.w3.org/TR/xml-exc-c14n/). + * + * Returns exclusive c14n transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformExclC14NGetKlass(void) { + return(&xmlSecTransformExclC14NKlass); +} + +static xmlSecTransformKlass xmlSecTransformExclC14NWithCommentsKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformC14NSize, /* xmlSecSize objSize */ + + xmlSecNameExcC14NWithComments, /* const xmlChar* name; */ + xmlSecHrefExcC14NWithComments, /* const xmlChar* href; */ + xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, + /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformExclC14NWithCommentsGetKlass: + * + * Exclusive canoncicalization that includes comments transform klass + * (http://www.w3.org/TR/xml-exc-c14n/). + * + * Returns exclusive c14n with comments transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformExclC14NWithCommentsGetKlass(void) { + return(&xmlSecTransformExclC14NWithCommentsKlass); +} + +static xmlSecTransformKlass xmlSecTransformRemoveXmlTagsC14NKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformC14NSize, /* xmlSecSize objSize */ + + BAD_CAST "remove-xml-tags-transform", /* const xmlChar* name; */ + NULL, /* const xmlChar* href; */ + xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, + /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformRemoveXmlTagsC14NGetKlass: + * + * The "remove xml tags" transform klass (http://www.w3.org/TR/xmldsig-core/#sec-Base-64): + * Base64 transform requires an octet stream for input. If an XPath node-set + * (or sufficiently functional alternative) is given as input, then it is + * converted to an octet stream by performing operations logically equivalent + * to 1) applying an XPath transform with expression self::text(), then 2) + * taking the string-value of the node-set. Thus, if an XML element is + * identified by a barename XPointer in the Reference URI, and its content + * consists solely of base64 encoded character data, then this transform + * automatically strips away the start and end tags of the identified element + * and any of its descendant elements as well as any descendant comments and + * processing instructions. The output of this transform is an octet stream. + * + * Returns "remove xml tags" transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformRemoveXmlTagsC14NGetKlass(void) { + return(&xmlSecTransformRemoveXmlTagsC14NKlass); +} + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_dl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_dl.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,917 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_app.h" +#include "xmlsec_list.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_private.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_errors.h" +#include "xmlsec_dl.h" + + +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + +#include "xmlsec-ltdl.h" + +/*********************************************************************** + * + * loaded libraries list + * + **********************************************************************/ +typedef struct _xmlSecCryptoDLLibrary xmlSecCryptoDLLibrary, + *xmlSecCryptoDLLibraryPtr; +struct _xmlSecCryptoDLLibrary { + xmlChar* name; + xmlChar* filename; + xmlChar* getFunctionsName; + xmlSecCryptoDLFunctionsPtr functions; + + xmlsec_lt_dlhandle handle; +}; + +static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryCreate (const xmlChar* name); +static void xmlSecCryptoDLLibraryDestroy (xmlSecCryptoDLLibraryPtr lib); +static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryDuplicate (xmlSecCryptoDLLibraryPtr lib); +static xmlChar* xmlSecCryptoDLLibraryConstructFilename (const xmlChar* name); +static xmlChar* xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name); + + +static xmlSecPtrListKlass xmlSecCryptoDLLibrariesListKlass = { + BAD_CAST "dl-libraries-list", + (xmlSecPtrDuplicateItemMethod)xmlSecCryptoDLLibraryDuplicate,/* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecCryptoDLLibraryDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; +static xmlSecPtrListId xmlSecCryptoDLLibrariesListGetKlass (void); +static int xmlSecCryptoDLLibrariesListFindByName (xmlSecPtrListPtr list, + const xmlChar* name); + +typedef xmlSecCryptoDLFunctionsPtr (*xmlSecCryptoGetFunctionsCallback)(void); + +static xmlSecCryptoDLLibraryPtr +xmlSecCryptoDLLibraryCreate(const xmlChar* name) { + xmlSecCryptoDLLibraryPtr lib; + xmlSecCryptoGetFunctionsCallback getFunctions; + + xmlSecAssert2(name != NULL, NULL); + + /* fprintf (stderr, "loading \"library %s\"...\n", name); */ + + /* Allocate a new xmlSecCryptoDLLibrary and fill the fields. */ + lib = (xmlSecCryptoDLLibraryPtr)xmlMalloc(sizeof(xmlSecCryptoDLLibrary)); + if(lib == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", sizeof(lib)); + return(NULL); + } + memset(lib, 0, sizeof(xmlSecCryptoDLLibrary)); + + lib->name = xmlStrdup(name); + if(lib->name == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlStrdup", + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + lib->filename = xmlSecCryptoDLLibraryConstructFilename(name); + if(lib->filename == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlSecCryptoDLLibraryConstructFilename", + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + lib->getFunctionsName = xmlSecCryptoDLLibraryConstructGetFunctionsName(name); + if(lib->getFunctionsName == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlSecCryptoDLLibraryConstructGetFunctionsName", + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + + lib->handle = xmlsec_lt_dlopen((char*)lib->filename); + if(lib->handle == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlsec_lt_dlopen", + NULL, + XMLSEC_ERRORS_R_IO_FAILED, + "filename=%s", + xmlSecErrorsSafeString(lib->filename)); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + + getFunctions = (xmlSecCryptoGetFunctionsCallback)xmlsec_lt_dlsym(lib->handle, (char*)lib->getFunctionsName); + if(getFunctions == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlsec_lt_dlsym", + NULL, + XMLSEC_ERRORS_R_IO_FAILED, + "function=%s", + xmlSecErrorsSafeString(lib->getFunctionsName)); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + if(getFunctions == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "invalid configuration: no way to load library"); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + lib->functions = getFunctions(); + if(lib->functions == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + "getFunctions", + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + /* fprintf (stderr, "library %s loaded\n", name); */ + return(lib); +} + +static void +xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) { + xmlSecAssert(lib != NULL); + + /* fprintf (stderr, "unloading \"library %s\"...\n", lib->name); */ + if(lib->name != NULL) { + xmlFree(lib->name); + } + + if(lib->filename != NULL) { + xmlFree(lib->filename); + } + + if(lib->getFunctionsName != NULL) { + xmlFree(lib->getFunctionsName); + } + + if(lib->handle != NULL) { + int ret; + + ret = xmlsec_lt_dlclose(lib->handle); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + "xmlsec_lt_dlclose", + NULL, + XMLSEC_ERRORS_R_IO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + } + } + + memset(lib, 0, sizeof(xmlSecCryptoDLLibrary)); + xmlFree(lib); +} + +static xmlSecCryptoDLLibraryPtr +xmlSecCryptoDLLibraryDuplicate(xmlSecCryptoDLLibraryPtr lib) { + xmlSecAssert2(lib != NULL, NULL); + xmlSecAssert2(lib->name != NULL, NULL); + + return(xmlSecCryptoDLLibraryCreate(lib->name)); +} + +static xmlChar* +xmlSecCryptoDLLibraryConstructFilename(const xmlChar* name) { + static xmlChar tmpl[] = "lib%s-%s" LTDL_SHLIB_EXT; + xmlChar* res; + int len; + + xmlSecAssert2(name != NULL, NULL); + + len = xmlStrlen(BAD_CAST PACKAGE) + xmlStrlen(name) + xmlStrlen(tmpl) + 1; + res = (xmlChar*)xmlMalloc(len + 1); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", len + 1); + return(NULL); + } + xmlSecStrPrintf(res, len, tmpl, PACKAGE, name); + + return(res); +} + +static xmlChar* +xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name) { + static xmlChar tmpl[] = "xmlSecCryptoGetFunctions_%s"; + xmlChar* res; + int len; + + xmlSecAssert2(name != NULL, NULL); + + len = xmlStrlen(name) + xmlStrlen(tmpl) + 1; + res = (xmlChar*)xmlMalloc(len + 1); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", len + 1); + return(NULL); + } + xmlSecStrPrintf(res, len, tmpl, name); + + return(res); +} + +static xmlSecPtrListId +xmlSecCryptoDLLibrariesListGetKlass(void) { + return(&xmlSecCryptoDLLibrariesListKlass); +} + +static int +xmlSecCryptoDLLibrariesListFindByName(xmlSecPtrListPtr list, const xmlChar* name) { + xmlSecSize i, size; + xmlSecCryptoDLLibraryPtr lib; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecCryptoDLLibrariesListGetKlass()), -1); + xmlSecAssert2(name != NULL, -1); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(list, i); + if((lib != NULL) && (lib->name != NULL) && (xmlStrcmp(lib->name, name) == 0)) { + return(i); + } + } + return(-1); +} + +/****************************************************************************** + * + * Dynamic load functions + * + *****************************************************************************/ +static xmlSecCryptoDLFunctionsPtr gXmlSecCryptoDLFunctions = NULL; +static xmlSecPtrList gXmlSecCryptoDLLibraries; + +static xmlsec_lt_ptr xmlSecCryptoDLMalloc(size_t size) { + xmlsec_lt_ptr res; + + res = (xmlsec_lt_ptr)xmlMalloc(size); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", size); + return(NULL); + } + memset(res, 0, size); + return(res); +} + +static void xmlSecCryptoDLFree(xmlsec_lt_ptr ptr) { + if(ptr != NULL) { + xmlFree(ptr); + } +} + +/** + * xmlSecCryptoDLInit: + * + * Initializes dynamic loading engine. This is an internal function + * and should not be called by application directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +int +xmlSecCryptoDLInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(&gXmlSecCryptoDLLibraries, xmlSecCryptoDLLibrariesListGetKlass()); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecCryptoDLLibrariesListGetKlass"); + return(-1); + } + + /* use xmlMalloc/xmlFree */ + xmlsec_lt_dlmalloc = xmlSecCryptoDLMalloc; + xmlsec_lt_dlfree = xmlSecCryptoDLFree; + ret = xmlsec_lt_dlinit (); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlsec_lt_dlinit", + XMLSEC_ERRORS_R_IO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + + +/** + * xmlSecCryptoDLShutdown: + * + * Shutdowns dynamic loading engine. This is an internal function + * and should not be called by application directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +int +xmlSecCryptoDLShutdown(void) { + int ret; + + xmlSecPtrListFinalize(&gXmlSecCryptoDLLibraries); + + ret = xmlsec_lt_dlexit (); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlsec_lt_dlexit", + XMLSEC_ERRORS_R_IO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + } + return(0); +} + +/** + * xmlSecCryptoDLLoadLibrary: + * @crypto: the desired crypto library name ("openssl", "nss", ...). + * + * Loads the xmlsec- library. This function is NOT thread safe, + * application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions, + * and #xmlSecCryptoDLUnloadLibrary functions from multiple threads. + * + * Returns 0 on success or a negative value if an error occurs. + */ +int +xmlSecCryptoDLLoadLibrary(const xmlChar* crypto) { + xmlSecCryptoDLFunctionsPtr functions; + int ret; + + xmlSecAssert2(crypto != NULL, -1); + + functions = xmlSecCryptoDLGetLibraryFunctions(crypto); + if(functions == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLGetLibraryFunctions", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecCryptoDLSetFunctions(functions); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLSetFunctions", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecCryptoDLGetLibraryFunctions: + * @crypto: the desired crypto library name ("openssl", "nss", ...). + * + * Loads the xmlsec- library and gets global crypto functions/transforms/keys data/keys store + * table. This function is NOT thread safe, application MUST NOT call #xmlSecCryptoDLLoadLibrary, + * #xmlSecCryptoDLGetLibraryFunctions, and #xmlSecCryptoDLUnloadLibrary functions from multiple threads. + * + * Returns the table or NULL if an error occurs. + */ +xmlSecCryptoDLFunctionsPtr +xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) { + xmlSecCryptoDLLibraryPtr lib; + int pos; + int ret; + + xmlSecAssert2(crypto != NULL, NULL); + + pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto); + if(pos >= 0) { + lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos); + xmlSecAssert2(lib != NULL, NULL); + xmlSecAssert2(lib->functions != NULL, NULL); + + return(lib->functions); + } + + lib = xmlSecCryptoDLLibraryCreate(crypto); + if(lib == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLLibraryCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "crypto=%s", + xmlSecErrorsSafeString(crypto)); + return(NULL); + } + + ret = xmlSecPtrListAdd(&gXmlSecCryptoDLLibraries, lib); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "crypto=%s", + xmlSecErrorsSafeString(crypto)); + xmlSecCryptoDLLibraryDestroy(lib); + return(NULL); + } + + return(lib->functions); +} + +/** + * xmlSecCryptoDLUnloadLibrary: + * @crypto: the desired crypto library name ("openssl", "nss", ...). + * + * Unloads the xmlsec- library. All pointers to this library + * functions tables became invalid. This function is NOT thread safe, + * application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions, + * and #xmlSecCryptoDLUnloadLibrary functions from multiple threads. + * + * Returns 0 on success or a negative value if an error occurs. + */ +int +xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) { + xmlSecCryptoDLLibraryPtr lib; + int pos; + int ret; + + xmlSecAssert2(crypto != NULL, -1); + + pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto); + if(pos < 0) { + return(0); + } + + lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos); + if((lib != NULL) && (lib->functions == gXmlSecCryptoDLFunctions)) { + gXmlSecCryptoDLFunctions = NULL; + } + + ret = xmlSecPtrListRemove(&gXmlSecCryptoDLLibraries, pos); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListRemove", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecCryptoDLSetFunctions: + * @functions: the new table + * + * Sets global crypto functions/transforms/keys data/keys store table. + * + * Returns 0 on success or a negative value if an error occurs. + */ +int +xmlSecCryptoDLSetFunctions(xmlSecCryptoDLFunctionsPtr functions) { + xmlSecAssert2(functions != NULL, -1); + + gXmlSecCryptoDLFunctions = functions; + + return(0); +} + +/** + * xmlSecCryptoDLGetFunctions: + * + * Gets global crypto functions/transforms/keys data/keys store table. + * + * Returns the table. + */ +xmlSecCryptoDLFunctionsPtr +xmlSecCryptoDLGetFunctions(void) { + return(gXmlSecCryptoDLFunctions); +} + +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + +/** + * xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms: + * @functions: the functions table. + * + * Registers the key data and transforms klasses from @functions table in xmlsec. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFunctions* functions) { + xmlSecAssert2(functions != NULL, -1); + + /** + * Register keys + */ + if((functions->keyDataAesGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataAesGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataAesGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataDesGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataDesGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDesGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataDsaGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataDsaGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDsaGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataHmacGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataHmacGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataHmacGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataRsaGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataRsaGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRsaGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataX509GetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataX509GetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataX509GetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if((functions->keyDataRawX509CertGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataRawX509CertGetKlass()) < 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRawX509CertGetKlass())), + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + + /** + * Register transforms + */ + if((functions->transformAes128CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes128CbcGetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes128CbcGetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformAes192CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes192CbcGetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes192CbcGetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformAes256CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes256CbcGetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes256CbcGetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformKWAes128GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes128GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes128GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformKWAes192GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes192GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes192GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformKWAes256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes256GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes256GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformDes3CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDes3CbcGetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDes3CbcGetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformKWDes3GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWDes3GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWDes3GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformDsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDsaSha1GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDsaSha1GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacMd5GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacMd5GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacRipemd160GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacRipemd160GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha1GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha1GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha224GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha224GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha256GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha256GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha384GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha384GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformHmacSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha512GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha512GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformMd5GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformMd5GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRipemd160GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRipemd160GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaMd5GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaMd5GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaRipemd160GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaRipemd160GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha1GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha1GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha224GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha224GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha256GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha256GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha384GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha384GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha512GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha512GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaPkcs1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaPkcs1GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaPkcs1GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformRsaOaepGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaOaepGetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaOaepGetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha1GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha1GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha224GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha224GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha256GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha256GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha384GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha384GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((functions->transformSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha512GetKlass()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha512GetKlass())), + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_enveloped.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_enveloped.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,154 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Enveloped transform. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * Enveloped transform + * + *************************************************************************/ +static int xmlSecTransformEnvelopedExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + + +static xmlSecTransformKlass xmlSecTransformEnvelopedKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + sizeof(xmlSecTransform), /* xmlSecSize objSize */ + + xmlSecNameEnveloped, /* const xmlChar* name; */ + xmlSecHrefEnveloped, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + NULL, /* xmlSecTransformInitializeMethod initialize; */ + NULL, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformEnvelopedExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformEnvelopedGetKlass: + * + * The enveloped transform klass (http://www.w3.org/TR/xmldsig-core/#sec-EnvelopedSignature): + * + * An enveloped signature transform T removes the whole Signature element + * containing T from the digest calculation of the Reference element + * containing T. The entire string of characters used by an XML processor + * to match the Signature with the XML production element is removed. + * The output of the transform is equivalent to the output that would + * result from replacing T with an XPath transform containing the following + * XPath parameter element: + * + * + * count(ancestor-or-self::dsig:Signature | + * here()/ancestor::dsig:Signature[1]) > + * count(ancestor-or-self::dsig:Signature) + * + * The input and output requirements of this transform are identical to + * those of the XPath transform, but may only be applied to a node-set from + * its parent XML document. Note that it is not necessary to use an XPath + * expression evaluator to create this transform. However, this transform + * MUST produce output in exactly the same manner as the XPath transform + * parameterized by the XPath expression above. + * + * Returns enveloped transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformEnvelopedGetKlass(void) { + return(&xmlSecTransformEnvelopedKlass); +} + +static int +xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last, + xmlSecTransformCtxPtr transformCtx) { + xmlNodePtr node; + xmlSecNodeSetPtr children; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformEnvelopedId), -1); + xmlSecAssert2(transform->hereNode != NULL, -1); + xmlSecAssert2(transform->outNodes == NULL, -1); + xmlSecAssert2(last != 0, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + if((transform->inNodes != NULL) && (transform->inNodes->doc != transform->hereNode->doc)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* find signature node and get all its children in the nodes set */ + node = xmlSecFindParent(transform->hereNode, xmlSecNodeSignature, xmlSecDSigNs); + if(node == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeSignature), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + children = xmlSecNodeSetGetChildren(node->doc, node, 1, 1); + if(children == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecNodeSetGetChildren", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + + /* intersect node children with input nodes (if exist) */ + transform->outNodes = xmlSecNodeSetAdd(transform->inNodes, children, xmlSecNodeSetIntersection); + if(transform->outNodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecNodeSetAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecNodeSetDestroy(children); + return(-1); + } + + return(0); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_error_flag.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_error_flag.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Functions handling error situations. +* +*/ + +#include + +#include "xmlsec_globals.h" +#include "xmlsec_error_flag.h" + +static int XmlSecErrorFlag = 0; + +// --------------------------------------------------------------------------- +// Set out of memory flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +void xmlSecSetErrorFlag(int error) + { + XmlSecErrorFlag = error; + } + +// --------------------------------------------------------------------------- +// Reset out of memory flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +void xmlSecResetErrorFlag() + { + XmlSecErrorFlag = 0; + } + +// --------------------------------------------------------------------------- +// Check out of memory flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +int xmlSecCheckErrorFlag() + { + return XmlSecErrorFlag; + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_errors.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_errors.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,255 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Error codes and error reporting functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_private.h" +#include "xmlsec_errors.h" + + +//added for symbian port +#include "libxml2_globals.h" + +#define XMLSEC_ERRORS_BUFFER_SIZE 1024 + +typedef struct _xmlSecErrorDescription xmlSecErrorDescription, *xmlSecErrorDescriptionPtr; +struct _xmlSecErrorDescription { + int errorCode; + const char* errorMsg; +}; + +static xmlSecErrorDescription xmlSecErrorsTable[XMLSEC_ERRORS_MAX_NUMBER + 1] = { + { XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlsec library function failed" }, + { XMLSEC_ERRORS_R_MALLOC_FAILED, "malloc function failed" }, + { XMLSEC_ERRORS_R_STRDUP_FAILED, "strdup function failed" }, + { XMLSEC_ERRORS_R_CRYPTO_FAILED, "crypto library function failed" }, + { XMLSEC_ERRORS_R_XML_FAILED, "libxml2 library function failed" }, + { XMLSEC_ERRORS_R_XSLT_FAILED, "libxslt library function failed" }, + { XMLSEC_ERRORS_R_IO_FAILED, "io function failed" }, + { XMLSEC_ERRORS_R_DISABLED, "feature is disabled" }, + { XMLSEC_ERRORS_R_NOT_IMPLEMENTED, "feature is not implemented" }, + { XMLSEC_ERRORS_R_INVALID_SIZE, "invalid size" }, + { XMLSEC_ERRORS_R_INVALID_DATA, "invalid data" }, + { XMLSEC_ERRORS_R_INVALID_RESULT, "invalid result" }, + { XMLSEC_ERRORS_R_INVALID_TYPE, "invalid type" }, + { XMLSEC_ERRORS_R_INVALID_OPERATION, "invalid operation" }, + { XMLSEC_ERRORS_R_INVALID_STATUS, "invalid status" }, + { XMLSEC_ERRORS_R_INVALID_FORMAT, "invalid format" }, + { XMLSEC_ERRORS_R_DATA_NOT_MATCH, "data do not match" }, + { XMLSEC_ERRORS_R_INVALID_NODE, "invalid node" }, + { XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, "invalid node content" }, + { XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, "invalid node attribute" }, + { XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE, "missing node attribute" }, + { XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, "node already present" }, + { XMLSEC_ERRORS_R_UNEXPECTED_NODE, "unexpected node" }, + { XMLSEC_ERRORS_R_NODE_NOT_FOUND, "node node found" }, + { XMLSEC_ERRORS_R_INVALID_TRANSFORM, "invalid transform" }, + { XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY, "invalid transform key" }, + { XMLSEC_ERRORS_R_INVALID_URI_TYPE, "invalid URI type" }, + { XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED, "same document is required for transform" }, + { XMLSEC_ERRORS_R_TRANSFORM_DISABLED, "transform is disabled" }, + { XMLSEC_ERRORS_R_INVALID_KEY_DATA, "invalid key data" }, + { XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND, "key data is not found" }, + { XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, "key data already exist" }, + { XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, "invalid key data size" }, + { XMLSEC_ERRORS_R_KEY_NOT_FOUND, "key is not found" }, + { XMLSEC_ERRORS_R_KEYDATA_DISABLED, "key data is disabled" }, + { XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL, "maximum key retrieval level" }, + { XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,"key retrieval type mismatch" }, + { XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL, "maximum encrypted key level" }, + { XMLSEC_ERRORS_R_CERT_VERIFY_FAILED, "certificate verification failed" }, + { XMLSEC_ERRORS_R_CERT_NOT_FOUND, "certificate is not found" }, + { XMLSEC_ERRORS_R_CERT_REVOKED, "certificate is revoked" }, + { XMLSEC_ERRORS_R_CERT_ISSUER_FAILED, "certificate issuer check failed" }, + { XMLSEC_ERRORS_R_CERT_NOT_YET_VALID, "certificate is not yet valid" }, + { XMLSEC_ERRORS_R_CERT_HAS_EXPIRED, "certificate has expirred" }, + { XMLSEC_ERRORS_R_DSIG_NO_REFERENCES, "Reference nodes are not found" }, + { XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE, "Reference verification failed" }, + { XMLSEC_ERRORS_R_ASSERTION, "assertion" }, + { 0, NULL} +}; + +static xmlSecErrorsCallback xmlSecErrorsClbk = xmlSecErrorsDefaultCallback; +static int xmlSecPrintErrorMessages = 1; /* whether the error messages will be printed immidiatelly */ + +/** + * xmlSecErrorsInit: + * + * Initializes the errors reporting. It is called from #xmlSecInit function. + * and applications must not call this function directly. + */ +EXPORT_C +void +xmlSecErrorsInit(void) { +} + +/** + * xmlSecErrorsShutdown: + * + * Cleanups the errors reporting. It is called from #xmlSecShutdown function. + * and applications must not call this function directly. + */ +EXPORT_C +void +xmlSecErrorsShutdown(void) { +} + +/** + * xmlSecErrorsSetCallback: + * @callback: the new errors callback function. + * + * Sets the errors callback function to @callback that will be called + * every time an error occurs. + */ +EXPORT_C +void +xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) { + xmlSecErrorsClbk = callback; +} + +/** + * xmlSecErrorsDefaultCallback: + * @file: the error location file name (__FILE__ macro). + * @line: the error location line number (__LINE__ macro). + * @func: the error location function name (__FUNCTION__ macro). + * @errorObject: the error specific error object + * @errorSubject: the error specific error subject. + * @reason: the error code. + * @msg: the additional error message. + * + * The default error reporting callback that utilizes LibXML + * error reporting #xmlGenericError function. + */ +EXPORT_C +void +xmlSecErrorsDefaultCallback(const char* file, int line, const char* func, + const char* errorObject, const char* errorSubject, + int reason, const char* msg) { + if(xmlSecPrintErrorMessages) { + const char* error_msg = NULL; + xmlSecSize i; + + for(i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) { + if(xmlSecErrorsGetCode(i) == reason) { + error_msg = xmlSecErrorsGetMsg(i); + break; + } + } + xmlGenericError(xmlGenericErrorContext, + "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n", + (func != NULL) ? func : "unknown", + (file != NULL) ? file : "unknown", + line, + (errorObject != NULL) ? errorObject : "unknown", + (errorSubject != NULL) ? errorSubject : "unknown", + reason, + (error_msg != NULL) ? error_msg : "", + (msg != NULL) ? msg : ""); + } +} + +/** + * xmlSecErrorsDefaultCallbackEnableOutput: + * @enabled: the flag. + * + * Enables or disables calling LibXML2 callback from the default + * errors callback. + */ +EXPORT_C +void +xmlSecErrorsDefaultCallbackEnableOutput(int enabled) { + xmlSecPrintErrorMessages = enabled; +} + +/** + * xmlSecErrorsGetCode: + * @pos: the error position. + * + * Gets the known error code at position @pos. + * + * Returns the known error code or 0 if @pos is greater than + * total number of known error codes. + */ +EXPORT_C +int +xmlSecErrorsGetCode(xmlSecSize pos) { + /* could not use asserts here! */ + if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) { + return(xmlSecErrorsTable[pos].errorCode); + } + return(0); +} + +/** + * xmlSecErrorsGetMsg: + * @pos: the error position. + * + * Gets the known error message at position @pos. + * + * Returns the known error message or NULL if @pos is greater than + * total number of known error codes. + */ +EXPORT_C +const char* +xmlSecErrorsGetMsg(xmlSecSize pos) { + /* could not use asserts here! */ + if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) { + return(xmlSecErrorsTable[pos].errorMsg); + } + return(NULL); +} + +/** + * xmlSecError: + * @file: the error location filename (__FILE__). + * @line: the error location line number (__LINE__). + * @func: the error location function (__FUNCTIION__). + * @errorObject: the error specific error object + * @errorSubject: the error specific error subject. + * @reason: the error code. + * @msg: the error message in printf format. + * @...: the parameters for the @msg. + * + * Reports an error to the default (#xmlSecErrorsDefaultCallback) or + * application specific callback installed using #xmlSecErrorsSetCallback + * function. + */ +EXPORT_C +void +xmlSecError(const char* file, int line, const char* func, + const char* errorObject, const char* errorSubject, + int reason, const char* msg, ...) { + + if(xmlSecErrorsClbk != NULL) { + xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE]; + + if(msg != NULL) { + va_list va; + + va_start(va, msg); + xmlSecStrVPrintf(error_msg, sizeof(error_msg), BAD_CAST msg, va); + error_msg[sizeof(error_msg) - 1] = '\0'; + va_end(va); + } else { + error_msg[0] = '\0'; + } + xmlSecErrorsClbk(file, line, func, errorObject, errorSubject, reason, (char*)error_msg); + } +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_io.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_io.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,506 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Input uri transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + */ +#include "xmlsec_globals.h" + +#include +#include +#include + +#include //added for symbian + +#include +#include +#include +#include + +#ifdef LIBXML_HTTP_ENABLED +#include +#endif /* LIBXML_HTTP_ENABLED */ + +#ifdef LIBXML_FTP_ENABLED +#include +#endif /* LIBXML_FTP_ENABLED */ + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keys.h" +#include "xmlsec_io.h" +#include "xmlsec_errors.h" + +/******************************************************************* + * + * Input I/O callback sets + * + ******************************************************************/ +typedef struct _xmlSecIOCallback { + xmlInputMatchCallback matchcallback; + xmlInputOpenCallback opencallback; + xmlInputReadCallback readcallback; + xmlInputCloseCallback closecallback; +} xmlSecIOCallback, *xmlSecIOCallbackPtr; + +static xmlSecIOCallbackPtr xmlSecIOCallbackCreate (xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); +static void xmlSecIOCallbackDestroy (xmlSecIOCallbackPtr callbacks); + +static xmlSecIOCallbackPtr +xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, xmlInputCloseCallback closeFunc) { + xmlSecIOCallbackPtr callbacks; + + xmlSecAssert2(matchFunc != NULL, NULL); + + /* Allocate a new xmlSecIOCallback and fill the fields. */ + callbacks = (xmlSecIOCallbackPtr)xmlMalloc(sizeof(xmlSecIOCallback)); + if(callbacks == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecIOCallback)=%d", + sizeof(xmlSecIOCallback)); + return(NULL); + } + memset(callbacks, 0, sizeof(xmlSecIOCallback)); + + callbacks->matchcallback = matchFunc; + callbacks->opencallback = openFunc; + callbacks->readcallback = readFunc; + callbacks->closecallback = closeFunc; + + return(callbacks); +} + +static void +xmlSecIOCallbackDestroy(xmlSecIOCallbackPtr callbacks) { + xmlSecAssert(callbacks != NULL); + + memset(callbacks, 0, sizeof(xmlSecIOCallback)); + xmlFree(callbacks); +} + +/******************************************************************* + * + * Input I/O callback list + * + ******************************************************************/ +static xmlSecPtrListKlass xmlSecIOCallbackPtrListKlass = { + BAD_CAST "io-callbacks-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecIOCallbackDestroy,/* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +#define xmlSecIOCallbackPtrListId xmlSecIOCallbackPtrListGetKlass () +static xmlSecPtrListId xmlSecIOCallbackPtrListGetKlass (void); +static xmlSecIOCallbackPtr xmlSecIOCallbackPtrListFind (xmlSecPtrListPtr list, + const char* uri); + +/** + * xmlSecIOCallbackPtrListGetKlass: + * + * The keys list klass. + * + * Returns keys list id. + */ +static xmlSecPtrListId +xmlSecIOCallbackPtrListGetKlass(void) { + return(&xmlSecIOCallbackPtrListKlass); +} + +static xmlSecIOCallbackPtr +xmlSecIOCallbackPtrListFind(xmlSecPtrListPtr list, const char* uri) { + xmlSecIOCallbackPtr callbacks; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecIOCallbackPtrListId), NULL); + xmlSecAssert2(uri != NULL, NULL); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + callbacks = (xmlSecIOCallbackPtr)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(callbacks != NULL, NULL); + xmlSecAssert2(callbacks->matchcallback != NULL, NULL); + + if((callbacks->matchcallback(uri)) != 0) { + return(callbacks); + } + } + return(NULL); +} + +static xmlSecPtrList xmlSecAllIOCallbacks; + +/** + * xmlSecIOInit: + * + * The IO initialization (called from #xmlSecInit function). + * Applications should not call this function directly. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecIOInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(&xmlSecAllIOCallbacks, xmlSecIOCallbackPtrListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#ifdef LIBXML_HTTP_ENABLED + xmlNanoHTTPInit(); +#endif /* LIBXML_HTTP_ENABLED */ + +#ifdef LIBXML_FTP_ENABLED + xmlNanoFTPInit(); +#endif /* LIBXML_FTP_ENABLED */ + + return(xmlSecIORegisterDefaultCallbacks()); +} + +/** + * xmlSecIOShutdown: + * + * The IO clenaup (called from #xmlSecShutdown function). + * Applications should not call this function directly. + */ +EXPORT_C +void +xmlSecIOShutdown(void) { + +#ifdef LIBXML_HTTP_ENABLED + xmlNanoHTTPCleanup(); +#endif /* LIBXML_HTTP_ENABLED */ + +#ifdef LIBXML_FTP_ENABLED + xmlNanoFTPCleanup(); +#endif /* LIBXML_FTP_ENABLED */ + + xmlSecPtrListFinalize(&xmlSecAllIOCallbacks); +} + +/** + * xmlSecIOCleanupCallbacks: + * + * Clears the entire input callback table. this includes the + * compiled-in I/O. + */ +EXPORT_C +void +xmlSecIOCleanupCallbacks(void) { + xmlSecPtrListEmpty(&xmlSecAllIOCallbacks); +} + +/** + * xmlSecIORegisterCallbacks: + * @matchFunc: the protocol match callback. + * @openFunc: the open stream callback. + * @readFunc: the read from stream callback. + * @closeFunc: the close stream callback. + * + * Register a new set of I/O callback for handling parser input. + * + * Returns the 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc) { + xmlSecIOCallbackPtr callbacks; + int ret; + + xmlSecAssert2(matchFunc != NULL, -1); + + callbacks = xmlSecIOCallbackCreate(matchFunc, openFunc, readFunc, closeFunc); + if(callbacks == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecIOCallbackCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecPtrListAdd(&xmlSecAllIOCallbacks, callbacks); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecIOCallbackDestroy(callbacks); + return(-1); + } + return(0); +} + + +/** + * xmlSecIORegisterDefaultCallbacks: + * + * Registers the default compiled-in I/O handlers. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecIORegisterDefaultCallbacks(void) { + int ret; + +#ifdef LIBXML_HTTP_ENABLED + ret = xmlSecIORegisterCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen, + xmlIOHTTPRead, xmlIOHTTPClose); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecIORegisterCallbacks", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "http"); + return(-1); + } +#endif /* LIBXML_HTTP_ENABLED */ + +#ifdef LIBXML_FTP_ENABLED + ret = xmlSecIORegisterCallbacks(xmlIOFTPMatch, xmlIOFTPOpen, + xmlIOFTPRead, xmlIOFTPClose); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecIORegisterCallbacks", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ftp"); + return(-1); + } +#endif /* LIBXML_FTP_ENABLED */ + + ret = xmlSecIORegisterCallbacks(xmlFileMatch, xmlFileOpen, + xmlFileRead, xmlFileClose); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecIORegisterCallbacks", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "file"); + return(-1); + } + + return(0); +} + + + + +/************************************************************** + * + * Input URI Transform + * + * xmlSecInputURICtx is located after xmlSecTransform + * + **************************************************************/ +typedef struct _xmlSecInputURICtx xmlSecInputURICtx, + *xmlSecInputURICtxPtr; +struct _xmlSecInputURICtx { + xmlSecIOCallbackPtr clbks; + void* clbksCtx; +}; +#define xmlSecTransformInputUriSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecInputURICtx)) +#define xmlSecTransformInputUriGetCtx(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecTransformInputUriSize)) ? \ + (xmlSecInputURICtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlSecInputURICtxPtr)NULL) + +static int xmlSecTransformInputURIInitialize (xmlSecTransformPtr transform); +static void xmlSecTransformInputURIFinalize (xmlSecTransformPtr transform); +static int xmlSecTransformInputURIPopBin (xmlSecTransformPtr transform, + xmlSecByte* data, + xmlSecSize maxDataSize, + xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx); + +static xmlSecTransformKlass xmlSecTransformInputURIKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformInputUriSize, /* xmlSecSize objSize */ + + BAD_CAST "input-uri", /* const xmlChar* name; */ + NULL, /* const xmlChar* href; */ + 0, /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformInputURIInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformInputURIFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformInputURIPopBin, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformInputURIGetKlass: + * + * The input uri transform klass. Reads binary data from an uri. + * + * Returns input URI transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformInputURIGetKlass(void) { + return(&xmlSecTransformInputURIKlass); +} + +/** + * xmlSecTransformInputURIOpen: + * @transform: the pointer to IO transform. + * @uri: the URL to open. + * + * Opens the given @uri for reading. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) { + xmlSecInputURICtxPtr ctx; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1); + xmlSecAssert2(uri != NULL, -1); + + ctx = xmlSecTransformInputUriGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->clbks == NULL, -1); + xmlSecAssert2(ctx->clbksCtx == NULL, -1); + + /* + * Try to find one of the input accept method accepting that scheme + * Go in reverse to give precedence to user defined handlers. + * try with an unescaped version of the uri + */ + if(ctx->clbks == NULL) { + char *unescaped; + + unescaped = xmlURIUnescapeString((char*)uri, 0, NULL); + if (unescaped != NULL) { + ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, unescaped); + if(ctx->clbks != NULL) { + ctx->clbksCtx = ctx->clbks->opencallback(unescaped); + } + xmlFree(unescaped); + } + } + + /* + * If this failed try with a non-escaped uri this may be a strange + * filename + */ + if (ctx->clbks == NULL) { + ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, (char*)uri); + if(ctx->clbks != NULL) { + ctx->clbksCtx = ctx->clbks->opencallback((char*)uri); + } + } + + if((ctx->clbks == NULL) || (ctx->clbksCtx == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "opencallback", + XMLSEC_ERRORS_R_IO_FAILED, + "uri=%s;errno=%d", + xmlSecErrorsSafeString(uri), + errno); + return(-1); + } + + return(0); +} + +static int +xmlSecTransformInputURIInitialize(xmlSecTransformPtr transform) { + xmlSecInputURICtxPtr ctx; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1); + + ctx = xmlSecTransformInputUriGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + memset(ctx, 0, sizeof(xmlSecInputURICtx)); + return(0); +} + +static void +xmlSecTransformInputURIFinalize(xmlSecTransformPtr transform) { + xmlSecInputURICtxPtr ctx; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId)); + + ctx = xmlSecTransformInputUriGetCtx(transform); + xmlSecAssert(ctx != NULL); + + if((ctx->clbksCtx != NULL) && (ctx->clbks != NULL) && (ctx->clbks->closecallback != NULL)) { + (ctx->clbks->closecallback)(ctx->clbksCtx); + } + memset(ctx, 0, sizeof(xmlSecInputURICtx)); +} + +static int +xmlSecTransformInputURIPopBin(xmlSecTransformPtr transform, xmlSecByte* data, + xmlSecSize maxDataSize, xmlSecSize* dataSize, + xmlSecTransformCtxPtr transformCtx) { + xmlSecInputURICtxPtr ctx; + + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(dataSize != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecTransformInputUriGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + if((ctx->clbksCtx != NULL) && (ctx->clbks != NULL) && (ctx->clbks->readcallback != NULL)) { + ret = (ctx->clbks->readcallback)(ctx->clbksCtx, (char*)data, (int)maxDataSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "readcallback", + XMLSEC_ERRORS_R_IO_FAILED, + "errno=%d", errno); + return(-1); + } + (*dataSize) = ret; + } else { + (*dataSize) = 0; + } + return(0); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_keyinfo.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_keyinfo.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1583 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * element processing + * (http://www.w3.org/TR/xmlSec-core/#sec-KeyInfo: + * + * The KeyInfo Element + * + * KeyInfo is an optional element that enables the recipient(s) to obtain + * the key needed to validate the signature. KeyInfo may contain keys, + * names, certificates and other public key management information, such as + * in-band key distribution or key agreement data. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_base64.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_xmlenc.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_errors.h" + + +/************************************************************************** + * + * Hi level functions + * + *************************************************************************/ +/** + * xmlSecKeyInfoNodeRead: + * @keyInfoNode: the pointer to node. + * @key: the pointer to result key object. + * @keyInfoCtx: the pointer to element processing context. + * + * Parses the element @keyInfoNode, extracts the key data + * and stores into @key. + * + * Returns 0 on success or -1 if an error occurs. + */ +EXPORT_C +int +xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* nodeName; + const xmlChar* nodeNs; + xmlSecKeyDataId dataId; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(keyInfoNode != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + for(cur = xmlSecGetNextElementNode(keyInfoNode->children); + (cur != NULL) && + (((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND) != 0) || + (xmlSecKeyIsValid(key) == 0) || + (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) == 0)); + cur = xmlSecGetNextElementNode(cur->next)) { + + /* find data id */ + nodeName = cur->name; + nodeNs = xmlSecGetNodeNsHref(cur); + + /* use global list only if we don't have a local one */ + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData), + nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead); + } else { + dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(), + nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead); + } + if(dataId != xmlSecKeyDataIdUnknown) { + /* read data node */ + ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyDataXmlRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) { + /* there is a laxi schema validation but application may + * desire to disable unknown nodes*/ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +/** + * xmlSecKeyInfoNodeWrite: + * @keyInfoNode: the pointer to node. + * @key: the pointer to key object. + * @keyInfoCtx: the pointer to element processing context. + * + * Writes the @key into the element template @keyInfoNode. + * + * Returns 0 on success or -1 if an error occurs. + */ +EXPORT_C +int +xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* nodeName; + const xmlChar* nodeNs; + xmlSecKeyDataId dataId; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(keyInfoNode != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1); + + for(cur = xmlSecGetNextElementNode(keyInfoNode->children); + cur != NULL; + cur = xmlSecGetNextElementNode(cur->next)) { + + /* find data id */ + nodeName = cur->name; + nodeNs = xmlSecGetNodeNsHref(cur); + + /* use global list only if we don't have a local one */ + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData), + nodeName, nodeNs, + xmlSecKeyDataUsageKeyInfoNodeWrite); + } else { + dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(), + nodeName, nodeNs, + xmlSecKeyDataUsageKeyInfoNodeWrite); + } + if(dataId != xmlSecKeyDataIdUnknown) { + ret = xmlSecKeyDataXmlWrite(dataId, key, cur, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyDataXmlWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) { + /* laxi schema validation but application can disable it*/ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +/************************************************************************** + * + * KeyInfo context + * + *************************************************************************/ +/** + * xmlSecKeyInfoCtxCreate: + * @keysMngr: the pointer to keys manager (may be NULL). + * + * Allocates and initializes element processing context. + * Caller is responsible for freeing it by calling #xmlSecKeyInfoCtxDestroy + * function. + * + * Returns pointer to newly allocated object or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyInfoCtxPtr +xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) { + xmlSecKeyInfoCtxPtr keyInfoCtx; + int ret; + + /* Allocate a new xmlSecKeyInfoCtx and fill the fields. */ + keyInfoCtx = (xmlSecKeyInfoCtxPtr)xmlMalloc(sizeof(xmlSecKeyInfoCtx)); + if(keyInfoCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", sizeof(xmlSecKeyInfoCtx)); + return(NULL); + } + + ret = xmlSecKeyInfoCtxInitialize(keyInfoCtx, keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxDestroy(keyInfoCtx); + return(NULL); + } + + return(keyInfoCtx); +} + +/** + * xmlSecKeyInfoCtxDestroy: + * @keyInfoCtx: the pointer to element processing context. + * + * Destroys @keyInfoCtx object created with #xmlSecKeyInfoCtxCreate function. + */ +EXPORT_C +void +xmlSecKeyInfoCtxDestroy(xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert(keyInfoCtx != NULL); + + xmlSecKeyInfoCtxFinalize(keyInfoCtx); + xmlFree(keyInfoCtx); +} + +/** + * xmlSecKeyInfoCtxInitialize: + * @keyInfoCtx: the pointer to element processing context. + * @keysMngr: the pointer to keys manager (may be NULL). + * + * Initializes element processing context. Caller is + * responsible for cleaning it up by #xmlSecKeyInfoCtxFinalize function. + * + * Returns 0 on success and a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr keysMngr) { + int ret; + + xmlSecAssert2(keyInfoCtx != NULL, -1); + + memset(keyInfoCtx, 0, sizeof(xmlSecKeyInfoCtx)); + keyInfoCtx->keysMngr = keysMngr; + keyInfoCtx->base64LineSize = XMLSEC_BASE64_LINESIZE; + ret = xmlSecPtrListInitialize(&(keyInfoCtx->enabledKeyData), xmlSecKeyDataIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + keyInfoCtx->maxRetrievalMethodLevel = 1; + ret = xmlSecTransformCtxInitialize(&(keyInfoCtx->retrievalMethodCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#ifndef XMLSEC_NO_XMLENC + keyInfoCtx->maxEncryptedKeyLevel = 1; +#endif /* XMLSEC_NO_XMLENC */ + +#ifndef XMLSEC_NO_X509 + keyInfoCtx->certsVerificationDepth= 9; +#endif /* XMLSEC_NO_X509 */ + + ret = xmlSecKeyReqInitialize(&(keyInfoCtx->keyReq)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyReqInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyInfoCtxFinalize: + * @keyInfoCtx: the pointer to element processing context. + * + * Cleans up the @keyInfoCtx initialized with #xmlSecKeyInfoCtxInitialize + * function. + */ +EXPORT_C +void +xmlSecKeyInfoCtxFinalize(xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert(keyInfoCtx != NULL); + + xmlSecPtrListFinalize(&(keyInfoCtx->enabledKeyData)); + xmlSecTransformCtxFinalize(&(keyInfoCtx->retrievalMethodCtx)); + xmlSecKeyReqFinalize(&(keyInfoCtx->keyReq)); + +#ifndef XMLSEC_NO_XMLENC + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxDestroy(keyInfoCtx->encCtx); + } +#endif /* XMLSEC_NO_XMLENC */ + + memset(keyInfoCtx, 0, sizeof(xmlSecKeyInfoCtx)); +} + +/** + * xmlSecKeyInfoCtxReset: + * @keyInfoCtx: the pointer to element processing context. + * + * Resets the @keyInfoCtx state. User settings are not changed. + */ +EXPORT_C +void +xmlSecKeyInfoCtxReset(xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert(keyInfoCtx != NULL); + + xmlSecTransformCtxReset(&(keyInfoCtx->retrievalMethodCtx)); + keyInfoCtx->curRetrievalMethodLevel = 0; + +#ifndef XMLSEC_NO_XMLENC + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxReset(keyInfoCtx->encCtx); + } + keyInfoCtx->curEncryptedKeyLevel = 0; +#endif /* XMLSEC_NO_XMLENC */ + + xmlSecKeyReqReset(&(keyInfoCtx->keyReq)); +} + +/** + * xmlSecKeyInfoCtxCreateEncCtx: + * @keyInfoCtx: the pointer to element processing context. + * + * Creates encryption context form processing child + * of element. + * + * Returns 0 on success and a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) { +#ifndef XMLSEC_NO_XMLENC + xmlSecEncCtxPtr tmp; + int ret; + + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->encCtx == NULL, -1); + + /* we have to use tmp variable to avoid a recursive loop */ + tmp = xmlSecEncCtxCreate(keyInfoCtx->keysMngr); + if(tmp == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + tmp->mode = xmlEncCtxModeEncryptedKey; + + /* copy user preferences from our current ctx */ + switch(keyInfoCtx->mode) { + case xmlSecKeyInfoModeRead: + ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoReadCtx), keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecEncCtxDestroy(tmp); + return(-1); + } + break; + case xmlSecKeyInfoModeWrite: + ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoWriteCtx), keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecEncCtxDestroy(tmp); + return(-1); + } + break; + } + keyInfoCtx->encCtx = tmp; + + return(0); +#else /* XMLSEC_NO_XMLENC */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xml encryption", + XMLSEC_ERRORS_R_DISABLED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); +#endif /* XMLSEC_NO_XMLENC */ +} + +/** + * xmlSecKeyInfoCtxCopyUserPref: + * @dst: the pointer to destination context object. + * @src: the pointer to source context object. + * + * Copies user preferences from @src context to @dst context. + * + * Returns 0 on success and a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) { + int ret; + + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + dst->userData = src->userData; + dst->flags = src->flags; + dst->flags2 = src->flags2; + dst->keysMngr = src->keysMngr; + dst->mode = src->mode; + dst->base64LineSize = src->base64LineSize; + + ret = xmlSecPtrListCopy(&(dst->enabledKeyData), &(src->enabledKeyData)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "enabledKeyData"); + return(-1); + } + + /* */ + dst->maxRetrievalMethodLevel= src->maxRetrievalMethodLevel; + ret = xmlSecTransformCtxCopyUserPref(&(dst->retrievalMethodCtx), + &(src->retrievalMethodCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "enabledKeyData"); + return(-1); + } + + /* */ +#ifndef XMLSEC_NO_XMLENC + xmlSecAssert2(dst->encCtx == NULL, -1); + if(src->encCtx != NULL) { + dst->encCtx = xmlSecEncCtxCreate(dst->keysMngr); + if(dst->encCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + dst->encCtx->mode = xmlEncCtxModeEncryptedKey; + ret = xmlSecEncCtxCopyUserPref(dst->encCtx, src->encCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + dst->maxEncryptedKeyLevel = src->maxEncryptedKeyLevel; +#endif /* XMLSEC_NO_XMLENC */ + + /* */ +#ifndef XMLSEC_NO_X509 + dst->certsVerificationTime = src->certsVerificationTime; + dst->certsVerificationDepth = src->certsVerificationDepth; +#endif /* XMLSEC_NO_X509 */ + + return(0); +} + +/** + * xmlSecKeyInfoCtxDebugDump: + * @keyInfoCtx: the pointer to element processing context. + * @output: the output file pointer. + * + * Prints user settings and current context state to @output. + */ +EXPORT_C +void +xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) { + xmlSecAssert(keyInfoCtx != NULL); + xmlSecAssert(output != NULL); + + switch(keyInfoCtx->mode) { + case xmlSecKeyInfoModeRead: + fprintf(output, "= KEY INFO READ CONTEXT\n"); + break; + case xmlSecKeyInfoModeWrite: + fprintf(output, "= KEY INFO WRITE CONTEXT\n"); + break; + } + + fprintf(output, "== flags: 0x%08x\n", keyInfoCtx->flags); + fprintf(output, "== flags2: 0x%08x\n", keyInfoCtx->flags2); + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + fprintf(output, "== enabled key data: "); + xmlSecKeyDataIdListDebugDump(&(keyInfoCtx->enabledKeyData), output); + } else { + fprintf(output, "== enabled key data: all\n"); + } + fprintf(output, "== RetrievalMethod level (cur/max): %d/%d\n", + keyInfoCtx->curRetrievalMethodLevel, + keyInfoCtx->maxRetrievalMethodLevel); + xmlSecTransformCtxDebugDump(&(keyInfoCtx->retrievalMethodCtx), output); + +#ifndef XMLSEC_NO_XMLENC + fprintf(output, "== EncryptedKey level (cur/max): %d/%d\n", + keyInfoCtx->curEncryptedKeyLevel, + keyInfoCtx->maxEncryptedKeyLevel); + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxDebugDump(keyInfoCtx->encCtx, output); + } +#endif /* XMLSEC_NO_XMLENC */ + + xmlSecKeyReqDebugDump(&(keyInfoCtx->keyReq), output); +} + +/** + * xmlSecKeyInfoCtxDebugXmlDump: + * @keyInfoCtx: the pointer to element processing context. + * @output: the output file pointer. + * + * Prints user settings and current context state in XML format to @output. + */ +EXPORT_C +void +xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) { + xmlSecAssert(keyInfoCtx != NULL); + xmlSecAssert(output != NULL); + + switch(keyInfoCtx->mode) { + case xmlSecKeyInfoModeRead: + fprintf(output, "\n"); + break; + case xmlSecKeyInfoModeWrite: + fprintf(output, "\n"); + break; + } + + fprintf(output, "%08x\n", keyInfoCtx->flags); + fprintf(output, "%08x\n", keyInfoCtx->flags2); + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + fprintf(output, "\n"); + xmlSecKeyDataIdListDebugXmlDump(&(keyInfoCtx->enabledKeyData), output); + fprintf(output, "\n"); + } else { + fprintf(output, "all\n"); + } + + fprintf(output, "\n", + keyInfoCtx->curRetrievalMethodLevel, + keyInfoCtx->maxRetrievalMethodLevel); + xmlSecTransformCtxDebugXmlDump(&(keyInfoCtx->retrievalMethodCtx), output); + +#ifndef XMLSEC_NO_XMLENC + fprintf(output, "\n", + keyInfoCtx->curEncryptedKeyLevel, + keyInfoCtx->maxEncryptedKeyLevel); + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxDebugXmlDump(keyInfoCtx->encCtx, output); + } +#endif /* XMLSEC_NO_XMLENC */ + + xmlSecKeyReqDebugXmlDump(&(keyInfoCtx->keyReq), output); + switch(keyInfoCtx->mode) { + case xmlSecKeyInfoModeRead: + fprintf(output, "\n"); + break; + case xmlSecKeyInfoModeWrite: + fprintf(output, "\n"); + break; + } +} + +/************************************************************************** + * + * processing + * + *************************************************************************/ +static int xmlSecKeyDataNameXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecKeyDataNameXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +static xmlSecKeyDataKlass xmlSecKeyDataNameKlass = { + sizeof(xmlSecKeyDataKlass), + sizeof(xmlSecKeyData), + + /* data */ + xmlSecNameKeyName, + xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */ + NULL, /* const xmlChar* href; */ + xmlSecNodeKeyName, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyDataInitializeMethod initialize; */ + NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */ + NULL, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + NULL, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecKeyDataNameXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecKeyDataNameXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecKeyDataNameGetKlass: + * + * The element key data klass + * (http://www.w3.org/TR/xmldsig-core/#sec-KeyName): + * + * The KeyName element contains a string value (in which white space is + * significant) which may be used by the signer to communicate a key + * identifier to the recipient. Typically, KeyName contains an identifier + * related to the key pair used to sign the message, but it may contain + * other protocol-related information that indirectly identifies a key pair. + * (Common uses of KeyName include simple string names for keys, a key index, + * a distinguished name (DN), an email address, etc.) + * + * Returns the element processing key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataNameGetKlass(void) { + return(&xmlSecKeyDataNameKlass); +} + +static int +xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* oldName; + xmlChar* newName; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataNameId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + oldName = xmlSecKeyGetName(key); + newName = xmlNodeGetContent(node); + if(newName == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* compare name values */ + if((oldName != NULL) && !xmlStrEqual(oldName, newName)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "key name is already specified", + XMLSEC_ERRORS_R_INVALID_KEY_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(newName); + return(-1); + } + + /* try to find key in the manager */ + if((xmlSecKeyGetValue(key) == NULL) && (keyInfoCtx->keysMngr != NULL)) { + xmlSecKeyPtr tmpKey; + + tmpKey = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, newName, keyInfoCtx); + if(tmpKey != NULL) { + /* erase any current information in the key */ + xmlSecKeyEmpty(key); + + + /* and copy what we've found */ + ret = xmlSecKeyCopy(key, tmpKey); + + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(tmpKey); + xmlFree(newName); + return(-1); + } + tmpKey->value=NULL; + xmlSecKeyDestroy(tmpKey); + } + } + + /* finally set key name if it is not there */ + if(xmlSecKeyGetName(key) == NULL) { + xmlSecKeySetName(key, newName); + } + xmlFree(newName); + return(0); +} + +static int +xmlSecKeyDataNameXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* name; + + xmlSecAssert2(id == xmlSecKeyDataNameId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1); + + name = xmlSecKeyGetName(key); + if(name != NULL) { + xmlNodeSetContent(node, name); + if (OOM_FLAG) + { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeSetContent", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +/************************************************************************** + * + * processing + * + *************************************************************************/ +static int xmlSecKeyDataValueXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecKeyDataValueXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +static xmlSecKeyDataKlass xmlSecKeyDataValueKlass = { + sizeof(xmlSecKeyDataKlass), + sizeof(xmlSecKeyData), + + /* data */ + xmlSecNameKeyValue, + xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */ + NULL, /* const xmlChar* href; */ + xmlSecNodeKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyDataInitializeMethod initialize; */ + NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */ + NULL, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + NULL, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecKeyDataValueXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecKeyDataValueXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecKeyDataValueGetKlass: + * + * The element key data klass + * (http://www.w3.org/TR/xmldsig-core/#sec-KeyValue): + * + * The KeyValue element contains a single public key that may be useful in + * validating the signature. + * + * Returns the element processing key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataValueGetKlass(void) { + return(&xmlSecKeyDataValueKlass); +} + +static int +xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* nodeName; + const xmlChar* nodeNs; + xmlSecKeyDataId dataId; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataValueId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + cur = xmlSecGetNextElementNode(node->children); + if(cur == NULL) { + /* just an empty node */ + return(0); + } + + /* find data id */ + nodeName = cur->name; + nodeNs = xmlSecGetNodeNsHref(cur); + + /* use global list only if we don't have a local one */ + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData), + nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead); + } else { + dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(), + nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead); + } + if(dataId != xmlSecKeyDataIdUnknown) { + /* read data node */ + ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataXmlRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD) != 0) { + /* laxi schema validation but application can disable it */ + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* might have only one node */ + cur = xmlSecGetNextElementNode(cur->next); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + const xmlChar* nodeName; + const xmlChar* nodeNs; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataValueId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1); + + if(!xmlSecKeyDataIsValid(key->value) || + !xmlSecKeyDataCheckUsage(key->value, xmlSecKeyDataUsageKeyValueNodeWrite)){ + /* nothing to write */ + return(0); + } + if((xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) && + (xmlSecKeyDataIdListFind(&(keyInfoCtx->enabledKeyData), id) != 1)) { + + /* we are not enabled to write out key data with this id */ + return(0); + } + if(xmlSecKeyReqMatchKey(&(keyInfoCtx->keyReq), key) != 1) { + /* we are not allowed to write out this key */ + return(0); + } + + nodeName = key->value->id->dataNodeName; + nodeNs = key->value->id->dataNodeNs; + xmlSecAssert2(nodeName != NULL, -1); + + /* remove all existing key value */ + xmlNodeSetContent(node, NULL); + + /* create key node */ + cur = xmlSecAddChild(node, nodeName, nodeNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + + ret = xmlSecKeyDataXmlWrite(key->value->id, key, cur, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataXmlWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + + return(0); +} + +/************************************************************************** + * + * processing + * + *************************************************************************/ +static int xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); + + + +static xmlSecKeyDataKlass xmlSecKeyDataRetrievalMethodKlass = { + sizeof(xmlSecKeyDataKlass), + sizeof(xmlSecKeyData), + + /* data */ + xmlSecNameRetrievalMethod, + xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */ + NULL, /* const xmlChar* href; */ + xmlSecNodeRetrievalMethod, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyDataInitializeMethod initialize; */ + NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */ + NULL, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + NULL, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecKeyDataRetrievalMethodXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecKeyDataRetrievalMethodXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +static int xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, + xmlSecKeyPtr key, + const xmlChar* buffer, + xmlSecSize bufferSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +/** + * xmlSecKeyDataRetrievalMethodGetKlass: + * + * The element key data klass + * (http://www.w3.org/TR/xmldsig-core/#sec-RetrievalMethod): + * A RetrievalMethod element within KeyInfo is used to convey a reference to + * KeyInfo information that is stored at another location. For example, + * several signatures in a document might use a key verified by an X.509v3 + * certificate chain appearing once in the document or remotely outside the + * document; each signature's KeyInfo can reference this chain using a single + * RetrievalMethod element instead of including the entire chain with a + * sequence of X509Certificate elements. + * + * RetrievalMethod uses the same syntax and dereferencing behavior as + * Reference's URI and The Reference Processing Model. + * + * Returns the element processing key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataRetrievalMethodGetKlass(void) { + return(&xmlSecKeyDataRetrievalMethodKlass); +} + +static int +xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataId dataId = xmlSecKeyDataIdUnknown; + xmlChar *retrType = NULL; + xmlChar *uri = NULL; + xmlNodePtr cur; + int res = -1; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataRetrievalMethodId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(node->doc != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + /* check retrieval level */ + if(keyInfoCtx->curRetrievalMethodLevel >= keyInfoCtx->maxRetrievalMethodLevel) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL, + "cur=%d;max=%d", + keyInfoCtx->curRetrievalMethodLevel, + keyInfoCtx->maxRetrievalMethodLevel); + goto done; + } + ++keyInfoCtx->curRetrievalMethodLevel; + + retrType = xmlGetProp(node, xmlSecAttrType); + if(retrType != NULL) { + /* use global list only if we don't have a local one */ + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + dataId = xmlSecKeyDataIdListFindByHref(&(keyInfoCtx->enabledKeyData), + retrType, xmlSecKeyDataUsageRetrievalMethodNode); + } else { + dataId = xmlSecKeyDataIdListFindByHref(xmlSecKeyDataIdsGet(), + retrType, xmlSecKeyDataUsageRetrievalMethodNode); + } + } + + /* laxi schema validation but aplication can disable it */ + if(dataId == xmlSecKeyDataIdUnknown) { + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecAttrType), + XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, + "value=%s", xmlSecErrorsSafeString(retrType)); + } else { + res = 0; + } + goto done; + } + + /* destroy prev retrieval method context */ + xmlSecTransformCtxReset(&(keyInfoCtx->retrievalMethodCtx)); + + /* set start URI and check that it is enabled */ + uri = xmlGetProp(node, xmlSecAttrURI); + ret = xmlSecTransformCtxSetUri(&(keyInfoCtx->retrievalMethodCtx), uri, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecTransformCtxSetUri", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + goto done; + } + + /* the only one node is optional Transforms node */ + cur = xmlSecGetNextElementNode(node->children); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) { + ret = xmlSecTransformCtxNodesListRead(&(keyInfoCtx->retrievalMethodCtx), + cur, xmlSecTransformUsageDSigTransform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecTransformCtxNodesListRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + goto done; + } + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + /* finally get transforms results */ + ret = xmlSecTransformCtxExecute(&(keyInfoCtx->retrievalMethodCtx), node->doc); + if((ret < 0) || + (keyInfoCtx->retrievalMethodCtx.result == NULL) || + (xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result) == NULL)) { + + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecTransformCtxExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + + /* assume that the data is in XML if we could not find id */ + if((dataId == xmlSecKeyDataIdUnknown) || + ((dataId->usage & xmlSecKeyDataUsageRetrievalMethodNodeXml) != 0)) { + + ret = xmlSecKeyDataRetrievalMethodReadXmlResult(dataId, key, + xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result), + xmlSecBufferGetSize(keyInfoCtx->retrievalMethodCtx.result), + keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataRetrievalMethodReadXmlResult", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } else { + ret = xmlSecKeyDataBinRead(dataId, key, + xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result), + xmlSecBufferGetSize(keyInfoCtx->retrievalMethodCtx.result), + keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataBinRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + --keyInfoCtx->curRetrievalMethodLevel; + + res = 0; +done: + if(uri != NULL) { + xmlFree(uri); + } + if(retrType != NULL) { + xmlFree(retrType); + } + return(res); +} + +static int +xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(id == xmlSecKeyDataRetrievalMethodId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1); + + /* just do nothing */ + return(0); +} + +static int +xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr key, + const xmlChar* buffer, xmlSecSize bufferSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlDocPtr doc; + xmlNodePtr cur; + const xmlChar* nodeName; + const xmlChar* nodeNs; + xmlSecKeyDataId dataId; + int ret; + + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(buffer != NULL, -1); + xmlSecAssert2(bufferSize > 0, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + doc = xmlRecoverMemory((const char*)buffer, bufferSize); + if(doc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)), + "xmlRecoverMemory", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlDocGetRootElement(doc); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)), + "xmlDocGetRootElement", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(doc); + return(-1); + } + + nodeName = cur->name; + nodeNs = xmlSecGetNodeNsHref(cur); + + /* use global list only if we don't have a local one */ + if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) { + dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData), + nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml); + } else { + dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(), + nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml); + } + if(dataId == xmlSecKeyDataIdUnknown) { + xmlFreeDoc(doc); + + /* laxi schema validation but application can disable it */ + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); + } else if((typeId != xmlSecKeyDataIdUnknown) && (typeId != dataId) && + ((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF) != 0)) { + + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)), + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(doc); + return(-1); + } + + /* read data node */ + ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)), + "xmlSecKeyDataXmlRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + xmlFreeDoc(doc); + return(-1); + } + + xmlFreeDoc(doc); + return(0); +} + + +#ifndef XMLSEC_NO_XMLENC +/************************************************************************** + * + * processing + * + *************************************************************************/ +static int xmlSecKeyDataEncryptedKeyXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecKeyDataEncryptedKeyXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); + + + +static xmlSecKeyDataKlass xmlSecKeyDataEncryptedKeyKlass = { + sizeof(xmlSecKeyDataKlass), + sizeof(xmlSecKeyData), + + /* data */ + xmlSecNameEncryptedKey, + xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefEncryptedKey, /* const xmlChar* href; */ + xmlSecNodeEncryptedKey, /* const xmlChar* dataNodeName; */ + xmlSecEncNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyDataInitializeMethod initialize; */ + NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */ + NULL, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + NULL, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecKeyDataEncryptedKeyXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecKeyDataEncryptedKeyXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecKeyDataEncryptedKeyGetKlass: + * + * The element key data klass + * (http://www.w3.org/TR/xmlenc-core/#sec-EncryptedKey): + * + * The EncryptedKey element is used to transport encryption keys from + * the originator to a known recipient(s). It may be used as a stand-alone + * XML document, be placed within an application document, or appear inside + * an EncryptedData element as a child of a ds:KeyInfo element. The key value + * is always encrypted to the recipient(s). When EncryptedKey is decrypted the + * resulting octets are made available to the EncryptionMethod algorithm + * without any additional processing. + * + * Returns the element processing key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataEncryptedKeyGetKlass(void) { + return(&xmlSecKeyDataEncryptedKeyKlass); +} + +static int +xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecBufferPtr result; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataEncryptedKeyId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1); + + /* check the enc level */ + if(keyInfoCtx->curEncryptedKeyLevel >= keyInfoCtx->maxEncryptedKeyLevel) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL, + "cur=%d;max=%d", + keyInfoCtx->curEncryptedKeyLevel, + keyInfoCtx->maxEncryptedKeyLevel); + return(-1); + } + ++keyInfoCtx->curEncryptedKeyLevel; + + /* init Enc context */ + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxReset(keyInfoCtx->encCtx); + } else { + ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyInfoCtxCreateEncCtx", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1); + + result = xmlSecEncCtxDecryptToBuffer(keyInfoCtx->encCtx, node); + if((result == NULL) || (xmlSecBufferGetData(result) == NULL)) { + /* We might have multiple EncryptedKey elements, encrypted + * for different receipints but application can enforce + * correct enc key. + */ + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecEncCtxDecryptToBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); + } + + ret = xmlSecKeyDataBinRead(keyInfoCtx->keyReq.keyId, key, + xmlSecBufferGetData(result), + xmlSecBufferGetSize(result), + keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataBinRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + --keyInfoCtx->curEncryptedKeyLevel; + + return(0); +} + +static int +xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyInfoCtx keyInfoCtx2; + xmlSecByte *keyBuf = NULL; + xmlSecSize keySize = 0; + int res = -1; + int ret; + + xmlSecAssert2(id == xmlSecKeyDataEncryptedKeyId, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(xmlSecKeyIsValid(key), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1); + + /* dump key to a binary buffer */ + ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx2, NULL); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + ret = xmlSecKeyInfoCtxCopyUserPref(&keyInfoCtx2, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxFinalize(&keyInfoCtx2); + goto done; + } + + keyInfoCtx2.keyReq.keyType = xmlSecKeyDataTypeAny; + ret = xmlSecKeyDataBinWrite(key->value->id, key, &keyBuf, &keySize, &keyInfoCtx2); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataBinWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxFinalize(&keyInfoCtx2); + goto done; + } + xmlSecKeyInfoCtxFinalize(&keyInfoCtx2); + + /* init Enc context */ + if(keyInfoCtx->encCtx != NULL) { + xmlSecEncCtxReset(keyInfoCtx->encCtx); + } else { + ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyInfoCtxCreateEncCtx", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1); + + ret = xmlSecEncCtxBinaryEncrypt(keyInfoCtx->encCtx, node, keyBuf, keySize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecEncCtxBinaryEncrypt", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + res = 0; +done: + if(keyBuf != NULL) { + memset(keyBuf, 0, keySize); + xmlFree(keyBuf); keyBuf = NULL; + } + return(res); +} + +#endif /* XMLSEC_NO_XMLENC */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_keys.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_keys.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1467 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Keys. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * xmlSecKeyUseWith + * + *************************************************************************/ +/** + * xmlSecKeyUseWithInitialize: + * @keyUseWith: the pointer to information about key application/user. + * + * Initializes @keyUseWith object. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyUseWithInitialize(xmlSecKeyUseWithPtr keyUseWith) { + xmlSecAssert2(keyUseWith != NULL, -1); + + memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith)); + return(0); +} + +/** + * xmlSecKeyUseWithFinalize: + * @keyUseWith: the pointer to information about key application/user. + * + * Finalizes @keyUseWith object. + */ +EXPORT_C +void +xmlSecKeyUseWithFinalize(xmlSecKeyUseWithPtr keyUseWith) { + xmlSecAssert(keyUseWith != NULL); + + xmlSecKeyUseWithReset(keyUseWith); + memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith)); +} + +/** + * xmlSecKeyUseWithReset: + * @keyUseWith: the pointer to information about key application/user. + * + * Resets the @keyUseWith to its state after initialization. + */ +EXPORT_C +void +xmlSecKeyUseWithReset(xmlSecKeyUseWithPtr keyUseWith) { + xmlSecAssert(keyUseWith != NULL); + + xmlSecKeyUseWithSet(keyUseWith, NULL, NULL); +} + +/** + * xmlSecKeyUseWithCopy: + * @dst: the pointer to destination object. + * @src: the pointer to source object. + * + * Copies information from @dst to @src. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyUseWithCopy(xmlSecKeyUseWithPtr dst, xmlSecKeyUseWithPtr src) { + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + return(xmlSecKeyUseWithSet(dst, src->application, src->identifier)); +} + +/** + * xmlSecKeyUseWithCreate: + * @keyUseWith: the pointer to information about key application/user. + * @application: the application value. + * @identifier: the identifier value. + * + * Creates new xmlSecKeyUseWith object. The caller is responsible for destroying + * returned object with @xmlSecKeyUseWithDestroy function. + * + * Returns pointer to newly created object or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyUseWithPtr +xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) { + xmlSecKeyUseWithPtr keyUseWith; + int ret; + + /* Allocate a new xmlSecKeyUseWith and fill the fields. */ + keyUseWith = (xmlSecKeyUseWithPtr)xmlMalloc(sizeof(xmlSecKeyUseWith)); + if(keyUseWith == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecKeyUseWith)=%d", + sizeof(xmlSecKeyUseWith)); + return(NULL); + } + memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith)); + + ret = xmlSecKeyUseWithInitialize(keyUseWith); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyUseWithInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyUseWithDestroy(keyUseWith); + return(NULL); + } + + ret = xmlSecKeyUseWithSet(keyUseWith, application, identifier); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyUseWithSet", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyUseWithDestroy(keyUseWith); + return(NULL); + } + + return(keyUseWith); +} + +/** + * xmlSecKeyUseWithDuplicate: + * @keyUseWith: the pointer to information about key application/user. + * + * Duplicates @keyUseWith object. The caller is responsible for destroying + * returned object with @xmlSecKeyUseWithDestroy function. + * + * Returns pointer to newly created object or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyUseWithPtr +xmlSecKeyUseWithDuplicate(xmlSecKeyUseWithPtr keyUseWith) { + int ret; + + xmlSecKeyUseWithPtr newKeyUseWith; + + xmlSecAssert2(keyUseWith != NULL, NULL); + + newKeyUseWith = xmlSecKeyUseWithCreate(NULL, NULL); + if(newKeyUseWith == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyUseWithCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecKeyUseWithCopy(newKeyUseWith, keyUseWith); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyUseWithCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyUseWithDestroy(keyUseWith); + return(NULL); + } + + return(newKeyUseWith); +} + +/** + * xmlSecKeyUseWithDestroy: + * @keyUseWith: the pointer to information about key application/user. + * + * Destroys @keyUseWith created with @xmlSecKeyUseWithCreate or @xmlSecKeyUseWithDuplicate + * functions. + */ +EXPORT_C +void +xmlSecKeyUseWithDestroy(xmlSecKeyUseWithPtr keyUseWith) { + xmlSecAssert(keyUseWith != NULL); + + xmlSecKeyUseWithFinalize(keyUseWith); + xmlFree(keyUseWith); +} + +/** + * xmlSecKeyUseWithSet: + * @keyUseWith: the pointer to information about key application/user. + * @application: the new application value. + * @identifier: the new identifier value. + * + * Sets @application and @identifier in the @keyUseWith. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyUseWithSet(xmlSecKeyUseWithPtr keyUseWith, const xmlChar* application, const xmlChar* identifier) { + xmlSecAssert2(keyUseWith != NULL, -1); + + if(keyUseWith->application != NULL) { + xmlFree(keyUseWith->application); + keyUseWith->application = NULL; + } + if(keyUseWith->identifier != NULL) { + xmlFree(keyUseWith->identifier); + keyUseWith->identifier = NULL; + } + + if(application != NULL) { + keyUseWith->application = xmlStrdup(application); + if(keyUseWith->application == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "xmlStrlen(application)=%d", + xmlStrlen(application)); + return(-1); + } + } + if(identifier != NULL) { + keyUseWith->identifier = xmlStrdup(identifier); + if(keyUseWith->identifier == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "xmlStrlen(identifier)=%d", + xmlStrlen(identifier)); + return(-1); + } + } + + return(0); +} + +/** + * xmlSecKeyUseWithDebugDump: + * @keyUseWith: the pointer to information about key application/user. + * @output: the pointer to output FILE. + * + * Prints xmlSecKeyUseWith debug information to a file @output. + */ +EXPORT_C +void +xmlSecKeyUseWithDebugDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) { + xmlSecAssert(keyUseWith != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "=== KeyUseWith: application=\"%s\",identifier=\"%s\"\n", + (keyUseWith->application) ? keyUseWith->application : BAD_CAST "", + (keyUseWith->identifier) ? keyUseWith->identifier : BAD_CAST ""); +} + +/** + * xmlSecKeyUseWithDebugXmlDump: + * @keyUseWith: the pointer to information about key application/user. + * @output: the pointer to output FILE. + * + * Prints xmlSecKeyUseWith debug information to a file @output in XML format. + */ +EXPORT_C +void +xmlSecKeyUseWithDebugXmlDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) { + xmlSecAssert(keyUseWith != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "\n"); + fprintf(output, "%s", + (keyUseWith->application) ? keyUseWith->application : BAD_CAST ""); + fprintf(output, "%s", + (keyUseWith->identifier) ? keyUseWith->identifier : BAD_CAST ""); + fprintf(output, "\n"); +} + +/*********************************************************************** + * + * KeyUseWith list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecKeyUseWithPtrListKlass = { + BAD_CAST "key-use-with-list", + (xmlSecPtrDuplicateItemMethod)xmlSecKeyUseWithDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecKeyUseWithDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecKeyUseWithPtrListGetKlass: + * + * The key data list klass. + * + * Returns pointer to the key data list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecKeyUseWithPtrListGetKlass(void) { + return(&xmlSecKeyUseWithPtrListKlass); +} + +/************************************************************************** + * + * xmlSecKeyReq - what key are we looking for? + * + *************************************************************************/ +/** + * xmlSecKeyReqInitialize: + * @keyReq: the pointer to key requirements object. + * + * Initialize key requirements object. Caller is responsible for + * cleaning it with #xmlSecKeyReqFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) { + int ret; + + xmlSecAssert2(keyReq != NULL, -1); + + memset(keyReq, 0, sizeof(xmlSecKeyReq)); + + keyReq->keyUsage = xmlSecKeyUsageAny; /* by default you can do whatever you want with the key */ + ret = xmlSecPtrListInitialize(&keyReq->keyUseWithList, xmlSecKeyUseWithPtrListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + + return(0); +} + +/** + * xmlSecKeyReqFinalize: + * @keyReq: the pointer to key requirements object. + * + * Cleans the key requirements object initialized with #xmlSecKeyReqInitialize + * function. + */ +EXPORT_C +void +xmlSecKeyReqFinalize(xmlSecKeyReqPtr keyReq) { + xmlSecAssert(keyReq != NULL); + + xmlSecPtrListFinalize(&keyReq->keyUseWithList); + memset(keyReq, 0, sizeof(xmlSecKeyReq)); +} + +/** + * xmlSecKeyReqReset: + * @keyReq: the pointer to key requirements object. + * + * Resets key requirements object for new key search. + */ +EXPORT_C +void +xmlSecKeyReqReset(xmlSecKeyReqPtr keyReq) { + xmlSecAssert(keyReq != NULL); + + xmlSecPtrListEmpty(&keyReq->keyUseWithList); + keyReq->keyId = NULL; + keyReq->keyType = 0; + keyReq->keyUsage = xmlSecKeyUsageAny; + keyReq->keyBitsSize = 0; +} + +/** + * xmlSecKeyReqCopy: + * @dst: the pointer to destination object. + * @src: the pointer to source object. + * + * Copies key requirements from @src object to @dst object. + * + * Returns 0 on success and a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyReqCopy(xmlSecKeyReqPtr dst, xmlSecKeyReqPtr src) { + int ret; + + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + dst->keyId = src->keyId; + dst->keyType = src->keyType; + dst->keyUsage = src->keyUsage; + dst->keyBitsSize = src->keyBitsSize; + + ret = xmlSecPtrListCopy(&dst->keyUseWithList, &src->keyUseWithList); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyReqMatchKey: + * @keyReq: the pointer to key requirements object. + * @key: the pointer to key. + * + * Checks whether @key matches key requirements @keyReq. + * + * Returns 1 if key matches requirements, 0 if not and a negative value + * if an error occurs. + */ +EXPORT_C +int +xmlSecKeyReqMatchKey(xmlSecKeyReqPtr keyReq, xmlSecKeyPtr key) { + xmlSecAssert2(keyReq != NULL, -1); + xmlSecAssert2(xmlSecKeyIsValid(key), -1); + + if((keyReq->keyType != xmlSecKeyDataTypeUnknown) && ((xmlSecKeyGetType(key) & keyReq->keyType) == 0)) { + return(0); + } + if((keyReq->keyUsage != xmlSecKeyDataUsageUnknown) && ((keyReq->keyUsage & key->usage) == 0)) { + return(0); + } + + return(xmlSecKeyReqMatchKeyValue(keyReq, xmlSecKeyGetValue(key))); +} + +/** + * xmlSecKeyReqMatchKeyValue: + * @keyReq: the pointer to key requirements. + * @value: the pointer to key value. + * + * Checks whether @keyValue matches key requirements @keyReq. + * + * Returns 1 if key value matches requirements, 0 if not and a negative value + * if an error occurs. + */ +EXPORT_C +int +xmlSecKeyReqMatchKeyValue(xmlSecKeyReqPtr keyReq, xmlSecKeyDataPtr value) { + xmlSecAssert2(keyReq != NULL, -1); + xmlSecAssert2(value != NULL, -1); + + if((keyReq->keyId != xmlSecKeyDataIdUnknown) && + (!xmlSecKeyDataCheckId(value, keyReq->keyId))) { + + return(0); + } + if((keyReq->keyBitsSize > 0) && + (xmlSecKeyDataGetSize(value) > 0) && + (xmlSecKeyDataGetSize(value) < keyReq->keyBitsSize)) { + + return(0); + } + return(1); +} + +/** + * xmlSecKeyReqDebugDump: + * @keyReq: the pointer to key requirements object. + * @output: the pointer to output FILE. + * + * Prints debug information about @keyReq into @output. + */ +EXPORT_C +void +xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) { + xmlSecAssert(keyReq != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "=== KeyReq:\n"); + fprintf(output, "==== keyId: %s\n", + (xmlSecKeyDataKlassGetName(keyReq->keyId)) ? + xmlSecKeyDataKlassGetName(keyReq->keyId) : + BAD_CAST "NULL"); + fprintf(output, "==== keyType: 0x%08x\n", keyReq->keyType); + fprintf(output, "==== keyUsage: 0x%08x\n", keyReq->keyUsage); + fprintf(output, "==== keyBitsSize: %d\n", keyReq->keyBitsSize); + xmlSecPtrListDebugDump(&(keyReq->keyUseWithList), output); +} + +/** + * xmlSecKeyReqDebugXmlDump: + * @keyReq: the pointer to key requirements object. + * @output: the pointer to output FILE. + * + * Prints debug information about @keyReq into @output in XML format. + */ +EXPORT_C +void +xmlSecKeyReqDebugXmlDump(xmlSecKeyReqPtr keyReq, FILE* output) { + xmlSecAssert(keyReq != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "\n"); + fprintf(output, "%s\n", + (xmlSecKeyDataKlassGetName(keyReq->keyId)) ? + xmlSecKeyDataKlassGetName(keyReq->keyId) : + BAD_CAST "NULL"); + fprintf(output, "0x%08x\n", keyReq->keyType); + fprintf(output, "0x%08x\n", keyReq->keyUsage); + fprintf(output, "%d\n", keyReq->keyBitsSize); + xmlSecPtrListDebugXmlDump(&(keyReq->keyUseWithList), output); + fprintf(output, "\n"); +} + + +/************************************************************************** + * + * xmlSecKey + * + *************************************************************************/ +/** + * xmlSecKeyCreate: + * + * Allocates and initializes new key. Caller is responsible for + * freeing returned object with #xmlSecKeyDestroy function. + * + * Returns the pointer to newly allocated @xmlSecKey structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyCreate(void) { + xmlSecKeyPtr key; + + /* Allocate a new xmlSecKey and fill the fields. */ + key = (xmlSecKeyPtr)xmlMalloc(sizeof(xmlSecKey)); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecKey)=%d", + sizeof(xmlSecKey)); + return(NULL); + } + memset(key, 0, sizeof(xmlSecKey)); + key->usage = xmlSecKeyUsageAny; + return(key); +} + +/** + * xmlSecKeyEmpty: + * @key: the pointer to key. + * + * Clears the @key data. + */ +EXPORT_C +void +xmlSecKeyEmpty(xmlSecKeyPtr key) { + xmlSecAssert(key != NULL); + + if(key->value != NULL) { + xmlSecKeyDataDestroy(key->value); + } + if(key->name != NULL) { + xmlFree(key->name); + } + if(key->dataList != NULL) { + xmlSecPtrListDestroy(key->dataList); + } + + memset(key, 0, sizeof(xmlSecKey)); +} + +/** + * xmlSecKeyDestroy: + * @key: the pointer to key. + * + * Destroys the key created using #xmlSecKeyCreate function. + */ +EXPORT_C +void +xmlSecKeyDestroy(xmlSecKeyPtr key) { + xmlSecAssert(key != NULL); + + xmlSecKeyEmpty(key); + xmlFree(key); +} + +/** + * xmlSecKeyCopy: + * @keyDst: the destination key. + * @keySrc: the source key. + * + * Copies key data from @keySrc to @keyDst. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) { + xmlSecAssert2(keyDst != NULL, -1); + xmlSecAssert2(keySrc != NULL, -1); + + /* empty destination */ + xmlSecKeyEmpty(keyDst); + + /* copy everything */ + if(keySrc->name != NULL) { + keyDst->name = xmlStrdup(keySrc->name); + if(keyDst->name == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "len=%d", xmlStrlen(keySrc->name)); + return(-1); + } + } + + if(keySrc->value != NULL) { + keyDst->value = xmlSecKeyDataDuplicate(keySrc->value); + if(keyDst->value == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataDuplicate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + if(keySrc->dataList != NULL) { + keyDst->dataList = xmlSecPtrListDuplicate(keySrc->dataList); + if(keyDst->dataList == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListDuplicate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + keyDst->usage = keySrc->usage; + keyDst->notValidBefore = keySrc->notValidBefore; + keyDst->notValidAfter = keySrc->notValidAfter; + return(0); +} + +/** + * xmlSecKeyDuplicate: + * @key: the pointer to the #xmlSecKey structure. + * + * Creates a duplicate of the given @key. + * + * Returns the pointer to newly allocated #xmlSecKey structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyDuplicate(xmlSecKeyPtr key) { + xmlSecKeyPtr newKey; + int ret; + + xmlSecAssert2(key != NULL, NULL); + + newKey = xmlSecKeyCreate(); + if(newKey == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecKeyCopy(newKey, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(newKey); + return(NULL); + } + + return(newKey); +} + +/** + * xmlSecKeyMatch: + * @key: the pointer to key. + * @name: the pointer to key name (may be NULL). + * @keyReq: the pointer to key requirements. + * + * Checks whether the @key matches the given criteria. + * + * Returns 1 if the key satisfies the given criteria or 0 otherwise. + */ +EXPORT_C +int +xmlSecKeyMatch(xmlSecKeyPtr key, const xmlChar *name, xmlSecKeyReqPtr keyReq) { + xmlSecAssert2(xmlSecKeyIsValid(key), -1); + xmlSecAssert2(keyReq != NULL, -1); + + if((name != NULL) && (!xmlStrEqual(xmlSecKeyGetName(key), name))) { + return(0); + } + return(xmlSecKeyReqMatchKey(keyReq, key)); +} + +/** + * xmlSecKeyGetType: + * @key: the pointer to key. + * + * Gets @key type. + * + * Returns key type. + */ +EXPORT_C +xmlSecKeyDataType +xmlSecKeyGetType(xmlSecKeyPtr key) { + xmlSecKeyDataPtr data; + + xmlSecAssert2(key != NULL, xmlSecKeyDataTypeUnknown); + + data = xmlSecKeyGetValue(key); + if(data == NULL) { + return(xmlSecKeyDataTypeUnknown); + } + return(xmlSecKeyDataGetType(data)); +} + +/** + * xmlSecKeyGetName: + * @key: the pointer to key. + * + * Gets key name (see also #xmlSecKeySetName function). + * + * Returns key name. + */ +EXPORT_C +const xmlChar* +xmlSecKeyGetName(xmlSecKeyPtr key) { + xmlSecAssert2(key != NULL, NULL); + + return(key->name); +} + +/** + * xmlSecKeySetName: + * @key: the pointer to key. + * @name: the new key name. + * + * Sets key name (see also #xmlSecKeyGetName function). + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) { + xmlSecAssert2(key != NULL, -1); + + if(key->name != NULL) { + xmlFree(key->name); + key->name = NULL; + } + + if(name != NULL) { + key->name = xmlStrdup(name); + if(key->name == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "len=%d", xmlStrlen(name)); + return(-1); + } + } + + return(0); +} + +/** + * xmlSecKeyGetValue: + * @key: the pointer to key. + * + * Gets key value (see also #xmlSecKeySetValue function). + * + * Returns key value (crypto material). + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecKeyGetValue(xmlSecKeyPtr key) { + xmlSecAssert2(key != NULL, NULL); + + return(key->value); +} + +/** + * xmlSecKeySetValue: + * @key: the pointer to key. + * @value: the new value. + * + * Sets key value (see also #xmlSecKeyGetValue function). + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeySetValue(xmlSecKeyPtr key, xmlSecKeyDataPtr value) { + xmlSecAssert2(key != NULL, -1); + + if(key->value != NULL) { + xmlSecKeyDataDestroy(key->value); + key->value = NULL; + } + key->value = value; + + return(0); +} + +/** + * xmlSecKeyGetData: + * @key: the pointer to key. + * @dataId: the requested data klass. + * + * Gets key's data. + * + * Returns additional data associated with the @key (see also + * #xmlSecKeyAdoptData function). + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecKeyGetData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) { + + xmlSecAssert2(key != NULL, NULL); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + + /* special cases */ + if(dataId == xmlSecKeyDataValueId) { + return(key->value); + } else if(key->dataList != NULL) { + xmlSecKeyDataPtr tmp; + xmlSecSize pos, size; + + size = xmlSecPtrListGetSize(key->dataList); + for(pos = 0; pos < size; ++pos) { + tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos); + if((tmp != NULL) && (tmp->id == dataId)) { + return(tmp); + } + } + } + return(NULL); +} + +/** + * xmlSecKeyEnsureData: + * @key: the pointer to key. + * @dataId: the requested data klass. + * + * If necessary, creates key data of @dataId klass and adds to @key. + * + * Returns pointer to key data or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) { + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(key != NULL, NULL); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + + data = xmlSecKeyGetData(key, dataId); + if(data != NULL) { + return(data); + } + + data = xmlSecKeyDataCreate(dataId); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "dataId=%s", + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId))); + return(NULL); + } + + ret = xmlSecKeyAdoptData(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyAdoptData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "dataId=%s", + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId))); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + return(data); +} + +/** + * xmlSecKeyAdoptData: + * @key: the pointer to key. + * @data: the pointer to key data. + * + * Adds @data to the @key. The @data object will be destroyed + * by @key. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) { + xmlSecKeyDataPtr tmp; + xmlSecSize pos, size; + + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + + /* special cases */ + if(data->id == xmlSecKeyDataValueId) { + if(key->value != NULL) { + xmlSecKeyDataDestroy(key->value); + } + key->value = data; + return(0); + } + + if(key->dataList == NULL) { + key->dataList = xmlSecPtrListCreate(xmlSecKeyDataListId); + if(key->dataList == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + + size = xmlSecPtrListGetSize(key->dataList); + for(pos = 0; pos < size; ++pos) { + tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos); + if((tmp != NULL) && (tmp->id == data->id)) { + return(xmlSecPtrListSet(key->dataList, data, pos)); + } + } + + return(xmlSecPtrListAdd(key->dataList, data)); +} + +/** + * xmlSecKeyDebugDump: + * @key: the pointer to key. + * @output: the pointer to output FILE. + * + * Prints the information about the @key to the @output. + */ +EXPORT_C +void +xmlSecKeyDebugDump(xmlSecKeyPtr key, FILE *output) { + xmlSecAssert(xmlSecKeyIsValid(key)); + xmlSecAssert(output != NULL); + + fprintf(output, "== KEY\n"); + fprintf(output, "=== method: %s\n", + (key->value->id->dataNodeName != NULL) ? + (char*)(key->value->id->dataNodeName) : "NULL"); + + fprintf(output, "=== key type: "); + if((xmlSecKeyGetType(key) & xmlSecKeyDataTypeSymmetric) != 0) { + fprintf(output, "Symmetric\n"); + } else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePrivate) != 0) { + fprintf(output, "Private\n"); + } else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePublic) != 0) { + fprintf(output, "Public\n"); + } else { + fprintf(output, "Unknown\n"); + } + + if(key->name != NULL) { + fprintf(output, "=== key name: %s\n", key->name); + } + fprintf(output, "=== key usage: %d\n", key->usage); + if(key->notValidBefore < key->notValidAfter) { + fprintf(output, "=== key not valid before: %ld\n", (unsigned long)key->notValidBefore); + fprintf(output, "=== key not valid after: %ld\n", (unsigned long)key->notValidAfter); + } + if(key->value != NULL) { + xmlSecKeyDataDebugDump(key->value, output); + } + if(key->dataList != NULL) { + xmlSecPtrListDebugDump(key->dataList, output); + } +} + +/** + * xmlSecKeyDebugXmlDump: + * @key: the pointer to key. + * @output: the pointer to output FILE. + * + * Prints the information about the @key to the @output in XML format. + */ +EXPORT_C +void +xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) { + xmlSecAssert(xmlSecKeyIsValid(key)); + xmlSecAssert(output != NULL); + + fprintf(output, "\n"); + if(key->value->id->dataNodeName != NULL) { + fprintf(output, "%s\n", + key->value->id->dataNodeName); + } + + fprintf(output, ""); + if((xmlSecKeyGetType(key) & xmlSecKeyDataTypeSymmetric) != 0) { + fprintf(output, "Symmetric\n"); + } else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePrivate) != 0) { + fprintf(output, "Private\n"); + } else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePublic) != 0) { + fprintf(output, "Public\n"); + } else { + fprintf(output, "Unknown\n"); + } + fprintf(output, "\n"); + + if(key->name != NULL) { + fprintf(output, "%s\n", key->name); + } + if(key->notValidBefore < key->notValidAfter) { + fprintf(output, "\n", + (unsigned long)key->notValidBefore, + (unsigned long)key->notValidAfter); + } + + if(key->value != NULL) { + xmlSecKeyDataDebugXmlDump(key->value, output); + } + if(key->dataList != NULL) { + xmlSecPtrListDebugXmlDump(key->dataList, output); + } + + fprintf(output, "\n"); +} + +/** + * xmlSecKeyGenerate: + * @dataId: the requested key klass (rsa, dsa, aes, ...). + * @sizeBits: the new key size (in bits!). + * @type: the new key type (session, permanent, ...). + * + * Generates new key of requested klass @dataId and @type. + * + * Returns pointer to newly created key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType type) { + xmlSecKeyPtr key; + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + + data = xmlSecKeyDataCreate(dataId); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecKeyDataGenerate(data, sizeBits, type); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyDataGenerate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d;type=%d", sizeBits, type); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + key = xmlSecKeyCreate(); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + xmlSecKeyDestroy(key); + return(NULL); + } + + return(key); +} + +/** + * xmlSecKeyGenerateByName: + * @name: the requested key klass name (rsa, dsa, aes, ...). + * @sizeBits: the new key size (in bits!). + * @type: the new key type (session, permanent, ...). + * + * Generates new key of requested @klass and @type. + * + * Returns pointer to newly created key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataType type) { + xmlSecKeyDataId dataId; + + xmlSecAssert2(name != NULL, NULL); + + dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), name, xmlSecKeyDataUsageAny); + if(dataId == xmlSecKeyDataIdUnknown) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(name), + XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecKeyGenerate(dataId, sizeBits, type)); +} + +/** + * xmlSecKeyReadBuffer: + * @dataId: the key value data klass. + * @buffer: the buffer that contains the binary data. + * + * Reads the key value of klass @dataId from a buffer. + * + * Returns pointer to newly created key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) { + xmlSecKeyInfoCtx keyInfoCtx; + xmlSecKeyPtr key; + int ret; + + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + xmlSecAssert2(buffer != NULL, NULL); + + /* create key data */ + key = xmlSecKeyCreate(); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(key); + return(NULL); + } + + keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny; + ret = xmlSecKeyDataBinRead(dataId, key, + xmlSecBufferGetData(buffer), + xmlSecBufferGetSize(buffer), + &keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyDataBinRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + xmlSecKeyDestroy(key); + return(NULL); + } + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + + return(key); +} + +/** + * xmlSecKeyReadBinaryFile: + * @dataId: the key value data klass. + * @filename: the key binary filename. + * + * Reads the key value of klass @dataId from a binary file @filename. + * + * Returns pointer to newly created key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) { + xmlSecKeyPtr key; + xmlSecBuffer buffer; + int ret; + + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + xmlSecAssert2(filename != NULL, NULL); + + /* read file to buffer */ + ret = xmlSecBufferInitialize(&buffer, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecBufferReadFile(&buffer, filename); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecBufferReadFile", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + + key = xmlSecKeyReadBuffer(dataId, &buffer); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyReadBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + + xmlSecBufferFinalize(&buffer); + return (key); +} + +/** + * xmlSecKeyReadMemory: + * @dataId: the key value data klass. + * @data: the memory containing the key + * @dataSize: the size of the memory block + * + * Reads the key value of klass @dataId from a memory block @data. + * + * Returns pointer to newly created key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize dataSize) { + xmlSecBuffer buffer; + xmlSecKeyPtr key; + int ret; + + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL); + xmlSecAssert2(data != NULL, NULL); + xmlSecAssert2(dataSize > 0, NULL); + + /* read file to buffer */ + ret = xmlSecBufferInitialize(&buffer, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + if (xmlSecBufferAppend(&buffer, data, dataSize) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + + key = xmlSecKeyReadBuffer(dataId, &buffer); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)), + "xmlSecKeyReadBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + + xmlSecBufferFinalize(&buffer); + return (key); +} + +/** + * xmlSecKeysMngrGetKey: + * @keyInfoNode: the pointer to node. + * @keyInfoCtx: the pointer to node processing context. + * + * Reads the node @keyInfoNode and extracts the key. + * + * Returns the pointer to key or NULL if the key is not found or + * an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyPtr key; + xmlSecKeyPtr tempkey; + int ret; + const xmlChar* keyname; + + xmlSecAssert2(keyInfoCtx != NULL, NULL); + + + /* first try to read data from node */ + key = xmlSecKeyCreate(); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + if(keyInfoNode != NULL) { + ret = xmlSecKeyInfoNodeRead(keyInfoNode, key, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(keyInfoNode))); + xmlSecKeyDestroy(key); + return(NULL); + } + + if((xmlSecKeyGetValue(key) != NULL) && + (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) != 0)) { + return(key); + } + } + tempkey=xmlSecKeyDuplicate(key); + if(tempkey == NULL) + { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrFindKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + keyname=xmlSecKeyGetName(tempkey); + xmlSecKeyDestroy(key); + + /* if we have keys manager, try it */ + if(keyInfoCtx->keysMngr != NULL) { + key = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, keyname /*NULL*/, keyInfoCtx); + xmlSecKeyDestroy(tempkey); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrFindKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + if(xmlSecKeyGetValue(key) != NULL) { + return(key); + } + xmlSecKeyDestroy(key); + } + + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_KEY_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); +} + +/*********************************************************************** + * + * Keys list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecKeyPtrListKlass = { + BAD_CAST "keys-list", + (xmlSecPtrDuplicateItemMethod)xmlSecKeyDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecKeyDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDebugXmlDump,/* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecKeyPtrListGetKlass: + * + * The keys list klass. + * + * Returns keys list id. + */ +EXPORT_C +xmlSecPtrListId +xmlSecKeyPtrListGetKlass(void) { + return(&xmlSecKeyPtrListKlass); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_keysdata.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_keysdata.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1429 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Key data. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" +#include "xmlsec_base64.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_errors.h" + + +/************************************************************************** + * + * Global xmlSecKeyDataIds list functions + * + *************************************************************************/ +static xmlSecPtrList xmlSecAllKeyDataIds; + +/** + * xmlSecKeyDataIdsGet: + * + * Gets global registered key data klasses list. + * + * Returns the pointer to list of all registered key data klasses. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecKeyDataIdsGet(void) { + return(&xmlSecAllKeyDataIds); +} + +/** + * xmlSecKeyDataIdsInit: + * + * Initializes the key data klasses. This function is called from the + * #xmlSecInit function and the application should not call it directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataIdsInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(xmlSecKeyDataIdsGet(), xmlSecKeyDataIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataIdListId"); + return(-1); + } + + ret = xmlSecKeyDataIdsRegisterDefault(); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsRegisterDefault", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataIdsShutdown: + * + * Shuts down the keys data klasses. This function is called from the + * #xmlSecShutdown function and the application should not call it directly. + */ +EXPORT_C +void +xmlSecKeyDataIdsShutdown(void) { + xmlSecPtrListFinalize(xmlSecKeyDataIdsGet()); +} + +/** + * xmlSecKeyDataIdsRegister: + * @id: the key data klass. + * + * Registers @id in the global list of key data klasses. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataIdsRegister(xmlSecKeyDataId id) { + int ret; + + xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1); + + ret = xmlSecPtrListAdd(xmlSecKeyDataIdsGet(), (xmlSecPtr)id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "dataId=%s", + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id))); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataIdsRegisterDefault: + * + * Registers default (implemented by XML Security Library) + * key data klasses: element processing klass, + * element processing klass, ... + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataIdsRegisterDefault(void) { + if(xmlSecKeyDataIdsRegister(xmlSecKeyDataNameId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataNameId"); + return(-1); + } + + if(xmlSecKeyDataIdsRegister(xmlSecKeyDataValueId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataValueId"); + return(-1); + } + + if(xmlSecKeyDataIdsRegister(xmlSecKeyDataRetrievalMethodId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataRetrievalMethodId"); + return(-1); + } + +#ifndef XMLSEC_NO_XMLENC + if(xmlSecKeyDataIdsRegister(xmlSecKeyDataEncryptedKeyId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataEncryptedKeyId"); + return(-1); + } +#endif /* XMLSEC_NO_XMLENC */ + + return(0); +} + +/************************************************************************** + * + * xmlSecKeyData functions + * + *************************************************************************/ +/** + * xmlSecKeyDataCreate: + * @id: the data id. + * + * Allocates and initializes new key data of the specified type @id. + * Caller is responsible for destroing returend object with + * #xmlSecKeyDataDestroy function. + * + * Returns the pointer to newly allocated key data structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecKeyDataCreate(xmlSecKeyDataId id) { + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(id != NULL, NULL); + xmlSecAssert2(id->klassSize >= sizeof(xmlSecKeyDataKlass), NULL); + xmlSecAssert2(id->objSize >= sizeof(xmlSecKeyData), NULL); + xmlSecAssert2(id->name != NULL, NULL); + + /* Allocate a new xmlSecKeyData and fill the fields. */ + data = (xmlSecKeyDataPtr)xmlMalloc(id->objSize); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", id->objSize); + return(NULL); + } + memset(data, 0, id->objSize); + data->id = id; + + if(id->initialize != NULL) { + ret = (id->initialize)(data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "id->initialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(NULL); + } + } + + return(data); +} + +/** + * xmlSecKeyDataDuplicate: + * @data: the pointer to the key data. + * + * Creates a duplicate of the given @data. Caller is responsible for + * destroing returend object with #xmlSecKeyDataDestroy function. + * + * Returns the pointer to newly allocated key data structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) { + xmlSecKeyDataPtr newData; + int ret; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL); + xmlSecAssert2(data->id->duplicate != NULL, NULL); + + newData = xmlSecKeyDataCreate(data->id); + if(newData == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = (data->id->duplicate)(newData, data); + + if(newData == NULL || ret<0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "id->duplicate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(newData); + return(NULL); + } + xmlSecKeyDataDestroy(data); + return(newData); +} + +/** + * xmlSecKeyDataDestroy: + * @data: the pointer to the key data. + * + * Destroys the data and frees all allocated memory. + */ +EXPORT_C +void +xmlSecKeyDataDestroy(xmlSecKeyDataPtr data) { + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(data->id->objSize > 0); + + if(data->id->finalize != NULL) { + (data->id->finalize)(data); + } + memset(data, 0, data->id->objSize); + xmlFree(data); +} + + +/** + * xmlSecKeyDataXmlRead: + * @id: the data klass. + * @key: the destination key. + * @node: the pointer to an XML node. + * @keyInfoCtx: the pointer to element processing context. + * + * Reads the key data of klass @id from XML @node and adds them to @key. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(id != NULL, -1); + xmlSecAssert2(id->xmlRead != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + return((id->xmlRead)(id, key, node, keyInfoCtx)); +} + +/** + * xmlSecKeyDataXmlWrite: + * @id: the data klass. + * @key: the source key. + * @node: the pointer to an XML node. + * @keyInfoCtx: the pointer to element processing context. + * + * Writes the key data of klass @id from @key to an XML @node. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(id != NULL, -1); + xmlSecAssert2(id->xmlWrite != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + return((id->xmlWrite)(id, key, node, keyInfoCtx)); +} + +/** + * xmlSecKeyDataBinRead: + * @id: the data klass. + * @key: the destination key. + * @buf: the input binary buffer. + * @bufSize: the input buffer size. + * @keyInfoCtx: the node processing context. + * + * Reads the key data of klass @id from binary buffer @buf to @key. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + const xmlSecByte* buf, xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(id != NULL, -1); + xmlSecAssert2(id->binRead != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + return((id->binRead)(id, key, buf, bufSize, keyInfoCtx)); +} + +/** + * xmlSecKeyDataBinWrite: + * @id: the data klass. + * @key: the source key. + * @buf: the output binary buffer. + * @bufSize: the output buffer size. + * @keyInfoCtx: the node processing context. + * + * Writes the key data of klass @id from the @key to a binary buffer @buf. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlSecByte** buf, xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(id != NULL, -1); + xmlSecAssert2(id->binWrite != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + return((id->binWrite)(id, key, buf, bufSize, keyInfoCtx)); +} + +/** + * xmlSecKeyDataGenerate: + * @data: the pointer to key data. + * @sizeBits: the desired key data size (in bits). + * @type: the desired key data type. + * + * Generates new key data of given size and type. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, + xmlSecKeyDataType type) { + int ret; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + xmlSecAssert2(data->id->generate != NULL, -1); + + /* write data */ + ret = data->id->generate(data, sizeBits, type); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "id->generate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", sizeBits); + return(-1); + } + return(0); +} + +/** + * xmlSecKeyDataGetType: + * @data: the pointer to key data. + * + * Gets key data type. + * + * Returns key data type. + */ +EXPORT_C +xmlSecKeyDataType +xmlSecKeyDataGetType(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataIsValid(data), xmlSecKeyDataTypeUnknown); + xmlSecAssert2(data->id->getType != NULL, xmlSecKeyDataTypeUnknown); + + return(data->id->getType(data)); +} + +/** + * xmlSecKeyDataGetSize: + * @data: the pointer to key data. + * + * Gets key data size. + * + * Returns key data size (in bits). + */ +EXPORT_C +xmlSecSize +xmlSecKeyDataGetSize(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataIsValid(data), 0); + xmlSecAssert2(data->id->getSize != NULL, 0); + + return(data->id->getSize(data)); +} + +/** + * xmlSecKeyDataGetIdentifier: + * @data: the pointer to key data. + * + * Gets key data identifier string. + * + * Returns key data id string. + */ +EXPORT_C +const xmlChar* +xmlSecKeyDataGetIdentifier(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL); + xmlSecAssert2(data->id->getIdentifier != NULL, NULL); + + return(data->id->getIdentifier(data)); +} + +/** + * xmlSecKeyDataDebugDump: + * @data: the pointer to key data. + * @output: the pointer to output FILE. + * + * Prints key data debug info. + */ +EXPORT_C +void +xmlSecKeyDataDebugDump(xmlSecKeyDataPtr data, FILE *output) { + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(data->id->debugDump != NULL); + xmlSecAssert(output != NULL); + + data->id->debugDump(data, output); +} + +/** + * xmlSecKeyDataDebugXmlDump: + * @data: the pointer to key data. + * @output: the pointer to output FILE. + * + * Prints key data debug info in XML format. + */ +EXPORT_C +void +xmlSecKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE *output) { + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(data->id->debugXmlDump != NULL); + xmlSecAssert(output != NULL); + + data->id->debugXmlDump(data, output); +} + +/************************************************************************** + * + * xmlSecKeyDataBinary methods + * + * key (xmlSecBuffer) is located after xmlSecKeyData structure + * + *************************************************************************/ +/** + * xmlSecKeyDataBinaryValueInitialize: + * @data: the pointer to binary key data. + * + * Initializes key data. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueInitialize(xmlSecKeyDataPtr data) { + xmlSecBufferPtr buffer; + int ret; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), -1); + + /* initialize buffer */ + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer != NULL, -1); + + ret = xmlSecBufferInitialize(buffer, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataBinaryValueDuplicate: + * @dst: the pointer to destination binary key data. + * @src: the pointer to source binary key data. + * + * Copies binary key data from @src to @dst. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + xmlSecBufferPtr buffer; + int ret; + + xmlSecAssert2(xmlSecKeyDataIsValid(dst), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(dst, xmlSecKeyDataBinarySize), -1); + xmlSecAssert2(xmlSecKeyDataIsValid(src), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(src, xmlSecKeyDataBinarySize), -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(src); + xmlSecAssert2(buffer != NULL, -1); + + /* copy data */ + ret = xmlSecKeyDataBinaryValueSetBuffer(dst, + xmlSecBufferGetData(buffer), + xmlSecBufferGetSize(buffer)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "xmlSecKeyDataBinaryValueSetBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataBinaryValueFinalize: + * @data: the pointer to binary key data. + * + * Cleans up binary key data. + */ +EXPORT_C +void +xmlSecKeyDataBinaryValueFinalize(xmlSecKeyDataPtr data) { + xmlSecBufferPtr buffer; + + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize)); + + /* initialize buffer */ + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert(buffer != NULL); + + xmlSecBufferFinalize(buffer); +} + +/** + * xmlSecKeyDataBinaryValueXmlRead: + * @id: the data klass. + * @key: the pointer to destination key. + * @node: the pointer to an XML node. + * @keyInfoCtx: the pointer to element processing context. + * + * Reads binary key data from @node to the key by base64 decoding the @node content. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlChar* str; + xmlSecSize len; + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + + str = xmlNodeGetContent(node); + if(str == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* usual trick: decode into the same buffer */ + ret = xmlSecBase64Decode(str, (xmlSecByte*)str, xmlStrlen(str)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecBase64Decode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(str); + return(-1); + } + len = ret; + + /* check do we have a key already */ + data = xmlSecKeyGetValue(key); + if(data != NULL) { + xmlSecBufferPtr buffer; + + if(!xmlSecKeyDataCheckId(data, id)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(str); + return(-1); + } + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != len)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + "cur-data-size=%d;new-data-size=%d", + xmlSecBufferGetSize(buffer), len); + xmlFree(str); + return(-1); + } + if((buffer != NULL) && (len > 0) && (memcmp(xmlSecBufferGetData(buffer), str, len) != 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + "key already has a different value"); + xmlFree(str); + return(-1); + } + if(buffer != NULL) { + /* we already have exactly the same key */ + xmlFree(str); + return(0); + } + + /* we have binary key value with empty buffer */ + } + + + data = xmlSecKeyDataCreate(id); + if(data == NULL ) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(str); + return(-1); + } + + ret = xmlSecKeyDataBinaryValueSetBuffer(data, (xmlSecByte*)str, len); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataBinaryValueSetBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", len); + xmlSecKeyDataDestroy(data); + xmlFree(str); + return(-1); + } + xmlFree(str); + + if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), data) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyReqMatchKeyValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(0); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataBinaryValueXmlWrite: + * @id: the data klass. + * @key: the pointer to source key. + * @node: the pointer to an XML node. + * @keyInfoCtx: the pointer to element processing context. + * + * Base64 encodes binary key data of klass @id from the @key and + * sets to the @node content. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecBufferPtr buffer; + xmlSecKeyDataPtr value; + xmlChar* str; + + xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + + if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) { + /* we can have only symmetric key */ + return(0); + } + + value = xmlSecKeyGetValue(key); + xmlSecAssert2(xmlSecKeyDataIsValid(value), -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(value); + xmlSecAssert2(buffer != NULL, -1); + + str = xmlSecBase64Encode(xmlSecBufferGetData(buffer), + xmlSecBufferGetSize(buffer), + keyInfoCtx->base64LineSize); + if(str == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlNodeSetContent(node, str); + xmlFree(str); + return(0); +} + +/** + * xmlSecKeyDataBinaryValueBinRead: + * @id: the data klass. + * @key: the pointer to destination key. + * @buf: the source binary buffer. + * @bufSize: the source binary buffer size. + * @keyInfoCtx: the pointer to element processing context. + * + * Reads binary key data of the klass @id from @buf to the @key. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + const xmlSecByte* buf, xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(bufSize > 0, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + + /* check do we have a key already */ + data = xmlSecKeyGetValue(key); + if(data != NULL) { + xmlSecBufferPtr buffer; + + if(!xmlSecKeyDataCheckId(data, id)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != bufSize)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + "cur-data-size=%d;new-data-size=%d", + xmlSecBufferGetSize(buffer), bufSize); + return(-1); + } + if((buffer != NULL) && (bufSize > 0) && (memcmp(xmlSecBufferGetData(buffer), buf, bufSize) != 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, + "key already has a different value"); + return(-1); + } + if(buffer != NULL) { + /* we already have exactly the same key */ + return(0); + } + + /* we have binary key value with empty buffer */ + } + + data = xmlSecKeyDataCreate(id); + if(data == NULL ) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecKeyDataBinaryValueSetBuffer(data, buf, bufSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataBinaryValueSetBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", bufSize); + xmlSecKeyDataDestroy(data); + return(-1); + } + + if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), data) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyReqMatchKeyValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(0); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(-1); + } + + return(0); +} + +/** + * xmlSecKeyDataBinaryValueBinWrite: + * @id: the data klass. + * @key: the pointer to source key. + * @buf: the destination binary buffer. + * @bufSize: the destination binary buffer size. + * @keyInfoCtx: the pointer to element processing context. + * + * Writes binary key data of klass @id from the @key to @buf. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlSecByte** buf, xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr value; + xmlSecBufferPtr buffer; + + xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(bufSize != NULL, -1); + xmlSecAssert2(keyInfoCtx != NULL, -1); + + if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) { + /* we can have only symmetric key */ + return(0); + } + + value = xmlSecKeyGetValue(key); + xmlSecAssert2(xmlSecKeyDataIsValid(value), -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(key->value); + xmlSecAssert2(buffer != NULL, -1); + + (*bufSize) = xmlSecBufferGetSize(buffer); + (*buf) = (xmlSecByte*) xmlMalloc((*bufSize)); + if((*buf) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + memcpy((*buf), xmlSecBufferGetData(buffer), (*bufSize)); + return(0); +} + +/** + * xmlSecKeyDataBinaryValueDebugDump: + * @data: the pointer to binary key data. + * @output: the pointer to output FILE. + * + * Prints binary key data debug information to @output. + */ +EXPORT_C +void +xmlSecKeyDataBinaryValueDebugDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecBufferPtr buffer; + + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize)); + xmlSecAssert(data->id->dataNodeName != NULL); + xmlSecAssert(output != NULL); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert(buffer != NULL); + + /* print only size, everything else is sensitive */ + fprintf(output, "=== %s: size=%d\n", data->id->dataNodeName, + xmlSecKeyDataGetSize(data)); +} + +/** + * xmlSecKeyDataBinaryValueDebugXmlDump: + * @data: the pointer to binary key data. + * @output: the pointer to output FILE. + * + * Prints binary key data debug information to @output in XML format. + */ +EXPORT_C +void +xmlSecKeyDataBinaryValueDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecBufferPtr buffer; + + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize)); + xmlSecAssert(data->id->dataNodeName != NULL); + xmlSecAssert(output != NULL); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert(buffer != NULL); + + /* print only size, everything else is sensitive */ + fprintf(output, "<%s size=\"%d\" />\n", data->id->dataNodeName, + xmlSecKeyDataGetSize(data)); +} + +/** + * xmlSecKeyDataBinaryValueGetSize: + * @data: the pointer to binary key data. + * + * Gets the binary key data size. + * + * Returns binary key data size in bits. + */ +EXPORT_C +xmlSecSize +xmlSecKeyDataBinaryValueGetSize(xmlSecKeyDataPtr data) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), 0); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), 0); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer != NULL, 0); + + /* return size in bits */ + return(8 * xmlSecBufferGetSize(buffer)); +} + +/** + * xmlSecKeyDataBinaryValueGetBuffer: + * @data: the pointer to binary key data. + * + * Gets the binary key data buffer. + * + * Returns pointer to binary key data buffer. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), NULL); + + /* key (xmlSecBuffer) is located after xmlSecKeyData structure */ + return((xmlSecBufferPtr)(((xmlSecByte*)data) + sizeof(xmlSecKeyData))); +} + +/** + * xmlSecKeyDataBinaryValueSetBuffer: + * @data: the pointer to binary key data. + * @buf: the pointer to binary buffer. + * @bufSize: the binary buffer size. + * + * Sets the value of @data to @buf. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecKeyDataBinaryValueSetBuffer(xmlSecKeyDataPtr data, + const xmlSecByte* buf, xmlSecSize bufSize) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), -1); + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(bufSize > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer != NULL, -1); + + return(xmlSecBufferSetData(buffer, buf, bufSize)); +} + +/*********************************************************************** + * + * Keys Data list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecKeyDataListKlass = { + BAD_CAST "key-data-list", + (xmlSecPtrDuplicateItemMethod)xmlSecKeyDataDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecKeyDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecKeyDataListGetKlass: + * + * The key data list klass. + * + * Returns pointer to the key data list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecKeyDataListGetKlass(void) { + return(&xmlSecKeyDataListKlass); +} + + +/*********************************************************************** + * + * Keys Data Ids list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecKeyDataIdListKlass = { + BAD_CAST "key-data-ids-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecKeyDataIdListGetKlass: + * + * The key data id list klass. + * + * Returns pointer to the key data id list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecKeyDataIdListGetKlass(void) { + return(&xmlSecKeyDataIdListKlass); +} + +/** + * xmlSecKeyDataIdListFind: + * @list: the pointer to key data ids list. + * @dataId: the key data klass. + * + * Lookups @dataId in @list. + * + * Returns 1 if @dataId is found in the @list, 0 if not and a negative + * value if an error occurs. + */ +EXPORT_C +int +xmlSecKeyDataIdListFind(xmlSecPtrListPtr list, xmlSecKeyDataId dataId) { + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), 0); + xmlSecAssert2(dataId != NULL, 0); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + if((xmlSecKeyDataId)xmlSecPtrListGetItem(list, i) == dataId) { + return(1); + } + } + return(0); +} + +/** + * xmlSecKeyDataIdListFindByNode: + * @list: the pointer to key data ids list. + * @nodeName: the desired key data klass XML node name. + * @nodeNs: the desired key data klass XML node namespace. + * @usage: the desired key data usage. + * + * Lookups data klass in the list with given @nodeName, @nodeNs and + * @usage in the @list. + * + * Returns key data klass is found and NULL otherwise. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName, + const xmlChar* nodeNs, xmlSecKeyDataUsage usage) { + xmlSecKeyDataId dataId; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown); + xmlSecAssert2(nodeName != NULL, xmlSecKeyDataIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown); + + if(((usage & dataId->usage) != 0) && + xmlStrEqual(nodeName, dataId->dataNodeName) && + xmlStrEqual(nodeNs, dataId->dataNodeNs)) { + + return(dataId); + } + } + return(xmlSecKeyDataIdUnknown); +} + +/** + * xmlSecKeyDataIdListFindByHref: + * @list: the pointer to key data ids list. + * @href: the desired key data klass href. + * @usage: the desired key data usage. + * + * Lookups data klass in the list with given @href and @usage in @list. + * + * Returns key data klass is found and NULL otherwise. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href, + xmlSecKeyDataUsage usage) { + xmlSecKeyDataId dataId; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown); + xmlSecAssert2(href != NULL, xmlSecKeyDataIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown); + + if(((usage & dataId->usage) != 0) && (dataId->href != NULL) && + xmlStrEqual(href, dataId->href)) { + + return(dataId); + } + } + return(xmlSecKeyDataIdUnknown); +} + +/** + * xmlSecKeyDataIdListFindByName: + * @list: the pointer to key data ids list. + * @name: the desired key data klass name. + * @usage: the desired key data usage. + * + * Lookups data klass in the list with given @name and @usage in @list. + * + * Returns key data klass is found and NULL otherwise. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecKeyDataIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name, + xmlSecKeyDataUsage usage) { + xmlSecKeyDataId dataId; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown); + xmlSecAssert2(name != NULL, xmlSecKeyDataIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown); + + if(((usage & dataId->usage) != 0) && (dataId->name != NULL) && + xmlStrEqual(name, BAD_CAST dataId->name)) { + + return(dataId); + } + } + return(xmlSecKeyDataIdUnknown); +} + +/** + * xmlSecKeyDataIdListDebugDump: + * @list: the pointer to key data ids list. + * @output: the pointer to output FILE. + * + * Prints binary key data debug information to @output. + */ +EXPORT_C +void +xmlSecKeyDataIdListDebugDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecKeyDataId dataId; + xmlSecSize i, size; + + xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId)); + xmlSecAssert(output != NULL); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i); + xmlSecAssert(dataId != NULL); + xmlSecAssert(dataId->name != NULL); + + if(i > 0) { + fprintf(output, ",\"%s\"", dataId->name); + } else { + fprintf(output, "\"%s\"", dataId->name); + } + } + fprintf(output, "\n"); +} + +/** + * xmlSecKeyDataIdListDebugXmlDump: + * @list: the pointer to key data ids list. + * @output: the pointer to output FILE. + * + * Prints binary key data debug information to @output in XML format. + */ +EXPORT_C +void +xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecKeyDataId dataId; + xmlSecSize i, size; + + xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId)); + xmlSecAssert(output != NULL); + + fprintf(output, "\n"); + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i); + xmlSecAssert(dataId != NULL); + xmlSecAssert(dataId->name != NULL); + + fprintf(output, "", dataId->name); + } + fprintf(output, "\n"); +} + +/************************************************************************** + * + * xmlSecKeyDataStore functions + * + *************************************************************************/ +/** + * xmlSecKeyDataStoreCreate: + * @id: the store id. + * + * Creates new key data store of the specified klass @id. Caller is responsible + * for freeng returned object with #xmlSecKeyDataStoreDestroy function. + * + * Returns the pointer to newly allocated key data store structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataStorePtr +xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id) { + xmlSecKeyDataStorePtr store; + int ret; + + xmlSecAssert2(id != NULL, NULL); + xmlSecAssert2(id->objSize > 0, NULL); + + /* Allocate a new xmlSecKeyDataStore and fill the fields. */ + store = (xmlSecKeyDataStorePtr)xmlMalloc(id->objSize); + if(store == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", id->objSize); + return(NULL); + } + memset(store, 0, id->objSize); + store->id = id; + + if(id->initialize != NULL) { + ret = (id->initialize)(store); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)), + "id->initialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataStoreDestroy(store); + return(NULL); + } + } + + return(store); +} + +/** + * xmlSecKeyDataStoreDestroy: + * @store: the pointer to the key data store.. + * + * Destroys the key data store created with #xmlSecKeyDataStoreCreate + * function. + */ +EXPORT_C +void +xmlSecKeyDataStoreDestroy(xmlSecKeyDataStorePtr store) { + xmlSecAssert(xmlSecKeyDataStoreIsValid(store)); + xmlSecAssert(store->id->objSize > 0); + + if(store->id->finalize != NULL) { + (store->id->finalize)(store); + } + memset(store, 0, store->id->objSize); + xmlFree(store); +} + +/*********************************************************************** + * + * Keys Data Store list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecKeyDataStorePtrListKlass = { + BAD_CAST "keys-data-store-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecKeyDataStoreDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecKeyDataStorePtrListGetKlass: + * + * Key data stores list. + * + * Returns key data stores list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecKeyDataStorePtrListGetKlass(void) { + return(&xmlSecKeyDataStorePtrListKlass); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_keysmngr.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_keysmngr.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,760 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Keys Manager + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_list.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_errors.h" + + +/**************************************************************************** + * + * Keys Manager + * + ***************************************************************************/ +/** + * xmlSecKeysMngrCreate: + * + * Creates new keys manager. Caller is responsible for freeing it with + * #xmlSecKeysMngrDestroy function. + * + * Returns the pointer to newly allocated keys manager or NULL if + * an error occurs. + */ +EXPORT_C +xmlSecKeysMngrPtr +xmlSecKeysMngrCreate(void) { + xmlSecKeysMngrPtr mngr; + int ret; + + /* Allocate a new xmlSecKeysMngr and fill the fields. */ + mngr = (xmlSecKeysMngrPtr)xmlMalloc(sizeof(xmlSecKeysMngr)); + if(mngr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecKeysMngr)=%d", + sizeof(xmlSecKeysMngr)); + return(NULL); + } + memset(mngr, 0, sizeof(xmlSecKeysMngr)); + + ret = xmlSecPtrListInitialize(&(mngr->storesList), xmlSecKeyDataStorePtrListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyDataStorePtrListId"); + return(NULL); + } + + return(mngr); +} + +/** + * xmlSecKeysMngrDestroy: + * @mngr: the pointer to keys manager. + * + * Destroys keys manager created with #xmlSecKeysMngrCreate function. + */ +EXPORT_C +void +xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) { + xmlSecAssert(mngr != NULL); + + /* destroy keys store */ + if(mngr->keysStore != NULL) { + xmlSecKeyStoreDestroy(mngr->keysStore); + } + + /* destroy other data stores */ + xmlSecPtrListFinalize(&(mngr->storesList)); + + memset(mngr, 0, sizeof(xmlSecKeysMngr)); + xmlFree(mngr); +} + +/** + * xmlSecKeysMngrFindKey: + * @mngr: the pointer to keys manager. + * @name: the desired key name. + * @keyInfoCtx: the pointer to node processing context. + * + * Lookups key in the keys manager keys store. The caller is responsible + * for destroying the returned key using #xmlSecKeyDestroy method. + * + * Returns the pointer to a key or NULL if key is not found or an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeysMngrFindKey(xmlSecKeysMngrPtr mngr, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyStorePtr store; + + xmlSecAssert2(mngr != NULL, NULL); + xmlSecAssert2(keyInfoCtx != NULL, NULL); + + store = xmlSecKeysMngrGetKeysStore(mngr); + if(store == NULL) { + return(NULL); + } + + return(xmlSecKeyStoreFindKey(store, name, keyInfoCtx)); +} + +/** + * xmlSecKeysMngrAdoptKeysStore: + * @mngr: the pointer to keys manager. + * @store: the pointer to keys store. + * + * Adopts keys store in the keys manager @mngr. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store) { + xmlSecAssert2(mngr != NULL, -1); + xmlSecAssert2(xmlSecKeyStoreIsValid(store), -1); + + if(mngr->keysStore != NULL) { + xmlSecKeyStoreDestroy(mngr->keysStore); + } + mngr->keysStore = store; + + return(0); +} + +/** + * xmlSecKeysMngrGetKeysStore: + * @mngr: the pointer to keys manager. + * + * Gets the keys store. + * + * Returns the keys store in the keys manager @mngr or NULL if + * there is no store or an error occurs. + */ +EXPORT_C +xmlSecKeyStorePtr +xmlSecKeysMngrGetKeysStore(xmlSecKeysMngrPtr mngr) { + xmlSecAssert2(mngr != NULL, NULL); + + return(mngr->keysStore); +} + +/** + * xmlSecKeysMngrAdoptDataStore: + * @mngr: the pointer to keys manager. + * @store: the pointer to data store. + * + * Adopts data store in the keys manager. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store) { + xmlSecKeyDataStorePtr tmp; + xmlSecSize pos, size; + + xmlSecAssert2(mngr != NULL, -1); + xmlSecAssert2(xmlSecKeyDataStoreIsValid(store), -1); + + size = xmlSecPtrListGetSize(&(mngr->storesList)); + for(pos = 0; pos < size; ++pos) { + tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos); + if((tmp != NULL) && (tmp->id == store->id)) { + return(xmlSecPtrListSet(&(mngr->storesList), store, pos)); + } + } + + return(xmlSecPtrListAdd(&(mngr->storesList), store)); +} + + +/** + * xmlSecKeysMngrGetDataStore: + * @mngr: the pointer to keys manager. + * @id: the desired data store klass. + * + * Lookups the data store of given klass @id in the keys manager. + * + * Returns pointer to data store or NULL if it is not found or an error + * occurs. + */ +EXPORT_C +xmlSecKeyDataStorePtr +xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id) { + xmlSecKeyDataStorePtr tmp; + xmlSecSize pos, size; + + xmlSecAssert2(mngr != NULL, NULL); + xmlSecAssert2(id != xmlSecKeyDataStoreIdUnknown, NULL); + + size = xmlSecPtrListGetSize(&(mngr->storesList)); + for(pos = 0; pos < size; ++pos) { + tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos); + if((tmp != NULL) && (tmp->id == id)) { + return(tmp); + } + } + + return(NULL); +} + +/************************************************************************** + * + * xmlSecKeyStore functions + * + *************************************************************************/ +/** + * xmlSecKeyStoreCreate: + * @id: the key store klass. + * + * Creates new store of the specified klass @klass. Caller is responsible + * for freeing the returned store by calling #xmlSecKeyStoreDestroy function. + * + * Returns the pointer to newly allocated keys store or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyStorePtr +xmlSecKeyStoreCreate(xmlSecKeyStoreId id) { + xmlSecKeyStorePtr store; + int ret; + + xmlSecAssert2(id != NULL, NULL); + xmlSecAssert2(id->objSize > 0, NULL); + + /* Allocate a new xmlSecKeyStore and fill the fields. */ + store = (xmlSecKeyStorePtr)xmlMalloc(id->objSize); + if(store == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", id->objSize); + return(NULL); + } + memset(store, 0, id->objSize); + store->id = id; + + if(id->initialize != NULL) { + ret = (id->initialize)(store); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)), + "id->initialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyStoreDestroy(store); + return(NULL); + } + } + + return(store); +} + +/** + * xmlSecKeyStoreDestroy: + * @store: the pointer to keys store. + * + * Destroys the store created with #xmlSecKeyStoreCreate function. + */ +EXPORT_C +void +xmlSecKeyStoreDestroy(xmlSecKeyStorePtr store) { + xmlSecAssert(xmlSecKeyStoreIsValid(store)); + xmlSecAssert(store->id->objSize > 0); + + if(store->id->finalize != NULL) { + (store->id->finalize)(store); + } + memset(store, 0, store->id->objSize); + xmlFree(store); +} + +/** + * xmlSecKeyStoreFindKey: + * @store: the pointer to keys store. + * @name: the desired key name. + * @keyInfoCtx: the pointer to node processing context. + * + * Lookups key in the store. The caller is responsible for destroying + * the returned key using #xmlSecKeyDestroy method. + * + * Returns the pointer to a key or NULL if key is not found or an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(xmlSecKeyStoreIsValid(store), NULL); + xmlSecAssert2(store->id->findKey != NULL, NULL); + xmlSecAssert2(keyInfoCtx != NULL, NULL); + + return(store->id->findKey(store, name, keyInfoCtx)); +} + +/**************************************************************************** + * + * Simple Keys Store + * + * keys list (xmlSecPtrList) is located after xmlSecKeyStore + * + ***************************************************************************/ +#define xmlSecSimpleKeysStoreSize \ + (sizeof(xmlSecKeyStore) + sizeof(xmlSecPtrList)) +#define xmlSecSimpleKeysStoreGetList(store) \ + ((xmlSecKeyStoreCheckSize((store), xmlSecSimpleKeysStoreSize)) ? \ + (xmlSecPtrListPtr)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \ + (xmlSecPtrListPtr)NULL) + +static int xmlSecSimpleKeysStoreInitialize (xmlSecKeyStorePtr store); +static void xmlSecSimpleKeysStoreFinalize (xmlSecKeyStorePtr store); +static xmlSecKeyPtr xmlSecSimpleKeysStoreFindKey (xmlSecKeyStorePtr store, + const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +static xmlSecKeyStoreKlass xmlSecSimpleKeysStoreKlass = { + sizeof(xmlSecKeyStoreKlass), + xmlSecSimpleKeysStoreSize, + + /* data */ + BAD_CAST "simple-keys-store", /* const xmlChar* name; */ + + /* constructors/destructor */ + xmlSecSimpleKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */ + xmlSecSimpleKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */ + xmlSecSimpleKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSimpleKeysStoreGetKlass: + * + * The simple list based keys store klass. + * + * Returns simple list based keys store klass. + */ +EXPORT_C +xmlSecKeyStoreId +xmlSecSimpleKeysStoreGetKlass(void) { + return(&xmlSecSimpleKeysStoreKlass); +} + +/** + * xmlSecSimpleKeysStoreAdoptKey: + * @store: the pointer to simple keys store. + * @key: the pointer to key. + * + * Adds @key to the @store. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) { + xmlSecPtrListPtr list; + int ret; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1); + xmlSecAssert2(key != NULL, -1); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyPtrListId), -1); + + ret = xmlSecPtrListAdd(list, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecSimpleKeysStoreLoad: + * @store: the pointer to simple keys store. + * @uri: the filename. + * @keysMngr: the pointer to associated keys manager. + * + * Reads keys from an XML file. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, + xmlSecKeysMngrPtr keysMngr) { + xmlDocPtr doc; + xmlNodePtr root; + xmlNodePtr cur; + xmlSecKeyPtr key; + xmlSecKeyInfoCtx keyInfoCtx; + int ret; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1); + xmlSecAssert2(uri != NULL, -1); + + doc = xmlParseFile(uri); + if(doc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlParseFile", + XMLSEC_ERRORS_R_XML_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + return(-1); + } + + root = xmlDocGetRootElement(doc); + if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + xmlSecErrorsSafeString(xmlSecNodeGetName(root)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected-node="); + xmlFreeDoc(doc); + return(-1); + } + + cur = xmlSecGetNextElementNode(root->children); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) { + key = xmlSecKeyCreate(); + if(key == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected-node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyInfo)); + xmlFreeDoc(doc); + return(-1); + } + + ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(key); + xmlFreeDoc(doc); + return(-1); + } + + keyInfoCtx.mode = xmlSecKeyInfoModeRead; + keyInfoCtx.keysMngr = keysMngr; + keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND | + XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS; + keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown; + keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny; + keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny; + + ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecKeyInfoNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + xmlSecKeyDestroy(key); + xmlFreeDoc(doc); + return(-1); + } + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + + if(xmlSecKeyIsValid(key)) { + ret = xmlSecSimpleKeysStoreAdoptKey(store, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecSimpleKeysStoreAdoptKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(key); + xmlFreeDoc(doc); + return(-1); + } + } else { + /* we have an unknown key in our file, just ignore it */ + xmlSecKeyDestroy(key); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(doc); + return(-1); + } + + xmlFreeDoc(doc); + return(0); + +} + +/** + * xmlSecSimpleKeysStoreSave: + * @store: the pointer to simple keys store. + * @filename: the filename. + * @type: the saved keys type (public, private, ...). + * + * Writes keys from @store to an XML file. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecKeyDataType type) { + xmlSecKeyInfoCtx keyInfoCtx; + xmlSecPtrListPtr list; + xmlSecKeyPtr key; + xmlSecSize i, keysSize; + xmlDocPtr doc; + xmlNodePtr cur; + xmlSecKeyDataPtr data; + xmlSecPtrListPtr idsList; + xmlSecKeyDataId dataId; + xmlSecSize idsSize, j; + int ret; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1); + xmlSecAssert2(filename != NULL, -1); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyPtrListId), -1); + + /* create doc */ + doc = xmlSecCreateTree(BAD_CAST "Keys", xmlSecNs); + if(doc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecCreateTree", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + idsList = xmlSecKeyDataIdsGet(); + xmlSecAssert2(idsList != NULL, -1); + + keysSize = xmlSecPtrListGetSize(list); + idsSize = xmlSecPtrListGetSize(idsList); + for(i = 0; i < keysSize; ++i) { + key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(key != NULL, -1); + + cur = xmlSecAddChild(xmlDocGetRootElement(doc), xmlSecNodeKeyInfo, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyInfo)); + xmlFreeDoc(doc); + return(-1); + } + + /* special data key name */ + if(xmlSecKeyGetName(key) != NULL) { + if(xmlSecAddChild(cur, xmlSecNodeKeyName, xmlSecDSigNs) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyName)); + xmlFreeDoc(doc); + return(-1); + } + } + + /* create nodes for other keys data */ + for(j = 0; j < idsSize; ++j) { + dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(idsList, j); + xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, -1); + + if(dataId->dataNodeName == NULL) { + continue; + } + + data = xmlSecKeyGetData(key, dataId); + if(data == NULL) { + continue; + } + + if(xmlSecAddChild(cur, dataId->dataNodeName, dataId->dataNodeNs) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(dataId->dataNodeName)); + xmlFreeDoc(doc); + return(-1); + } + } + + ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(doc); + return(-1); + } + + keyInfoCtx.mode = xmlSecKeyInfoModeWrite; + keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown; + keyInfoCtx.keyReq.keyType = type; + keyInfoCtx.keyReq.keyUsage = xmlSecKeyDataUsageAny; + + /* finally write key in the node */ + ret = xmlSecKeyInfoNodeWrite(cur, key, &keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecKeyInfoNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + xmlFreeDoc(doc); + return(-1); + } + xmlSecKeyInfoCtxFinalize(&keyInfoCtx); + } + + /* now write result */ + ret = xmlSaveFormatFile(filename, doc, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSaveFormatFile", + XMLSEC_ERRORS_R_XML_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + xmlFreeDoc(doc); + return(-1); + } + + xmlFreeDoc(doc); + return(0); +} + +/** + * xmlSecSimpleKeysStoreGetKeys: + * @store: the pointer to simple keys store. + * + * Returns pointer to the list of keys stored in the keys store or NULL + * if an error occurs. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecSimpleKeysStoreGetKeys(xmlSecKeyStorePtr store) { + xmlSecPtrListPtr list; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), NULL); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyPtrListId), NULL); + + return list; +} + +static int +xmlSecSimpleKeysStoreInitialize(xmlSecKeyStorePtr store) { + xmlSecPtrListPtr list; + int ret; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert2(list != NULL, -1); + + ret = xmlSecPtrListInitialize(list, xmlSecKeyPtrListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecKeyPtrListId"); + return(-1); + } + + return(0); +} + +static void +xmlSecSimpleKeysStoreFinalize(xmlSecKeyStorePtr store) { + xmlSecPtrListPtr list; + + xmlSecAssert(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId)); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert(list != NULL); + + xmlSecPtrListFinalize(list); +} + +static xmlSecKeyPtr +xmlSecSimpleKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecPtrListPtr list; + xmlSecKeyPtr key; + xmlSecSize pos, size; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), NULL); + xmlSecAssert2(keyInfoCtx != NULL, NULL); + + list = xmlSecSimpleKeysStoreGetList(store); + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyPtrListId), NULL); + + size = xmlSecPtrListGetSize(list); + for(pos = 0; pos < size; ++pos) { + key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, pos); + if((key != NULL) && (xmlSecKeyMatch(key, name, &(keyInfoCtx->keyReq)) == 1)) { + return(xmlSecKeyDuplicate(key)); + } + } + return(NULL); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_list.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_list.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,526 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * List of pointers. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_list.h" +#include "xmlsec_errors.h" + + +static int xmlSecPtrListEnsureSize (xmlSecPtrListPtr list, + xmlSecSize size); + +static xmlSecAllocMode gAllocMode = xmlSecAllocModeDouble; +static xmlSecSize gInitialSize = 64; + +/** + * xmlSecPtrListSetDefaultAllocMode: + * @defAllocMode: the new default memory allocation mode. + * @defInitialSize: the new default minimal initial size. + * + * Sets new default allocation mode and minimal initial list size. + */ +EXPORT_C +void +xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInitialSize) { + xmlSecAssert(defInitialSize > 0); + + gAllocMode = defAllocMode; + gInitialSize = defInitialSize; +} + +/** + * xmlSecPtrListCreate: + * @id: the list klass. + * + * Creates new list object. Caller is responsible for freeing returned list + * by calling #xmlSecPtrListDestroy function. + * + * Returns pointer to newly allocated list or NULL if an error occurs. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecPtrListCreate(xmlSecPtrListId id) { + xmlSecPtrListPtr list; + int ret; + + xmlSecAssert2(id != xmlSecPtrListIdUnknown, NULL); + + /* Allocate a new xmlSecPtrList and fill the fields. */ + list = (xmlSecPtrListPtr)xmlMalloc(sizeof(xmlSecPtrList)); + if(list == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecPtrList)=%d", + sizeof(xmlSecPtrList)); + return(NULL); + } + + ret = xmlSecPtrListInitialize(list, id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)), + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(list); + return(NULL); + } + + return(list); +} + +/** + * xmlSecPtrListDestroy: + * @list: the pointer to list. + * + * Destroys @list created with #xmlSecPtrListCreate function. + */ +EXPORT_C +void +xmlSecPtrListDestroy(xmlSecPtrListPtr list) { + xmlSecAssert(xmlSecPtrListIsValid(list)); + xmlSecPtrListFinalize(list); + xmlFree(list); +} + +/** + * xmlSecPtrListInitialize: + * @list: the pointer to list. + * @id: the list klass. + * + * Initializes the list of given klass. Caller is responsible + * for cleaning up by calling #xmlSecPtrListFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecPtrListInitialize(xmlSecPtrListPtr list, xmlSecPtrListId id) { + xmlSecAssert2(id != xmlSecPtrListIdUnknown, -1); + xmlSecAssert2(list != NULL, -1); + + memset(list, 0, sizeof(xmlSecPtrList)); + list->id = id; + list->allocMode = gAllocMode; + + return(0); +} + +/** + * xmlSecPtrListFinalize: + * @list: the pointer to list. + * + * Cleans up the list initialized with #xmlSecPtrListInitialize + * function. + */ +EXPORT_C +void +xmlSecPtrListFinalize(xmlSecPtrListPtr list) { + xmlSecAssert(xmlSecPtrListIsValid(list)); + + xmlSecPtrListEmpty(list); + memset(list, 0, sizeof(xmlSecPtrList)); +} + +/** + * xmlSecPtrListEmpty: + * @list: the pointer to list. + * + * Remove all items from @list (if any). + */ +EXPORT_C +void +xmlSecPtrListEmpty(xmlSecPtrListPtr list) { + xmlSecAssert(xmlSecPtrListIsValid(list)); + + if(list->id->destroyItem != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < list->use; ++pos) { + xmlSecAssert(list->data != NULL); + if(list->data[pos] != NULL) { + list->id->destroyItem(list->data[pos]); + } + } + } + if(list->max > 0) { + xmlSecAssert(list->data != NULL); + + memset(list->data, 0, sizeof(xmlSecPtr) * list->use); + xmlFree(list->data); + } + list->max = list->use = 0; + list->data = NULL; +} + +/** + * xmlSecPtrListCopy: + * @dst: the pointer to destination list. + * @src: the pointer to source list. + * + * Copies @src list items to @dst list using #duplicateItem method + * of the list klass. If #duplicateItem method is NULL then + * we jsut copy pointers to items. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) { + xmlSecSize i; + int ret; + + xmlSecAssert2(xmlSecPtrListIsValid(dst), -1); + xmlSecAssert2(xmlSecPtrListIsValid(src), -1); + xmlSecAssert2(dst->id == src->id, -1); + + /* allocate memory */ + ret = xmlSecPtrListEnsureSize(dst, dst->use + src->use); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(src)), + "xmlSecPtrListEnsureSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", src->use); + return(-1); + } + + /* copy one item after another */ + for(i = 0; i < src->use; ++i, ++dst->use) { + xmlSecAssert2(src->data != NULL, -1); + xmlSecAssert2(dst->data != NULL, -1); + + if((dst->id->duplicateItem != NULL) && (src->data[i] != NULL)) { + dst->data[dst->use] = dst->id->duplicateItem(src->data[i]); + if(dst->data[dst->use] == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(src)), + "duplicateItem", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + dst->data[dst->use] = src->data[i]; + } + } + + return(0); +} + +/** + * xmlSecPtrListDuplicate: + * @list: the pointer to list. + * + * Creates a new copy of @list and all its items. + * + * Returns pointer to newly allocated list or NULL if an error occurs. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecPtrListDuplicate(xmlSecPtrListPtr list) { + xmlSecPtrListPtr newList; + int ret; + + xmlSecAssert2(xmlSecPtrListIsValid(list), NULL); + + newList = xmlSecPtrListCreate(list->id); + if(newList == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(list)), + "xmlSecPtrListCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ret = xmlSecPtrListCopy(newList, list); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(list)), + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecPtrListDestroy(newList); + return(NULL); + } + return(newList); +} + +/** + * xmlSecPtrListGetSize: + * @list: the pointer to list. + * + * Gets list size. + * + * Returns the number of itmes in @list. + */ +EXPORT_C +xmlSecSize +xmlSecPtrListGetSize(xmlSecPtrListPtr list) { + xmlSecAssert2(xmlSecPtrListIsValid(list), 0); + + return(list->use); +} + +/** + * xmlSecPtrListGetItem: + * @list: the pointer to list. + * @pos: the item position. + * + * Gets item from the list. + * + * Returns the list item at position @pos or NULL if @pos is greater + * than the number of items in the list or an error occurs. + */ +EXPORT_C +xmlSecPtr +xmlSecPtrListGetItem(xmlSecPtrListPtr list, xmlSecSize pos) { + xmlSecAssert2(xmlSecPtrListIsValid(list), NULL); + xmlSecAssert2(list->data != NULL, NULL); + xmlSecAssert2(pos < list->use, NULL); + + return(list->data[pos]); +} + +/** + * xmlSecPtrListAdd: + * @list: the pointer to list. + * @item: the item. + * + * Adds @item to the end of the @list. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) { + int ret; + + xmlSecAssert2(xmlSecPtrListIsValid(list), -1); + + ret = xmlSecPtrListEnsureSize(list, list->use + 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(list)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", list->use + 1); + return(-1); + } + + list->data[list->use++] = item; + return(0); +} + +/** + * xmlSecPtrListSet: + * @list: the pointer to list. + * @item: the item. + * @pos: the pos. + * + * Sets the value of list item at position @pos. The old value + * is destroyed. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos) { + xmlSecAssert2(xmlSecPtrListIsValid(list), -1); + xmlSecAssert2(list->data != NULL, -1); + xmlSecAssert2(pos < list->use, -1); + + if((list->id->destroyItem != NULL) && (list->data[pos] != NULL)) { + list->id->destroyItem(list->data[pos]); + } + list->data[pos] = item; + return(0); +} + +/** + * xmlSecPtrListRemove: + * @list: the pointer to list. + * @pos: the position. + * + * Destroys list item at the position @pos and sets it value to NULL. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecPtrListRemove(xmlSecPtrListPtr list, xmlSecSize pos) { + xmlSecAssert2(xmlSecPtrListIsValid(list), -1); + xmlSecAssert2(list->data != NULL, -1); + xmlSecAssert2(pos < list->use, -1); + + if((list->id->destroyItem != NULL) && (list->data[pos] != NULL)) { + list->id->destroyItem(list->data[pos]); + } + list->data[pos] = NULL; + if(pos == list->use - 1) { + --list->use; + } + return(0); +} + +/** + * xmlSecPtrListDebugDump: + * @list: the pointer to list. + * @output: the pointer to output FILE. + * + * Prints debug information about @list to the @output. + */ +EXPORT_C +void +xmlSecPtrListDebugDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecAssert(xmlSecPtrListIsValid(list)); + xmlSecAssert(output != NULL); + + fprintf(output, "=== list size: %d\n", list->use); + if(list->id->debugDumpItem != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < list->use; ++pos) { + xmlSecAssert(list->data != NULL); + if(list->data[pos] != NULL) { + list->id->debugDumpItem(list->data[pos], output); + } + } + } +} + +/** + * xmlSecPtrListDebugXmlDump: + * @list: the pointer to list. + * @output: the pointer to output FILE. + * + * Prints debug information about @list to the @output in XML format. + */ +EXPORT_C +void +xmlSecPtrListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecAssert(xmlSecPtrListIsValid(list)); + xmlSecAssert(output != NULL); + + fprintf(output, "\n", list->use); + if(list->id->debugXmlDumpItem != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < list->use; ++pos) { + xmlSecAssert(list->data != NULL); + if(list->data[pos] != NULL) { + list->id->debugXmlDumpItem(list->data[pos], output); + } + } + } + fprintf(output, "\n"); +} + +static int +xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) { + xmlSecPtr* newData; + xmlSecSize newSize = 0; + + xmlSecAssert2(xmlSecPtrListIsValid(list), -1); + + if(size < list->max) { + return(0); + } + + switch(list->allocMode) { + case xmlSecAllocModeExact: + newSize = size + 8; + break; + case xmlSecAllocModeDouble: + newSize = 2 * size + 32; + break; + } + + if(newSize < gInitialSize) { + newSize = gInitialSize; + } + + if(list->data != NULL) { + newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize); + } else { + newData = (xmlSecPtr*)xmlMalloc(sizeof(xmlSecPtr) * newSize); + } + if(newData == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecPtrListGetName(list)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecPtr)*%d=%d", + newSize, sizeof(xmlSecPtr) * newSize); + return(-1); + } + + list->data = newData; + list->max = newSize; + + return(0); +} + +/*********************************************************************** + * + * strings list + * + **********************************************************************/ +static xmlSecPtr xmlSecStringListDuplicateItem (xmlSecPtr ptr); +static void xmlSecStringListDestroyItem (xmlSecPtr ptr); + +static xmlSecPtrListKlass xmlSecStringListKlass = { + BAD_CAST "strings-list", + xmlSecStringListDuplicateItem, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + xmlSecStringListDestroyItem, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecStringListGetKlass: + * + * The strins list class. + * + * Returns strings list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecStringListGetKlass(void) { + return(&xmlSecStringListKlass); +} + +static xmlSecPtr +xmlSecStringListDuplicateItem(xmlSecPtr ptr) { + xmlSecAssert2(ptr != NULL, NULL); + + return(xmlStrdup((xmlChar*)ptr)); +} + +static void +xmlSecStringListDestroyItem(xmlSecPtr ptr) { + xmlSecAssert(ptr != NULL); + + xmlFree(ptr); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_membuf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_membuf.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,213 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Memory buffer transform + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keys.h" +#include "xmlsec_base64.h" +#include "xmlsec_membuf.h" +#include "xmlsec_errors.h" + +/***************************************************************************** + * + * Memory Buffer Transform + * + * xmlSecBuffer is located after xmlSecTransform + * + ****************************************************************************/ +#define xmlSecTransformMemBufSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecBuffer)) +#define xmlSecTransformMemBufGetBuf(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecTransformMemBufSize)) ? \ + (xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlSecBufferPtr)NULL) + +static int xmlSecTransformMemBufInitialize (xmlSecTransformPtr transform); +static void xmlSecTransformMemBufFinalize (xmlSecTransformPtr transform); +static int xmlSecTransformMemBufExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); +static xmlSecTransformKlass xmlSecTransformMemBufKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecTransformMemBufSize, /* xmlSecSize objSize */ + + xmlSecNameMemBuf, /* const xmlChar* name; */ + NULL, /* const xmlChar* href; */ + 0, /* xmlSecAlgorithmUsage usage; */ + + xmlSecTransformMemBufInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformMemBufFinalize, /* xmlSecTransformFianlizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformMemBufExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformMemBufGetKlass: + * + * The memory buffer transorm (used to store the data that go through it). + * + * Returns memory buffer transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformMemBufGetKlass(void) { + return(&xmlSecTransformMemBufKlass); +} + +/** + * xmlSecTransformMemBufGetBuffer: + * @transform: the pointer to memory buffer transform. + * + * Gets the pointer to memory buffer transform buffer. + * + * Returns pointer to the transform's #xmlSecBuffer. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecTransformMemBufGetBuffer(xmlSecTransformPtr transform) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), NULL); + + buffer = xmlSecTransformMemBufGetBuf(transform); + xmlSecAssert2(buffer != NULL, NULL); + + return(buffer); +} + +static int +xmlSecTransformMemBufInitialize(xmlSecTransformPtr transform) { + xmlSecBufferPtr buffer; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), -1); + + buffer = xmlSecTransformMemBufGetBuf(transform); + xmlSecAssert2(buffer != NULL, -1); + + ret = xmlSecBufferInitialize(buffer, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static void +xmlSecTransformMemBufFinalize(xmlSecTransformPtr transform) { + xmlSecBufferPtr buffer; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId)); + + buffer = xmlSecTransformMemBufGetBuf(transform); + xmlSecAssert(buffer != NULL); + + xmlSecBufferFinalize(xmlSecTransformMemBufGetBuf(transform)); +} + +static int +xmlSecTransformMemBufExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) { + xmlSecBufferPtr buffer; + xmlSecBufferPtr in, out; + xmlSecSize inSize; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + buffer = xmlSecTransformMemBufGetBuf(transform); + xmlSecAssert2(buffer != NULL, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + inSize = xmlSecBufferGetSize(in); + + if(transform->status == xmlSecTransformStatusNone) { + transform->status = xmlSecTransformStatusWorking; + } + + if(transform->status == xmlSecTransformStatusWorking) { + /* just copy everything from in to our buffer and out */ + ret = xmlSecBufferAppend(buffer, xmlSecBufferGetData(in), inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + + ret = xmlSecBufferAppend(out, xmlSecBufferGetData(in), inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + + if(last != 0) { + transform->status = xmlSecTransformStatusFinished; + } + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(inSize == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + return(0); +} + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_nodeset.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_nodeset.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,616 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Enchanced nodes set + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_nodeset.h" +#include "xmlsec_errors.h" + +#define xmlSecGetParent(node) \ + (((node)->type != XML_NAMESPACE_DECL) ? \ + (node)->parent : \ + (xmlNodePtr)((xmlNsPtr)(node))->next) + +static int xmlSecNodeSetOneContains (xmlSecNodeSetPtr nset, + xmlNodePtr node, + xmlNodePtr parent); +static int xmlSecNodeSetWalkRecursive (xmlSecNodeSetPtr nset, + xmlSecNodeSetWalkCallback walkFunc, + void* data, + xmlNodePtr cur, + xmlNodePtr parent); + +/** + * xmlSecNodeSetCreate: + * @doc: the pointer to parent XML document. + * @nodes: the list of nodes. + * @type: the nodes set type. + * + * Creates new nodes set. Caller is responsible for freeng returend object + * by calling #xmlSecNodeSetDestroy function. + * + * Returns pointer to newly allocated node set or NULL if an error occurs. + */ +EXPORT_C +xmlSecNodeSetPtr +xmlSecNodeSetCreate(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlSecNodeSetType type) { + xmlSecNodeSetPtr nset; + + nset = (xmlSecNodeSetPtr)xmlMalloc(sizeof(xmlSecNodeSet)); + if(nset == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecNodeSet)=%d", + sizeof(xmlSecNodeSet)); + return(NULL); + } + memset(nset, 0, sizeof(xmlSecNodeSet)); + + nset->doc = doc; + nset->nodes = nodes; + nset->type = type; + nset->next = nset->prev = nset; + return(nset); +} + +/** + * xmlSecNodeSetDestroy: + * @nset: the pointer to node set. + * + * Destroys the nodes set created with #xmlSecNodeSetCreate function. + */ +EXPORT_C +void +xmlSecNodeSetDestroy(xmlSecNodeSetPtr nset) { + xmlSecNodeSetPtr tmp; + + xmlSecAssert(nset != NULL); + + while((tmp = nset) != NULL) { + if((nset->next != NULL) && (nset->next != nset)) { + nset->next->prev = nset->prev; + nset->prev->next = nset->next; + nset = nset->next; + } else { + nset = NULL; + } + + if(tmp->nodes != NULL) { + xmlXPathFreeNodeSet(tmp->nodes); + } + if(tmp->children != NULL) { + xmlSecNodeSetDestroy(tmp->children); + } + if((tmp->doc != NULL) && (tmp->destroyDoc != 0)) { + xmlFreeDoc(tmp->doc); + } + memset(tmp, 0, sizeof(xmlSecNodeSet)); + xmlFree(tmp); + } +} + +/** + * xmlSecNodeSetDocDestroy: + * @nset: the pointer to node set. + * + * Instructs node set to destroy nodes parent doc when node set is destroyed. + */ +EXPORT_C +void +xmlSecNodeSetDocDestroy(xmlSecNodeSetPtr nset) { + xmlSecAssert(nset != NULL); + + nset->destroyDoc = 1; +} + +static int +xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent) { + int in_nodes_set = 1; + + xmlSecAssert2(nset != NULL, 0); + xmlSecAssert2(node != NULL, 0); + + /* special cases: */ + switch(nset->type) { + case xmlSecNodeSetTreeWithoutComments: + case xmlSecNodeSetTreeWithoutCommentsInvert: + if(node->type == XML_COMMENT_NODE) { + return(0); + } + break; + case xmlSecNodeSetList: + return(xmlSecNodeSetContains(nset->children, node, parent)); + default: + break; + } + + if(nset->nodes != NULL) { + if(node->type != XML_NAMESPACE_DECL) { + in_nodes_set = xmlXPathNodeSetContains(nset->nodes, node); + } else { + xmlNs ns; + + memcpy(&ns, node, sizeof(ns)); + + if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) { + ns.next = (xmlNsPtr)parent->parent; + } else { + ns.next = (xmlNsPtr)parent; + } + + /* + * If the input is an XPath node-set, then the node-set must explicitly + * contain every node to be rendered to the canonical form. + */ + in_nodes_set = (xmlXPathNodeSetContains(nset->nodes, (xmlNodePtr)&ns)); + } + } + + switch(nset->type) { + case xmlSecNodeSetNormal: + return(in_nodes_set); + case xmlSecNodeSetInvert: + return(!in_nodes_set); + case xmlSecNodeSetTree: + case xmlSecNodeSetTreeWithoutComments: + if(in_nodes_set) { + return(1); + } + if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) { + return(xmlSecNodeSetOneContains(nset, parent, parent->parent)); + } + return(0); + case xmlSecNodeSetTreeInvert: + case xmlSecNodeSetTreeWithoutCommentsInvert: + if(in_nodes_set) { + return(0); + } + if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) { + return(xmlSecNodeSetOneContains(nset, parent, parent->parent)); + } + return(1); + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_TYPE, + "type=%d", nset->type); + } + + return(0); +} + +/** + * xmlSecNodeSetContains: + * @nset: the pointer to node set. + * @node: the pointer to XML node to check. + * @parent: the pointer to @node parent node. + * + * Checks whether the @node is in the nodes set or not. + * + * Returns 1 if the @node is in the nodes set @nset, 0 if it is not + * and a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent) { + int status = 1; + xmlSecNodeSetPtr cur; + + xmlSecAssert2(node != NULL, 0); + + /* special cases: */ + if(nset == NULL) { + return(1); + } + + status = 1; + cur = nset; + do { + switch(cur->op) { + case xmlSecNodeSetIntersection: + if(status && !xmlSecNodeSetOneContains(cur, node, parent)) { + status = 0; + } + break; + case xmlSecNodeSetSubtraction: + if(status && xmlSecNodeSetOneContains(cur, node, parent)) { + status = 0; + } + break; + case xmlSecNodeSetUnion: + if(!status && xmlSecNodeSetOneContains(cur, node, parent)) { + status = 1; + } + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_OPERATION, + "operation=%d", cur->op); + return(-1); + } + cur = cur->next; + } while(cur != nset); + + return(status); +} + +/** + * xmlSecNodeSetAdd: + * @nset: the pointer to currrent nodes set (or NULL). + * @newNSet: the pointer to new nodes set. + * @op: the operation type. + * + * Adds @newNSet to the @nset using operation @op. + * + * Returns the pointer to combined nodes set or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecNodeSetPtr +xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, + xmlSecNodeSetOp op) { + xmlSecAssert2(newNSet != NULL, NULL); + xmlSecAssert2(newNSet->next == newNSet, NULL); + + newNSet->op = op; + if(nset == NULL) { + return(newNSet); + } + + newNSet->next = nset; + newNSet->prev = nset->prev; + nset->prev->next = newNSet; + nset->prev = newNSet; + return(nset); +} + +/** + * xmlSecNodeSetAddList: + * @nset: the pointer to currrent nodes set (or NULL). + * @newNSet: the pointer to new nodes set. + * @op: the operation type. + * + * Adds @newNSet to the @nset as child using operation @op. + * + * Returns the pointer to combined nodes set or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecNodeSetPtr +xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNodeSetOp op) { + xmlSecNodeSetPtr tmp1, tmp2; + + xmlSecAssert2(newNSet != NULL, NULL); + + tmp1 = xmlSecNodeSetCreate(newNSet->doc, NULL, xmlSecNodeSetList); + if(tmp1 == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + tmp1->children = newNSet; + + tmp2 = xmlSecNodeSetAdd(nset, tmp1, op); + if(tmp2 == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecNodeSetDestroy(tmp1); + return(NULL); + } + return(tmp2); +} + + +/** + * xmlSecNodeSetWalk: + * @nset: the pointer to node set. + * @walkFunc: the callback functions. + * @data: the application specific data passed to the @walkFunc. + * + * Calls the function @walkFunc once per each node in the nodes set @nset. + * If the @walkFunc returns a negative value, then the walk procedure + * is interrupted. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, void* data) { + xmlNodePtr cur; + int ret = 0; + + xmlSecAssert2(nset != NULL, -1); + xmlSecAssert2(nset->doc != NULL, -1); + xmlSecAssert2(walkFunc != NULL, -1); + + /* special cases */ + if(nset->nodes != NULL) { + int i; + + switch(nset->type) { + case xmlSecNodeSetNormal: + case xmlSecNodeSetTree: + case xmlSecNodeSetTreeWithoutComments: + for(i = 0; (ret >= 0) && (i < nset->nodes->nodeNr); ++i) { + ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, + nset->nodes->nodeTab[i], + xmlSecGetParent(nset->nodes->nodeTab[i])); + } + return(ret); + default: + break; + } + } + + for(cur = nset->doc->children; (cur != NULL) && (ret >= 0); cur = cur->next) { + ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, cur, xmlSecGetParent(cur)); + } + return(ret); +} + +static int +xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, + void* data, xmlNodePtr cur, xmlNodePtr parent) { + int ret; + + xmlSecAssert2(nset != NULL, -1); + xmlSecAssert2(cur != NULL, -1); + xmlSecAssert2(walkFunc != NULL, -1); + + /* the node itself */ + if(xmlSecNodeSetContains(nset, cur, parent)) { + ret = walkFunc(nset, cur, parent, data); + + if(ret < 0) { + return(ret); + } + } + + /* element node has attributes, namespaces */ + if(cur->type == XML_ELEMENT_NODE) { + xmlAttrPtr attr; + xmlNodePtr node; + xmlNsPtr ns, tmp; + + attr = (xmlAttrPtr)cur->properties; + while(attr != NULL) { + if(xmlSecNodeSetContains(nset, (xmlNodePtr)attr, cur)) { + ret = walkFunc(nset, (xmlNodePtr)attr, cur, data); + if(ret < 0) { + return(ret); + } + } + attr = attr->next; + } + + node = cur; + while(node != NULL) { + ns = node->nsDef; + while(ns != NULL) { + tmp = xmlSearchNs(nset->doc, cur, ns->prefix); + if((tmp == ns) && xmlSecNodeSetContains(nset, (xmlNodePtr)ns, cur)) { + ret = walkFunc(nset, (xmlNodePtr)ns, cur, data); + if(ret < 0) { + return(ret); + } + } + ns = ns->next; + } + node = node->parent; + } + } + + /* element and document nodes have children */ + if((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE)) { + xmlNodePtr node; + + node = cur->children; + while(node != NULL) { + ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, node, cur); + if(ret < 0) { + return(ret); + } + node = node->next; + } + } + return(0); +} + +/** + * xmlSecNodeSetGetChildren: + * @doc: the pointer to an XML document. + * @parent: the pointer to parent XML node or NULL if we want to include all document nodes. + * @withComments: the flag include comments or not. + * @invert: the "invert" flag. + * + * Creates a new nodes set that contains: + * - if @withComments is not 0 and @invert is 0: + * all nodes in the @parent subtree; + * - if @withComments is 0 and @invert is 0: + * all nodes in the @parent subtree except comment nodes; + * - if @withComments is not 0 and @invert not is 0: + * all nodes in the @doc except nodes in the @parent subtree; + * - if @withComments is 0 and @invert is 0: + * all nodes in the @doc except nodes in the @parent subtree + * and comment nodes. + * + * Returns pointer to the newly created #xmlSecNodeSet structure + * or NULL if an error occurs. + */ +EXPORT_C +xmlSecNodeSetPtr +xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComments, int invert) { + xmlNodeSetPtr nodes; + xmlSecNodeSetType type; + xmlSecNodeSetPtr result = NULL; + + xmlSecAssert2(doc != NULL, NULL); + + nodes = xmlXPathNodeSetCreate(parent); + if(nodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPathNodeSetCreate", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* if parent is NULL then we add all the doc children */ + if(parent == NULL) { + xmlNodePtr cur; + for(cur = doc->children; cur != NULL; cur = cur->next) { + if(withComments || (cur->type != XML_COMMENT_NODE)) { + xmlXPathNodeSetAdd(nodes, cur); + } + } + } + + if(withComments && invert) { + type = xmlSecNodeSetTreeInvert; + } else if(withComments && !invert) { + type = xmlSecNodeSetTree; + } else if(!withComments && invert) { + type = xmlSecNodeSetTreeWithoutCommentsInvert; + } else { /* if(!withComments && !invert) */ + type = xmlSecNodeSetTreeWithoutComments; + } + + result = xmlSecNodeSetCreate(doc, nodes, type); + if ( !result ) + { + xmlXPathFreeNodeSet( nodes ); + } + return result; +} + +static int +xmlSecNodeSetDumpTextNodesWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur, + xmlNodePtr parent, + void* data) { + xmlSecAssert2(nset != NULL, -1); + xmlSecAssert2(cur != NULL, -1); + xmlSecAssert2(data != NULL, -1); + + if(cur->type == XML_TEXT_NODE) { + xmlOutputBufferWriteString((xmlOutputBufferPtr)data, + (char*)(cur->content)); + } + return(0); +} + +/** + * xmlSecNodeSetDumpTextNodes: + * @nset: the pointer to node set. + * @out: the output buffer. + * + * Dumps content of all the text nodes from @nset to @out. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, xmlOutputBufferPtr out) { + xmlSecAssert2(nset != NULL, -1); + xmlSecAssert2(out != NULL, -1); + + return(xmlSecNodeSetWalk(nset, xmlSecNodeSetDumpTextNodesWalkCallback, out)); +} + +/** + * xmlSecNodeSetDebugDump: + * @nset: the pointer to node set. + * @output: the pointer to output FILE. + * + * Prints information about @nset to the @output. + */ +EXPORT_C +void +xmlSecNodeSetDebugDump(xmlSecNodeSetPtr nset, FILE *output) { + int i, l; + xmlNodePtr cur; + + xmlSecAssert(nset != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "== Nodes set "); + switch(nset->type) { + case xmlSecNodeSetNormal: + fprintf(output, "(xmlSecNodeSetNormal)\n"); + break; + case xmlSecNodeSetInvert: + fprintf(output, "(xmlSecNodeSetInvert)\n"); + break; + case xmlSecNodeSetTree: + fprintf(output, "(xmlSecNodeSetTree)\n"); + break; + case xmlSecNodeSetTreeWithoutComments: + fprintf(output, "(xmlSecNodeSetTreeWithoutComments)\n"); + break; + case xmlSecNodeSetTreeInvert: + fprintf(output, "(xmlSecNodeSetTreeInvert)\n"); + break; + case xmlSecNodeSetTreeWithoutCommentsInvert: + fprintf(output, "(xmlSecNodeSetTreeWithoutCommentsInvert)\n"); + break; + case xmlSecNodeSetList: + fprintf(output, "(xmlSecNodeSetList)\n"); + fprintf(output, ">>>\n"); + xmlSecNodeSetDebugDump(nset->children, output); + fprintf(output, "<<<\n"); + return; + default: + fprintf(output, "(unknown=%d)\n", nset->type); + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_TYPE, + "type=%d", nset->type); + } + + l = xmlXPathNodeSetGetLength(nset->nodes); + for(i = 0; i < l; ++i) { + cur = xmlXPathNodeSetItem(nset->nodes, i); + if(cur->type != XML_NAMESPACE_DECL) { + fprintf(output, "%d: %s\n", cur->type, + (cur->name) ? cur->name : BAD_CAST "null"); + } else { + xmlNsPtr ns = (xmlNsPtr)cur; + fprintf(output, "%d: %s=%s (%s:%s)\n", cur->type, + (ns->prefix) ? ns->prefix : BAD_CAST "null", + (ns->href) ? ns->href : BAD_CAST "null", + (((xmlNodePtr)ns->next)->ns && + ((xmlNodePtr)ns->next)->ns->prefix) ? + ((xmlNodePtr)ns->next)->ns->prefix : BAD_CAST "null", + ((xmlNodePtr)ns->next)->name); + } + } +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_parser.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_parser.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,574 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * XML Parser transform and utility functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_parser.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * Internal parser + * + *****************************************************************************/ +typedef struct _xmlSecParserCtx xmlSecParserCtx, + *xmlSecParserCtxPtr; +struct _xmlSecParserCtx { + xmlParserCtxtPtr parserCtx; +}; + +/************************************************************************** + * + * XML Parser transform + * + * xmlSecParserCtx is located after xmlSecTransform + * + ***************************************************************************/ +#define xmlSecParserSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecParserCtx)) +#define xmlSecParserGetCtx(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecParserSize)) ? \ + ((xmlSecParserCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) : \ + (xmlSecParserCtxPtr)NULL) + +static int xmlSecParserInitialize (xmlSecTransformPtr transform); +static void xmlSecParserFinalize (xmlSecTransformPtr transform); +static int xmlSecParserPushBin (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + int final, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecParserPopXml (xmlSecTransformPtr transform, + xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx); + +static xmlSecTransformKlass xmlSecParserKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecParserSize, /* xmlSecSize objSize */ + + BAD_CAST "xml-parser", /* const xmlChar* name; */ + NULL, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + xmlSecParserInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecParserFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecParserPushBin, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecParserPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + NULL, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformXmlParserGetKlass: + * + * The XML parser transform. + * + * Returns XML parser transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformXmlParserGetKlass(void) { + return(&xmlSecParserKlass); +} + +static int +xmlSecParserInitialize(xmlSecTransformPtr transform) { + xmlSecParserCtxPtr ctx; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecParserSize), -1); + + ctx = xmlSecParserGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + /* initialize context */ + memset(ctx, 0, sizeof(xmlSecParserCtx)); + return(0); +} + +static void +xmlSecParserFinalize(xmlSecTransformPtr transform) { + xmlSecParserCtxPtr ctx; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecParserSize)); + + ctx = xmlSecParserGetCtx(transform); + xmlSecAssert(ctx != NULL); + + if(ctx->parserCtx != NULL) { + xmlFreeParserCtxt(ctx->parserCtx); + } + memset(ctx, 0, sizeof(xmlSecParserCtx)); +} + +static int +xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data, + xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) { + xmlSecParserCtxPtr ctx; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecParserGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + /* check/update current transform status */ + if(transform->status == xmlSecTransformStatusNone) { + xmlSecAssert2(ctx->parserCtx == NULL, -1); + + ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL); + if(ctx->parserCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlCreatePushParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* required for c14n! */ + ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctx->parserCtx->replaceEntities = 1; + + transform->status = xmlSecTransformStatusWorking; + } else if(transform->status == xmlSecTransformStatusFinished) { + return(0); + } else if(transform->status != xmlSecTransformStatusWorking) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1); + xmlSecAssert2(ctx->parserCtx != NULL, -1); + + /* push data to the input buffer */ + if((data != NULL) && (dataSize > 0)) { + ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + "size=%d", dataSize); + return(-1); + } + } + + /* finish parsing and push to next in the chain */ + if(final != 0) { + ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1); + if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + transform->outNodes = xmlSecNodeSetCreate(ctx->parserCtx->myDoc, + NULL, xmlSecNodeSetTree); + if(transform->outNodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(ctx->parserCtx->myDoc); + ctx->parserCtx->myDoc = NULL; + return(-1); + } + xmlSecNodeSetDocDestroy(transform->outNodes); /* this node set "owns" the doc pointer */ + ctx->parserCtx->myDoc = NULL; + + /* push result to the next transform (if exist) */ + if(transform->next != NULL) { + ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformPushXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + transform->status = xmlSecTransformStatusFinished; + } + + return(0); +} + +static int +xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx) { + xmlSecParserCtxPtr ctx; + xmlParserInputBufferPtr buf; + xmlParserInputPtr input; + xmlParserCtxtPtr ctxt; + xmlDocPtr doc; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1); + xmlSecAssert2(nodes != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecParserGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + /* check/update current transform status */ + switch(transform->status) { + case xmlSecTransformStatusNone: + transform->status = xmlSecTransformStatusWorking; + break; + case xmlSecTransformStatusWorking: + /* just do nothing */ + break; + case xmlSecTransformStatusFinished: + (*nodes) = NULL; + return(0); + default: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1); + + /* prepare parser context */ + if(transform->prev == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + "prev transform is null"); + return(-1); + } + + buf = xmlSecTransformCreateInputBuffer(transform->prev, transformCtx); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformCreateInputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlNewParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeParserInputBuffer(buf); + return(-1); + } + + input = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE); + if(input == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlNewParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeParserCtxt(ctxt); + xmlFreeParserInputBuffer(buf); + return(-1); + } + + ret = inputPush(ctxt, input); + if(input == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "inputPush", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeInputStream(input); + xmlFreeParserCtxt(ctxt); + return(-1); + } + + /* required for c14n! */ + ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctxt->replaceEntities = 1; + + /* finaly do the parsing */ + ret = xmlParseDocument(ctxt); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParseDocument", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if(ctxt->myDoc != NULL) { + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + xmlFreeParserCtxt(ctxt); + return(-1); + } + + /* remember the result and free parsing context */ + doc = ctxt->myDoc; + ctxt->myDoc = NULL; + xmlFreeParserCtxt(ctxt); + + /* return result to the caller */ + (*nodes) = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetTree); + if((*nodes) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(doc); + return(-1); + } + xmlSecNodeSetDocDestroy((*nodes)); /* this node set "owns" the doc pointer */ + transform->status = xmlSecTransformStatusFinished; + return(0); +} + +/************************************************************************** + * + * XML Parser functions + * + *************************************************************************/ +typedef struct _xmlSecExtMemoryParserCtx { + const xmlSecByte *prefix; + xmlSecSize prefixSize; + const xmlSecByte *buffer; + xmlSecSize bufferSize; + const xmlSecByte *postfix; + xmlSecSize postfixSize; +} xmlSecExtMemoryParserCtx, *xmlSecExtMemoryParserCtxPtr; + +/** + * xmlSecParseFile: + * @filename: the filename. + * + * Loads XML Doc from file @filename. We need a special version because of + * c14n issue. The code is copied from xmlSAXParseFileWithData() function. + * + * Returns pointer to the loaded XML document or NULL if an error occurs. + */ +EXPORT_C +xmlDocPtr +xmlSecParseFile(const char *filename) { + xmlDocPtr ret; + xmlParserCtxtPtr ctxt; + char *directory = NULL; + + xmlSecAssert2(filename != NULL, NULL); + + xmlInitParser(); + ctxt = xmlCreateFileParserCtxt(filename); + if (ctxt == NULL) { + return(NULL); + } + + if ((ctxt->directory == NULL) && (directory == NULL)) + directory = xmlParserGetDirectory(filename); + if ((ctxt->directory == NULL) && (directory != NULL)) + ctxt->directory = (char *) xmlStrdup((xmlChar *) directory); + + /* required for c14n! */ + ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctxt->replaceEntities = 1; + + xmlParseDocument(ctxt); + + if(ctxt->wellFormed) { + ret = ctxt->myDoc; + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + xmlFreeParserCtxt(ctxt); + return(ret); + +} + +/** + * xmlSecParseMemoryExt: + * @prefix: the first part of the input. + * @prefixSize: the size of the first part of the input. + * @buffer: the second part of the input. + * @bufferSize: the size of the second part of the input. + * @postfix: the third part of the input. + * @postfixSize: the size of the third part of the input. + * + * Loads XML Doc from 3 chunks of memory: @prefix, @buffer and @postfix. + * + * Returns pointer to the loaded XML document or NULL if an error occurs. + */ +EXPORT_C +xmlDocPtr +xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize, + const xmlSecByte *buffer, xmlSecSize bufferSize, + const xmlSecByte *postfix, xmlSecSize postfixSize) { + xmlParserCtxtPtr ctxt = NULL; + xmlDocPtr doc = NULL; + int ret; + + /* create context */ + ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL); + if(ctxt == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlCreatePushParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + /* required for c14n! */ + ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctxt->replaceEntities = 1; + + /* prefix */ + if((prefix != NULL) && (prefixSize > 0)) { + ret = xmlParseChunk(ctxt, (const char*)prefix, prefixSize, 0); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + "prefixSize=%d", prefixSize); + goto done; + } + } + + /* buffer */ + if((buffer != NULL) && (bufferSize > 0)) { + ret = xmlParseChunk(ctxt, (const char*)buffer, bufferSize, 0); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + "bufferSize=%d", bufferSize); + goto done; + } + } + + /* postfix */ + if((postfix != NULL) && (postfixSize > 0)) { + ret = xmlParseChunk(ctxt, (const char*)postfix, postfixSize, 0); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + "postfixSize=%d", postfixSize); + goto done; + } + } + + /* finishing */ + ret = xmlParseChunk(ctxt, NULL, 0, 1); + if((ret != 0) || (ctxt->myDoc == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + doc = ctxt->myDoc; + +done: + if(ctxt != NULL) { + xmlFreeParserCtxt(ctxt); + } + return(doc); +} + + +/** + * xmlSecParseMemory: + * @buffer: the input buffer. + * @size: the input buffer size. + * @recovery: the flag. + * + * Loads XML Doc from memory. We need a special version because of + * c14n issue. The code is copied from xmlSAXParseMemory() function. + * + * Returns pointer to the loaded XML document or NULL if an error occurs. + */ +EXPORT_C +xmlDocPtr +xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) { + xmlDocPtr ret; + xmlParserCtxtPtr ctxt; + + xmlSecAssert2(buffer != NULL, NULL); + + ctxt = xmlCreateMemoryParserCtxt((char*)buffer, size); + if (ctxt == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlCreateMemoryParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* required for c14n! */ + ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctxt->replaceEntities = 1; + + xmlParseDocument(ctxt); + + if((ctxt->wellFormed) || recovery) { + ret = ctxt->myDoc; + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + xmlFreeParserCtxt(ctxt); + return(ret); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_soap.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_soap.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1347 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Simple SOAP messages parsing/creation. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_SOAP +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_soap.h" +#include "xmlsec_errors.h" + +/*********************************************************************** + * + * SOAP 1.1 + * + **********************************************************************/ +/** + * xmlSecSoap11CreateEnvelope: + * @doc: the parent doc (might be NULL). + * + * Creates a new SOAP Envelope node. Caller is responsible for + * adding the returned node to the XML document. + * + * XML Schema (http://schemas.xmlsoap.org/soap/envelope/): + * + * + * + * + * + * + * + * + * + * + * + * Returns pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11CreateEnvelope(xmlDocPtr doc) { + xmlNodePtr envNode; + xmlNodePtr bodyNode; + xmlNsPtr ns; + + /* create Envelope node */ + envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL); + if(envNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEnvelope)); + return(NULL); + } + + ns = xmlNewNs(envNode, xmlSecSoap11Ns, NULL) ; + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(xmlSecSoap11Ns)); + xmlFreeNode(envNode); + return(NULL); + } + xmlSetNs(envNode, ns); + + /* add required Body node */ + bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap11Ns); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeBody)); + xmlFreeNode(envNode); + return(NULL); + } + + return(envNode); +} + +/** + * xmlSecSoap11EnsureHeader: + * @envNode: the pointer to node. + * + * Gets the pointer to node (if necessary, the node + * is created). + * + * XML Schema (http://schemas.xmlsoap.org/soap/envelope/): + * + * + * + * + * + * + * + * + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11EnsureHeader(xmlNodePtr envNode) { + xmlNodePtr hdrNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* try to find Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap11Ns)) { + return(cur); + } + + /* if the first element child is not Header then it is Body */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* finally add Header node before body */ + hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap11Ns); + if(hdrNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddPrevSibling", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(hdrNode); +} + +/** + * xmlSecSoap11AddBodyEntry: + * @envNode: the pointer to node. + * @entryNode: the pointer to body entry node. + * + * Adds a new entry to node. + * + * Returns pointer to the added entry (@contentNode) or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) { + xmlNodePtr bodyNode; + + xmlSecAssert2(envNode != NULL, NULL); + xmlSecAssert2(entryNode != NULL, NULL); + + bodyNode = xmlSecSoap11GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecAddChildNode(bodyNode, entryNode)); +} + +/** + * xmlSecSoap11AddFaultEntry: + * @envNode: the pointer to node. + * @faultCodeHref: the fault code QName href (must be known in th context of + * node). + * @faultCodeLocalPart: the fault code QName LocalPart. + * @faultString: the human readable explanation of the fault. + * @faultActor: the information about who caused the fault (might be NULL). + * + * Adds entry to the @envNode. Note that only one + * entry is allowed. + * + * XML Schema (http://schemas.xmlsoap.org/soap/envelope/): + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Returns pointer to the added entry or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref, + const xmlChar* faultCodeLocalPart, + const xmlChar* faultString, const xmlChar* faultActor) { + xmlNodePtr bodyNode; + xmlNodePtr faultNode; + xmlNodePtr cur; + xmlChar* qname; + + xmlSecAssert2(envNode != NULL, NULL); + xmlSecAssert2(faultCodeLocalPart != NULL, NULL); + xmlSecAssert2(faultString != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap11GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* check that we don't have Fault node already */ + faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns); + if(faultNode != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* add Fault node */ + faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns); + if(faultNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeFault)); + return(NULL); + } + + /* add faultcode node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeFaultCode, xmlSecSoap11Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeFaultCode)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* create qname for fault code */ + qname = xmlSecGetQName(cur, faultCodeHref, faultCodeLocalPart); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGetQName", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(cur->name)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* set faultcode value */ + xmlNodeSetContent(cur, qname); + xmlFree(qname); + + /* add faultstring node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeFaultString, xmlSecSoap11Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeFaultString)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* set faultstring node */ + xmlNodeSetContent(cur, faultString); + + if(faultActor != NULL) { + /* add faultactor node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeFaultActor, xmlSecSoap11Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeFaultActor)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* set faultactor node */ + xmlNodeSetContent(cur, faultActor); + } + + return(faultNode); +} + +/** + * xmlSecSoap11CheckEnvelope: + * @envNode: the pointer to node. + * + * Validates node structure. + * + * Returns 1 if @envNode has a valid element, 0 if it is + * not valid or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, -1); + + /* verify envNode itself */ + if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap11Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeEnvelope), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + /* optional Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap11Ns)) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* required Body node is next */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + return(1); +} + +/** + * xmlSecSoap11GetHeader: + * @envNode: the pointer to node. + * + * Gets pointer to the node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11GetHeader(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* optional Header node is first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap11Ns)) { + return(cur); + } + + return(NULL); +} + +/** + * xmlSecSoap11GetBody: + * @envNode: the pointer to node. + * + * Gets pointer to the node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11GetBody(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* optional Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap11Ns)) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* Body node is next */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(cur); +} + +/** + * xmlSecSoap11GetBodyEntriesNumber: + * @envNode: the pointer to node. + * + * Gets the number of body entries. + * + * Returns the number of body entries. + */ +EXPORT_C +xmlSecSize +xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode) { + xmlSecSize number = 0; + xmlNodePtr bodyNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, 0); + + /* get Body node */ + bodyNode = xmlSecSoap11GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + cur = xmlSecGetNextElementNode(bodyNode->children); + while(cur != NULL) { + number++; + cur = xmlSecGetNextElementNode(cur->next); + } + + return(number); +} + +/** + * xmlSecSoap11GetBodyEntry: + * @envNode: the pointer to node. + * @pos: the body entry number. + * + * Gets the body entry number @pos. + * + * Returns pointer to body entry node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) { + xmlNodePtr bodyNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap11GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecGetNextElementNode(bodyNode->children); + while((cur != NULL) && (pos > 0)) { + pos--; + cur = xmlSecGetNextElementNode(cur->next); + } + + return(cur); +} + +/** + * xmlSecSoap11GetFaultEntry: + * @envNode: the pointer to node. + * + * Gets the Fault entry (if any). + * + * Returns pointer to Fault entry or NULL if it does not exist. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap11GetFaultEntry(xmlNodePtr envNode) { + xmlNodePtr bodyNode; + + xmlSecAssert2(envNode != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap11GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns)); +} + + +/*********************************************************************** + * + * SOAP 1.2 + * + **********************************************************************/ +static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] = +{ + { xmlSecSoap12Ns, xmlSecSoapFaultCodeVersionMismatch, + xmlSecSoap12FaultCodeVersionMismatch }, + { xmlSecSoap12Ns, xmlSecSoapFaultCodeMustUnderstand, + xmlSecSoap12FaultCodeMustUnderstand }, + { xmlSecSoap12Ns, xmlSecSoapFaultDataEncodningUnknown, + xmlSecSoap12FaultCodeDataEncodingUnknown }, + { xmlSecSoap12Ns, xmlSecSoapFaultCodeSender, + xmlSecSoap12FaultCodeSender }, + { xmlSecSoap12Ns, xmlSecSoapFaultCodeReceiver, + xmlSecSoap12FaultCodeReceiver }, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +/** + * xmlSecSoap12CreateEnvelope: + * @doc: the parent doc (might be NULL). + * + * Creates a new SOAP 1.2 Envelope node. Caller is responsible for + * adding the returned node to the XML document. + * + * XML Schema (http://www.w3.org/2003/05/soap-envelope): + * + * + * + * + * + * + * + * + * + * + * Returns pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12CreateEnvelope(xmlDocPtr doc) { + xmlNodePtr envNode; + xmlNodePtr bodyNode; + xmlNsPtr ns; + + /* create Envelope node */ + envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL); + if(envNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEnvelope)); + return(NULL); + } + + ns = xmlNewNs(envNode, xmlSecSoap12Ns, NULL) ; + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(xmlSecSoap12Ns)); + xmlFreeNode(envNode); + return(NULL); + } + xmlSetNs(envNode, ns); + + /* add required Body node */ + bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap12Ns); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeBody)); + xmlFreeNode(envNode); + return(NULL); + } + + return(envNode); +} + +/** + * xmlSecSoap12EnsureHeader: + * @envNode: the pointer to node. + * + * Gets the pointer to node (if necessary, the node + * is created). + * + * XML Schema (http://www.w3.org/2003/05/soap-envelope): + * + * + * + * + * + * + * + * + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12EnsureHeader(xmlNodePtr envNode) { + xmlNodePtr hdrNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* try to find Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap12Ns)) { + return(cur); + } + + /* if the first element child is not Header then it is Body */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* finally add Header node before body */ + hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap12Ns); + if(hdrNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddPrevSibling", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(hdrNode); +} + +/** + * xmlSecSoap12AddBodyEntry: + * @envNode: the pointer to node. + * @entryNode: the pointer to body entry node. + * + * Adds a new entry to node. + * + * XML Schema (http://www.w3.org/2003/05/soap-envelope): + * + * + * + * + * + * + * + * + * + * Returns pointer to the added entry (@contentNode) or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) { + xmlNodePtr bodyNode; + + xmlSecAssert2(envNode != NULL, NULL); + xmlSecAssert2(entryNode != NULL, NULL); + + bodyNode = xmlSecSoap12GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecAddChildNode(bodyNode, entryNode)); +} + +/** + * xmlSecSoap12AddFaultEntry: + * @envNode: the pointer to node. + * @faultCode: the fault code. + * @faultReasonText: the human readable explanation of the fault. + * @faultReasonLang: the language (xml:lang) for @faultReason string. + * @faultNodeURI: the more preciese information about fault source + * (might be NULL). + * @faultRole: the role the node was operating in at the point + * the fault occurred (might be NULL). + * + * Adds entry to the @envNode. Note that only one + * entry is allowed. + * + * XML Schema (http://www.w3.org/2003/05/soap-envelope): + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Returns pointer to the added entry or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode, + const xmlChar* faultReasonText, const xmlChar* faultReasonLang, + const xmlChar* faultNodeURI, const xmlChar* faultRole) { + xmlNodePtr bodyNode; + xmlNodePtr faultNode; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(envNode != NULL, NULL); + xmlSecAssert2(faultCode != xmlSecSoap12FaultCodeUnknown, NULL); + xmlSecAssert2(faultReasonText != NULL, NULL); + xmlSecAssert2(faultReasonLang != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap12GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* check that we don't have Fault node already */ + faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns); + if(faultNode != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* add Fault node */ + faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns); + if(faultNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeFault)); + return(NULL); + } + + /* add Code node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeCode, xmlSecSoap12Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCode)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* write the fault code in Value child */ + ret = xmlSecQName2IntegerNodeWrite(gXmlSecSoap12FaultCodeInfo, cur, + xmlSecNodeValue, xmlSecSoap12Ns, + faultCode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "faultCode=%d", + faultCode); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* add Reason node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeReason, xmlSecSoap12Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeReason)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + /* Add Reason/Text node */ + if(xmlSecSoap12AddFaultReasonText(faultNode, faultReasonText, faultReasonLang) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12AddFaultReasonText", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "text=%s", + xmlSecErrorsSafeString(faultReasonText)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + + if(faultNodeURI != NULL) { + /* add Node node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeNode, xmlSecSoap12Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeNode)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + xmlNodeSetContent(cur, faultNodeURI); + } + + if(faultRole != NULL) { + /* add Role node */ + cur = xmlSecAddChild(faultNode, xmlSecNodeRole, xmlSecSoap12Ns); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRole)); + xmlUnlinkNode(faultNode); + xmlFreeNode(faultNode); + return(NULL); + } + xmlNodeSetContent(cur, faultRole); + } + + return(faultNode); +} + +/** + * xmlSecSoap12AddFaultSubcode: + * @faultNode: the pointer to node. + * @subCodeHref: the subcode href. + * @subCodeName: the subcode name. + * + * Adds a new node to the node or the last node. + * + * Returns a pointer to the newly created node or NULL if an error + * occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, const xmlChar* subCodeName) { + xmlNodePtr cur, subcodeNode, valueNode; + xmlChar* qname; + + xmlSecAssert2(faultNode != NULL, NULL); + xmlSecAssert2(subCodeHref != NULL, NULL); + xmlSecAssert2(subCodeName != NULL, NULL); + + /* Code node is the first childern in Fault node */ + cur = xmlSecGetNextElementNode(faultNode->children); + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeCode, xmlSecSoap12Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCode)); + return(NULL); + } + + /* find the Code or Subcode node that does not have Subcode child */ + while(1) { + xmlNodePtr tmp; + + tmp = xmlSecFindChild(cur, xmlSecNodeSubcode, xmlSecSoap12Ns); + if(tmp != NULL) { + cur = tmp; + } else { + break; + } + } + xmlSecAssert2(cur != NULL, NULL); + + /* add Subcode node */ + subcodeNode = xmlSecAddChild(cur, xmlSecNodeSubcode, xmlSecSoap12Ns); + if(subcodeNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSubcode)); + return(NULL); + } + + /* add Value node */ + valueNode = xmlSecAddChild(subcodeNode, xmlSecNodeValue, xmlSecSoap12Ns); + if(valueNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeValue)); + xmlUnlinkNode(subcodeNode); + xmlFreeNode(subcodeNode); + return(NULL); + } + + /* create qname for fault code */ + qname = xmlSecGetQName(cur, subCodeHref, subCodeName); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGetQName", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(cur->name)); + xmlUnlinkNode(subcodeNode); + xmlFreeNode(subcodeNode); + return(NULL); + } + + /* set result qname in Value node */ + xmlNodeSetContent(cur, qname); + if(qname != subCodeName) { + xmlFree(qname); + } + + return(subcodeNode); +} + +/** + * xmlSecSoap12AddFaultReasonText: + * @faultNode: the pointer to node. + * @faultReasonText: the new reason text. + * @faultReasonLang: the new reason xml:lang attribute. + * + * Adds a new Text node to the Fault/Reason node. + * + * Returns a pointer to the newly created node or NULL if an error + * occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonText, + const xmlChar* faultReasonLang) { + xmlNodePtr reasonNode; + xmlNodePtr textNode; + + xmlSecAssert2(faultNode != NULL, NULL); + xmlSecAssert2(faultReasonText != NULL, NULL); + xmlSecAssert2(faultReasonLang != NULL, NULL); + + /* find Reason node */ + reasonNode = xmlSecFindChild(faultNode, xmlSecNodeReason, xmlSecSoap12Ns); + if(reasonNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecFindChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeReason)); + return(NULL); + } + + /* add Text node */ + textNode = xmlSecAddChild(reasonNode, xmlSecNodeText, xmlSecSoap12Ns); + if(textNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeText)); + return(NULL); + } + xmlNodeSetContent(textNode, faultReasonText); + xmlNodeSetLang(textNode, faultReasonLang); + + return(textNode); +} + +/** + * xmlSecSoap12AddFaultDetailEntry: + * @faultNode: the pointer to node. + * @detailEntryNode: the pointer to detail entry node. + * + * Adds a new child to the Detail child element of @faultNode. + * + * Returns pointer to the added child (@detailEntryNode) or NULL if an error + * occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode) { + xmlNodePtr detailNode; + + xmlSecAssert2(faultNode != NULL, NULL); + xmlSecAssert2(detailEntryNode != NULL, NULL); + + /* find Detail node and add it if needed */ + detailNode = xmlSecFindChild(faultNode, xmlSecNodeDetail, xmlSecSoap12Ns); + if(detailNode == NULL) { + detailNode = xmlSecAddChild(faultNode, xmlSecNodeDetail, xmlSecSoap12Ns); + if(detailNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDetail)); + return(NULL); + } + } + + return(xmlSecAddChildNode(detailNode, detailEntryNode)); +} + +/** + * xmlSecSoap12CheckEnvelope: + * @envNode: the pointer to node. + * + * Validates node structure. + * + * Returns 1 if @envNode has a valid element, 0 if it is + * not valid or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, -1); + + /* verify envNode itself */ + if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap12Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeEnvelope), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + /* optional Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap12Ns)) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* required Body node is next */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + return(1); +} + +/** + * xmlSecSoap12GetHeader: + * @envNode: the pointer to node. + * + * Gets pointer to the node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12GetHeader(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* optional Header node is first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap12Ns)) { + return(cur); + } + + return(NULL); +} + +/** + * xmlSecSoap12GetBody: + * @envNode: the pointer to node. + * + * Gets pointer to the node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12GetBody(xmlNodePtr envNode) { + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* optional Header node first */ + cur = xmlSecGetNextElementNode(envNode->children); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHeader, xmlSecSoap12Ns)) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* Body node is next */ + if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeBody), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(cur); +} + +/** + * xmlSecSoap12GetBodyEntriesNumber: + * @envNode: the pointer to node. + * + * Gets the number of body entries. + * + * Returns the number of body entries. + */ +EXPORT_C +xmlSecSize +xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode) { + xmlSecSize number = 0; + xmlNodePtr bodyNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, 0); + + /* get Body node */ + bodyNode = xmlSecSoap12GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + + cur = xmlSecGetNextElementNode(bodyNode->children); + while(cur != NULL) { + number++; + cur = xmlSecGetNextElementNode(cur->next); + } + + return(number); +} + +/** + * xmlSecSoap12GetBodyEntry: + * @envNode: the pointer to node. + * @pos: the body entry number. + * + * Gets the body entry number @pos. + * + * Returns pointer to body entry node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) { + xmlNodePtr bodyNode; + xmlNodePtr cur; + + xmlSecAssert2(envNode != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap12GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecGetNextElementNode(bodyNode->children); + while((cur != NULL) && (pos > 0)) { + pos--; + cur = xmlSecGetNextElementNode(cur->next); + } + + return(cur); +} + +/** + * xmlSecSoap12GetFaultEntry: + * @envNode: the pointer to node. + * + * Gets the Fault entry (if any). + * + * Returns pointer to Fault entry or NULL if it does not exist. + */ +EXPORT_C +xmlNodePtr +xmlSecSoap12GetFaultEntry(xmlNodePtr envNode) { + xmlNodePtr bodyNode; + + xmlSecAssert2(envNode != NULL, NULL); + + /* get Body node */ + bodyNode = xmlSecSoap12GetBody(envNode); + if(bodyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBody", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns)); +} + +#endif /* XMLSEC_NO_SOAP */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_strings.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_strings.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,588 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * All the string constants. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_strings.h" + +const xmlSecGlobalConstData xmlSecGlobalConsts = { + +/************************************************************************* + * + * Global Namespaces + * + ************************************************************************/ +BAD_CAST "http://www.aleksey.com/xmlsec/2002", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#", +BAD_CAST "http://www.w3.org/2002/03/xkms#", +BAD_CAST "http://www.w3.org/TR/1999/REC-xpath-19991116", +BAD_CAST "http://www.w3.org/2002/06/xmldsig-filter2", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more/xptr", +BAD_CAST "http://schemas.xmlsoap.org/soap/envelope/", +BAD_CAST "http://www.w3.org/2002/06/soap-envelope", + +/************************************************************************* + * + * DSig Nodes + * + ************************************************************************/ +BAD_CAST "Signature", +BAD_CAST "SignedInfo", +BAD_CAST "CanonicalizationMethod", +BAD_CAST "SignatureMethod", +BAD_CAST "SignatureValue", +BAD_CAST "DigestMethod", +BAD_CAST "DigestValue", +BAD_CAST "Object", +BAD_CAST "Manifest", +BAD_CAST "SignatureProperties", + +/************************************************************************* + * + * Encryption Nodes + * + ************************************************************************/ +BAD_CAST "EncryptedData", +BAD_CAST "EncryptionMethod", +BAD_CAST "EncryptionProperties", +BAD_CAST "EncryptionProperty", +BAD_CAST "CipherData", +BAD_CAST "CipherValue", +BAD_CAST "CipherReference", +BAD_CAST "ReferenceList", +BAD_CAST "DataReference", +BAD_CAST "KeyReference", + +BAD_CAST "CarriedKeyName", + +BAD_CAST "http://www.w3.org/2001/04/xmlenc#Content", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#Element", + +/************************************************************************* + * + * XKMS Nodes + * + ************************************************************************/ +#ifndef XMLSEC_NO_XKMS +BAD_CAST "result-response", +BAD_CAST "status-request", +BAD_CAST "locate-request", +BAD_CAST "validate-request", +BAD_CAST "compound-request", + +BAD_CAST "Result", +BAD_CAST "StatusRequest", +BAD_CAST "StatusResult", +BAD_CAST "LocateRequest", +BAD_CAST "LocateResult", +BAD_CAST "ValidateRequest", +BAD_CAST "ValidateResult", +BAD_CAST "CompoundRequest", +BAD_CAST "CompoundResult", + +BAD_CAST "MessageExtension", +BAD_CAST "OpaqueClientData", +BAD_CAST "ResponseMechanism", +BAD_CAST "RespondWith", +BAD_CAST "PendingNotification", +BAD_CAST "QueryKeyBinding", +BAD_CAST "KeyUsage", +BAD_CAST "UseKeyWith", +BAD_CAST "TimeInstant", +BAD_CAST "RequestSignatureValue", +BAD_CAST "UnverifiedKeyBinding", +BAD_CAST "ValidityInterval", +BAD_CAST "Status", +BAD_CAST "ValidReason", +BAD_CAST "InvalidReason", +BAD_CAST "IndeterminateReason", + +BAD_CAST "Service", +BAD_CAST "Nonce", +BAD_CAST "OriginalRequestId", +BAD_CAST "ResponseLimit", +BAD_CAST "Mechanism[", +BAD_CAST "Identifier", +BAD_CAST "Application", +BAD_CAST "ResultMajor", +BAD_CAST "ResultMinor", +BAD_CAST "RequestId", +BAD_CAST "NotBefore", +BAD_CAST "NotOnOrAfter", +BAD_CAST "Time", +BAD_CAST "StatusValue", + +BAD_CAST "Pending", +BAD_CAST "Represent", +BAD_CAST "RequestSignatureValue", + +BAD_CAST "KeyName", +BAD_CAST "KeyValue", +BAD_CAST "X509Cert", +BAD_CAST "X509Chain", +BAD_CAST "X509CRL", +BAD_CAST "OCSP", +BAD_CAST "RetrievalMethod", +BAD_CAST "PGP", +BAD_CAST "PGPWeb", +BAD_CAST "SPKI", +BAD_CAST "PrivateKey", + +BAD_CAST "Success", +BAD_CAST "Failed", +BAD_CAST "Pending", + +BAD_CAST "Encryption", +BAD_CAST "Signature", +BAD_CAST "Exchange", + +BAD_CAST "Valid", +BAD_CAST "Invalid", +BAD_CAST "Indeterminate", + +BAD_CAST "IssuerTrust", +BAD_CAST "RevocationStatus", +BAD_CAST "ValidityInterval", +BAD_CAST "Signature", + +BAD_CAST "Success", +BAD_CAST "VersionMismatch", +BAD_CAST "Sender", +BAD_CAST "Receiver", +BAD_CAST "Represent", +BAD_CAST "Pending", + +BAD_CAST "NoMatch", +BAD_CAST "TooManyResponses", +BAD_CAST "Incomplete", +BAD_CAST "Failure", +BAD_CAST "Refused", +BAD_CAST "NoAuthentication", +BAD_CAST "MessageNotSupported", +BAD_CAST "UnknownResponseId", +BAD_CAST "NotSynchronous", + +BAD_CAST "MessageNotSupported", +BAD_CAST "BadMessage", + +BAD_CAST "en", +BAD_CAST "Unsupported SOAP version", +BAD_CAST "Unable to process %s", +BAD_CAST "Service temporarily unable", +BAD_CAST "%s message not supported", +BAD_CAST "%s message invalid", + +BAD_CAST "plain", +BAD_CAST "soap-1.1", +BAD_CAST "soap-1.2", + +#endif /* XMLSEC_NO_XKMS */ + +/************************************************************************* + * + * KeyInfo Nodes + * + ************************************************************************/ +BAD_CAST "KeyInfo", +BAD_CAST "Reference", +BAD_CAST "Transforms", +BAD_CAST "Transform", + +/************************************************************************* + * + * Attributes + * + ************************************************************************/ +BAD_CAST "Id", +BAD_CAST "URI", +BAD_CAST "Type", +BAD_CAST "MimeType", +BAD_CAST "Encoding", +BAD_CAST "Algorithm", +BAD_CAST "Filter", +BAD_CAST "Recipient", +BAD_CAST "Target", + +/************************************************************************* + * + * AES strings + * + ************************************************************************/ +BAD_CAST "aes", +BAD_CAST "AESKeyValue", +BAD_CAST "http://www.aleksey.com/xmlsec/2002#AESKeyValue", + +BAD_CAST "aes128-cbc", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes128-cbc", + +BAD_CAST "aes192-cbc", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes192-cbc", + +BAD_CAST "aes256-cbc", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#aes256-cbc", + +BAD_CAST "kw-aes128", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes128", + +BAD_CAST "kw-aes192", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes192", + +BAD_CAST "kw-aes256", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-aes256", + +/************************************************************************* + * + * BASE64 strings + * + ************************************************************************/ +BAD_CAST "base64", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#base64", + +/************************************************************************* + * + * C14N strings + * + ************************************************************************/ +BAD_CAST "c14n", +BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", + +BAD_CAST "c14n-with-comments", +BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", + +BAD_CAST "exc-c14n", +BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#", + +BAD_CAST "exc-c14n-with-comments", +BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#WithComments", + +BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#", +BAD_CAST "http://www.w3.org/2001/10/xml-exc-c14n#WithComments", + +BAD_CAST "InclusiveNamespaces", +BAD_CAST "PrefixList", +/************************************************************************* + * + * DES strings + * + ************************************************************************/ +BAD_CAST "des", +BAD_CAST "DESKeyValue", +BAD_CAST "http://www.aleksey.com/xmlsec/2002#DESKeyValue", + +BAD_CAST "tripledes-cbc", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#tripledes-cbc", + +BAD_CAST "kw-tripledes", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#kw-tripledes", + +/************************************************************************* + * + * DSA strings + * + ************************************************************************/ +BAD_CAST "dsa", +BAD_CAST "DSAKeyValue", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#DSAKeyValue", +BAD_CAST "P", +BAD_CAST "Q", +BAD_CAST "G", +BAD_CAST "J", +BAD_CAST "X", +BAD_CAST "Y", +BAD_CAST "Seed", +BAD_CAST "PgenCounter", + +BAD_CAST "dsa-sha1", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#dsa-sha1", + +/************************************************************************* + * + * EncryptedKey + * + ************************************************************************/ +BAD_CAST "enc-key", +BAD_CAST "EncryptedKey", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#EncryptedKey", + +/************************************************************************* + * + * Enveloped transform strings + * + ************************************************************************/ +BAD_CAST "enveloped-signature", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#enveloped-signature", + +/************************************************************************* + * + * HMAC strings + * + ************************************************************************/ +BAD_CAST "hmac", +BAD_CAST "HMACKeyValue", +BAD_CAST "http://www.aleksey.com/xmlsec/2002#HMACKeyValue", + +BAD_CAST "HMACOutputLength", + +BAD_CAST "hmac-md5", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-md5", + +BAD_CAST "hmac-ripemd160", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160", + +BAD_CAST "hmac-sha1", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#hmac-sha1", + +BAD_CAST "hmac-sha224", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224", + +BAD_CAST "hmac-sha256", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", + +BAD_CAST "hmac-sha384", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384", + +BAD_CAST "hmac-sha512", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512", + +/************************************************************************* + * + * KeyName strings + * + ************************************************************************/ +BAD_CAST "key-name", +BAD_CAST "KeyName", + +/************************************************************************* + * + * KeyValue strings + * + ************************************************************************/ +BAD_CAST "key-value", +BAD_CAST "KeyValue", + +/************************************************************************* + * + * Memory Buffer strings + * + ************************************************************************/ +BAD_CAST "membuf-transform", + +/************************************************************************* + * + * MD5 strings + * + ************************************************************************/ +BAD_CAST "md5", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#md5", + +/************************************************************************* + * + * RetrievalMethod + * + ************************************************************************/ +BAD_CAST "retrieval-method", +BAD_CAST "RetrievalMethod", + +/************************************************************************* + * + * RIPEMD160 strings + * + ************************************************************************/ +BAD_CAST "ripemd160", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#ripemd160", + +/************************************************************************* + * + * RSA strings + * + ************************************************************************/ +BAD_CAST "rsa", +BAD_CAST "RSAKeyValue", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#RSAKeyValue", +BAD_CAST "Modulus", +BAD_CAST "Exponent", +BAD_CAST "PrivateExponent", + +BAD_CAST "rsa-md5", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-md5", + +BAD_CAST "rsa-ripemd160", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160", + +BAD_CAST "rsa-sha1", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#rsa-sha1", + +BAD_CAST "rsa-sha224", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224", + +BAD_CAST "rsa-sha256", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", + +BAD_CAST "rsa-sha384", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", + +BAD_CAST "rsa-sha512", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", + +BAD_CAST "rsa-1_5", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#rsa-1_5", + +BAD_CAST "rsa-oaep-mgf1p", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p", +BAD_CAST "OAEPparams", + +/************************************************************************* + * + * SHA1 strings + * + ************************************************************************/ +BAD_CAST "sha1", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#sha1", + +BAD_CAST "sha224", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#sha224", + +BAD_CAST "sha256", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#sha256", + +BAD_CAST "sha384", +BAD_CAST "http://www.w3.org/2001/04/xmldsig-more#sha384", + +BAD_CAST "sha512", +BAD_CAST "http://www.w3.org/2001/04/xmlenc#sha512", + +/************************************************************************* + * + * X509 strings + * + ************************************************************************/ +BAD_CAST "x509", +BAD_CAST "X509Data", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#X509Data", + +BAD_CAST "X509Certificate", +BAD_CAST "X509CRL", +BAD_CAST "X509SubjectName", +BAD_CAST "X509IssuerSerial", +BAD_CAST "X509IssuerName", +BAD_CAST "X509SerialNumber", +BAD_CAST "X509SKI", + +BAD_CAST "raw-x509-cert", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#rawX509Certificate", + +BAD_CAST "x509-store", + +/************************************************************************* + * + * PGP strings + * + ************************************************************************/ +BAD_CAST "pgp", +BAD_CAST "PGPData", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#PGPData", + +/************************************************************************* + * + * SPKI strings + * + ************************************************************************/ +BAD_CAST "spki", +BAD_CAST "SPKIData", +BAD_CAST "http://www.w3.org/2000/09/xmldsig#SPKIData", + +/************************************************************************* + * + * XPath/XPointer strings + * + ************************************************************************/ +BAD_CAST "xpath", +BAD_CAST "XPath", + +BAD_CAST "xpath2", +BAD_CAST "XPath", +BAD_CAST "intersect", +BAD_CAST "subtract", +BAD_CAST "union", + +BAD_CAST "xpointer", +BAD_CAST "XPointer", + +/************************************************************************* + * + * Xslt strings + * + ************************************************************************/ +BAD_CAST "xslt", +BAD_CAST "http://www.w3.org/TR/1999/REC-xslt-19991116", + +#ifndef XMLSEC_NO_SOAP +/************************************************************************* + * + * SOAP 1.1/1.2 strings + * + ************************************************************************/ +BAD_CAST "Envelope", +BAD_CAST "Header", +BAD_CAST "Body", +BAD_CAST "Fault", +BAD_CAST "faultcode", +BAD_CAST "faultstring", +BAD_CAST "faultactor", +BAD_CAST "detail", +BAD_CAST "Code", +BAD_CAST "Reason", +BAD_CAST "Node", +BAD_CAST "Role", +BAD_CAST "Detail", +BAD_CAST "Value", +BAD_CAST "Subcode", +BAD_CAST "Text", + + +BAD_CAST "VersionMismatch", +BAD_CAST "MustUnderstand", +BAD_CAST "Client", +BAD_CAST "Server", +BAD_CAST "Receiver", +BAD_CAST "Sender", +BAD_CAST "DataEncodingUnknown", + + +#endif /* XMLSEC_NO_SOAP */ + +/************************************************************************* + * + * Utility strings + * + ************************************************************************/ +BAD_CAST "", +BAD_CAST "\n" + + +}; // xmlSecGlobalConsts +EXPORT_C +const xmlSecGlobalConstData* xmlSecGetGlobalConsts() +{ + return &xmlSecGlobalConsts; + +} + + + + + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_templates.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_templates.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2184 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Creating signature and encryption templates. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_transforms.h" +#include "xmlsec_strings.h" +#include "xmlsec_base64.h" +#include "xmlsec_templates.h" +#include "xmlsec_errors.h" + +//added for symbian port +#include + +static int useNewLine = 1; + +static unsigned char* dsPref = NULL; + +static xmlNodePtr xmlSecTmplAddReference (xmlNodePtr parentNode, + xmlSecTransformId digestMethodId, + const xmlChar *id, + const xmlChar *uri, + const xmlChar *type); +static int xmlSecTmplPrepareEncData (xmlNodePtr parentNode, + xmlSecTransformId encMethodId); +static int xmlSecTmplNodeWriteNsList (xmlNodePtr parentNode, + const xmlChar** namespaces); +EXPORT_C + + +void xmlSetNewLineFlag(int aNewLine) + { + useNewLine = aNewLine; + } + +int xmlGetNewLineFlag() + { + return useNewLine; + } +EXPORT_C + +void xmlSetPrefix(unsigned char* aPref) + { + dsPref = aPref; + } + +unsigned char* xmlGetPrefix() + { + return dsPref; + } + +/************************************************************************** + * + * node + * + **************************************************************************/ +/** + * xmlSecTmplSignatureCreate: + * @doc: the pointer to signature document or NULL; in the + * second case, application must later call @xmlSetTreeDoc + * to ensure that all the children nodes have correct + * pointer to XML document. + * @c14nMethodId: the signature canonicalization method. + * @signMethodId: the signature method. + * @id: the node id (may be NULL). + * + * Creates new node with the mandatory , + * , and + * children and sub-children. + * The application is responsible for inserting the returned node + * in the XML document. + * + * Returns the pointer to newly created node or NULL if an + * error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureCreate(xmlDocPtr doc, xmlSecTransformId c14nMethodId, + xmlSecTransformId signMethodId, const xmlChar *id) { + xmlNodePtr signNode; + xmlNodePtr signedInfoNode; + xmlNodePtr cur; + xmlNsPtr ns; + + xmlSecAssert2(c14nMethodId != NULL, NULL); + xmlSecAssert2(c14nMethodId->href != NULL, NULL); + xmlSecAssert2(signMethodId != NULL, NULL); + xmlSecAssert2(signMethodId->href != NULL, NULL); + + /* create Signature node itself */ + signNode = xmlNewDocNode(doc, NULL, xmlSecNodeSignature, NULL); + if(signNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSignature)); + return(NULL); + } + + ns = xmlNewNs(signNode, xmlSecDSigNs, dsPref); + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(xmlSecDSigNs)); + xmlFreeNode(signNode); + return(NULL); + } + xmlSetNs(signNode, ns); + + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(signNode, BAD_CAST "Id", id); + if ( !ptr && OOM_FLAG ) + { + xmlFreeNode(signNode); + return(NULL); + } + } + + /* add SignedInfo node */ + signedInfoNode = xmlSecAddChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs); + if(signedInfoNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSignedInfo)); + xmlFreeNode(signNode); + return(NULL); + } + + /* add SignatureValue node */ + cur = xmlSecAddChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSignatureValue)); + xmlFreeNode(signNode); + return(NULL); + } + + /* add CanonicaizationMethod node to SignedInfo */ + cur = xmlSecAddChild(signedInfoNode, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod)); + xmlFreeNode(signNode); + return(NULL); + } + if(xmlSetNsProp(cur, ns, xmlSecAttrAlgorithm, c14nMethodId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(c14nMethodId->href)); + xmlFreeNode(signNode); + return(NULL); + } + + /* add SignatureMethod node to SignedInfo */ + cur = xmlSecAddChild(signedInfoNode, xmlSecNodeSignatureMethod, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSignatureMethod)); + xmlFreeNode(signNode); + return(NULL); + } + if(xmlSetNsProp(cur, ns, xmlSecAttrAlgorithm, signMethodId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(signMethodId->href)); + xmlFreeNode(signNode); + return(NULL); + } + + return(signNode); +} + +/** + * xmlSecTmplSignatureEnsureKeyInfo: + * @signNode: the pointer to node. + * @id: the node id (may be NULL). + * + * Adds (if necessary) node to the + * node @signNode. + * + * Returns the pointer to newly created node or NULL if an + * error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) { + xmlNodePtr res; + int created = 0; + + xmlSecAssert2(signNode != NULL, NULL); + + res = xmlSecFindChild(signNode, xmlSecNodeKeyInfo, xmlSecDSigNs); + if(res == NULL) { + xmlNodePtr signValueNode; + + signValueNode = xmlSecFindChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs); + if(signValueNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeSignatureValue), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + res = xmlSecAddNextSibling(signValueNode, xmlSecNodeKeyInfo, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddNextSibling", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyInfo)); + return(NULL); + } + created = 1; + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + if (!ptr && OOM_FLAG) + { + if (created) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + } + return(NULL); + } + } + return(res); +} + +/** + * xmlSecTmplSignatureAddReference: + * @signNode: the pointer to node. + * @digestMethodId: the reference digest method. + * @id: the node id (may be NULL). + * @uri: the reference node uri (may be NULL). + * @type: the reference node type (may be NULL). + * + * Adds node with given URI (@uri), Id (@id) and + * Type (@type) attributes and the required children and + * to the child of @signNode. + * + * Returns the pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMethodId, + const xmlChar *id, const xmlChar *uri, const xmlChar *type) { + xmlNodePtr signedInfoNode; + + xmlSecAssert2(signNode != NULL, NULL); + xmlSecAssert2(digestMethodId != NULL, NULL); + xmlSecAssert2(digestMethodId->href != NULL, NULL); + + signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs); + if(signedInfoNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeSignedInfo), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecTmplAddReference(signedInfoNode, digestMethodId, id, uri, type)); +} + +static xmlNodePtr +xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId, + const xmlChar *id, const xmlChar *uri, const xmlChar *type) { + xmlNodePtr res; + xmlNodePtr cur; + int error = 0; + + xmlSecAssert2(parentNode != NULL, NULL); + xmlSecAssert2(digestMethodId != NULL, NULL); + xmlSecAssert2(digestMethodId->href != NULL, NULL); + + /* add Reference node */ + res = xmlSecAddChild(parentNode, xmlSecNodeReference, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeReference)); + return(NULL); + } + + /* set Reference node attributes */ + if(id != NULL) { + xmlAttrPtr ptr = xmlSetNsProp(res, res->ns, xmlSecAttrId, id); + error = error || !ptr; + } + if(type != NULL) { + xmlAttrPtr ptr = xmlSetNsProp(res, res->ns, xmlSecAttrType, type); + error = error || !ptr; + } + if(uri != NULL) { + xmlAttrPtr ptr = xmlSetNsProp(res, res->ns, xmlSecAttrURI, uri); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + /* add DigestMethod node and set algorithm */ + cur = xmlSecAddChild(res, xmlSecNodeDigestMethod, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDigestMethod)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + if(xmlSetNsProp(cur, cur->ns, xmlSecAttrAlgorithm, digestMethodId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(digestMethodId->href)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + /* add DigestValue node */ + cur = xmlSecAddChild(res, xmlSecNodeDigestValue, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDigestValue)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplSignatureAddObject: + * @signNode: the pointer to node. + * @id: the node id (may be NULL). + * @mimeType: the object mime type (may be NULL). + * @encoding: the object encoding (may be NULL). + * + * Adds node to the node @signNode. + * + * Returns the pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id, + const xmlChar *mimeType, const xmlChar *encoding) { + xmlNodePtr res; + int error = 0; + + xmlSecAssert2(signNode != NULL, NULL); + + res = xmlSecAddChild(signNode, xmlSecNodeObject, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeObject)); + return(NULL); + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + error = error || !ptr; + } + if(mimeType != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrMimeType, mimeType); + error = error || !ptr; + } + if(encoding != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrEncoding, encoding); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplSignatureGetSignMethodNode: + * @signNode: the pointer to node. + * + * Gets pointer to child of node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureGetSignMethodNode(xmlNodePtr signNode) { + xmlNodePtr signedInfoNode; + + xmlSecAssert2(signNode != NULL, NULL); + + signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs); + if(signedInfoNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeSignedInfo), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + return(xmlSecFindChild(signedInfoNode, xmlSecNodeSignatureMethod, xmlSecDSigNs)); +} + +/** + * xmlSecTmplSignatureGetC14NMethodNode: + * @signNode: the pointer to node. + * + * Gets pointer to child of node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplSignatureGetC14NMethodNode(xmlNodePtr signNode) { + xmlNodePtr signedInfoNode; + + xmlSecAssert2(signNode != NULL, NULL); + + signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs); + if(signedInfoNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeSignedInfo), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + return(xmlSecFindChild(signedInfoNode, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs)); +} + +/** + * xmlSecTmplReferenceAddTransform: + * @referenceNode: the pointer to node. + * @transformId: the transform method id. + * + * Adds node to the node @referenceNode. + * + * Returns the pointer to newly created node or NULL if an + * error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId transformId) { + xmlNodePtr transformsNode; + xmlNodePtr res; + + xmlSecAssert2(referenceNode != NULL, NULL); + xmlSecAssert2(transformId != NULL, NULL); + xmlSecAssert2(transformId->href != NULL, NULL); + + /* do we need to create Transforms node first */ + transformsNode = xmlSecFindChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs); + if(transformsNode == NULL) { + xmlNodePtr tmp; + + tmp = xmlSecGetNextElementNode(referenceNode->children); + if(tmp == NULL) { + transformsNode = xmlSecAddChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs); + } else { + transformsNode = xmlSecAddPrevSibling(tmp, xmlSecNodeTransforms, xmlSecDSigNs); + } + if(transformsNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild or xmlSecAddPrevSibling", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransforms)); + return(NULL); + } + } + + res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransform)); + return(NULL); + } + + if(xmlSetNsProp(res, res->ns, xmlSecAttrAlgorithm, transformId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(transformId->href)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplObjectAddSignProperties: + * @objectNode: the pointer to node. + * @id: the node id (may be NULL). + * @target: the Target (may be NULL). + * + * Adds node to the node @objectNode. + * + * Returns the pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, const xmlChar *target) { + xmlNodePtr res; + int error = 0; + + xmlSecAssert2(objectNode != NULL, NULL); + + res = xmlSecAddChild(objectNode, xmlSecNodeSignatureProperties, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeSignatureProperties)); + return(NULL); + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + error = error || !ptr; + } + if(target != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrTarget, target); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + return(res); +} + +/** + * xmlSecTmplObjectAddManifest: + * @objectNode: the pointer to node. + * @id: the node id (may be NULL). + * + * Adds node to the node @objectNode. + * + * Returns the pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplObjectAddManifest(xmlNodePtr objectNode, const xmlChar *id) { + xmlNodePtr res; + + xmlSecAssert2(objectNode != NULL, NULL); + + res = xmlSecAddChild(objectNode, xmlSecNodeManifest, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeManifest)); + return(NULL); + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + if (!ptr && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + } + return(res); +} + +/** + * xmlSecTmplManifestAddReference: + * @manifestNode: the pointer to node. + * @digestMethodId: the reference digest method. + * @id: the node id (may be NULL). + * @uri: the reference node uri (may be NULL). + * @type: the reference node type (may be NULL). + * + * Adds node with specified URI (@uri), Id (@id) and + * Type (@type) attributes and the required children and + * to the node @manifestNode. + * + * Returns the pointer to newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digestMethodId, + const xmlChar *id, const xmlChar *uri, const xmlChar *type) { + return(xmlSecTmplAddReference(manifestNode, digestMethodId, id, uri, type)); +} + +/************************************************************************** + * + * node + * + **************************************************************************/ +/** + * xmlSecTmplEncDataCreate: + * @doc: the pointer to signature document or NULL; in the later + * case, application must later call @xmlSetTreeDoc to ensure + * that all the children nodes have correct pointer to XML document. + * @encMethodId: the encryption method (may be NULL). + * @id: the Id attribute (optional). + * @type: the Type attribute (optional) + * @mimeType: the MimeType attribute (optional) + * @encoding: the Encoding attribute (optional) + * + * Creates new node for encryption template. + * + * Returns the pointer newly created node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId, + const xmlChar *id, const xmlChar *type, + const xmlChar *mimeType, const xmlChar *encoding) { + xmlNodePtr encNode; + xmlNsPtr ns; + int error = 0; + + encNode = xmlNewDocNode(doc, NULL, xmlSecNodeEncryptedData, NULL); + if(encNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptedData)); + return(NULL); + } + + ns = xmlNewNs(encNode, xmlSecEncNs, NULL); + if(ns == NULL) { + xmlFreeNode(encNode); + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(xmlSecEncNs)); + return(NULL); + } + xmlSetNs(encNode, ns); + + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(encNode, xmlSecAttrId, id); + error = error || !ptr; + } + if(type != NULL) { + xmlAttrPtr ptr = xmlSetProp(encNode, xmlSecAttrType, type); + error = error || !ptr; + } + if(mimeType != NULL) { + xmlAttrPtr ptr = xmlSetProp(encNode, xmlSecAttrMimeType, mimeType); + error = error || !ptr; + } + if(encoding != NULL) { + xmlAttrPtr ptr = xmlSetProp(encNode, xmlSecAttrEncoding, encoding); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlFreeNode(encNode); + return(NULL); + } + + if(xmlSecTmplPrepareEncData(encNode, encMethodId) < 0) { + xmlFreeNode(encNode); + return(NULL); + } + return(encNode); +} + +static int +xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) { + xmlNodePtr cur; + + xmlSecAssert2(parentNode != NULL, -1); + xmlSecAssert2((encMethodId == NULL) || (encMethodId->href != NULL), -1); + + /* add EncryptionMethod node if requested */ + if(encMethodId != NULL) { + cur = xmlSecAddChild(parentNode, xmlSecNodeEncryptionMethod, xmlSecEncNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptionMethod)); + return(-1); + } + if(xmlSetProp(cur, xmlSecAttrAlgorithm, encMethodId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(encMethodId->href)); + return(-1); + } + } + + /* and CipherData node */ + cur = xmlSecAddChild(parentNode, xmlSecNodeCipherData, xmlSecEncNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCipherData)); + return(-1); + } + + return(0); +} + + +/** + * xmlSecTmplEncDataEnsureKeyInfo: + * @encNode: the pointer to node. + * @id: the Id attrbibute (optional). + * + * Adds to the node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataEnsureKeyInfo(xmlNodePtr encNode, const xmlChar* id) { + xmlNodePtr res; + + xmlSecAssert2(encNode != NULL, NULL); + + res = xmlSecFindChild(encNode, xmlSecNodeKeyInfo, xmlSecDSigNs); + if(res == NULL) { + xmlNodePtr cipherDataNode; + + cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs); + if(cipherDataNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeCipherData), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + res = xmlSecAddPrevSibling(cipherDataNode, xmlSecNodeKeyInfo, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddPrevSibling", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyInfo)); + return(NULL); + } + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + if (!ptr && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + } + return(res); +} + +/** + * xmlSecTmplEncDataEnsureEncProperties: + * @encNode: the pointer to node. + * @id: the Id attribute (optional). + * + * Adds node to the + * node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataEnsureEncProperties(xmlNodePtr encNode, const xmlChar *id) { + xmlNodePtr res; + int created = 0; + + xmlSecAssert2(encNode != NULL, NULL); + + res = xmlSecFindChild(encNode, xmlSecNodeEncryptionProperties, xmlSecEncNs); + if(res == NULL) { + res = xmlSecAddChild(encNode, xmlSecNodeEncryptionProperties, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptionProperties)); + return(NULL); + } + created = 1; + } + + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + if (!ptr && OOM_FLAG) + { + if (created) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + } + return(NULL); + } + } + + return(res); +} + +/** + * xmlSecTmplEncDataAddEncProperty: + * @encNode: the pointer to node. + * @id: the Id attribute (optional). + * @target: the Target attribute (optional). + * + * Adds node (and the parent + * node if required) to the + * node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xmlChar *target) { + xmlNodePtr encProps; + xmlNodePtr res; + int error = 0; + + xmlSecAssert2(encNode != NULL, NULL); + + encProps = xmlSecTmplEncDataEnsureEncProperties(encNode, NULL); + if(encProps == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTmplEncDataEnsureEncProperties", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + res = xmlSecAddChild(encProps, xmlSecNodeEncryptionProperty, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptionProperty)); + return(NULL); + } + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrId, id); + error = error || !ptr; + } + if(target != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrTarget, target); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplEncDataEnsureCipherValue: + * @encNode: the pointer to node. + * + * Adds to the node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) { + xmlNodePtr cipherDataNode; + xmlNodePtr res, tmp; + + xmlSecAssert2(encNode != NULL, NULL); + + cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs); + if(cipherDataNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeCipherData), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* check that we don;t have CipherReference node */ + tmp = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs); + if(tmp != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeCipherReference), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs); + if(res == NULL) { + res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCipherValue)); + return(NULL); + } + } + + return(res); +} + +/** + * xmlSecTmplEncDataEnsureCipherReference: + * @encNode: the pointer to node. + * @uri: the URI attribute (may be NULL). + * + * Adds node with specified URI attribute @uri + * to the node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) { + xmlNodePtr cipherDataNode; + xmlNodePtr res, tmp; + int created = 1; + + xmlSecAssert2(encNode != NULL, NULL); + + cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs); + if(cipherDataNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeCipherData), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* check that we don;t have CipherValue node */ + tmp = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs); + if(tmp != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeCipherValue), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs); + if(res == NULL) { + res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCipherReference)); + return(NULL); + } + created = 1; + } + + if(uri != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrURI, uri); + if (!ptr && OOM_FLAG) + { + if (created) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + } + return(NULL); + } + } + + return(res); +} + +/** + * xmlSecTmplEncDataGetEncMethodNode: + * @encNode: the pointer to node. + * + * Gets pointer to node. + * + * Returns pointer to node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplEncDataGetEncMethodNode(xmlNodePtr encNode) { + xmlSecAssert2(encNode != NULL, NULL); + + return(xmlSecFindChild(encNode, xmlSecNodeEncryptionMethod, xmlSecEncNs)); +} + +/** + * xmlSecTmplCipherReferenceAddTransform: + * @cipherReferenceNode: the pointer to node. + * @transformId: the transform id. + * + * Adds node (and the parent node) + * with specified transform methods @transform to the + * child node of the node @encNode. + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode, + xmlSecTransformId transformId) { + xmlNodePtr transformsNode; + xmlNodePtr res; + + xmlSecAssert2(cipherReferenceNode != NULL, NULL); + xmlSecAssert2(transformId != NULL, NULL); + xmlSecAssert2(transformId->href != NULL, NULL); + + transformsNode = xmlSecFindChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs); + if(transformsNode == NULL) { + transformsNode = xmlSecAddChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs); + if(transformsNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransforms)); + return(NULL); + } + } + + res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransform)); + return(NULL); + } + + if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(transformId->href)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + + +/*********************************************************************** + * + * node + * + **********************************************************************/ + +/** + * xmlSecTmplReferenceListAddDataReference: + * @encNode: the pointer to node. + * @uri: uri to reference (optional) + * + * Adds and the parent node (if needed). + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri) { + xmlNodePtr refListNode, res; + + xmlSecAssert2(encNode != NULL, NULL); + + refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs); + if(refListNode == NULL) { + refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs); + if(refListNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeReferenceList)); + return(NULL); + } + } + + res = xmlSecAddChild(refListNode, xmlSecNodeDataReference, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDataReference)); + return(NULL); + } + + if(uri != NULL) { + if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrURI), + xmlSecErrorsSafeString(uri)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + } + + return(res); +} + +/** + * xmlSecTmplReferenceListAddKeyReference: + * @encNode: the pointer to node. + * @uri: uri to reference (optional) + * + * Adds and the parent node (if needed). + * + * Returns the pointer to newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) { + xmlNodePtr refListNode, res; + + xmlSecAssert2(encNode != NULL, NULL); + + refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs); + if(refListNode == NULL) { + refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs); + if(refListNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeReferenceList)); + return(NULL); + } + } + + res = xmlSecAddChild(refListNode, xmlSecNodeKeyReference, xmlSecEncNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyReference)); + return(NULL); + } + + if(uri != NULL) { + if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrURI), + xmlSecErrorsSafeString(uri)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + } + + return(res); +} + + +/************************************************************************** + * + * node + * + **************************************************************************/ + +/** + * xmlSecTmplKeyInfoAddKeyName: + * @keyInfoNode: the pointer to node. + * @name: the key name (optional). + * + * Adds node to the node @keyInfoNode. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplKeyInfoAddKeyName(xmlNodePtr keyInfoNode, const xmlChar* name) { + xmlNodePtr res; + + xmlSecAssert2(keyInfoNode != NULL, NULL); + + res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyName, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyName)); + return(NULL); + } + if(name != NULL) { + xmlNodeSetContent(res, name); + if ( OOM_FLAG ) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + } + return(res); +} + +/** + * xmlSecTmplKeyInfoAddKeyValue: + * @keyInfoNode: the pointer to node. + * + * Adds node to the node @keyInfoNode. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplKeyInfoAddKeyValue(xmlNodePtr keyInfoNode) { + xmlNodePtr res; + + xmlSecAssert2(keyInfoNode != NULL, NULL); + + res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyValue, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyValue)); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplKeyInfoAddX509Data: + * @keyInfoNode: the pointer to node. + * + * Adds node to the node @keyInfoNode. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) { + xmlNodePtr res; + + xmlSecAssert2(keyInfoNode != NULL, NULL); + + res = xmlSecAddChild(keyInfoNode, xmlSecNodeX509Data, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509Data)); + return(NULL); + } + + return(res); +} + +/** + * xmlSecTmplKeyInfoAddRetrievalMethod: + * @keyInfoNode: the pointer to node. + * @uri: the URI attribute (optional). + * @type: the Type attribute(optional). + * + * Adds node to the node @keyInfoNode. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplKeyInfoAddRetrievalMethod(xmlNodePtr keyInfoNode, const xmlChar *uri, + const xmlChar *type) { + xmlNodePtr res; + int error = 0; + + xmlSecAssert2(keyInfoNode != NULL, NULL); + + res = xmlSecAddChild(keyInfoNode, xmlSecNodeRetrievalMethod, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRetrievalMethod)); + return(NULL); + } + + if(uri != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrURI, uri); + error = error || !ptr; + } + if(type != NULL) { + xmlAttrPtr ptr = xmlSetProp(res, xmlSecAttrType, type); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + return(res); +} + +/** + * xmlSecTmplRetrievalMethodAddTransform: + * @retrMethodNode: the pointer to node. + * @transformId: the transform id. + * + * Adds node (and the parent node + * if required) to the node @retrMethod. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransformId transformId) { + xmlNodePtr transformsNode; + xmlNodePtr res; + + xmlSecAssert2(retrMethodNode != NULL, NULL); + xmlSecAssert2(transformId != NULL, NULL); + xmlSecAssert2(transformId->href != NULL, NULL); + + transformsNode = xmlSecFindChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs); + if(transformsNode == NULL) { + transformsNode = xmlSecAddChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs); + if(transformsNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransforms)); + return(NULL); + } + } + + res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs); + if(res == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeTransform)); + return(NULL); + } + + if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + xmlSecErrorsSafeString(transformId->href)); + xmlUnlinkNode(res); + xmlFreeNode(res); + return(NULL); + } + + return(res); +} + + +/** + * xmlSecTmplKeyInfoAddEncryptedKey: + * @keyInfoNode: the pointer to node. + * @encMethodId: the encryption method (optional). + * @id: the Id attribute (optional). + * @type: the Type attribute (optional). + * @recipient: the Recipient attribute (optional). + * + * Adds node with given attributes to + * the node @keyInfoNode. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMethodId, + const xmlChar* id, const xmlChar* type, const xmlChar* recipient) { + xmlNodePtr encKeyNode; + int error = 0; + + xmlSecAssert2(keyInfoNode != NULL, NULL); + + /* we allow multiple encrypted key elements */ + encKeyNode = xmlSecAddChild(keyInfoNode, xmlSecNodeEncryptedKey, xmlSecEncNs); + if(encKeyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptedKey)); + return(NULL); + } + + if(id != NULL) { + xmlAttrPtr ptr = xmlSetProp(encKeyNode, xmlSecAttrId, id); + error = error || !ptr; + } + if(type != NULL) { + xmlAttrPtr ptr = xmlSetProp(encKeyNode, xmlSecAttrType, type); + error = error || !ptr; + } + if(recipient != NULL) { + xmlAttrPtr ptr = xmlSetProp(encKeyNode, xmlSecAttrRecipient, recipient); + error = error || !ptr; + } + if (error && OOM_FLAG) + { + xmlUnlinkNode(encKeyNode); + xmlFreeNode(encKeyNode); + return(NULL); + } + + if(xmlSecTmplPrepareEncData(encKeyNode, encMethodId) < 0) { + xmlUnlinkNode(encKeyNode); + xmlFreeNode(encKeyNode); + return(NULL); + } + return(encKeyNode); +} + +/*********************************************************************** + * + * node + * + **********************************************************************/ +/** + * xmlSecTmplX509DataAddIssuerSerial: + * @x509DataNode: the pointer to node. + * + * Adds node to the given node. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C + +xmlNodePtr +xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) { + xmlNodePtr cur; + + xmlSecAssert2(x509DataNode != NULL, NULL); + + cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509IssuerSerial, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509IssuerSerial, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial)); + return(NULL); + } + + return (cur); +} + +/** + * xmlSecTmplX509DataAddSubjectName: + * @x509DataNode: the pointer to node. + * + * Adds node to the given node. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C + +xmlNodePtr +xmlSecTmplX509DataAddSubjectName(xmlNodePtr x509DataNode) { + xmlNodePtr cur; + + xmlSecAssert2(x509DataNode != NULL, NULL); + + cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509SubjectName, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeX509SubjectName), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SubjectName, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SubjectName)); + return(NULL); + } + + return (cur); +} + +/** + * xmlSecTmplX509DataAddSKI: + * @x509DataNode: the pointer to node. + * + * Adds node to the given node. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C + +xmlNodePtr +xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) { + xmlNodePtr cur; + + xmlSecAssert2(x509DataNode != NULL, NULL); + + cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509SKI, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeX509SKI), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SKI, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SKI)); + return(NULL); + } + + return (cur); +} + + +/** + * xmlSecTmplX509DataAddCertificate: + * @x509DataNode: the pointer to node. + * + * Adds node to the given node. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C + +xmlNodePtr +xmlSecTmplX509DataAddCertificate(xmlNodePtr x509DataNode) { + xmlNodePtr cur; + + xmlSecAssert2(x509DataNode != NULL, NULL); + + cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509Certificate, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeX509Certificate), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509Certificate, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509Certificate)); + return(NULL); + } + + return (cur); +} + +/** + * xmlSecTmplX509DataAddCRL: + * @x509DataNode: the pointer to node. + * + * Adds node to the given node. + * + * Returns the pointer to the newly created node or + * NULL if an error occurs. + */ +EXPORT_C + +xmlNodePtr +xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) { + xmlNodePtr cur; + + xmlSecAssert2(x509DataNode != NULL, NULL); + + cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509CRL, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeX509CRL), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509CRL, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509CRL)); + return(NULL); + } + + return (cur); +} + +/************************************************************************* + * + * node + * + ************************************************************************/ + +/** + * xmlSecTmplTransformAddHmacOutputLength: + * @transformNode: the pointer to node + * @bitsLen: the required length in bits + * + * Creates child for the HMAC transform + * node @node. + * + * Returns 0 on success and a negatie value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddHmacOutputLength(xmlNodePtr transformNode, xmlSecSize bitsLen) { + xmlNodePtr cur; + char buf[32]; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(bitsLen > 0, -1); + + cur = xmlSecFindChild(transformNode, xmlSecNodeHMACOutputLength, xmlSecDSigNs); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(transformNode, xmlSecNodeHMACOutputLength, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength)); + return(-1); + } + + sprintf(buf, "%u", bitsLen); + xmlNodeSetContent(cur, BAD_CAST buf); + return(0); +} + +/** + * xmlSecTmplTransformAddRsaOaepParam: + * @transformNode: the pointer to node. + * @buf: the OAEP param buffer. + * @size: the OAEP param buffer size. + * + * Creates child node in the @node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode, + const xmlSecByte *buf, xmlSecSize size) { + xmlNodePtr oaepParamNode; + xmlChar *base64; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + xmlSecAssert2(size > 0, -1); + + oaepParamNode = xmlSecFindChild(transformNode, xmlSecNodeRsaOAEPparams, xmlSecEncNs); + if(oaepParamNode != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + oaepParamNode = xmlSecAddChild(transformNode, xmlSecNodeRsaOAEPparams, xmlSecEncNs); + if(oaepParamNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams)); + return(-1); + } + + base64 = xmlSecBase64Encode(buf, size, 0); + if(base64 == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return(-1); + } + + xmlNodeSetContent(oaepParamNode, base64); + xmlFree(base64); + return(0); +} + +/** + * xmlSecTmplTransformAddXsltStylesheet: + * @transformNode: the pointer to node. + * @xslt: the XSLT transform exspression. + * + * Writes the XSLT transform expression to the @node. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xslt) { + xmlDocPtr xsltDoc; + int ret; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(xslt != NULL, -1); + + xsltDoc = xmlParseMemory((const char*)xslt, xmlStrlen(xslt)); + if(xsltDoc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseMemory", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecReplaceContent(transformNode, xmlDocGetRootElement(xsltDoc)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecReplaceContent", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(xsltDoc); + return(-1); + } + + xmlFreeDoc(xsltDoc); + return(0); +} + +/** + * xmlSecTmplTransformAddC14NInclNamespaces: + * @transformNode: the pointer to node. + * @prefixList: the white space delimited list of namespace prefixes, + * where "#default" indicates the default namespace + * (optional). + * + * Adds "inclusive" namespaces to the ExcC14N transform node @node. + * + * Returns 0 if success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode, + const xmlChar *prefixList) { + xmlNodePtr cur; + xmlAttrPtr ptr; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(prefixList != NULL, -1); + + cur = xmlSecFindChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecNodeGetName(transformNode)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces)); + return(-1); + } + + ptr = xmlSetProp(cur, xmlSecAttrPrefixList, prefixList); + if (!ptr && OOM_FLAG) + { + xmlUnlinkNode(cur); + xmlFreeNode(cur); + return(-1); + } + return(0); +} + +/** + * xmlSecTmplTransformAddXPath: + * @transformNode: the pointer to the node. + * @expression: the XPath expression. + * @nsList: the NULL terminated list of namespace prefix/href pairs + * (optional). + * + * Writes XPath transform infromation to the node + * @node. + * + * Returns 0 for success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression, + const xmlChar **nsList) { + xmlNodePtr xpathNode; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(expression != NULL, -1); + + xpathNode = xmlSecFindChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs); + if(xpathNode != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeXPath), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + xpathNode = xmlSecAddChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs); + if(xpathNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeXPath)); + return(-1); + } + + xmlNodeSetContent(xpathNode, expression); + return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpathNode, nsList) : 0); +} + +/** + * xmlSecTmplTransformAddXPath2: + * @transformNode: the pointer to the node. + * @type: the XPath2 transform type ("union", "intersect" or "subtract"). + * @expression: the XPath expression. + * @nsList: the NULL terminated list of namespace prefix/href pairs. + * (optional). + * + * Writes XPath2 transform infromation to the node + * @node. + * + * Returns 0 for success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type, + const xmlChar *expression, const xmlChar **nsList) { + xmlNodePtr xpathNode; + xmlAttrPtr ptr; + + xmlSecAssert2(transformNode != NULL, -1); + xmlSecAssert2(type != NULL, -1); + xmlSecAssert2(expression != NULL, -1); + + xpathNode = xmlSecAddChild(transformNode, xmlSecNodeXPath, xmlSecXPath2Ns); + if(xpathNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeXPath)); + return(-1); + } + ptr = xmlSetProp(xpathNode, xmlSecAttrFilter, type); + if (!ptr && OOM_FLAG) + { + xmlUnlinkNode(xpathNode); + xmlFreeNode(xpathNode); + return(-1); + } + + xmlNodeSetContent(xpathNode, expression); + return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpathNode, nsList) : 0); +} + +/** + * xmlSecTmplTransformAddXPointer: + * @transformNode: the pointer to the node. + * @expression: the XPath expression. + * @nsList: the NULL terminated list of namespace prefix/href pairs. + * (optional). + * + * Writes XPoniter transform infromation to the node + * @node. + * + * Returns 0 for success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expression, + const xmlChar **nsList) { + xmlNodePtr xpointerNode; + + xmlSecAssert2(expression != NULL, -1); + xmlSecAssert2(transformNode != NULL, -1); + + xpointerNode = xmlSecFindChild(transformNode, xmlSecNodeXPointer, xmlSecXPointerNs); + if(xpointerNode != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeXPointer), + XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + xpointerNode = xmlSecAddChild(transformNode, xmlSecNodeXPointer, xmlSecXPointerNs); + if(xpointerNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeXPointer)); + return(-1); + } + + + xmlNodeSetContent(xpointerNode, expression); + return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpointerNode, nsList) : 0); +} + +static int +xmlSecTmplNodeWriteNsList(xmlNodePtr parentNode, const xmlChar** nsList) { + xmlNsPtr ns; + const xmlChar *prefix; + const xmlChar *href; + const xmlChar **ptr; + + xmlSecAssert2(parentNode != NULL, -1); + xmlSecAssert2(nsList != NULL, -1); + + ptr = nsList; + while((*ptr) != NULL) { + if(xmlStrEqual(BAD_CAST "#default", (*ptr))) { + prefix = NULL; + } else { + prefix = (*ptr); + } + if((++ptr) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "unexpected end of ns list"); + return(-1); + } + href = *(ptr++); + + ns = xmlNewNs(parentNode, href, prefix); + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "href=%s;prefix=%s", + xmlSecErrorsSafeString(href), + xmlSecErrorsSafeString(prefix)); + return(-1); + } + } + return(0); +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_transforms.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_transforms.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2925 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * The Transforms Element (http://www.w3.org/TR/xmldsig-core/#sec-Transforms) + * + * The optional Transforms element contains an ordered list of Transform + * elements; these describe how the signer obtained the data object that + * was digested. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + * + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keysdata.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" +#include "xmlsec_base64.h" +#include "xmlsec_io.h" +#include "xmlsec_membuf.h" +#include "xmlsec_parser.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * Global xmlSecTransformIds list functions + * + *************************************************************************/ +static xmlSecPtrList xmlSecAllTransformIds; + + +/** + * xmlSecTransformIdsGet: + * + * Gets global registered transform klasses list. + * + * Returns the pointer to list of all registered transform klasses. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecTransformIdsGet(void) { + return(&xmlSecAllTransformIds); +} + +/** + * xmlSecTransformIdsInit: + * + * Initializes the transform klasses. This function is called from the + * #xmlSecInit function and the application should not call it directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformIdsInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(xmlSecTransformIdsGet(), xmlSecTransformIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecTransformIdListId"); + return(-1); + } + + ret = xmlSecTransformIdsRegisterDefault(); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegisterDefault", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecTransformIdsShutdown: + * + * Shuts down the keys data klasses. This function is called from the + * #xmlSecShutdown function and the application should not call it directly. + */ +EXPORT_C +void +xmlSecTransformIdsShutdown(void) { + xmlSecPtrListFinalize(xmlSecTransformIdsGet()); +} + +/** + * xmlSecTransformIdsRegister: + * @id: the transform klass. + * + * Registers @id in the global list of transform klasses. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformIdsRegister(xmlSecTransformId id) { + int ret; + + xmlSecAssert2(id != xmlSecTransformIdUnknown, -1); + + ret = xmlSecPtrListAdd(xmlSecTransformIdsGet(), (xmlSecPtr)id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id))); + return(-1); + } + + return(0); +} + +/** + * xmlSecTransformIdsRegisterDefault: + * + * Registers default (implemented by XML Security Library) + * transform klasses: XPath transform, Base64 transform, ... + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformIdsRegisterDefault(void) { + if(xmlSecTransformIdsRegister(xmlSecTransformBase64Id) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformBase64Id))); + return(-1); + } + + if(xmlSecTransformIdsRegister(xmlSecTransformEnvelopedId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformEnvelopedId))); + return(-1); + } + + /* c14n methods */ + if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId))); + return(-1); + } + if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NWithCommentsId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NWithCommentsId))); + return(-1); + } + if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NId))); + return(-1); + } + if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NWithCommentsId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NWithCommentsId))); + return(-1); + } + + if(xmlSecTransformIdsRegister(xmlSecTransformXPathId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPathId))); + return(-1); + } + + if(xmlSecTransformIdsRegister(xmlSecTransformXPath2Id) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPath2Id))); + return(-1); + } + + if(xmlSecTransformIdsRegister(xmlSecTransformXPointerId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId))); + return(-1); + } + +#ifndef XMLSEC_NO_XSLT + if(xmlSecTransformIdsRegister(xmlSecTransformXsltId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXsltId))); + return(-1); + } +#endif /* XMLSEC_NO_XSLT */ + + return(0); +} + +/************************************************************************** + * + * utils + * + *************************************************************************/ +/** + * xmlSecTransformUriTypeCheck: + * @type: the expected URI type. + * @uri: the uri for checking. + * + * Checks if @uri matches expected type @type. + * + * Returns 1 if @uri matches @type, 0 if not or a negative value + * if an error occurs. + */ +EXPORT_C +int +xmlSecTransformUriTypeCheck(xmlSecTransformUriType type, const xmlChar* uri) { + xmlSecTransformUriType uriType = 0; + + if((uri == NULL) || (xmlStrlen(uri) == 0)) { + uriType = xmlSecTransformUriTypeEmpty; + } else if(uri[0] == '#') { + uriType = xmlSecTransformUriTypeSameDocument; + } else if(xmlStrncmp(uri, BAD_CAST "file://", 7) == 0) { + uriType = xmlSecTransformUriTypeLocal; + } else { + uriType = xmlSecTransformUriTypeRemote; + } + return(((uriType & type) != 0) ? 1 : 0); +} + +/************************************************************************** + * + * xmlSecTransformCtx + * + *************************************************************************/ + +/** + * xmlSecTransformCtxCreate: + * + * Creates transforms chain processing context. + * The caller is responsible for destroying returend object by calling + * #xmlSecTransformCtxDestroy function. + * + * Returns pointer to newly allocated context object or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecTransformCtxPtr +xmlSecTransformCtxCreate(void) { + xmlSecTransformCtxPtr ctx; + int ret; + + /* Allocate a new xmlSecTransform and fill the fields. */ + ctx = (xmlSecTransformCtxPtr)xmlMalloc(sizeof(xmlSecTransformCtx)); + if(ctx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", sizeof(xmlSecTransformCtx)); + return(NULL); + } + + ret = xmlSecTransformCtxInitialize(ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecTransformCtxDestroy(ctx); + return(NULL); + } + + return(ctx); +} + +/** + * xmlSecTransformCtxDestroy: + * @ctx: the pointer to transforms chain processing context. + * + * Destroy context object created with #xmlSecTransformCtxCreate function. + */ +EXPORT_C +void +xmlSecTransformCtxDestroy(xmlSecTransformCtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + xmlSecTransformCtxFinalize(ctx); + xmlFree(ctx); +} + +/** + * xmlSecTransformCtxInitialize: + * @ctx: the pointer to transforms chain processing context. + * + * Initializes transforms chain processing context. + * The caller is responsible for cleaing up returend object by calling + * #xmlSecTransformCtxFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformCtxInitialize(xmlSecTransformCtxPtr ctx) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + + memset(ctx, 0, sizeof(xmlSecTransformCtx)); + + ret = xmlSecPtrListInitialize(&(ctx->enabledTransforms), xmlSecTransformIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ctx->enabledUris = xmlSecTransformUriTypeAny; + return(0); +} + +/** + * xmlSecTransformCtxFinalize: + * @ctx: the pointer to transforms chain processing context. + * + * Cleans up @ctx object initialized with #xmlSecTransformCtxInitialize function. + */ +EXPORT_C +void +xmlSecTransformCtxFinalize(xmlSecTransformCtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + xmlSecTransformCtxReset(ctx); + xmlSecPtrListFinalize(&(ctx->enabledTransforms)); + memset(ctx, 0, sizeof(xmlSecTransformCtx)); +} + +/** + * xmlSecTransformCtxReset: + * @ctx: the pointer to transforms chain processing context. + * + * Resets transfroms context for new processing. + */ +EXPORT_C +void +xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) { + xmlSecTransformPtr transform, tmp; + + xmlSecAssert(ctx != NULL); + + ctx->result = NULL; + ctx->status = xmlSecTransformStatusNone; + + /* destroy uri */ + if(ctx->uri != NULL) { + xmlFree(ctx->uri); + ctx->uri = NULL; + } + if(ctx->xptrExpr != NULL) { + xmlFree(ctx->xptrExpr); + ctx->xptrExpr = NULL; + } + + /* destroy transforms chain */ + for(transform = ctx->first; transform != NULL; transform = tmp) { + tmp = transform->next; + xmlSecTransformDestroy(transform); + } + ctx->first = ctx->last = NULL; +} + +/** + * xmlSecTransformCtxCopyUserPref: + * @dst: the pointer to destination transforms chain processing context. + * @src: the pointer to source transforms chain processing context. + * + * Copies user settings from @src context to @dst. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxCopyUserPref(xmlSecTransformCtxPtr dst, xmlSecTransformCtxPtr src) { + int ret; + + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + dst->userData = src->userData; + dst->flags = src->flags; + dst->flags2 = src->flags2; + dst->enabledUris = src->enabledUris; + dst->preExecCallback = src->preExecCallback; + + ret = xmlSecPtrListCopy(&(dst->enabledTransforms), &(src->enabledTransforms)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecTransformCtxAppend: + * @ctx: the pointer to transforms chain processing context. + * @transform: the pointer to new transform. + * + * Connects the @transform to the end of the chain of transforms in the @ctx + * (see #xmlSecTransformConnect function for details). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + + if(ctx->last != NULL) { + ret = xmlSecTransformConnect(ctx->last, transform, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformConnect", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + return(-1); + } + } else { + xmlSecAssert2(ctx->first == NULL, -1); + ctx->first = transform; + } + ctx->last = transform; + + return(0); +} + +/** + * xmlSecTransformCtxPrepend: + * @ctx: the pointer to transforms chain processing context. + * @transform: the pointer to new transform. + * + * Connects the @transform to the beggining of the chain of transforms in the @ctx + * (see #xmlSecTransformConnect function for details). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + + if(ctx->first != NULL) { + ret = xmlSecTransformConnect(transform, ctx->first, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformConnect", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + return(-1); + } + } else { + xmlSecAssert2(ctx->last == NULL, -1); + ctx->last = transform; + } + ctx->first = transform; + + return(0); +} + +/** + * xmlSecTransformCtxCreateAndAppend: + * @ctx: the pointer to transforms chain processing context. + * @id: the new transform klass. + * + * Creaeates new transform and connects it to the end of the chain of + * transforms in the @ctx (see #xmlSecTransformConnect function for details). + * + * Returns pointer to newly created transform or NULL if an error occurs. + */ +EXPORT_C +xmlSecTransformPtr +xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId id) { + xmlSecTransformPtr transform; + int ret; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL); + xmlSecAssert2(id != xmlSecTransformIdUnknown, NULL); + + transform = xmlSecTransformCreate(id); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id))); + return(NULL); + } + + ret = xmlSecTransformCtxAppend(ctx, transform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + xmlSecTransformDestroy(transform); + return(NULL); + } + + return(transform); +} + +/** + * xmlSecTransformCtxCreateAndPrepend: + * @ctx: the pointer to transforms chain processing context. + * @id: the new transform klass. + * + * Creaeates new transform and connects it to the end of the chain of + * transforms in the @ctx (see #xmlSecTransformConnect function for details). + * + * Returns pointer to newly created transform or NULL if an error occurs. + */ +EXPORT_C +xmlSecTransformPtr +xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId id) { + xmlSecTransformPtr transform; + int ret; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL); + xmlSecAssert2(id != xmlSecTransformIdUnknown, NULL); + + transform = xmlSecTransformCreate(id); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id))); + return(NULL); + } + + ret = xmlSecTransformCtxPrepend(ctx, transform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + xmlSecTransformDestroy(transform); + return(NULL); + } + + return(transform); +} + +/** + * xmlSecTransformCtxNodeRead: + * @ctx: the pointer to transforms chain processing context. + * @node: the pointer to transform's node. + * @usage: the transform's usage (signature, encryption, etc.). + * + * Reads the transform from the @node and appends it to the current chain + * of transforms in @ctx. + * + * Returns pointer to newly created transform or NULL if an error occurs. + */ +EXPORT_C +xmlSecTransformPtr +xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, + xmlSecTransformUsage usage) { + xmlSecTransformPtr transform; + int ret; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL); + xmlSecAssert2(node != NULL, NULL); + + transform = xmlSecTransformNodeRead(node, usage, ctx); + if(transform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(NULL); + } + + ret = xmlSecTransformCtxAppend(ctx, transform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + xmlSecTransformDestroy(transform); + return(NULL); + } + + return(transform); +} + +/** + * xmlSecTransformCtxNodesListRead: + * @ctx: the pointer to transforms chain processing context. + * @node: the pointer to nodes parent node. + * @usage: the transform's usage (signature, encryption, etc.). + * + * Reads transforms from the children of the @node and + * appends them to the current transforms chain in @ctx object. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlSecTransformUsage usage) { + xmlSecTransformPtr transform; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(node != NULL, -1); + + cur = xmlSecGetNextElementNode(node->children); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeTransform, xmlSecDSigNs)) { + transform = xmlSecTransformNodeRead(cur, usage, ctx); + if(transform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + + ret = xmlSecTransformCtxAppend(ctx, transform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + xmlSecTransformDestroy(transform); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecTransformCtxSetUri: + * @ctx: the pointer to transforms chain processing context. + * @uri: the URI. + * @hereNode: the pointer to "here" node required by some + * XML transforms (may be NULL). + * + * Parses uri and adds xpointer transforms if required. + * + * The following examples demonstrate what the URI attribute identifies and + * how it is dereferenced + * (http://www.w3.org/TR/xmldsig-core/#sec-ReferenceProcessingModel): + * + * - URI="http://example.com/bar.xml" + * identifies the octets that represent the external resource + * 'http://example.com/bar.xml', that is probably an XML document given + * its file extension. + * + * - URI="http://example.com/bar.xml#chapter1" + * identifies the element with ID attribute value 'chapter1' of the + * external XML resource 'http://example.com/bar.xml', provided as an + * octet stream. Again, for the sake of interoperability, the element + * identified as 'chapter1' should be obtained using an XPath transform + * rather than a URI fragment (barename XPointer resolution in external + * resources is not REQUIRED in this specification). + * + * - URI="" + * identifies the node-set (minus any comment nodes) of the XML resource + * containing the signature + * + * - URI="#chapter1" + * identifies a node-set containing the element with ID attribute value + * 'chapter1' of the XML resource containing the signature. XML Signature + * (and its applications) modify this node-set to include the element plus + * all descendents including namespaces and attributes -- but not comments. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodePtr hereNode) { + xmlSecNodeSetType nodeSetType = xmlSecNodeSetTree; + const xmlChar* xptr; + xmlChar* buf = NULL; + int useVisa3DHack = 0; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->uri == NULL, -1); + xmlSecAssert2(ctx->xptrExpr == NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(hereNode != NULL, -1); + + /* check uri */ + if(xmlSecTransformUriTypeCheck(ctx->enabledUris, uri) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_URI_TYPE, + "uri=%s", + xmlSecErrorsSafeString(uri)); + return(-1); + } + + /* is it an empty uri? */ + if((uri == NULL) || (xmlStrlen(uri) == 0)) { + return(0); + } + + /* do we have barename or full xpointer? */ + xptr = xmlStrchr(uri, '#'); + if(xptr == NULL){ + ctx->uri = xmlStrdup(uri); + if(ctx->uri == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "size=%d", xmlStrlen(uri)); + return(-1); + } + /* we are done */ + return(0); + } else if(xmlStrcmp(uri, BAD_CAST "#xpointer(/)") == 0) { + ctx->xptrExpr = xmlStrdup(uri); + if(ctx->xptrExpr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "size=%d", xmlStrlen(uri)); + return(-1); + } + /* we are done */ + return(0); + } + + ctx->uri = xmlStrndup(uri, xptr - uri); + if(ctx->uri == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "size=%d", xptr - uri); + return(-1); + } + + ctx->xptrExpr = xmlStrdup(xptr); + if(ctx->xptrExpr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + "size=%d", xmlStrlen(xptr)); + return(-1); + } + + /* do we have barename or full xpointer? */ + xmlSecAssert2(xptr != NULL, -1); + if((xmlStrncmp(xptr, BAD_CAST "#xpointer(", 10) == 0) || (xmlStrncmp(xptr, BAD_CAST "#xmlns(", 7) == 0)) { + ++xptr; + nodeSetType = xmlSecNodeSetTree; + } else if((ctx->flags & XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK) != 0) { + ++xptr; + nodeSetType = xmlSecNodeSetTreeWithoutComments; + useVisa3DHack = 1; + } else { + static const char tmpl[] = "xpointer(id(\'%s\'))"; + xmlSecSize size; + + /* we need to add "xpointer(id('..')) because otherwise we have + * problems with numeric ("111" and so on) and other "strange" ids */ + size = xmlStrlen(BAD_CAST tmpl) + xmlStrlen(xptr) + 2; + buf = (xmlChar*)xmlMalloc(size * sizeof(xmlChar)); + if(buf == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", size); + return(-1); + } + sprintf((char*)buf, tmpl, xptr + 1); + xptr = buf; + nodeSetType = xmlSecNodeSetTreeWithoutComments; + } + + if(useVisa3DHack == 0) { + xmlSecTransformPtr transform; + + /* we need to create XPonter transform to execute expr */ + transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXPointerId); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId))); + xmlFree( buf ); //buf == xptr + return(-1); + } + + ret = xmlSecTransformXPointerSetExpr(transform, xptr, nodeSetType, hereNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformXPointerSetExpr", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + if( buf != NULL) { + xmlFree( buf ); //buf == xptr + } + return(-1); + } + } else { + /* Visa3D protocol doesn't follow XML/XPointer/XMLDSig specs + * and allows something like "#12345" in the URI attribute. + */ + xmlSecTransformPtr transform; + + transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformVisa3DHackId); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformVisa3DHackId))); + return(-1); + } + + ret = xmlSecTransformVisa3DHackSetID(transform, xptr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformVisa3DHackSetID", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + if(buf != NULL) { + xmlFree(buf); + } + return(-1); + } + } + if(buf != NULL) { + xmlFree(buf); + } + + return(0); +} + +/** + * xmlSecTransformCtxPrepare: + * @ctx: the pointer to transforms chain processing context. + * @inputDataType: the expected input type. + * + * Prepares the transform context for processing data of @inputDataType. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inputDataType) { + xmlSecTransformDataType firstType; + xmlSecTransformPtr transform; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->result == NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + + /* add binary buffer to store result */ + transform = xmlSecTransformCtxCreateAndAppend(ctx, xmlSecTransformMemBufId); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId))); + return(-1); + } + ctx->result = xmlSecTransformMemBufGetBuffer(transform); + if(ctx->result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformMemBufGetBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId))); + return(-1); + } + + firstType = xmlSecTransformGetDataType(ctx->first, xmlSecTransformModePush, ctx); + if(((firstType & xmlSecTransformDataTypeBin) == 0) && + ((inputDataType & xmlSecTransformDataTypeBin) != 0)) { + + /* need to add parser transform */ + transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXmlParserId); + if(transform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXmlParserId))); + return(-1); + } + } else if(((firstType & xmlSecTransformDataTypeXml) == 0) && + ((inputDataType & xmlSecTransformDataTypeXml) != 0)) { + + /* need to add c14n transform */ + transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInclC14NId); + if(transform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId))); + return(-1); + } + } + + /* finally let application a chance to verify that it's ok to execte + * this transforms chain */ + if(ctx->preExecCallback != NULL) { + ret = (ctx->preExecCallback)(ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "ctx->preExecCallback", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + ctx->status = xmlSecTransformStatusWorking; + return(0); +} + +/** + * xmlSecTransformCtxBinaryExecute: + * @ctx: the pointer to transforms chain processing context. + * @data: the input binary data buffer. + * @dataSize: the input data size. + * + * Processes binary data using transforms chain in the @ctx. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx, + const xmlSecByte* data, xmlSecSize dataSize) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->result == NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(dataSize > 0, -1); + + /* we should not have uri stored in ctx */ + xmlSecAssert2(ctx->uri == NULL, -1); + + ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeBin); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPrepare", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "type=bin"); + return(-1); + } + + ret = xmlSecTransformPushBin(ctx->first, data, dataSize, 1, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPushBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "dataSize=%d", dataSize); + return(-1); + } + + ctx->status = xmlSecTransformStatusFinished; + return(0); +} + +/** + * xmlSecTransformCtxUriExecute: + * @ctx: the pointer to transforms chain processing context. + * @uri: the URI. + * + * Process binary data from the URI using transforms chain in @ctx. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) { + xmlSecTransformPtr uriTransform; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(uri != NULL, -1); + + /* we should not execute transform for a different uri */ + xmlSecAssert2((ctx->uri == NULL) || (uri == ctx->uri) || xmlStrEqual(uri, ctx->uri), -1); + + uriTransform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInputURIId); + if(uriTransform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInputURIId))); + return(-1); + } + + ret = xmlSecTransformInputURIOpen(uriTransform, uri); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformInputURIOpen", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + return(-1); + } + + /* we do not need to do something special for this transform */ + ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeUnknown); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPrepare", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "type=bin"); + return(-1); + } + + /* Now we have a choice: we either can push from first transform or pop + * from last. Our C14N transforms prefers push, so push data! + */ + ret = xmlSecTransformPump(uriTransform, uriTransform->next, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformPump", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + return(-1); + } + + ctx->status = xmlSecTransformStatusFinished; + return(0); +} + +/** + * xmlSecTransformCtxXmlExecute: + * @ctx: the pointer to transforms chain processing context. + * @nodes: the input node set. + * + * Process @nodes using transforms in the transforms chain in @ctx. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->result == NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(nodes != NULL, -1); + + xmlSecAssert2((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0), -1); + + ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeXml); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPrepare", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "type=xml"); + return(-1); + } + + /* it's better to do push than pop because all XML transform + * just don't care and c14n likes push more than pop */ + ret = xmlSecTransformPushXml(ctx->first, nodes, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformPushXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(ctx->first))); + return(-1); + } + + ctx->status = xmlSecTransformStatusFinished; + return(0); +} + +/** + * xmlSecTransformCtxExecute: + * @ctx: the pointer to transforms chain processing context. + * @doc: the pointer to input document. + * + * Executes transforms chain in @ctx. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->result == NULL, -1); + xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1); + xmlSecAssert2(doc != NULL, -1); + + if((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0)) { + xmlSecNodeSetPtr nodes; + + if((ctx->xptrExpr != NULL) && (xmlStrlen(ctx->xptrExpr) > 0)){ + /* our xpointer transform takes care of providing correct nodes set */ + nodes = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetNormal); + if(nodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + } else { + /* we do not want to have comments for empty URI */ + nodes = xmlSecNodeSetGetChildren(doc, NULL, 0, 0); + if(nodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetGetChildren", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + ret = xmlSecTransformCtxXmlExecute(ctx, nodes); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxXmlExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecNodeSetDestroy(nodes); + return(-1); + } + xmlSecNodeSetDestroy(nodes); + } else { + ret = xmlSecTransformCtxUriExecute(ctx, ctx->uri); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxUriExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +/** + * xmlSecTransformCtxDebugDump: + * @ctx: the pointer to transforms chain processing context. + * @output: the pointer to output FILE. + * + * Prints transforms context debug information to @output. + */ +EXPORT_C +void +xmlSecTransformCtxDebugDump(xmlSecTransformCtxPtr ctx, FILE* output) { + xmlSecTransformPtr transform; + + xmlSecAssert(ctx != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "== TRANSFORMS CTX (status=%d)\n", ctx->status); + + fprintf(output, "== flags: 0x%08x\n", ctx->flags); + fprintf(output, "== flags2: 0x%08x\n", ctx->flags2); + if(xmlSecPtrListGetSize(&(ctx->enabledTransforms)) > 0) { + fprintf(output, "== enabled transforms: "); + xmlSecTransformIdListDebugDump(&(ctx->enabledTransforms), output); + } else { + fprintf(output, "== enabled transforms: all\n"); + } + + fprintf(output, "=== uri: %s\n", + (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL"); + fprintf(output, "=== uri xpointer expr: %s\n", + (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL"); + for(transform = ctx->first; transform != NULL; transform = transform->next) { + xmlSecTransformDebugDump(transform, output); + } +} + +/** + * xmlSecTransformCtxDebugXmlDump: + * @ctx: the pointer to transforms chain processing context. + * @output: the pointer to output FILE. + * + * Prints transforms context debug information to @output in XML format. + */ +EXPORT_C +void +xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) { + xmlSecTransformPtr transform; + + xmlSecAssert(ctx != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "\n", ctx->status); + + fprintf(output, "%08x\n", ctx->flags); + fprintf(output, "%08x\n", ctx->flags2); + if(xmlSecPtrListGetSize(&(ctx->enabledTransforms)) > 0) { + fprintf(output, "\n"); + xmlSecTransformIdListDebugXmlDump(&(ctx->enabledTransforms), output); + fprintf(output, "\n"); + } else { + fprintf(output, "all\n"); + } + + + fprintf(output, "%s\n", + (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL"); + fprintf(output, "%s\n", + (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL"); + + for(transform = ctx->first; transform != NULL; transform = transform->next) { + xmlSecTransformDebugXmlDump(transform, output); + } + fprintf(output, "\n"); +} + +/************************************************************************** + * + * xmlSecTransform + * + *************************************************************************/ +/** + * xmlSecTransformCreate: + * @id: the transform id to create. + * + * Creates new transform of the @id klass. The caller is responsible for + * destroying returned tansform using #xmlSecTransformDestroy function. + * + * Returns pointer to newly created transform or NULL if an error occurs. + */ +EXPORT_C +xmlSecTransformPtr +xmlSecTransformCreate(xmlSecTransformId id) { + xmlSecTransformPtr transform; + int ret; + + xmlSecAssert2(id != NULL, NULL); + xmlSecAssert2(id->klassSize >= sizeof(xmlSecTransformKlass), NULL); + xmlSecAssert2(id->objSize >= sizeof(xmlSecTransform), NULL); + xmlSecAssert2(id->name != NULL, NULL); + + /* Allocate a new xmlSecTransform and fill the fields. */ + transform = (xmlSecTransformPtr)xmlMalloc(id->objSize); + if(transform == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", id->objSize); + return(NULL); + } + memset(transform, 0, id->objSize); + transform->id = id; + + if(id->initialize != NULL) { + ret = (id->initialize)(transform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "id->initialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecTransformDestroy(transform); + return(NULL); + } + } + + ret = xmlSecBufferInitialize(&(transform->inBuf), 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", 0); + xmlSecTransformDestroy(transform); + return(NULL); + } + + ret = xmlSecBufferInitialize(&(transform->outBuf), 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", 0); + xmlSecTransformDestroy(transform); + return(NULL); + } + + return(transform); +} + +/** + * xmlSecTransformDestroy: + * @transform: the pointer to transform. + * + * Destroys transform created with #xmlSecTransformCreate function. + */ +EXPORT_C +void +xmlSecTransformDestroy(xmlSecTransformPtr transform) { + xmlSecAssert(xmlSecTransformIsValid(transform)); + xmlSecAssert(transform->id->objSize > 0); + + /* first need to remove ourselves from chain */ + xmlSecTransformRemove(transform); + + xmlSecBufferFinalize(&(transform->inBuf)); + xmlSecBufferFinalize(&(transform->outBuf)); + + /* we never destroy input nodes, output nodes + * are destroyed if and only if they are different + * from input nodes + */ + if((transform->outNodes != NULL) && (transform->outNodes != transform->inNodes)) { + xmlSecNodeSetDestroy(transform->outNodes); + } + if(transform->id->finalize != NULL) { + (transform->id->finalize)(transform); + } + memset(transform, 0, transform->id->objSize); + xmlFree(transform); +} + +/** + * xmlSecTransformNodeRead: + * @node: the pointer to the transform's node. + * @usage: the transform usage (signature, encryption, ...). + * @transformCtx: the transform's chaing processing context. + * + * Reads transform from the @node as follows: + * + * 1) reads "Algorithm" attribute; + * + * 2) checks the lists of known and allowed transforms; + * + * 3) calls transform's create method; + * + * 4) calls transform's read transform node method. + * + * Returns pointer to newly created transform or NULL if an error occurs. + */ +EXPORT_C +xmlSecTransformPtr +xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformPtr transform; + xmlSecTransformId id; + xmlChar *href; + int ret; + + xmlSecAssert2(node != NULL, NULL); + xmlSecAssert2(transformCtx != NULL, NULL); + + href = xmlGetProp(node, xmlSecAttrAlgorithm); + if(href == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecAttrAlgorithm), + XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(NULL); + } + + id = xmlSecTransformIdListFindByHref(xmlSecTransformIdsGet(), href, usage); + if(id == xmlSecTransformIdUnknown) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsListFindByHref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "href=%s", + xmlSecErrorsSafeString(href)); + xmlFree(href); + return(NULL); + } + + /* check with enabled transforms list */ + if((xmlSecPtrListGetSize(&(transformCtx->enabledTransforms)) > 0) && + (xmlSecTransformIdListFind(&(transformCtx->enabledTransforms), id) != 1)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)), + XMLSEC_ERRORS_R_TRANSFORM_DISABLED, + "href=%s", + xmlSecErrorsSafeString(href)); + xmlFree(href); + return(NULL); + } + + transform = xmlSecTransformCreate(id); + if(!xmlSecTransformIsValid(transform)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id))); + xmlFree(href); + return(NULL); + } + + if(transform->id->readNode != NULL) { + ret = transform->id->readNode(transform, node, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "id->readNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(transform))); + xmlSecTransformDestroy(transform); + xmlFree(href); + return(NULL); + } + } + + /* finally remember the transform node */ + transform->hereNode = node; + xmlFree(href); + return(transform); +} + +/** + * xmlSecTransformPump: + * @left: the source pumping transform. + * @right: the destination pumping transform. + * @transformCtx: the transform's chaing processing context. + * + * Pops data from @left transform and pushes to @right transform until + * no more data is available. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformDataType leftType; + xmlSecTransformDataType rightType; + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(left), -1); + xmlSecAssert2(xmlSecTransformIsValid(right), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + leftType = xmlSecTransformGetDataType(left, xmlSecTransformModePop, transformCtx); + rightType = xmlSecTransformGetDataType(right, xmlSecTransformModePush, transformCtx); + + if(((leftType & xmlSecTransformDataTypeXml) != 0) && + ((rightType & xmlSecTransformDataTypeXml) != 0)) { + + xmlSecNodeSetPtr nodes = NULL; + + ret = xmlSecTransformPopXml(left, &nodes, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(left)), + "xmlSecTransformPopXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecTransformPushXml(right, nodes, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(right)), + "xmlSecTransformPushXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else if(((leftType & xmlSecTransformDataTypeBin) != 0) && + ((rightType & xmlSecTransformDataTypeBin) != 0)) { + xmlSecByte buf[XMLSEC_TRANSFORM_BINARY_CHUNK]; + xmlSecSize bufSize; + int final; + + do { + ret = xmlSecTransformPopBin(left, buf, sizeof(buf), &bufSize, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(left)), + "xmlSecTransformPopBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + final = (bufSize == 0) ? 1 : 0; + ret = xmlSecTransformPushBin(right, buf, bufSize, final, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(right)), + "xmlSecTransformPushBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } while(final == 0); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(left)), + xmlSecErrorsSafeString(xmlSecTransformGetName(right)), + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + "transforms input/output data formats do not match"); + } + return(0); +} + + +/** + * xmlSecTransformSetKey: + * @transform: the pointer to transform. + * @key: the pointer to key. + * + * Sets the transform's key. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(key != NULL, -1); + + if(transform->id->setKey != NULL) { + return((transform->id->setKey)(transform, key)); + } + return(0); +} + +/** + * xmlSecTransformSetKeyReq: + * @transform: the pointer to transform. + * @keyReq: the pointer to keys requirements object. + * + * Sets the key requirements for @transform in the @keyReq. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(keyReq != NULL, -1); + + keyReq->keyId = xmlSecKeyDataIdUnknown; + keyReq->keyType = xmlSecKeyDataTypeUnknown; + keyReq->keyUsage = xmlSecKeyUsageAny; + keyReq->keyBitsSize = 0; + + if(transform->id->setKeyReq != NULL) { + return((transform->id->setKeyReq)(transform, keyReq)); + } + return(0); +} + +/** + * xmlSecTransformVerify: + * @transform: the pointer to transform. + * @data: the binary data for verification. + * @dataSize: the data size. + * @transformCtx: the transform's chaing processing context. + * + * Verifies the data with transform's processing results + * (for digest, HMAC and signature transforms). The verification + * result is stored in the #status member of #xmlSecTransform object. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data, + xmlSecSize dataSize, xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->verify != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->verify)(transform, data, dataSize, transformCtx)); +} + +/** + * xmlSecTransformVerifyNodeContent: + * @transform: the pointer to transform. + * @node: the pointer to node. + * @transformCtx: the transform's chaing processing context. + * + * Gets the @node content, base64 decodes it and calls #xmlSecTransformVerify + * function to verify binary results. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx) { + xmlSecBuffer buffer; + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ret = xmlSecBufferInitialize(&buffer, 0); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecBufferBase64NodeContentRead(&buffer, node); + if((ret < 0) || (xmlSecBufferGetData(&buffer) == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferBase64NodeContentRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(-1); + } + + ret = xmlSecTransformVerify(transform, xmlSecBufferGetData(&buffer), + xmlSecBufferGetSize(&buffer), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformVerify", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(-1); + } + + xmlSecBufferFinalize(&buffer); + return(0); +} + +/** + * xmlSecTransformGetDataType: + * @transform: the pointer to transform. + * @mode: the data mode (push or pop). + * @transformCtx: the transform's chaing processing context. + * + * Gets transform input (@mode is "push") or output (@mode is "pop") data + * type (binary or XML). + * + * Returns the transform's data type for the @mode operation. + */ +EXPORT_C +xmlSecTransformDataType +xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode, + xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown); + xmlSecAssert2(transform->id->getDataType != NULL, xmlSecTransformDataTypeUnknown); + + return((transform->id->getDataType)(transform, mode, transformCtx)); +} + +/** + * xmlSecTransformPushBin: + * @transform: the pointer to transform object. + * @data: the input binary data, + * @dataSize: the input data size. + * @final: the flag: if set to 1 then it's the last + * data chunk. + * @transformCtx: the pointer to transform context object. + * + * Process binary @data and pushes results to next transform. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data, + xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->pushBin != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->pushBin)(transform, data, dataSize, final, transformCtx)); +} + +/** + * xmlSecTransformPopBin: + * @transform: the pointer to transform object. + * @data: the buffer to store result data. + * @maxDataSize: the size of the buffer #data. + * @dataSize: the pointer to returned data size. + * @transformCtx: the pointer to transform context object. + * + * Pops data from previous transform in the chain, processes data and + * returns result in the @data buffer. The size of returned data is + * placed in the @dataSize. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data, + xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->popBin != NULL, -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(dataSize != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->popBin)(transform, data, maxDataSize, dataSize, transformCtx)); +} + +/** + * xmlSecTransformPushXml: + * @transform: the pointer to transform object. + * @nodes: the input nodes. + * @transformCtx: the pointer to transform context object. + * + * Processes @nodes and pushes result to the next transform in the chain. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->pushXml != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->pushXml)(transform, nodes, transformCtx)); +} + +/** + * xmlSecTransformPopXml: + * @transform: the pointer to transform object. + * @nodes: the pointer to store popinter to result nodes. + * @transformCtx: the pointer to transform context object. + * + * Pops data from previous transform in the chain, processes the data and + * returns result in @nodes. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->popXml != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->popXml)(transform, nodes, transformCtx)); +} + +/** + * xmlSecTransformExecute: + * @transform: the pointer to transform. + * @last: the flag: if set to 1 then it's the last data chunk. + * @transformCtx: the transform's chaing processing context. + * + * Executes transform (used by default popBin/pushBin/popXml/pushXml methods). + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) { + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->id->execute != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + return((transform->id->execute)(transform, last, transformCtx)); +} + +/** + * xmlSecTransformDebugDump: + * @transform: the pointer to transform. + * @output: the pointer to output FILE. + * + * Prints transform's debug information to @output. + */ +EXPORT_C +void +xmlSecTransformDebugDump(xmlSecTransformPtr transform, FILE* output) { + xmlSecAssert(xmlSecTransformIsValid(transform)); + xmlSecAssert(output != NULL); + + fprintf(output, "=== Transform: %s (href=%s)\n", + xmlSecErrorsSafeString(transform->id->name), + xmlSecErrorsSafeString(transform->id->href)); +} + +/** + * xmlSecTransformDebugXmlDump: + * @transform: the pointer to transform. + * @output: the pointer to output FILE. + * + * Prints transform's debug information to @output in XML format. + */ +EXPORT_C +void +xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, FILE* output) { + xmlSecAssert(xmlSecTransformIsValid(transform)); + xmlSecAssert(output != NULL); + + fprintf(output, "\n", + xmlSecErrorsSafeString(transform->id->name), + xmlSecErrorsSafeString(transform->id->href)); +} + +/************************************************************************ + * + * Operations on transforms chain + * + ************************************************************************/ +/** + * xmlSecTransformConnect: + * @left: the pointer to left (prev) transform. + * @right: the pointer to right (next) transform. + * @transformCtx: the transform's chaing processing context. + * + * If the data object is a node-set and the next transform requires octets, + * the signature application MUST attempt to convert the node-set to an octet + * stream using Canonical XML [XML-C14N]. + * + * The story is different if the right transform is base64 decode + * (http://www.w3.org/TR/xmldsig-core/#sec-Base-64): + * + * This transform requires an octet stream for input. If an XPath node-set + * (or sufficiently functional alternative) is given as input, then it is + * converted to an octet stream by performing operations logically equivalent + * to 1) applying an XPath transform with expression self::text(), then 2) + * taking the string-value of the node-set. Thus, if an XML element is + * identified by a barename XPointer in the Reference URI, and its content + * consists solely of base64 encoded character data, then this transform + * automatically strips away the start and end tags of the identified element + * and any of its descendant elements as well as any descendant comments and + * processing instructions. The output of this transform is an octet stream. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right, + xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformDataType leftType; + xmlSecTransformDataType rightType; + xmlSecTransformId middleId; + xmlSecTransformPtr middle; + + xmlSecAssert2(xmlSecTransformIsValid(left), -1); + xmlSecAssert2(xmlSecTransformIsValid(right), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + leftType = xmlSecTransformGetDataType(left, xmlSecTransformModePop, transformCtx); + rightType = xmlSecTransformGetDataType(right, xmlSecTransformModePush, transformCtx); + + if((((leftType & xmlSecTransformDataTypeBin) != 0) && + ((rightType & xmlSecTransformDataTypeBin) != 0)) || + (((leftType & xmlSecTransformDataTypeXml) != 0) && + ((rightType & xmlSecTransformDataTypeXml) != 0))) { + + left->next = right; + right->prev = left; + return(0); + } + + if(((leftType & xmlSecTransformDataTypeBin) != 0) && + ((rightType & xmlSecTransformDataTypeXml) != 0)) { + + /* need to insert parser */ + middleId = xmlSecTransformXmlParserId; + } else if(((leftType & xmlSecTransformDataTypeXml) != 0) && + ((rightType & xmlSecTransformDataTypeBin) != 0)) { + + /* need to insert c14n or special pre-base64 transform */ + if(xmlSecTransformCheckId(right, xmlSecTransformBase64Id)) { + middleId = xmlSecTransformRemoveXmlTagsC14NId; + } else { + middleId = xmlSecTransformInclC14NId; + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(left)), + xmlSecErrorsSafeString(xmlSecTransformGetName(right)), + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + "leftType=%d;rightType=%d", + leftType, rightType); + return(-1); + } + + /* insert transform */ + middle = xmlSecTransformCreate(middleId); + if(middle == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(left)), + "xmlSecTransformCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(middleId))); + return(-1); + } + left->next = middle; + middle->prev = left; + middle->next = right; + right->prev = middle; + return(0); +} + +/** + * xmlSecTransformRemove: + * @transform: the pointer to #xmlSecTransform structure. + * + * Removes @transform from the chain. + */ +EXPORT_C +void +xmlSecTransformRemove(xmlSecTransformPtr transform) { + xmlSecAssert(xmlSecTransformIsValid(transform)); + + if(transform->next != NULL) { + transform->next->prev = transform->prev; + } + if(transform->prev != NULL) { + transform->prev->next = transform->next; + } + transform->next = transform->prev = NULL; +} + + +/************************************************************************ + * + * Default callbacks, most of the transforms can use them + * + ************************************************************************/ +/** + * xmlSecTransformDefaultGetDataType: + * @transform: the pointer to transform. + * @mode: the data mode (push or pop). + * @transformCtx: the transform's chaing processing context. + * + * Gets transform input (@mode is "push") or output (@mode is "pop") data + * type (binary or XML) by analyzing available pushBin/popBin/pushXml/popXml + * methods. + * + * Returns the transform's data type for the @mode operation. + */ +EXPORT_C +xmlSecTransformDataType +xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode, + xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformDataType type = xmlSecTransformDataTypeUnknown; + + xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown); + xmlSecAssert2(transformCtx != NULL, xmlSecTransformDataTypeUnknown); + + /* we'll try to guess the data type based on the handlers we have */ + switch(mode) { + case xmlSecTransformModePush: + if(transform->id->pushBin != NULL) { + type |= xmlSecTransformDataTypeBin; + } + if(transform->id->pushXml != NULL) { + type |= xmlSecTransformDataTypeXml; + } + break; + case xmlSecTransformModePop: + if(transform->id->popBin != NULL) { + type |= xmlSecTransformDataTypeBin; + } + if(transform->id->popXml != NULL) { + type |= xmlSecTransformDataTypeXml; + } + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "mode=%d", mode); + return(xmlSecTransformDataTypeUnknown); + } + + return(type); +} + +/** + * xmlSecTransformDefaultPushBin: + * @transform: the pointer to transform object. + * @data: the input binary data, + * @dataSize: the input data size. + * @final: the flag: if set to 1 then it's the last + * data chunk. + * @transformCtx: the pointer to transform context object. + * + * Process binary @data by calling transform's execute method and pushes + * results to next transform. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* data, + xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) { + xmlSecSize inSize = 0; + xmlSecSize outSize = 0; + int finalData = 0; + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + do { + /* append data to input buffer */ + if(dataSize > 0) { + xmlSecSize chunkSize; + + xmlSecAssert2(data != NULL, -1); + + chunkSize = dataSize; + if(chunkSize > XMLSEC_TRANSFORM_BINARY_CHUNK) { + chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK; + } + + ret = xmlSecBufferAppend(&(transform->inBuf), data, chunkSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", chunkSize); + return(-1); + } + + dataSize -= chunkSize; + data += chunkSize; + } + + /* process data */ + inSize = xmlSecBufferGetSize(&(transform->inBuf)); + outSize = xmlSecBufferGetSize(&(transform->outBuf)); + finalData = (((dataSize == 0) && (final != 0)) ? 1 : 0); + ret = xmlSecTransformExecute(transform, finalData, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "final=%d", final); + return(-1); + } + + /* push data to the next transform */ + inSize = xmlSecBufferGetSize(&(transform->inBuf)); + outSize = xmlSecBufferGetSize(&(transform->outBuf)); + if(inSize > 0) { + finalData = 0; + } + + /* we don't want to puch too much */ + if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) { + outSize = XMLSEC_TRANSFORM_BINARY_CHUNK; + finalData = 0; + } + if((transform->next != NULL) && ((outSize > 0) || (finalData != 0))) { + ret = xmlSecTransformPushBin(transform->next, + xmlSecBufferGetData(&(transform->outBuf)), + outSize, + finalData, + transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform->next)), + "xmlSecTransformPushBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "final=%d;outSize=%d", final, outSize); + return(-1); + } + } + + /* remove data anyway */ + if(outSize > 0) { + ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize); + return(-1); + } + } + } while((dataSize > 0) || (outSize > 0)); + + return(0); +} + +/** + * xmlSecTransformDefaultPopBin: + * @transform: the pointer to transform object. + * @data: the buffer to store result data. + * @maxDataSize: the size of the buffer #data. + * @dataSize: the pointer to returned data size. + * @transformCtx: the pointer to transform context object. + * + * Pops data from previous transform in the chain, processes data by calling + * transform's execute method and returns result in the @data buffer. The + * size of returned data is placed in the @dataSize. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data, + xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) { + xmlSecSize outSize; + int final = 0; + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(dataSize != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + while((xmlSecBufferGetSize(&(transform->outBuf)) == 0) && (final == 0)) { + /* read data from previous transform if exist */ + if(transform->prev != NULL) { + xmlSecSize inSize, chunkSize; + + inSize = xmlSecBufferGetSize(&(transform->inBuf)); + chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK; + + /* ensure that we have space for at least one data chunk */ + ret = xmlSecBufferSetMaxSize(&(transform->inBuf), inSize + chunkSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize + chunkSize); + return(-1); + } + + /* get data from previous transform */ + ret = xmlSecTransformPopBin(transform->prev, + xmlSecBufferGetData(&(transform->inBuf)) + inSize, + chunkSize, &chunkSize, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform->prev)), + "xmlSecTransformPopBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* adjust our size if needed */ + if(chunkSize > 0) { + ret = xmlSecBufferSetSize(&(transform->inBuf), inSize + chunkSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize + chunkSize); + return(-1); + } + final = 0; /* the previous transform returned some data..*/ + } else { + final = 1; /* no data returned from previous transform, we are done */ + } + } else { + final = 1; /* no previous transform, we are "permanently final" */ + } + + /* execute our transform */ + ret = xmlSecTransformExecute(transform, final, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* copy result (if any) */ + outSize = xmlSecBufferGetSize(&(transform->outBuf)); + if(outSize > maxDataSize) { + outSize = maxDataSize; + } + + /* we don't want to put too much */ + if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) { + outSize = XMLSEC_TRANSFORM_BINARY_CHUNK; + } + if(outSize > 0) { + xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1); + + memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize); + + ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize); + return(-1); + } + } + + /* set the result size */ + (*dataSize) = outSize; + return(0); +} + +/** + * xmlSecTransformDefaultPushXml: + * @transform: the pointer to transform object. + * @nodes: the input nodes. + * @transformCtx: the pointer to transform context object. + * + * Processes @nodes by calling transform's execute method and pushes + * result to the next transform in the chain. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes, + xmlSecTransformCtxPtr transformCtx) { + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->inNodes == NULL, -1); + xmlSecAssert2(transform->outNodes == NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + /* execute our transform */ + transform->inNodes = nodes; + ret = xmlSecTransformExecute(transform, 1, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* push result to the next transform (if exist) */ + if(transform->next != NULL) { + ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformPushXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +/** + * xmlSecTransformDefaultPopXml: + * @transform: the pointer to transform object. + * @nodes: the pointer to store popinter to result nodes. + * @transformCtx: the pointer to transform context object. + * + * Pops data from previous transform in the chain, processes the data + * by calling transform's execute method and returns result in @nodes. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes, + xmlSecTransformCtxPtr transformCtx) { + int ret; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(transform->inNodes == NULL, -1); + xmlSecAssert2(transform->outNodes == NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + /* pop result from the prev transform (if exist) */ + if(transform->prev != NULL) { + ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformPopXml", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* execute our transform */ + ret = xmlSecTransformExecute(transform, 1, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* return result if requested */ + if(nodes != NULL) { + (*nodes) = transform->outNodes; + } + + return(0); +} + +/*********************************************************************** + * + * Transform Ids list + * + **********************************************************************/ +static xmlSecPtrListKlass xmlSecTransformIdListKlass = { + BAD_CAST "transform-ids-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecTransformIdListGetKlass: + * + * The transform id list klass. + * + * Returns pointer to the transform id list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecTransformIdListGetKlass(void) { + return(&xmlSecTransformIdListKlass); +} + +/** + * xmlSecTransformIdListFind: + * @list: the pointer to transform ids list. + * @transformId: the transform klass. + * + * Lookups @dataId in @list. + * + * Returns 1 if @dataId is found in the @list, 0 if not and a negative + * value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformIdListFind(xmlSecPtrListPtr list, xmlSecTransformId transformId) { + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), -1); + xmlSecAssert2(transformId != NULL, -1); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + if((xmlSecTransformId)xmlSecPtrListGetItem(list, i) == transformId) { + return(1); + } + } + return(0); +} + +/** + * xmlSecTransformIdListFindByHref: + * @list: the pointer to transform ids list. + * @href: the desired transform klass href. + * @usage: the desired transform usage. + * + * Lookups data klass in the list with given @href and @usage in @list. + * + * Returns transform klass is found and NULL otherwise. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href, + xmlSecTransformUsage usage) { + xmlSecTransformId transformId; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), xmlSecTransformIdUnknown); + xmlSecAssert2(href != NULL, xmlSecTransformIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown); + + if(((usage & transformId->usage) != 0) && (transformId->href != NULL) && + xmlStrEqual(href, transformId->href)) { + + return(transformId); + } + } + return(xmlSecTransformIdUnknown); +} + +/** + * xmlSecTransformIdListFindByName: + * @list: the pointer to transform ids list. + * @name: the desired transform klass name. + * @usage: the desired transform usage. + * + * Lookups data klass in the list with given @name and @usage in @list. + * + * Returns transform klass is found and NULL otherwise. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name, + xmlSecTransformUsage usage) { + xmlSecTransformId transformId; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), xmlSecTransformIdUnknown); + xmlSecAssert2(name != NULL, xmlSecTransformIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i); + xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown); + + if(((usage & transformId->usage) != 0) && (transformId->name != NULL) && + xmlStrEqual(name, BAD_CAST transformId->name)) { + + return(transformId); + } + } + return(xmlSecTransformIdUnknown); +} + +/** + * xmlSecTransformIdListDebugDump: + * @list: the pointer to transform ids list. + * @output: the pointer to output FILE. + * + * Prints binary transform debug information to @output. + */ +EXPORT_C +void +xmlSecTransformIdListDebugDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecTransformId transformId; + xmlSecSize i, size; + + xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecTransformIdListId)); + xmlSecAssert(output != NULL); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i); + xmlSecAssert(transformId != NULL); + xmlSecAssert(transformId->name != NULL); + + if(i > 0) { + fprintf(output, ",\"%s\"", transformId->name); + } else { + fprintf(output, "\"%s\"", transformId->name); + } + } + fprintf(output, "\n"); +} + +/** + * xmlSecTransformIdListDebugXmlDump: + * @list: the pointer to transform ids list. + * @output: the pointer to output FILE. + * + * Prints binary transform debug information to @output in XML format. + */ +EXPORT_C +void +xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) { + xmlSecTransformId transformId; + xmlSecSize i, size; + + xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecTransformIdListId)); + xmlSecAssert(output != NULL); + + fprintf(output, "\n"); + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i); + xmlSecAssert(transformId != NULL); + xmlSecAssert(transformId->name != NULL); + + fprintf(output, "", transformId->name); + } + fprintf(output, "\n"); +} + +/************************************************************************ + * + * IO buffers for transforms + * + ************************************************************************/ +typedef struct _xmlSecTransformIOBuffer xmlSecTransformIOBuffer, + *xmlSecTransformIOBufferPtr; +typedef enum { + xmlSecTransformIOBufferModeRead, + xmlSecTransformIOBufferModeWrite +} xmlSecTransformIOBufferMode; + +struct _xmlSecTransformIOBuffer { + xmlSecTransformIOBufferMode mode; + xmlSecTransformPtr transform; + xmlSecTransformCtxPtr transformCtx; +}; + +static xmlSecTransformIOBufferPtr xmlSecTransformIOBufferCreate (xmlSecTransformIOBufferMode mode, + xmlSecTransformPtr transform, + xmlSecTransformCtxPtr transformCtx); +static void xmlSecTransformIOBufferDestroy (xmlSecTransformIOBufferPtr buffer); +static int xmlSecTransformIOBufferRead (xmlSecTransformIOBufferPtr buffer, + xmlSecByte *buf, + xmlSecSize size); +static int xmlSecTransformIOBufferWrite (xmlSecTransformIOBufferPtr buffer, + const xmlSecByte *buf, + xmlSecSize size); +static int xmlSecTransformIOBufferClose (xmlSecTransformIOBufferPtr buffer); + + +/** + * xmlSecTransformCreateOutputBuffer: + * @transform: the pointer to transform. + * @transformCtx: the pointer to transform context object. + * + * Creates output buffer to write data to @transform. + * + * Returns pointer to new output buffer or NULL if an error occurs. + */ +EXPORT_C +xmlOutputBufferPtr +xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformIOBufferPtr buffer; + xmlSecTransformDataType type; + xmlOutputBufferPtr output; + + xmlSecAssert2(xmlSecTransformIsValid(transform), NULL); + xmlSecAssert2(transformCtx != NULL, NULL); + + /* check that we have binary push method for this transform */ + type = xmlSecTransformDefaultGetDataType(transform, xmlSecTransformModePush, transformCtx); + if((type & xmlSecTransformDataTypeBin) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + "push binary data not supported"); + return(NULL); + } + + buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeWrite, transform, transformCtx); + if(buffer == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformIOBufferCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + output = xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecTransformIOBufferWrite, + (xmlOutputCloseCallback)xmlSecTransformIOBufferClose, + buffer, + NULL); + if(output == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlOutputBufferCreateIO", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecTransformIOBufferDestroy(buffer); + return(NULL); + } + + return(output); +} + +/** + * xmlSecTransformCreateInputBuffer: + * @transform: the pointer to transform. + * @transformCtx: the pointer to transform context object. + * + * Creates input buffer to read data from @transform. + * + * Returns pointer to new input buffer or NULL if an error occurs. + */ +EXPORT_C +xmlParserInputBufferPtr +xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformIOBufferPtr buffer; + xmlSecTransformDataType type; + xmlParserInputBufferPtr input; + + xmlSecAssert2(xmlSecTransformIsValid(transform), NULL); + xmlSecAssert2(transformCtx != NULL, NULL); + + /* check that we have binary pop method for this transform */ + type = xmlSecTransformDefaultGetDataType(transform, xmlSecTransformModePop, transformCtx); + if((type & xmlSecTransformDataTypeBin) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + "pop binary data not supported"); + return(NULL); + } + + buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeRead, transform, transformCtx); + if(buffer == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformIOBufferCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + input = xmlParserInputBufferCreateIO((xmlInputReadCallback)xmlSecTransformIOBufferRead, + (xmlInputCloseCallback)xmlSecTransformIOBufferClose, + buffer, + XML_CHAR_ENCODING_NONE); + if(input == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParserInputBufferCreateIO", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecTransformIOBufferDestroy(buffer); + return(NULL); + } + + return(input); +} + +static xmlSecTransformIOBufferPtr +xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferMode mode, xmlSecTransformPtr transform, + xmlSecTransformCtxPtr transformCtx) { + xmlSecTransformIOBufferPtr buffer; + + xmlSecAssert2(xmlSecTransformIsValid(transform), NULL); + xmlSecAssert2(transformCtx != NULL, NULL); + + buffer = (xmlSecTransformIOBufferPtr)xmlMalloc(sizeof(xmlSecTransformIOBuffer)); + if(buffer == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", sizeof(xmlSecTransformIOBuffer)); + return(NULL); + } + memset(buffer, 0, sizeof(xmlSecTransformIOBuffer)); + + buffer->mode = mode; + buffer->transform = transform; + buffer->transformCtx = transformCtx; + + return(buffer); +} + +static void +xmlSecTransformIOBufferDestroy(xmlSecTransformIOBufferPtr buffer) { + xmlSecAssert(buffer != NULL); + + memset(buffer, 0, sizeof(xmlSecTransformIOBuffer)); + xmlFree(buffer); +} + +static int +xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer, + xmlSecByte *buf, xmlSecSize size) { + int ret; + + xmlSecAssert2(buffer != NULL, -1); + xmlSecAssert2(buffer->mode == xmlSecTransformIOBufferModeRead, -1); + xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1); + xmlSecAssert2(buffer->transformCtx != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + ret = xmlSecTransformPopBin(buffer->transform, buf, size, &size, buffer->transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)), + "xmlSecTransformPopBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(size); +} + +static int +xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer, + const xmlSecByte *buf, xmlSecSize size) { + int ret; + + xmlSecAssert2(buffer != NULL, -1); + xmlSecAssert2(buffer->mode == xmlSecTransformIOBufferModeWrite, -1); + xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1); + xmlSecAssert2(buffer->transformCtx != NULL, -1); + xmlSecAssert2(buf != NULL, -1); + + ret = xmlSecTransformPushBin(buffer->transform, buf, size, 0, buffer->transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)), + "xmlSecTransformPushBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(size); +} + +static int +xmlSecTransformIOBufferClose(xmlSecTransformIOBufferPtr buffer) { + int ret; + + xmlSecAssert2(buffer != NULL, -1); + xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1); + xmlSecAssert2(buffer->transformCtx != NULL, -1); + + /* need to flush write buffer before destroing */ + if(buffer->mode == xmlSecTransformIOBufferModeWrite) { + ret = xmlSecTransformPushBin(buffer->transform, NULL, 0, 1, buffer->transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)), + "xmlSecTransformPushBin", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecTransformIOBufferDestroy(buffer); + return(-1); + } + } + + xmlSecTransformIOBufferDestroy(buffer); + return(0); +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_x509.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_x509.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,98 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_X509 +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_x509.h" +#include "xmlsec_errors.h" + +/** + * xmlSecX509DataGetNodeContent: + * @node: the pointer to node. + * @deleteChildren: the flag that indicates whether to remove node children after reading. + * @keyInfoCtx: the pointer to node processing context. + * + * Reads the contents of node and returns it as + * a bits mask. + * + * Returns the bit mask representing the node content + * or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecX509DataGetNodeContent (xmlNodePtr node, int deleteChildren, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlNodePtr cur, next; + int deleteCurNode; + int content = 0; + + xmlSecAssert2(node != NULL, 0); + xmlSecAssert2(keyInfoCtx != NULL, -1); + + /* determine the current node content */ + cur = xmlSecGetNextElementNode(node->children); + while(cur != NULL) { + deleteCurNode = 0; + if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) { + if(xmlSecIsEmptyNode(cur) == 1) { + content |= XMLSEC_X509DATA_CERTIFICATE_NODE; + deleteCurNode = 1; + } + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) { + if(xmlSecIsEmptyNode(cur) == 1) { + content |= XMLSEC_X509DATA_SUBJECTNAME_NODE; + deleteCurNode = 1; + } + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) { + if(xmlSecIsEmptyNode(cur) == 1) { + content |= XMLSEC_X509DATA_ISSUERSERIAL_NODE; + deleteCurNode = 1; + } + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) { + if(xmlSecIsEmptyNode(cur) == 1) { + content |= XMLSEC_X509DATA_SKI_NODE; + deleteCurNode = 1; + } + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) { + if(xmlSecIsEmptyNode(cur) == 1) { + content |= XMLSEC_X509DATA_CRL_NODE; + deleteCurNode = 1; + } + } else { + } + next = xmlSecGetNextElementNode(cur->next); + if((deleteCurNode != 0) && (deleteChildren != 0)) { + /* remove "template" nodes */ + xmlUnlinkNode(cur); + xmlFreeNode(cur); + } + cur = next; + } + + return (content); +} + +#endif /* XMLSEC_NO_X509 */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xkms.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xkms.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,5016 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Key Management Specification v 2.0" implementation + * http://www.w3.org/TR/xkms2/ + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ + +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XKMS +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_soap.h" +#include "xmlsec_xkms.h" +#include "xmlsec_private.h" +#include "xmlsec_privatexkms.h" +#include "xmlsec_errors.h" + +#define XMLSEC_XKMS_ID_ATTRIBUTE_LEN 32 + +/* The ID attribute in XKMS is 'Id' */ +static const xmlChar* xmlSecXkmsServerIds[] = { BAD_CAST "Id", NULL }; + +#ifndef XMLSEC_NO_SOAP +static int xmlSecXkmsServerCtxWriteSoap11FatalError (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr envNode); +static int xmlSecXkmsServerCtxWriteSoap12FatalError (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr envNode); +#endif /* XMLSEC_NO_SOAP */ + +static int xmlSecXkmsServerCtxRequestAbstractTypeNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxSignatureNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxMessageExtensionNodesRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxOpaqueClientDataNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxPendingNotificationNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxRespondWithNodesRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxPendingRequestNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxQueryKeyBindingNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxKeyInfoNodeWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxUseKeyWithNodesRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr* node); +static int xmlSecXkmsServerCtxUseKeyWithNodesWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxTimeInstantNodeRead (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxResultTypeNodeWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxKeyBindingNodeWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxValidityIntervalNodeWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); +static int xmlSecXkmsServerCtxKeyBindingStatusNodeWrite (xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node, + xmlSecKeyPtr key); + + +static const xmlSecQName2IntegerInfo gXmlSecXkmsResultMajorInfo[] = +{ + { xmlSecXkmsNs, xmlSecResultMajorCodeSuccess, + xmlSecXkmsResultMajorSuccess }, + { xmlSecXkmsNs, xmlSecResultMajorCodeVersionMismatch, + xmlSecXkmsResultMajorVersionMismatch }, + { xmlSecXkmsNs, xmlSecResultMajorCodeSender, + xmlSecXkmsResultMajorSender }, + { xmlSecXkmsNs, xmlSecResultMajorCodeReceiver, + xmlSecXkmsResultMajorReceiver }, + { xmlSecXkmsNs, xmlSecResultMajorCodeRepresent, + xmlSecXkmsResultMajorRepresent }, + { xmlSecXkmsNs, xmlSecResultMajorCodePending, + xmlSecXkmsResultMajorPending, }, + { NULL , NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2IntegerInfo gXmlSecXkmsMinorErrorInfo[] = +{ + { xmlSecXkmsNs, xmlSecResultMinorCodeNoMatch, + xmlSecXkmsResultMinorNoMatch }, + { xmlSecXkmsNs, xmlSecResultMinorCodeTooManyResponses, + xmlSecXkmsResultMinorTooManyResponses }, + { xmlSecXkmsNs, xmlSecResultMinorCodeIncomplete, + xmlSecXkmsResultMinorIncomplete }, + { xmlSecXkmsNs, xmlSecResultMinorCodeFailure, + xmlSecXkmsResultMinorFailure }, + { xmlSecXkmsNs, xmlSecResultMinorCodeRefused, + xmlSecXkmsResultMinorRefused }, + { xmlSecXkmsNs, xmlSecResultMinorCodeNoAuthentication, + xmlSecXkmsResultMinorNoAuthentication }, + { xmlSecXkmsNs, xmlSecResultMinorCodeMessageNotSupported, + xmlSecXkmsResultMinorMessageNotSupported }, + { xmlSecXkmsNs, xmlSecResultMinorCodeUnknownResponseId, + xmlSecXkmsResultMinorUnknownResponseId }, + { xmlSecXkmsNs, xmlSecResultMinorCodeNotSynchronous, + xmlSecXkmsResultMinorSynchronous }, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2IntegerInfo gXmlSecXkmsKeyBindingStatusInfo[] = +{ + { xmlSecXkmsNs, xmlSecKeyBindingStatusValid, + xmlSecXkmsKeyBindingStatusValid }, + { xmlSecXkmsNs, xmlSecKeyBindingStatusInvalid, + xmlSecXkmsKeyBindingStatusInvalid }, + { xmlSecXkmsNs, xmlSecKeyBindingStatusIndeterminate, + xmlSecXkmsKeyBindingStatusIndeterminate }, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] = +{ + { xmlSecXkmsNs, xmlSecKeyUsageEncryption, + xmlSecKeyUsageEncrypt | xmlSecKeyUsageDecrypt }, + { xmlSecXkmsNs, xmlSecKeyUsageSignature, + xmlSecKeyUsageSign | xmlSecKeyUsageVerify }, + { xmlSecXkmsNs, xmlSecKeyUsageExchange, + xmlSecKeyUsageKeyExchange}, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] = +{ + { xmlSecXkmsNs, xmlSecKeyBindingReasonIssuerTrust, + XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST }, + { xmlSecXkmsNs, xmlSecKeyBindingReasonRevocationStatus, + XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS }, + { xmlSecXkmsNs, xmlSecKeyBindingReasonValidityInterval, + XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL }, + { xmlSecXkmsNs, xmlSecKeyBindingReasonSignature, + XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE }, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] = +{ + { xmlSecXkmsNs, xmlSecResponseMechanismRepresent, + XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT }, + { xmlSecXkmsNs, xmlSecResponseMechanismPending, + XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING }, + { xmlSecXkmsNs, xmlSecResponseMechanismRequestSignatureValue, + XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE }, + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] = +{ + { NULL, xmlSecXkmsFormatStrPlain, + xmlSecXkmsServerFormatPlain }, +#ifndef XMLSEC_NO_SOAP + { NULL, xmlSecXkmsFormatStrSoap11, + xmlSecXkmsServerFormatSoap11 }, + { NULL, xmlSecXkmsFormatStrSoap12, + xmlSecXkmsServerFormatSoap12 }, +#endif /* XMLSEC_NO_SOAP */ + { NULL, NULL, 0 } /* MUST be last in the list */ +}; + +/** + * xmlSecXkmsServerFormatFromString: + * @str the string. + * + * Gets xmlSecXkmsServerFormat from string @str. + * + * Returns corresponding format or xmlSecXkmsServerFormatUnknown + * if format could not be recognized. + */ +EXPORT_C +xmlSecXkmsServerFormat +xmlSecXkmsServerFormatFromString(const xmlChar* str) { + int res; + int ret; + + xmlSecAssert2(str != NULL, xmlSecXkmsServerFormatUnknown); + + ret = xmlSecQName2IntegerGetInteger(gXmlSecXkmsFormatInfo, NULL, str, &res); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetInteger", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(xmlSecXkmsServerFormatUnknown); + } + + return((xmlSecXkmsServerFormat)res); +} + +/** + * xmlSecXkmsServerFormatToString: + * @format: the format. + * + * Gets string from @format. + * + * Returns string corresponding to @format or NULL if an error occurs. + */ +EXPORT_C +const xmlChar* +xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) { + xmlSecQName2IntegerInfoConstPtr info; + + xmlSecAssert2(format != xmlSecXkmsServerFormatUnknown, NULL); + + info = xmlSecQName2IntegerGetInfo(gXmlSecXkmsFormatInfo, format); + if(info == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetInfo", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + return(info->qnameLocalPart); +} + +/** + * xmlSecXkmsServerCtxCreate: + * @keysMngr: the pointer to keys manager. + * + * Creates XKMS request server side processing context. + * The caller is responsible for destroying returend object by calling + * #xmlSecXkmsServerCtxDestroy function. + * + * Returns pointer to newly allocated context object or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecXkmsServerCtxPtr +xmlSecXkmsServerCtxCreate(xmlSecKeysMngrPtr keysMngr) { + xmlSecXkmsServerCtxPtr ctx; + int ret; + + ctx = (xmlSecXkmsServerCtxPtr) xmlMalloc(sizeof(xmlSecXkmsServerCtx)); + if(ctx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecXkmsServerCtx)=%d", + sizeof(xmlSecXkmsServerCtx)); + return(NULL); + } + + ret = xmlSecXkmsServerCtxInitialize(ctx, keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxDestroy(ctx); + return(NULL); + } + return(ctx); +} + +/** + * xmlSecXkmsServerCtxDestroy: + * @ctx: the pointer to XKMS processing context. + * + * Destroy context object created with #xmlSecXkmsServerCtxCreate function. + */ +EXPORT_C +void +xmlSecXkmsServerCtxDestroy(xmlSecXkmsServerCtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + xmlSecXkmsServerCtxFinalize(ctx); + xmlFree(ctx); +} + +/** + * xmlSecXkmsServerCtxInitialize: + * @ctx: the pointer to XKMS processing context. + * @keysMngr: the pointer to keys manager. + * + * Initializes XKMS element processing context. + * The caller is responsible for cleaing up returend object by calling + * #xmlSecXkmsServerCtxFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keysMngr) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + + memset(ctx, 0, sizeof(xmlSecXkmsServerCtx)); + + ctx->resultMajor = xmlSecXkmsResultMajorSuccess; + ctx->resultMinor = xmlSecXkmsResultMinorNone; + ctx->responseLimit = XMLSEC_XKMS_NO_RESPONSE_LIMIT; + ctx->idLen = XMLSEC_XKMS_ID_ATTRIBUTE_LEN; + + /* initialize key info */ + ret = xmlSecKeyInfoCtxInitialize(&(ctx->keyInfoReadCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ctx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead; + + ret = xmlSecKeyInfoCtxInitialize(&(ctx->keyInfoWriteCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ctx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite; + + /* enabled RespondWith */ + ret = xmlSecPtrListInitialize(&(ctx->enabledRespondWithIds), xmlSecXkmsRespondWithIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* enabled ServerRequest */ + ret = xmlSecPtrListInitialize(&(ctx->enabledServerRequestIds), xmlSecXkmsServerRequestIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + + + /* initialize keys list */ + ret = xmlSecPtrListInitialize(&(ctx->keys), xmlSecKeyPtrListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* initialize RespondWith list */ + ret = xmlSecPtrListInitialize(&(ctx->respWithList), xmlSecXkmsRespondWithIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsServerCtxFinalize: + * @ctx: the pointer to XKMS processing context. + * + * Cleans up @ctx object. + */ +EXPORT_C +void +xmlSecXkmsServerCtxFinalize(xmlSecXkmsServerCtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + xmlSecXkmsServerCtxReset(ctx); + + if(ctx->expectedService != NULL) { + xmlFree(ctx->expectedService); + } + if(ctx->idPrefix != NULL) { + xmlFree(ctx->idPrefix); + } + + xmlSecKeyInfoCtxFinalize(&(ctx->keyInfoReadCtx)); + xmlSecKeyInfoCtxFinalize(&(ctx->keyInfoWriteCtx)); + xmlSecPtrListFinalize(&(ctx->enabledRespondWithIds)); + xmlSecPtrListFinalize(&(ctx->enabledServerRequestIds)); + xmlSecPtrListFinalize(&(ctx->keys)); + xmlSecPtrListFinalize(&(ctx->respWithList)); + memset(ctx, 0, sizeof(xmlSecXkmsServerCtx)); +} + +/** + * xmlSecXkmsServerCtxReset: + * @ctx: the pointer to XKMS processing context. + * + * Resets @ctx object, user settings are not touched. + */ +EXPORT_C +void +xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) { + xmlSecAssert(ctx != NULL); + + ctx->resultMajor = xmlSecXkmsResultMajorSuccess; + ctx->resultMinor = xmlSecXkmsResultMinorNone; + xmlSecKeyInfoCtxReset(&(ctx->keyInfoReadCtx)); + xmlSecKeyInfoCtxReset(&(ctx->keyInfoWriteCtx)); + xmlSecPtrListEmpty(&(ctx->keys)); + xmlSecPtrListEmpty(&(ctx->respWithList)); + + ctx->requestNode = NULL; + ctx->opaqueClientDataNode = NULL; + ctx->firtsMsgExtNode = NULL; + ctx->keyInfoNode = NULL; + ctx->requestId = xmlSecXkmsServerRequestIdUnknown; + + if(ctx->id != NULL) { + xmlFree(ctx->id); ctx->id = NULL; + } + if(ctx->service != NULL) { + xmlFree(ctx->service); ctx->service = NULL; + } + if(ctx->nonce != NULL) { + xmlFree(ctx->nonce); ctx->nonce = NULL; + } + if(ctx->originalRequestId != NULL) { + xmlFree(ctx->originalRequestId); ctx->originalRequestId = NULL; + } + if(ctx->pendingNotificationMechanism != NULL) { + xmlFree(ctx->pendingNotificationMechanism); + ctx->pendingNotificationMechanism = NULL; + } + if(ctx->pendingNotificationIdentifier != NULL) { + xmlFree(ctx->pendingNotificationIdentifier); + ctx->pendingNotificationIdentifier = NULL; + } + if(ctx->compoundRequestContexts != NULL) { + xmlSecPtrListDestroy(ctx->compoundRequestContexts); + ctx->compoundRequestContexts = NULL; + } + + ctx->responseLimit = XMLSEC_XKMS_NO_RESPONSE_LIMIT; + ctx->responseMechanismMask = 0; +} + +/** + * xmlSecXkmsServerCtxCopyUserPref: + * @dst: the pointer to destination context. + * @src: the pointer to source context. + * + * Copies user preference from @src context to @dst. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxPtr src) { + int ret; + + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + dst->userData = src->userData; + dst->flags = src->flags; + dst->flags2 = src->flags2; + + ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoReadCtx), &(src->keyInfoReadCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoWriteCtx), &(src->keyInfoWriteCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if(src->expectedService != NULL) { + dst->expectedService = xmlStrdup(src->expectedService); + if(dst->expectedService == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + if(src->idPrefix != NULL) { + dst->idPrefix = xmlStrdup(src->idPrefix); + if(dst->idPrefix == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + src->idLen = dst->idLen; + + + ret = xmlSecPtrListCopy(&(dst->enabledRespondWithIds), &(src->enabledRespondWithIds)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecPtrListCopy(&(dst->enabledServerRequestIds), &(src->enabledServerRequestIds)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsServerCtxProcess: + * @ctx: the pointer to XKMS processing context. + * @node: the pointer to request node. + * @format: the request/response format. + * @doc: the pointer to response parent XML document (might be NULL). + * + * Reads XKMS request from @node and creates response to a newly created node. + * Caller is responsible for adding the returned node to the XML document. + * + * Returns pointer to newly created XKMS response node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, + xmlSecXkmsServerFormat format, xmlDocPtr doc) { + int ret; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(ctx->requestId == NULL, NULL); + xmlSecAssert2(ctx->requestNode == NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + ctx->requestNode = xmlSecXkmsServerCtxRequestUnwrap(ctx, node, format); + if(ctx->requestNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestUnwrap", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + goto done; + } + + ret = xmlSecXkmsServerCtxRequestRead(ctx, ctx->requestNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdListFindByNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ctx->requestNode=%s", + xmlSecErrorsSafeString(ctx->requestNode->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + goto done; + } + + ret = xmlSecXkmsServerRequestExecute(ctx->requestId, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ctx->requestNode=%s", + xmlSecErrorsSafeString(ctx->requestNode->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + goto done; + } + +done: + /* always try to write response back */ + if(ctx->requestId != NULL) { + xmlNodePtr respNode; + xmlNodePtr wrappedRespNode; + + respNode = xmlSecXkmsServerCtxResponseWrite(ctx, doc); + if(respNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResponseWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ctx->requestNode=%s", + xmlSecErrorsSafeString(ctx->requestNode->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + goto error; + } + + + wrappedRespNode = xmlSecXkmsServerCtxResponseWrap(ctx, respNode, format, doc); + if(wrappedRespNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResponseWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ctx->requestNode=%s", + xmlSecErrorsSafeString(ctx->requestNode->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + xmlFreeNode(respNode); + goto error; + } + + return(wrappedRespNode); + } + +error: + /* last attempt: create fatatl error response */ + return(xmlSecXkmsServerCtxFatalErrorResponseCreate(ctx, format, doc)); +} + +/** + * xmlSecXkmsServerCtxRequestRead: + * @ctx: the pointer to XKMS processing context. + * @node: the pointer to request node. + * + * Reads XKMS request from @node and stores data in @ctx. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->requestId == NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* find out what the request is */ + if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) { + ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(&(ctx->enabledServerRequestIds), node); + } else { + ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(xmlSecXkmsServerRequestIdsGet(), node); + } + if(ctx->requestId == xmlSecXkmsServerRequestIdUnknown) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdListFindByNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported); + return(-1); + } + + xmlSecAddIDs(node->doc, node, xmlSecXkmsServerIds); + ret = xmlSecXkmsServerRequestNodeRead(ctx->requestId, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "request=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId))); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsServerCtxResponseWrite: + * @ctx: the pointer to XKMS processing context. + * @doc: the pointer to response parent XML document (might be NULL). + * + * Writes XKMS response from context to a newly created node. Caller is + * responsible for adding the returned node to the XML document. + * + * Returns pointer to newly created XKMS response node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) { + xmlNodePtr respNode; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(ctx->requestId != NULL, NULL); + + /* now write results */ + respNode = xmlSecXkmsServerRequestNodeWrite(ctx->requestId, ctx, doc, NULL); + if(respNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "request=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId))); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + return(respNode); +} + +/** + * xmlSecXkmsServerCtxRequestUnwrap: + * @ctx: the pointer to XKMS processing context. + * @node: the pointer to request node. + * @format: the request/response format. + * + * Removes SOAP or other envelope from XKMS request. + * + * Returns pointer to "real" XKMS request node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecXkmsServerFormat format) { + xmlNodePtr result = NULL; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + switch(format) { + case xmlSecXkmsServerFormatPlain: + result = node; + break; +#ifndef XMLSEC_NO_SOAP + case xmlSecXkmsServerFormatSoap11: + /* verify that it is actually soap Envelope node */ + if(xmlSecSoap11CheckEnvelope(node) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11CheckEnvelope", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + /* check that Body has exactly one entry */ + if(xmlSecSoap11GetBodyEntriesNumber(node) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBodyEntriesNumber", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + /* this one enntry is our xkms request */ + result = xmlSecSoap11GetBodyEntry(node, 0); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11GetBodyEntry", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + break; + case xmlSecXkmsServerFormatSoap12: + /* verify that it is actually soap Envelope node */ + if(xmlSecSoap12CheckEnvelope(node) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12CheckEnvelope", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + /* check that Body has exactly one entry */ + if(xmlSecSoap12GetBodyEntriesNumber(node) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBodyEntriesNumber", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + /* this one enntry is our xkms request */ + result = xmlSecSoap12GetBodyEntry(node, 0); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12GetBodyEntry", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + break; +#endif /* XMLSEC_NO_SOAP */ + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + "format=%d", + format); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + return(result); +} + +/** + * xmlSecXkmsServerCtxResponseWrap: + * @ctx: the pointer to XKMS processing context. + * @node: the pointer to response node. + * @format: the request/response format. + * @doc: the pointer to response parent XML document (might be NULL). + * + * Creates SOAP or other envelope around XKMS response. + * Caller is responsible for adding the returned node to the XML document. + * + * Returns pointer to newly created response envelope node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecXkmsServerFormat format, xmlDocPtr doc) { + xmlNodePtr result = NULL; + + xmlSecAssert2(ctx != NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + switch(format) { + case xmlSecXkmsServerFormatPlain: + result = node; /* do nothing */ + break; +#ifndef XMLSEC_NO_SOAP + case xmlSecXkmsServerFormatSoap11: + result = xmlSecSoap11CreateEnvelope(doc); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11CreateEnvelope", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + if(xmlSecSoap11AddBodyEntry(result, node) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11AddBodyEntry", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + break; + case xmlSecXkmsServerFormatSoap12: + result = xmlSecSoap12CreateEnvelope(doc); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12CreateEnvelope", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + if(xmlSecSoap12AddBodyEntry(result, node) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12AddBodyEntry", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + break; +#endif /* XMLSEC_NO_SOAP */ + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + "format=%d", + format); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + return(result); +} + +/** + * xmlSecXkmsServerCtxFatalErrorResponseCreate: + * @ctx: the pointer to XKMS processing context. + * @format: the request/response format. + * @doc: the pointer to response parent XML document (might be NULL). + * + * Creates a "fatal error" SOAP or other envelope respons. Caller is + * responsible for adding the returned node to the XML document. + * + * Returns pointer to newly created fatal error response (it might be NULL). + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsServerFormat format, xmlDocPtr doc) { + xmlNodePtr result = NULL; + int ret; + + xmlSecAssert2(ctx != NULL, NULL); + + /* make sure that we have an error */ + if(ctx->resultMajor == xmlSecXkmsResultMajorSuccess) { + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + } + + switch(format) { + case xmlSecXkmsServerFormatPlain: + /* try to create fatal error response with XKMS Status request */ + result = xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestResultId, ctx, doc, NULL); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + break; +#ifndef XMLSEC_NO_SOAP + case xmlSecXkmsServerFormatSoap11: + result = xmlSecSoap11CreateEnvelope(doc); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11CreateEnvelope", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + ret = xmlSecXkmsServerCtxWriteSoap11FatalError(ctx, result); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxWriteSoap11FatalError", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + xmlFreeNode(result); + return(NULL); + } + + break; + case xmlSecXkmsServerFormatSoap12: + result = xmlSecSoap12CreateEnvelope(doc); + if(result == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12CreateEnvelope", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + ret = xmlSecXkmsServerCtxWriteSoap12FatalError(ctx, result); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxWriteSoap12FatalError", + XMLSEC_ERRORS_R_INVALID_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + xmlFreeNode(result); + return(NULL); + } + + break; +#endif /* XMLSEC_NO_SOAP */ + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + "format=%d", + format); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(NULL); + } + + return(result); +} + +#ifndef XMLSEC_NO_SOAP +static int +xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr envNode) { + const xmlChar* faultCodeHref = NULL; + const xmlChar* faultCodeLocalPart = NULL; + xmlChar* faultString = NULL; + int len; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(envNode != NULL, -1); + + if((ctx->resultMajor == xmlSecXkmsResultMajorVersionMismatch) || + (ctx->requestNode == NULL)) { + /* we were not able to parse the envelope or its general version mismatch error */ + faultCodeHref = xmlSecSoap11Ns; + faultCodeLocalPart = xmlSecSoapFaultCodeVersionMismatch; + faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonUnsupportedVersion); + if(faultString == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) && + (ctx->requestId == NULL)) { + /* we understood the request but were not able to parse input message */ + faultCodeHref = xmlSecSoap11Ns; + faultCodeLocalPart = xmlSecSoapFaultCodeClient; + + len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + + xmlStrlen(xmlSecXkmsSoapFaultReasonMessageInvalid) + 1; + faultString = xmlMalloc(len + 1); + if(faultString == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + xmlSecStrPrintf(faultString, len , xmlSecXkmsSoapFaultReasonMessageInvalid, + xmlSecErrorsSafeString(ctx->requestNode->name)); + } else if((ctx->resultMajor == xmlSecXkmsResultMajorReceiver) && + (ctx->requestId == NULL)) { + /* we understood the request but were not able to process it */ + faultCodeHref = xmlSecSoap11Ns; + faultCodeLocalPart = xmlSecSoapFaultCodeServer; + faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable); + if(faultString == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } else if((ctx->requestId == NULL) && (ctx->requestNode != NULL)) { + /* we parsed the envelope but were not able to understand this request */ + faultCodeHref = xmlSecSoap11Ns; + faultCodeLocalPart = xmlSecSoapFaultCodeClient; + + len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + + xmlStrlen(xmlSecXkmsSoapFaultReasonMessageNotSupported) + 1; + faultString = xmlMalloc(len + 1); + if(faultString == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + xmlSecStrPrintf(faultString, len , xmlSecXkmsSoapFaultReasonMessageNotSupported, + xmlSecErrorsSafeString(ctx->requestNode->name)); + } else { + /* just some error */ + faultCodeHref = xmlSecSoap11Ns; + faultCodeLocalPart = xmlSecSoapFaultCodeServer; + faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable); + if(faultString == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } + + if(xmlSecSoap11AddFaultEntry(envNode, faultCodeHref, faultCodeLocalPart, faultString, NULL) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap11AddFaultEntry", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + xmlFree(faultString); + return(-1); + } + + xmlFree(faultString); + return(0); +} + +static int +xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr envNode) { + xmlSecSoap12FaultCode faultCode = xmlSecSoap12FaultCodeUnknown; + const xmlChar* faultSubCodeHref = NULL; + const xmlChar* faultSubCodeLocalPart = NULL; + xmlChar* faultReason = NULL; + int len; + xmlNodePtr faultNode; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(envNode != NULL, -1); + + if((ctx->resultMajor == xmlSecXkmsResultMajorVersionMismatch) || + (ctx->requestNode == NULL)) { + /* we were not able to parse the envelope or its general version mismatch error */ + faultCode = xmlSecSoap12FaultCodeVersionMismatch; + faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonUnsupportedVersion); + if(faultReason == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) && + (ctx->requestId == NULL)) { + /* we understood the request but were not able to parse input message */ + faultCode = xmlSecSoap12FaultCodeSender; + faultSubCodeHref = xmlSecXkmsNs; + faultSubCodeLocalPart = xmlSecXkmsSoapSubcodeValueMessageNotSupported; + + len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + + xmlStrlen(xmlSecXkmsSoapFaultReasonMessageInvalid) + 1; + faultReason = xmlMalloc(len + 1); + if(faultReason == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + xmlSecStrPrintf(faultReason, len , xmlSecXkmsSoapFaultReasonMessageInvalid, + xmlSecErrorsSafeString(ctx->requestNode->name)); + } else if((ctx->resultMajor == xmlSecXkmsResultMajorReceiver) && + (ctx->requestId == NULL)) { + /* we understood the request but were not able to process it */ + faultCode = xmlSecSoap12FaultCodeReceiver; + faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable); + if(faultReason == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } else if((ctx->requestId == NULL) && (ctx->requestNode != NULL)) { + /* we parsed the envelope but were not able to understand this request */ + faultCode = xmlSecSoap12FaultCodeSender; + faultSubCodeHref = xmlSecXkmsNs; + faultSubCodeLocalPart = xmlSecXkmsSoapSubcodeValueBadMessage; + + len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + + xmlStrlen(xmlSecXkmsSoapFaultReasonMessageNotSupported) + 1; + faultReason = xmlMalloc(len + 1); + if(faultReason == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + xmlSecStrPrintf(faultReason, len , xmlSecXkmsSoapFaultReasonMessageNotSupported, + xmlSecErrorsSafeString(ctx->requestNode->name)); + } else { + /* just some error */ + faultCode = xmlSecSoap12FaultCodeReceiver; + faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable); + if(faultReason == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + return(-1); + } + } + xmlSecAssert2(faultCode != xmlSecSoap12FaultCodeUnknown, -1); + xmlSecAssert2(faultReason != NULL, -1); + + faultNode = xmlSecSoap12AddFaultEntry(envNode, faultCode, faultReason, + xmlSecXkmsSoapFaultReasonLang, NULL, NULL); + if(faultNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12AddFaultEntry", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + xmlFree(faultReason); + return(-1); + } + xmlFree(faultReason); + + if((faultSubCodeHref != NULL) && (faultSubCodeLocalPart != NULL)) { + /* make sure that we have subcode (xkms) namespace declared */ + if(xmlNewNs(faultNode, faultSubCodeHref, BAD_CAST "xkms") == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(faultSubCodeHref)); + return(-1); + } + if(xmlSecSoap12AddFaultSubcode(faultNode, faultSubCodeHref, faultSubCodeLocalPart) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSoap12AddFaultSubcode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "href=%s,value=%s", + xmlSecErrorsSafeString(faultSubCodeHref), + xmlSecErrorsSafeString(faultSubCodeLocalPart)); + return(-1); + } + } + + return(0); +} + +#endif /* XMLSEC_NO_SOAP */ + + +/** + * xmlSecXkmsServerCtxSetResult: + * @ctx: the pointer to XKMS processing context. + * @resultMajor: the major result code. + * @resultMinor: the minor result code. + * + * Sets the major/minor result code in the context if no other result is already + * reported. + */ +EXPORT_C +void +xmlSecXkmsServerCtxSetResult(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsResultMajor resultMajor, + xmlSecXkmsResultMinor resultMinor) { + xmlSecAssert(ctx != NULL); + + if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && + (resultMinor != xmlSecXkmsResultMajorSuccess)) { + ctx->resultMajor = resultMajor; + ctx->resultMinor = resultMinor; + } else if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && + (ctx->resultMinor == xmlSecXkmsResultMinorNone)) { + xmlSecAssert(resultMajor == xmlSecXkmsResultMajorSuccess); + + ctx->resultMinor = resultMinor; + } +} + + +/** + * xmlSecXkmsServerCtxDebugDump: + * @ctx: the pointer to XKMS processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @ctx to @output. + */ +EXPORT_C +void +xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) { + xmlSecAssert(ctx != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "= XKMS SERVER CONTEXT: %s\n", + (ctx->requestId != xmlSecXkmsServerRequestIdUnknown && + xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ? + xmlSecXkmsServerRequestKlassGetName(ctx->requestId) : + BAD_CAST "NULL"); + + xmlSecQName2IntegerDebugDump(gXmlSecXkmsResultMajorInfo, + ctx->resultMajor, BAD_CAST "resultMajor", output); + xmlSecQName2IntegerDebugDump(gXmlSecXkmsMinorErrorInfo, + ctx->resultMinor, BAD_CAST "resultMinor", output); + + fprintf(output, "== id: %s\n", + (ctx->id) ? ctx->id : BAD_CAST ""); + fprintf(output, "== service: %s\n", + (ctx->service) ? ctx->service : BAD_CAST ""); + fprintf(output, "== nonce: %s\n", + (ctx->nonce) ? ctx->nonce : BAD_CAST ""); + fprintf(output, "== originalRequestId: %s\n", + (ctx->originalRequestId) ? ctx->originalRequestId : BAD_CAST ""); + fprintf(output, "== pendingNotificationMechanism: %s\n", + (ctx->pendingNotificationMechanism) ? + ctx->pendingNotificationMechanism : + BAD_CAST ""); + fprintf(output, "== pendingNotificationIdentifier: %s\n", + (ctx->pendingNotificationIdentifier) ? + ctx->pendingNotificationIdentifier : + BAD_CAST ""); + if(ctx->responseLimit != XMLSEC_XKMS_NO_RESPONSE_LIMIT) { + fprintf(output, "== ResponseLimit: %d\n", ctx->responseLimit); + } + xmlSecQName2BitMaskDebugDump(gXmlSecXkmsResponseMechanismInfo, + ctx->responseMechanismMask, BAD_CAST "responseMechanism", output); + + if(ctx->expectedService != NULL) { + fprintf(output, "== expected service: %s\n", ctx->expectedService); + } + fprintf(output, "== flags: 0x%08x\n", ctx->flags); + fprintf(output, "== flags2: 0x%08x\n", ctx->flags2); + + fprintf(output, "== Key Info Read Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(ctx->keyInfoReadCtx), output); + + fprintf(output, "== Key Info Write Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(ctx->keyInfoWriteCtx), output); + + if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) { + fprintf(output, "== Enabled RespondWith: "); + xmlSecTransformIdListDebugDump(&(ctx->enabledRespondWithIds), output); + } else { + fprintf(output, "== Enabled RespondWith: all\n"); + } + + if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) { + fprintf(output, "== Enabled ServerRequest: "); + xmlSecTransformIdListDebugDump(&(ctx->enabledServerRequestIds), output); + } else { + fprintf(output, "== Enabled ServerRequest: all\n"); + } + + fprintf(output, "== RespondWith List:\n"); + xmlSecPtrListDebugDump(&(ctx->respWithList), output); + + fprintf(output, "== Keys:\n"); + xmlSecPtrListDebugDump(&(ctx->keys), output); + + if(ctx->compoundRequestContexts != NULL) { + fprintf(output, "== Compound Request:\n"); + xmlSecPtrListDebugDump(ctx->compoundRequestContexts, output); + } +} + +/** + * xmlSecXkmsServerCtxDebugXmlDump: + * @ctx: the pointer to XKMS processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @ctx to @output in XML format. + */ +EXPORT_C +void +xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) { + xmlSecAssert(ctx != NULL); + xmlSecAssert(output != NULL); + + fprintf(output, "\n", + (ctx->requestId != xmlSecXkmsServerRequestIdUnknown && + xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ? + xmlSecXkmsServerRequestKlassGetName(ctx->requestId) : + BAD_CAST "NULL"); + + xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsResultMajorInfo, + ctx->resultMajor, BAD_CAST "MajorError", output); + xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsMinorErrorInfo, + ctx->resultMinor, BAD_CAST "MinorError", output); + + fprintf(output, "%s\n", + (ctx->id) ? ctx->id : BAD_CAST ""); + fprintf(output, "%s\n", + (ctx->service) ? ctx->service : BAD_CAST ""); + fprintf(output, "%s\n", + (ctx->nonce) ? ctx->nonce : BAD_CAST ""); + fprintf(output, "%s\n", + (ctx->originalRequestId) ? ctx->originalRequestId : BAD_CAST ""); + fprintf(output, "%s\n", + (ctx->pendingNotificationMechanism) ? + ctx->pendingNotificationMechanism : + BAD_CAST ""); + fprintf(output, "%s\n", + (ctx->pendingNotificationIdentifier) ? + ctx->pendingNotificationIdentifier : + BAD_CAST ""); + if(ctx->responseLimit != XMLSEC_XKMS_NO_RESPONSE_LIMIT) { + fprintf(output, "%d\n", ctx->responseLimit); + } + xmlSecQName2BitMaskDebugXmlDump(gXmlSecXkmsResponseMechanismInfo, + ctx->responseMechanismMask, BAD_CAST "ResponseMechanism", output); + + + if(ctx->expectedService != NULL) { + fprintf(output, "%s\n", ctx->expectedService); + } + fprintf(output, "%08x\n", ctx->flags); + fprintf(output, "%08x\n", ctx->flags2); + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(ctx->keyInfoReadCtx), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(ctx->keyInfoWriteCtx), output); + fprintf(output, "\n"); + + if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) { + fprintf(output, "\n"); + xmlSecTransformIdListDebugXmlDump(&(ctx->enabledRespondWithIds), output); + fprintf(output, "\n"); + } else { + fprintf(output, "all\n"); + } + + if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) { + fprintf(output, "\n"); + xmlSecTransformIdListDebugXmlDump(&(ctx->enabledServerRequestIds), output); + fprintf(output, "\n"); + } else { + fprintf(output, "all\n"); + } + + + fprintf(output, "\n"); + xmlSecPtrListDebugXmlDump(&(ctx->respWithList), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecPtrListDebugXmlDump(&(ctx->keys), output); + fprintf(output, "\n"); + + if(ctx->compoundRequestContexts != NULL) { + fprintf(output, "\n"); + xmlSecPtrListDebugXmlDump(ctx->compoundRequestContexts, output); + fprintf(output, "\n"); + } + + fprintf(output, "\n"); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + xmlNodePtr cur; + xmlChar* tmp; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2((*node) != NULL, -1); + + cur = (*node); + xmlSecAssert2(cur != NULL, -1); + + /* required Id attribute */ + xmlSecAssert2(ctx->id == NULL, -1); + ctx->id = xmlGetProp(cur, xmlSecAttrId); + if(ctx->id == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrId), + xmlSecErrorsSafeString(cur->name)); + return(-1); + } + + /* required Service attribute */ + xmlSecAssert2(ctx->service == NULL, -1); + ctx->service = xmlGetProp(cur, xmlSecAttrService); + if(ctx->service == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrService), + xmlSecErrorsSafeString(cur->name)); + return(-1); + } + + /* check service */ + if((ctx->expectedService != NULL) && (!xmlStrEqual(ctx->expectedService, ctx->service))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "expectedService=%s;actualService=%s", + xmlSecErrorsSafeString(ctx->expectedService), + xmlSecErrorsSafeString(ctx->service)); + return(-1); + } + + /* optional Nonce attribute */ + xmlSecAssert2(ctx->nonce == NULL, -1); + ctx->nonce = xmlGetProp(cur, xmlSecAttrNonce); + + /* optional OriginalRequestId attribute */ + xmlSecAssert2(ctx->originalRequestId == NULL, -1); + ctx->originalRequestId = xmlGetProp(cur, xmlSecAttrOriginalRequestId); + + /* optional ResponseLimit attribute */ + xmlSecAssert2(ctx->responseLimit == XMLSEC_XKMS_NO_RESPONSE_LIMIT, -1); + tmp = xmlGetProp(cur, xmlSecAttrResponseLimit); + if(tmp != NULL) { + ctx->responseLimit = atoi((char*)tmp); + xmlFree(tmp); + } + + /* now read children */ + cur = xmlSecGetNextElementNode(cur->children); + + /* first node is optional node */ + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeSignature, xmlSecDSigNs)) { + ret = xmlSecXkmsServerCtxSignatureNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxSignatureNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is zero or more nodes */ + ret = xmlSecXkmsServerCtxMessageExtensionNodesRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxMessageExtensionNodesRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* next is optional node */ + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeOpaqueClientData, xmlSecXkmsNs)) { + ret = xmlSecXkmsServerCtxOpaqueClientDataNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxOpaqueClientDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is zero or more nodes */ + ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsResponseMechanismInfo, &cur, + xmlSecNodeResponseMechanism, xmlSecXkmsNs, + ((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM) != 0) ? 1 : 0, + &ctx->responseMechanismMask); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskNodesRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecNodeResponseMechanism)); + return(-1); + } + + /* next is zero or more nodes */ + ret = xmlSecXkmsServerCtxRespondWithNodesRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRespondWithNodesRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* next is optional node */ + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodePendingNotification, xmlSecXkmsNs)) { + ret = xmlSecXkmsServerCtxPendingNotificationNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxPendingNotificationNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + (*node) = cur; + return(0); +} + +static int +xmlSecXkmsServerCtxSignatureNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + return(0); +} + +/** + * + * + * + * + */ +static int +xmlSecXkmsServerCtxMessageExtensionNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + xmlNodePtr cur; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->firtsMsgExtNode == NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = (*node); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeMessageExtension, xmlSecXkmsNs)) { + if(ctx->firtsMsgExtNode == NULL) { + ctx->firtsMsgExtNode = cur; + } + cur = xmlSecGetNextElementNode(cur->next); + } + + (*node) = cur; + return(0); +} + +static int +xmlSecXkmsServerCtxOpaqueClientDataNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->opaqueClientDataNode == NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* remember that node, will copy it in the response later */ + ctx->opaqueClientDataNode = node; + return(0); +} + +static int +xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = (*node); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeRespondWith, xmlSecXkmsNs)) { + xmlSecXkmsRespondWithId id = xmlSecXkmsRespondWithIdUnknown; + + if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) { + id = xmlSecXkmsRespondWithIdListFindByNodeValue(&(ctx->enabledRespondWithIds), cur); + } else { + id = xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecXkmsRespondWithIdsGet(), cur); + } + + if(id != xmlSecXkmsRespondWithIdUnknown) { + ret = xmlSecXkmsRespondWithNodeRead(id, ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCreateTree", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else if((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH) != 0) { + xmlChar* content ; + + content = xmlNodeGetContent(cur); + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(cur->name), + xmlSecErrorsSafeString(content)); + if(content != NULL) { + xmlFree(content); + } + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + (*node) = cur; + return(0); +} + +/** + * XML Schema: + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + xmlSecAssert2(ctx->pendingNotificationMechanism == NULL, -1); + ctx->pendingNotificationMechanism = xmlGetProp(node, xmlSecAttrMechanism); + if(ctx->pendingNotificationMechanism == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrMechanism), + xmlSecErrorsSafeString(node->name)); + return(-1); + } + + xmlSecAssert2(ctx->pendingNotificationIdentifier == NULL, -1); + ctx->pendingNotificationIdentifier = xmlGetProp(node, xmlSecAttrIdentifier); + if(ctx->pendingNotificationIdentifier == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrIdentifier), + xmlSecErrorsSafeString(node->name)); + return(-1); + } + + return(0); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * * + */ +static int +xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first read "parent" type */ + ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * ? + * ? + * ? + * ? + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxQueryKeyBindingNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first read "parent" type */ + cur = node; + ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* next is optional node */ + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeTimeInstant, xmlSecXkmsNs)) { + ret = xmlSecXkmsServerCtxTimeInstantNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxTimeInstantNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* check that there is nothing after the last node */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * ? + * ? + * ? + * ? + * * + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2((*node) != NULL, -1); + + cur = (*node); + xmlSecAssert2(cur != NULL, -1); + + /* we don't care about Id attribute in this node */ + cur = xmlSecGetNextElementNode(cur->children); + + /* first node is optional node. for now we only remember pointer */ + xmlSecAssert2(ctx->keyInfoNode == NULL, -1); + if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) { + ctx->keyInfoNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is zero or more nodes */ + ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsKeyUsageInfo, &cur, + xmlSecNodeKeyUsage, xmlSecXkmsNs, + ((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE) != 0) ? 1 : 0, + &(ctx->keyInfoReadCtx.keyReq.keyUsage)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskNodesRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyUsage)); + return(-1); + } + + /* next is zero or more nodes */ + ret = xmlSecXkmsServerCtxUseKeyWithNodesRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxUseKeyWithNodesRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + (*node) = cur; + return(0); +} + +static int +xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(key != NULL, -1); + + /* generate and add Id attribute */ + ret = xmlSecGenerateAndAddID(node, xmlSecAttrId, ctx->idPrefix, ctx->idLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGenerateAndAddID", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* node */ + cur = xmlSecAddChild(node, xmlSecNodeKeyInfo, xmlSecDSigNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyInfo)); + return(-1); + } + + ret = xmlSecXkmsServerCtxKeyInfoNodeWrite(ctx, cur, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyInfoNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* next is node */ + ret = xmlSecQName2BitMaskNodesWrite(gXmlSecXkmsKeyUsageInfo, node, + xmlSecNodeKeyUsage, xmlSecXkmsNs, + key->usage); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskNodesWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecNodeKeyUsage)); + return(-1); + } + + /* and the last node is */ + ret = xmlSecXkmsServerCtxUseKeyWithNodesWrite(ctx, node, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxUseKeyWithNodesWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecXkmsServerCtxKeyInfoNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* add child nodes as requested in nodes */ + ret = xmlSecXkmsRespondWithIdListWrite(&(ctx->respWithList), ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdListWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecKeyInfoNodeWrite(node, key, &(ctx->keyInfoWriteCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + + +/** + * XML Schema: + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) { + xmlSecPtrListPtr list; + xmlNodePtr cur; + xmlSecKeyUseWithPtr keyUseWith; + xmlChar* application; + xmlChar* identifier; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + list = &(ctx->keyInfoReadCtx.keyReq.keyUseWithList); + xmlSecAssert2(xmlSecPtrListGetSize(list) == 0, -1); + + cur = (*node); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeUseKeyWith, xmlSecXkmsNs)) { + application = xmlGetProp(cur, xmlSecAttrApplication); + if(application == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrApplication), + xmlSecErrorsSafeString(cur->name)); + return(-1); + } + + identifier = xmlGetProp(cur, xmlSecAttrIdentifier); + if(identifier == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s;node=%s", + xmlSecErrorsSafeString(xmlSecAttrIdentifier), + xmlSecErrorsSafeString(cur->name)); + xmlFree(application); + return(-1); + } + + keyUseWith = xmlSecKeyUseWithCreate(application, identifier); + if(keyUseWith == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyUseWithCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(application); + xmlFree(identifier); + return(-1); + } + xmlFree(application); + xmlFree(identifier); + + ret = xmlSecPtrListAdd(list, keyUseWith); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyUseWithDestroy(keyUseWith); + return(-1); + } + + cur = xmlSecGetNextElementNode(cur->next); + } + + (*node) = cur; + return(0); +} + +static int +xmlSecXkmsServerCtxUseKeyWithNodesWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(key != NULL, -1); + + return(0); +} + + +static int +xmlSecXkmsServerCtxTimeInstantNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + return(0); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* generate and add Id attribute */ + ret = xmlSecGenerateAndAddID(node, xmlSecAttrId, ctx->idPrefix, ctx->idLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGenerateAndAddID", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + + /* set Service atribute (required) */ + if((ctx->service == NULL) || (xmlSetProp(node, xmlSecAttrService, ctx->service) == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrService), + xmlSecErrorsSafeString(ctx->service)); + return(-1); + } + + + /* set RequestId atribute (optional) */ + if((ctx->id != NULL) && (xmlSetProp(node, xmlSecAttrRequestId, ctx->id) == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s,value=%s", + xmlSecErrorsSafeString(xmlSecAttrRequestId), + xmlSecErrorsSafeString(ctx->id)); + return(-1); + } + + + /* set major code (required) */ + ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsResultMajorInfo, node, + xmlSecAttrResultMajor, ctx->resultMajor); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerAttributeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s,value=%d", + xmlSecErrorsSafeString(xmlSecAttrResultMajor), + ctx->resultMajor); + return(-1); + } + + /* set minor code (optional) */ + if(ctx->resultMinor != xmlSecXkmsResultMinorNone) { + ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsMinorErrorInfo, node, + xmlSecAttrResultMinor, ctx->resultMinor); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerAttributeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s,value=%d", + xmlSecErrorsSafeString(xmlSecAttrResultMinor), + ctx->resultMinor); + return(-1); + } + } + + + + /* : An XKMS service SHOULD return the value of + * the element unmodified in a request in a response + * with status code Succes */ + if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && (ctx->opaqueClientDataNode != NULL)) { + xmlNodePtr copyNode; + + copyNode = xmlDocCopyNode(ctx->opaqueClientDataNode, node->doc, 1); + if(copyNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "name=%s", + xmlSecErrorsSafeString(ctx->opaqueClientDataNode->name)); + return(-1); + } + + if(xmlSecAddChildNode(node, copyNode) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChildNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(copyNode->name)); + return(-1); + } + } + + ret = xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestSignatureValueNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * A service SHOULD include the element in a response + * if the following conditions are satisfied and MUST NOT include the value + * otherwise: + * + * + * - The element was present in the corresponding request + * - The service successfully verified the element in the + * corresponding request, and + * - The ResponseMechanism RequestSignatureValue was specified. + * + */ +static int +xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + if((ctx->responseMechanismMask & XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE) == 0) { + /* The ResponseMechanism RequestSignatureValue was not specified. */ + return(0); + } + + return(0); +} + + +/** + * + * + * ? + * ? + * ? + * ? + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first write "parent" type */ + ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(ctx, node, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* node */ + ret = xmlSecXkmsServerCtxValidityIntervalNodeWrite(ctx, node, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxValidityIntervalNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecXkmsServerCtxValidityIntervalNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + return(0); +} + +/** + * + * ? + * ? + * ? + * ? + * * + * ? + * + * (? + * ? + * ? + * )* + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first write "parent" type */ + ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, node, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* node */ + ret = xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(ctx, node, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyBindingStatusNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * (? + * ? + * ? + * )* + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(key != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = xmlSecAddChild(node, xmlSecNodeStatus, xmlSecXkmsNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeStatus)); + return(-1); + } + + /* if we are here then the key was validated */ + ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsKeyBindingStatusInfo, cur, + xmlSecAttrStatusValue, xmlSecXkmsKeyBindingStatusValid); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerAttributeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecAttrStatusValue)); + return(-1); + } + + return(0); +} + +/************************************************************************ + * + * xmlSecXkmsServerCtx list + * + ************************************************************************/ +static xmlSecPtrListKlass xmlSecXkmsServerCtxPtrListKlass = { + BAD_CAST "xkms-server-ctx-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecXkmsServerCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; +EXPORT_C + +xmlSecPtrListId +xmlSecXkmsServerCtxPtrListGetKlass(void) { + return(&xmlSecXkmsServerCtxPtrListKlass); +} + + +/************************************************************************** + * + * Global xmlSecXkmsRespondWithIds list functions + * + *************************************************************************/ +static xmlSecPtrList xmlSecAllXkmsRespondWithIds; + + +/** + * xmlSecXkmsRespondWithIdsGet: + * + * Gets global registered RespondWith klasses list. + * + * Returns the pointer to list of all registered RespondWith klasses. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecXkmsRespondWithIdsGet(void) { + return(&xmlSecAllXkmsRespondWithIds); +} + +/** + * xmlSecXkmsRespondWithIdsInit: + * + * Initializes the RespondWith klasses. This function is called from the + * #xmlSecInit function and the application should not call it directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsRespondWithIdsInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(xmlSecXkmsRespondWithIdsGet(), xmlSecXkmsRespondWithIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecXkmsRespondWithIdListId"); + return(-1); + } + + ret = xmlSecXkmsRespondWithIdsRegisterDefault(); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegisterDefault", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsRespondWithIdsShutdown: + * + * Shuts down the keys data klasses. This function is called from the + * #xmlSecShutdown function and the application should not call it directly. + */ +EXPORT_C +void +xmlSecXkmsRespondWithIdsShutdown(void) { + xmlSecPtrListFinalize(xmlSecXkmsRespondWithIdsGet()); +} + +/** + * xmlSecXkmsRespondWithIdsRegister: + * @id: the RespondWith klass. + * + * Registers @id in the global list of RespondWith klasses. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) { + int ret; + + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + + ret = xmlSecPtrListAdd(xmlSecXkmsRespondWithIdsGet(), (xmlSecPtr)id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "RespondWith=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id))); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsRespondWithIdsRegisterDefault: + * + * Registers default (implemented by XML Security Library) + * RespondWith klasses: KeyName, KeyValue,... + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsRespondWithIdsRegisterDefault(void) { + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyNameId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyNameId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyValueId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyValueId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPrivateKeyId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPrivateKeyId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithRetrievalMethodId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithRetrievalMethodId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CertId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CertId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509ChainId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509ChainId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CRLId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CRLId))); + return(-1); + } + + /* + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPGPId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPGPId))); + return(-1); + } + + if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithSPKIId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithSPKIId))); + return(-1); + } + */ + return(0); +} + + +/************************************************************************ + * + * XKMS RespondWith Klass + * + ************************************************************************/ +/** + * xmlSecXkmsRespondWithNodeRead: + * @id: the RespondWith class. + * @ctx: the XKMS request processing context. + * @node: the pointer to node. + * + * Reads the content of the @node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsRespondWithNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + if(id->readNode != NULL) { + return((id->readNode)(id, ctx, node)); + } + return(0); +} + +/** + * xmlSecXkmsRespondWithNodeWrite: + * @id: the RespondWith class. + * @ctx: the XKMS request processing context. + * @node: the pointer to node. + * + * Writes the content of the @node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsRespondWithNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + if(id->writeNode != NULL) { + return((id->writeNode)(id, ctx, node)); + } + return(0); +} + +/** + * xmlSecXkmsRespondWithDebugDump: + * @id: the RespondWith class. + * @output: the output file. + * + * Writes debug information about @id into the @output. + */ +EXPORT_C +void +xmlSecXkmsRespondWithDebugDump(xmlSecXkmsRespondWithId id, FILE* output) { + xmlSecAssert(id != xmlSecXkmsRespondWithIdUnknown); + xmlSecAssert(output != NULL); + + fprintf(output, "=== RespondWith: \"%s\" (href=\"%s\")\n", + xmlSecErrorsSafeString(id->valueName), + xmlSecErrorsSafeString(id->valueNs)); +} + +/** + * xmlSecXkmsRespondWithDebugXmlDump: + * @id: the RespondWith class. + * @output: the output file. + * + * Writes debug information about @id into the @output in XML format. + */ +EXPORT_C +void +xmlSecXkmsRespondWithDebugXmlDump(xmlSecXkmsRespondWithId id, FILE* output) { + xmlSecAssert(id != xmlSecXkmsRespondWithIdUnknown); + xmlSecAssert(output != NULL); + + fprintf(output, "%s\n", + xmlSecErrorsSafeString(id->valueNs), + xmlSecErrorsSafeString(id->valueName)); +} +EXPORT_C + +int +xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + ret = xmlSecXkmsRespondWithIdListFind(&(ctx->respWithList), id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithIdListFind", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } else if(ret > 0) { + /* do nothing, we already have it in the list */ + return(0); + } + + ret = xmlSecPtrListAdd(&(ctx->respWithList), id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} +EXPORT_C + +int +xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + xmlNodePtr cur; + + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + xmlSecAssert2(id->nodeName != NULL, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = xmlSecAddChild(node, id->nodeName, id->nodeNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(id->nodeName)); + return(-1); + } + + return(0); +} + +/************************************************************************ + * + * XKMS RespondWith Klass List + * + ************************************************************************/ +static xmlSecPtrListKlass xmlSecXkmsRespondWithIdListKlass = { + BAD_CAST "respond-with-ids-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; +EXPORT_C + +xmlSecPtrListId +xmlSecXkmsRespondWithIdListGetKlass(void) { + return(&xmlSecXkmsRespondWithIdListKlass); +} +EXPORT_C + +int +xmlSecXkmsRespondWithIdListFind(xmlSecPtrListPtr list, xmlSecXkmsRespondWithId id) { + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsRespondWithIdListId), -1); + xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + if((xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i) == id) { + return(1); + } + } + return(0); +} +EXPORT_C + +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr node) { + xmlSecXkmsRespondWithId result = xmlSecXkmsRespondWithIdUnknown; + xmlSecXkmsRespondWithId id; + xmlChar* content; + xmlChar* qnameLocalPart = NULL; + xmlChar* qnamePrefix = NULL; + const xmlChar* qnameHref; + xmlNsPtr ns; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsRespondWithIdListId), xmlSecXkmsRespondWithIdUnknown); + xmlSecAssert2(node != NULL, xmlSecXkmsRespondWithIdUnknown); + + content = xmlNodeGetContent(node); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeGetContent", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + return(xmlSecXkmsRespondWithIdUnknown); + } + + qnameLocalPart = (xmlChar*)xmlStrchr(content, ':'); + if(qnameLocalPart != NULL) { + qnamePrefix = content; + *(qnameLocalPart++) = '\0'; + } else { + qnamePrefix = NULL; + qnameLocalPart = content; + } + + /* search namespace href */ + ns = xmlSearchNs(node->doc, node, qnamePrefix); + if((ns == NULL) && (qnamePrefix != NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSearchNs", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s,qnamePrefix=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qnamePrefix)); + xmlFree(content); + return(xmlSecXkmsRespondWithIdUnknown); + } + qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL; + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i); + if((id != xmlSecXkmsRespondWithIdUnknown) && + xmlStrEqual(id->valueName, qnameLocalPart) && + xmlStrEqual(id->valueNs, qnameHref)) { + result = id; + break; + } + } + + xmlFree(content); + return(result); +} +EXPORT_C + +int +xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecXkmsRespondWithId id; + xmlSecSize i, size; + int ret; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsRespondWithIdListId), -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i); + if(id != xmlSecXkmsRespondWithIdUnknown) { + ret = xmlSecXkmsRespondWithNodeWrite(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + } + + return(0); +} + +/******************************************************************** + * + * XML Sec Library RespondWith Ids + * + *******************************************************************/ +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyNameKlass = { + xmlSecRespondWithKeyName, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeKeyName, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithKeyNameGetKlass: + * + * The respond with KeyName klass. + * + * Returns respond with KeyName klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithKeyNameGetKlass(void) { + return(&xmlSecXkmsRespondWithKeyNameKlass); +} + + + +static int xmlSecXkmsRespondWithKeyValueNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyValueKlass = { + xmlSecRespondWithKeyValue, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeKeyValue, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithKeyValueNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithKeyValueGetKlass: + * + * The respond with KeyValue klass. + * + * Returns respond with KeyValue klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithKeyValueGetKlass(void) { + return(&xmlSecXkmsRespondWithKeyValueKlass); +} + +static int +xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsRespondWithKeyValueId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* do usual stuff */ + ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithDefaultNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* and now set some parameters in the ctx to look for a public or private + * key and to write a public key + */ + ctx->keyInfoReadCtx.keyReq.keyType |= (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate); + ctx->keyInfoWriteCtx.keyReq.keyType |= xmlSecKeyDataTypePublic; + + return(0); +} + +static int xmlSecXkmsRespondWithPrivateKeyNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPrivateKeyKlass = { + xmlSecRespondWithPrivateKey, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeKeyValue, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithPrivateKeyNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithPrivateKeyGetKlass: + * + * The respond with PrivateKey klass. + * + * Returns respond with PrivateKey klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithPrivateKeyGetKlass(void) { + return(&xmlSecXkmsRespondWithPrivateKeyKlass); +} + +static int +xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsRespondWithPrivateKeyId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* do usual stuff */ + ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithDefaultNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* and now set some parameters in the ctx to look for a private + * key and to write a private key + */ + ctx->keyInfoReadCtx.keyReq.keyType |= xmlSecKeyDataTypePrivate; + ctx->keyInfoWriteCtx.keyReq.keyType |= xmlSecKeyDataTypePrivate; + + return(0); +} + +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithRetrievalMethodKlass = { + xmlSecRespondWithRetrievalMethod, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeRetrievalMethod, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithRetrievalMethodGetKlass: + * + * The respond with RetrievalMethod klass. + * + * Returns respond with RetrievalMethod klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithRetrievalMethodGetKlass(void) { + return(&xmlSecXkmsRespondWithRetrievalMethodKlass); +} + + + +static int xmlSecXkmsRespondWithX509CertNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CertKlass = { + xmlSecRespondWithX509Cert, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeX509Data, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithX509CertNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithX509CertGetKlass: + * + * The respond with X509Cert klass. + * + * Returns respond with X509Cert klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithX509CertGetKlass(void) { + return(&xmlSecXkmsRespondWithX509CertKlass); +} + +static int +xmlSecXkmsRespondWithX509CertNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsRespondWithX509CertId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* do usual stuff */ + ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithDefaultNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int xmlSecXkmsRespondWithX509ChainNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509ChainKlass = { + xmlSecRespondWithX509Chain, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeX509Data, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithX509ChainNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithX509ChainGetKlass: + * + * The respond with X509Chain klass. + * + * Returns respond with X509Chain klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithX509ChainGetKlass(void) { + return(&xmlSecXkmsRespondWithX509ChainKlass); +} + +static int +xmlSecXkmsRespondWithX509ChainNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsRespondWithX509ChainId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* do usual stuff */ + ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithDefaultNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int xmlSecXkmsRespondWithX509CRLNodeRead (xmlSecXkmsRespondWithId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CRLKlass = { + xmlSecRespondWithX509CRL, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeX509Data, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithX509CRLNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithX509CRLGetKlass: + * + * The respond with X509CRL klass. + * + * Returns respond with X509CRL klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithX509CRLGetKlass(void) { + return(&xmlSecXkmsRespondWithX509CRLKlass); +} + +static int +xmlSecXkmsRespondWithX509CRLNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsRespondWithX509CRLId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* do usual stuff */ + ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)), + "xmlSecXkmsRespondWithDefaultNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPGPKlass = { + xmlSecRespondWithPGP, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodePGPData, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithPGPGetKlass: + * + * The respond with PGP klass. + * + * Returns respond with PGP klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithPGPGetKlass(void) { + return(&xmlSecXkmsRespondWithPGPKlass); +} + +static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithSPKIKlass = { + xmlSecRespondWithSPKI, /* const xmlChar* valueName; */ + xmlSecXkmsNs, /* const xmlChar* valueNs; */ + xmlSecNodeSPKIData, /* const xmlChar* nodeName; */ + xmlSecDSigNs, /* const xmlChar* nodeNs; */ + xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */ + xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsRespondWithSPKIGetKlass: + * + * The respond with SPKI klass. + * + * Returns respond with SPKI klass. + */ +EXPORT_C +xmlSecXkmsRespondWithId +xmlSecXkmsRespondWithSPKIGetKlass(void) { + return(&xmlSecXkmsRespondWithSPKIKlass); +} + +/************************************************************************** + * + * Global xmlSecXkmsServerRequestIds list functions + * + *************************************************************************/ +static xmlSecPtrList xmlSecAllXkmsServerRequestIds; + + +/** + * xmlSecXkmsServerRequestIdsGet: + * + * Gets global registered ServerRequest klasses list. + * + * Returns the pointer to list of all registered ServerRequest klasses. + */ +EXPORT_C +xmlSecPtrListPtr +xmlSecXkmsServerRequestIdsGet(void) { + return(&xmlSecAllXkmsServerRequestIds); +} + +/** + * xmlSecXkmsServerRequestIdsInit: + * + * Initializes the ServerRequest klasses. This function is called from the + * #xmlSecInit function and the application should not call it directly. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerRequestIdsInit(void) { + int ret; + + ret = xmlSecPtrListInitialize(xmlSecXkmsServerRequestIdsGet(), xmlSecXkmsServerRequestIdListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListPtrInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecXkmsServerRequestIdListId"); + return(-1); + } + + ret = xmlSecXkmsServerRequestIdsRegisterDefault(); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegisterDefault", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsServerRequestIdsShutdown: + * + * Shuts down the keys data klasses. This function is called from the + * #xmlSecShutdown function and the application should not call it directly. + */ +EXPORT_C +void +xmlSecXkmsServerRequestIdsShutdown(void) { + xmlSecPtrListFinalize(xmlSecXkmsServerRequestIdsGet()); +} + +/** + * xmlSecXkmsServerRequestIdsRegister: + * @id: the ServerRequest klass. + * + * Registers @id in the global list of ServerRequest klasses. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) { + int ret; + + xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1); + + ret = xmlSecPtrListAdd(xmlSecXkmsServerRequestIdsGet(), (xmlSecPtr)id); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ServerRequest=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(id))); + return(-1); + } + + return(0); +} + +/** + * xmlSecXkmsServerRequestIdsRegisterDefault: + * + * Registers default (implemented by XML Security Library) + * ServerRequest klasses: KeyName, KeyValue,... + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerRequestIdsRegisterDefault(void) { + if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestResultId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestResultId))); + return(-1); + } + + if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestStatusId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestStatusId))); + return(-1); + } + + if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestCompoundId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestCompoundId))); + return(-1); + } + + if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestLocateId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestLocateId))); + return(-1); + } + + if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestValidateId) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsRegister", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestValidateId))); + return(-1); + } + + return(0); +} + + +/************************************************************************ + * + * XKMS ServerRequest Klass + * + ************************************************************************/ +/** + * xmlSecXkmsServerRequestNodeRead: + * @id: the ServerRequest class. + * @ctx: the XKMS request processing context. + * @node: the pointer to node. + * + * Reads the content of the @node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerRequestNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node) { + xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + if(id->readNode != NULL) { + return((id->readNode)(id, ctx, node)); + } + return(0); +} + +/** + * xmlSecXkmsServerExecute: + * @id: the ServerRequest class. + * @ctx: the XKMS request processing context. + * + * Executes XKMS server request. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) { + xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1); + xmlSecAssert2(ctx != NULL, -1); + + if(id->execute != NULL) { + return((id->execute)(id, ctx)); + } + return(0); +} + + +/** + * xmlSecXkmsServerResponseNodeWrite: + * @id: the ServerRequest class. + * @ctx: the XKMS request processing context. + * @doc: the pointer to response parent XML document (might be NULL). + * @node: the pointer to response parent XML node (might be NULL). + * + * Writes XKMS response from context to a newly created node. Caller is + * responsible for adding the returned node to the XML document. + * + * Returns pointer to newly created XKMS response node or NULL + * if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, + xmlDocPtr doc, xmlNodePtr node) { + xmlNodePtr respNode; + int ret; + + xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, NULL); + xmlSecAssert2(ctx != NULL, NULL); + + /* create the response root node */ + if(node == NULL) { + xmlNsPtr ns; + + respNode = xmlNewDocNode(doc, NULL, id->resultNodeName, NULL); + if(respNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(id->resultNodeName)); + return(NULL); + } + ns = xmlNewNs(respNode, id->resultNodeNs, NULL); + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(id->resultNodeNs)); + xmlFreeNode(respNode); + return(NULL); + } + xmlSetNs(respNode, ns); + } else { + respNode = xmlSecAddChild(node, id->resultNodeName, id->resultNodeNs); + if(respNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(id->resultNodeName)); + return(NULL); + } + } + + if(id->writeNode != NULL) { + ret = (id->writeNode)(id, ctx, respNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "writeNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(id->resultNodeName)); + xmlFreeNode(respNode); + return(NULL); + } + } + + return(respNode); +} + +/** + * xmlSecXkmsServerRequestDebugDump: + * @id: the ServerRequest class. + * @output: the output file. + * + * Writes debug information about @id into the @output. + */ +EXPORT_C +void +xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id, FILE* output) { + xmlSecAssert(id != xmlSecXkmsServerRequestIdUnknown); + xmlSecAssert(output != NULL); + + fprintf(output, "=== ServerRequest: %s\n", xmlSecErrorsSafeString(id->name)); +} + +/** + * xmlSecXkmsServerRequestDebugXmlDump: + * @id: the ServerRequest class. + * @output: the output file. + * + * Writes debug information about @id into the @output in XML format. + */ +EXPORT_C +void +xmlSecXkmsServerRequestDebugXmlDump(xmlSecXkmsServerRequestId id, FILE* output) { + xmlSecAssert(id != xmlSecXkmsServerRequestIdUnknown); + xmlSecAssert(output != NULL); + + fprintf(output, "%s\n", xmlSecErrorsSafeString(id->name)); +} + +/************************************************************************ + * + * XKMS ServerRequest Klass List + * + ************************************************************************/ +static xmlSecPtrListKlass xmlSecXkmsServerRequestIdListKlass = { + BAD_CAST "xkms-server-request-ids-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; +EXPORT_C + +xmlSecPtrListId +xmlSecXkmsServerRequestIdListGetKlass(void) { + return(&xmlSecXkmsServerRequestIdListKlass); +} +EXPORT_C + +int +xmlSecXkmsServerRequestIdListFind(xmlSecPtrListPtr list, xmlSecXkmsServerRequestId id) { + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), -1); + xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + if((xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i) == id) { + return(1); + } + } + return(0); +} +EXPORT_C + +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name) { + xmlSecXkmsServerRequestId id; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), xmlSecXkmsServerRequestIdUnknown); + xmlSecAssert2(name != NULL, xmlSecXkmsServerRequestIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i); + if((id != xmlSecXkmsServerRequestIdUnknown) && xmlStrEqual(id->name, name)) { + return(id); + } + } + return(xmlSecXkmsServerRequestIdUnknown); +} +EXPORT_C + +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestIdListFindByNode(xmlSecPtrListPtr list, xmlNodePtr node) { + xmlSecXkmsServerRequestId id; + xmlSecSize i, size; + + xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), xmlSecXkmsServerRequestIdUnknown); + xmlSecAssert2(node != NULL, xmlSecXkmsServerRequestIdUnknown); + + size = xmlSecPtrListGetSize(list); + for(i = 0; i < size; ++i) { + id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i); + if((id != xmlSecXkmsServerRequestIdUnknown) && + xmlSecCheckNodeName(node, id->requestNodeName, id->requestNodeNs)) { + + return(id); + } + } + return(xmlSecXkmsServerRequestIdUnknown); +} + +/******************************************************************** + * + * XML Sec Library ServerRequest Ids + * + *******************************************************************/ + + +/******************************************************************** + * + * Result response + * + *******************************************************************/ +static int xmlSecXkmsServerRequestResultNodeWrite (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); + +static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestResultKlass = { + xmlSecXkmsServerRequestResultName, /* const xmlChar* name; */ + NULL, /* const xmlChar* requestNodeName; */ + NULL, /* const xmlChar* requestNodeNs; */ + xmlSecNodeResult, /* const xmlChar* responseNodeName; */ + xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */ + 0, /* xmlSecBitMask flags; */ + NULL, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */ + xmlSecXkmsServerRequestResultNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */ + NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsServerRequestResultGetKlass: + * + * The Result response klass. + * + * Returns Result response klass. + */ +EXPORT_C +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestResultGetKlass(void) { + return(&xmlSecXkmsServerRequestResultKlass); +} + +static int +xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestResultId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* set missing parameters (if any) */ + if(ctx->service == NULL) { + ctx->service = xmlStrdup((ctx->expectedService != NULL) ? ctx->expectedService : BAD_CAST ""); + if(ctx->service == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* first write the "parent" type */ + ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResultTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/******************************************************************** + * + * StatusRequest/StatusResponse + * + *******************************************************************/ +static int xmlSecXkmsServerRequestStatusNodeRead (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestStatusNodeWrite (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); + +static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestStatusKlass = { + xmlSecXkmsServerRequestStatusName, /* const xmlChar* name; */ + xmlSecNodeStatusRequest, /* const xmlChar* requestNodeName; */ + xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */ + xmlSecNodeStatusResult, /* const xmlChar* responseNodeName; */ + xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */ + 0, /* xmlSecBitMask flags; */ + xmlSecXkmsServerRequestStatusNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */ + xmlSecXkmsServerRequestStatusNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */ + NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsServerRequestStatusGetKlass: + * + * The StatusRequest klass. + * + * Returns StatusRequest klass. + */ +EXPORT_C +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestStatusGetKlass(void) { + return(&xmlSecXkmsServerRequestStatusKlass); +} + +/** + * + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestStatusId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = node; + + /* first read "parent" type */ + ret = xmlSecXkmsServerCtxPendingRequestNodeRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxPendingRequestNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* check that there is nothing after the last node */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * + * ? + * * + * ( + * ? + * )? + * * + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * * + */ +static int +xmlSecXkmsServerRequestStatusNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestStatusId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first write the "parent" type */ + ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResultTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/******************************************************************** + * + * CompoundRequest/CompoundResponse + * + *******************************************************************/ +static int xmlSecXkmsServerRequestCompoundNodeRead (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestCompoundExecute (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx); + +static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestCompoundKlass = { + xmlSecXkmsServerRequestCompoundName, /* const xmlChar* name; */ + xmlSecNodeCompoundRequest, /* const xmlChar* requestNodeName; */ + xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */ + xmlSecNodeCompoundResult, /* const xmlChar* responseNodeName; */ + xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */ + 0, /* xmlSecBitMask flags; */ + xmlSecXkmsServerRequestCompoundNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */ + xmlSecXkmsServerRequestCompoundNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */ + xmlSecXkmsServerRequestCompoundExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsServerRequestCompoundGetKlass: + * + * The CompoundRequest klass. + * + * Returns CompoundRequest klass. + */ +EXPORT_C +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestCompoundGetKlass(void) { + return(&xmlSecXkmsServerRequestCompoundKlass); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * ( + * ? + * ? + * ? + * ? + * ? + * ? + * )* + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecPtrListPtr serverRequestIdsList; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestCompoundId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = node; + + /* first read "parent" type */ + ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* create list for compound requests */ + xmlSecAssert2(ctx->compoundRequestContexts == NULL, -1); + ctx->compoundRequestContexts = xmlSecPtrListCreate(xmlSecXkmsServerCtxPtrListId); + if(ctx->compoundRequestContexts == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* get the list of enabled or all request klasses */ + if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) { + serverRequestIdsList = &(ctx->enabledServerRequestIds); + } else { + serverRequestIdsList = xmlSecXkmsServerRequestIdsGet(); + } + xmlSecAssert2(serverRequestIdsList != NULL, -1); + + while(cur != NULL) { + xmlSecXkmsServerCtxPtr ctxChild; + + /* create a new context */ + ctxChild = xmlSecXkmsServerCtxCreate(ctx->keyInfoReadCtx.keysMngr); + if(ctxChild == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* copy all settings from us */ + ret = xmlSecXkmsServerCtxCopyUserPref(ctxChild, ctx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxDestroy(ctxChild); + return(-1); + } + + /* add it to the list */ + ret = xmlSecPtrListAdd(ctx->compoundRequestContexts, ctxChild); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxDestroy(ctxChild); + return(-1); + } + + /* and now process request from current node */ + ctxChild->requestId = xmlSecXkmsServerRequestIdListFindByNode(serverRequestIdsList, cur); + if((ctxChild->requestId == xmlSecXkmsServerRequestIdUnknown) || + ((ctxChild->requestId->flags & XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND) == 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdListFindByNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported); + return(-1); + } + + ret = xmlSecXkmsServerRequestNodeRead(ctxChild->requestId, ctxChild, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "request=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId))); + xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* check that there is nothing after the last node */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * ( + * ? + * ? + * ? + * ? + * ? + * ? + * )* + * + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestCompoundId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* walk thru the list of chilren and pickup first error */ + if(ctx->compoundRequestContexts != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < xmlSecPtrListGetSize(ctx->compoundRequestContexts); pos++) { + xmlSecXkmsServerCtxPtr ctxChild; + + ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos); + if(ctxChild == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListGetItem", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if(ctxChild->resultMajor != xmlSecXkmsResultMajorSuccess) { + xmlSecXkmsServerCtxSetResult(ctx, ctxChild->resultMajor, ctxChild->resultMinor); + break; + } + } + } + + /* first write the "parent" type */ + ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResultTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* write compound result */ + if(ctx->compoundRequestContexts != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < xmlSecPtrListGetSize(ctx->compoundRequestContexts); pos++) { + xmlSecXkmsServerCtxPtr ctxChild; + xmlNodePtr cur; + + ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos); + if(ctxChild == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListGetItem", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecXkmsServerRequestNodeWrite(ctxChild->requestId, ctxChild, node->doc, node); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "request=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId))); + return(-1); + } + + if(xmlSecAddChildNode(node, cur) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChildNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeNode(cur); + return(-1); + } + } + } + + return(0); +} + +static int +xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) { + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestCompoundId, -1); + xmlSecAssert2(ctx != NULL, -1); + + if(ctx->compoundRequestContexts != NULL) { + xmlSecSize pos; + + for(pos = 0; pos < xmlSecPtrListGetSize(ctx->compoundRequestContexts); pos++) { + xmlSecXkmsServerCtxPtr ctxChild; + + ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos); + if(ctxChild == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListGetItem", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure); + continue; + } + + ret = xmlSecXkmsServerRequestExecute(ctxChild->requestId, ctxChild); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "request=%s", + xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId))); + xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure); + continue; + } + } + } + + return(0); +} + + +/******************************************************************** + * + * LocateRequest/LocateResponse + * + *******************************************************************/ +static int xmlSecXkmsServerRequestLocateNodeRead (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestLocateNodeWrite (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestLocateExecute (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx); + +static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestLocateKlass = { + xmlSecXkmsServerRequestLocateName, /* const xmlChar* name; */ + xmlSecNodeLocateRequest, /* const xmlChar* requestNodeName; */ + xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */ + xmlSecNodeLocateResult, /* const xmlChar* responseNodeName; */ + xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */ + XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND, /* xmlSecBitMask flags; */ + xmlSecXkmsServerRequestLocateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */ + xmlSecXkmsServerRequestLocateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */ + xmlSecXkmsServerRequestLocateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsServerRequestLocateGetKlass: + * + * The LocateRequest klass. + * + * Returns LocateRequest klass. + */ +EXPORT_C +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestLocateGetKlass(void) { + return(&xmlSecXkmsServerRequestLocateKlass); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * + * ? + * ? + * ? + * ? + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestLocateId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = node; + + /* first read "parent" type */ + ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* now read required node */ + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeQueryKeyBinding, xmlSecXkmsNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding)); + return(-1); + } + + /* read node */ + ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxQueryKeyBindingNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* check that there is nothing after the last node */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * ( + * ? + * ? + * ? + * ? + * * + * ? + * )* + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecSize pos, size; + xmlSecKeyPtr key; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestLocateId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first write the "parent" type */ + ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResultTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* write keys in nodes */ + size = xmlSecPtrListGetSize(&(ctx->keys)); + for(pos = 0; pos < size; ++pos) { + key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos); + if(key == NULL) { + continue; + } + + cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding)); + return(-1); + } + + ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, cur, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +static int +xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) { + xmlSecKeyPtr key = NULL; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestLocateId, -1); + xmlSecAssert2(ctx != NULL, -1); + + /* now we are ready to search for key */ + if((ctx->keyInfoReadCtx.keysMngr != NULL) && (ctx->keyInfoReadCtx.keysMngr->getKey != NULL)) { + key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx)); + } + + /* check that we got what we needed */ + if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) { + if(key != NULL) { + xmlSecKeyDestroy(key); + } + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch); + return(-1); + } + + xmlSecAssert2(key != NULL, -1); + ret = xmlSecPtrListAdd(&(ctx->keys), key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(key); + return(-1); + } + + return(0); +} + + +/******************************************************************** + * + * ValidateRequest/ValidateResponse + * + *******************************************************************/ +static int xmlSecXkmsServerRequestValidateNodeRead (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx, + xmlNodePtr node); +static int xmlSecXkmsServerRequestValidateExecute (xmlSecXkmsServerRequestId id, + xmlSecXkmsServerCtxPtr ctx); + +static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestValidateKlass = { + xmlSecXkmsServerRequestValidateName, /* const xmlChar* name; */ + xmlSecNodeValidateRequest, /* const xmlChar* requestNodeName; */ + xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */ + xmlSecNodeValidateResult, /* const xmlChar* responseNodeName; */ + xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */ + XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND, /* xmlSecBitMask flags; */ + xmlSecXkmsServerRequestValidateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */ + xmlSecXkmsServerRequestValidateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */ + xmlSecXkmsServerRequestValidateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */ + NULL, /* void* reserved1; */ + NULL /* void* reserved2; */ +}; + +/** + * xmlSecXkmsServerRequestValidateGetKlass: + * + * The ValidateRequest klass. + * + * Returns ValidateRequest klass. + */ +EXPORT_C +xmlSecXkmsServerRequestId +xmlSecXkmsServerRequestValidateGetKlass(void) { + return(&xmlSecXkmsServerRequestValidateKlass); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * * + * ? + * + * ? + * ? + * ? + * ? + * * + * ? + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestValidateId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = node; + + /* first read "parent" type */ + ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* now read required node */ + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeQueryKeyBinding, xmlSecXkmsNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding)); + return(-1); + } + + /* read node */ + ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxQueryKeyBindingNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* check that there is nothing after the last node */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * + * ? + * * + * ( + * ? + * )? + * * + * ( + * ? + * ? + * ? + * ? + * * + * ? + * + * (? + * ? + * ? + * )* + * )* + * + * XML Schema: + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +static int +xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) { + xmlSecSize pos, size; + xmlSecKeyPtr key; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestValidateId, -1); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first write the "parent" type */ + ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxResultTypeNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* write keys in nodes */ + size = xmlSecPtrListGetSize(&(ctx->keys)); + for(pos = 0; pos < size; ++pos) { + key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos); + if(key == NULL) { + continue; + } + + cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding)); + return(-1); + } + + ret = xmlSecXkmsServerCtxKeyBindingNodeWrite(ctx, cur, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerCtxKeyBindingNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +static int +xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) { + xmlSecKeyPtr key = NULL; + int ret; + + xmlSecAssert2(id == xmlSecXkmsServerRequestValidateId, -1); + xmlSecAssert2(ctx != NULL, -1); + + /* now we are ready to search for key */ + if((ctx->keyInfoReadCtx.keysMngr != NULL) && (ctx->keyInfoReadCtx.keysMngr->getKey != NULL)) { + key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx)); + } + + /* check that we got what we needed */ + if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) { + if(key != NULL) { + xmlSecKeyDestroy(key); + } + xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch); + return(-1); + } + + xmlSecAssert2(key != NULL, -1); + ret = xmlSecPtrListAdd(&(ctx->keys), key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDestroy(key); + return(-1); + } + + return(0); +} + +#endif /* XMLSEC_NO_XKMS */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xmldsig.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xmldsig.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1824 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Digital Signature" implementation + * http://www.w3.org/TR/xmldsig-core/ + * http://www.w3.org/Signature/Overview.html + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XMLDSIG +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_membuf.h" +#include "xmlsec_xmldsig.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * xmlSecDSigCtx + * + *************************************************************************/ +static int xmlSecDSigCtxProcessSignatureNode (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); +static int xmlSecDSigCtxProcessSignedInfoNode (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); +static int xmlSecDSigCtxProcessKeyInfoNode (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); +static int xmlSecDSigCtxProcessObjectNode (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); +static int xmlSecDSigCtxProcessManifestNode (xmlSecDSigCtxPtr dsigCtx, + xmlNodePtr node); + +/* The ID attribute in XMLDSig is 'Id' */ +static const xmlChar* xmlSecDSigIds[] = { xmlSecAttrId, NULL }; + +/** + * xmlSecDSigCtxCreate: + * @keysMngr: the pointer to keys manager. + * + * Creates element processing context. + * The caller is responsible for destroying returend object by calling + * #xmlSecDSigCtxDestroy function. + * + * Returns pointer to newly allocated context object or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecDSigCtxPtr +xmlSecDSigCtxCreate(xmlSecKeysMngrPtr keysMngr) { + xmlSecDSigCtxPtr dsigCtx; + int ret; + + dsigCtx = (xmlSecDSigCtxPtr) xmlMalloc(sizeof(xmlSecDSigCtx)); + if(dsigCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecDSigCtx)=%d", + sizeof(xmlSecDSigCtx)); + return(NULL); + } + + ret = xmlSecDSigCtxInitialize(dsigCtx, keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecDSigCtxDestroy(dsigCtx); + return(NULL); + } + return(dsigCtx); +} + +/** + * xmlSecDSigCtxDestroy: + * @dsigCtx: the pointer to processing context. + * + * Destroy context object created with #xmlSecDSigCtxCreate function. + */ +EXPORT_C +void +xmlSecDSigCtxDestroy(xmlSecDSigCtxPtr dsigCtx) { + xmlSecAssert(dsigCtx != NULL); + + xmlSecDSigCtxFinalize(dsigCtx); + xmlFree(dsigCtx); +} + +/** + * xmlSecDSigCtxInitialize: + * @dsigCtx: the pointer to processing context. + * @keysMngr: the pointer to keys manager. + * + * Initializes element processing context. + * The caller is responsible for cleaing up returend object by calling + * #xmlSecDSigCtxFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + + memset(dsigCtx, 0, sizeof(xmlSecDSigCtx)); + + /* initialize key info */ + ret = xmlSecKeyInfoCtxInitialize(&(dsigCtx->keyInfoReadCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + dsigCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead; + + ret = xmlSecKeyInfoCtxInitialize(&(dsigCtx->keyInfoWriteCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + dsigCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite; + /* it's not wise to write private key :) */ + dsigCtx->keyInfoWriteCtx.keyReq.keyType = xmlSecKeyDataTypePublic; + + /* initializes transforms dsigCtx */ + ret = xmlSecTransformCtxInitialize(&(dsigCtx->transformCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* references lists from SignedInfo and Manifest elements */ + xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences), + xmlSecDSigReferenceCtxListId); + xmlSecPtrListInitialize(&(dsigCtx->manifestReferences), + xmlSecDSigReferenceCtxListId); + + dsigCtx->enabledReferenceUris = xmlSecTransformUriTypeAny; + return(0); +} + +/** + * xmlSecDSigCtxFinalize: + * @dsigCtx: the pointer to processing context. + * + * Cleans up @dsigCtx object initialized with #xmlSecDSigCtxInitialize function. + */ +EXPORT_C +void +xmlSecDSigCtxFinalize(xmlSecDSigCtxPtr dsigCtx) { + xmlSecAssert(dsigCtx != NULL); + + xmlSecTransformCtxFinalize(&(dsigCtx->transformCtx)); + xmlSecKeyInfoCtxFinalize(&(dsigCtx->keyInfoReadCtx)); + xmlSecKeyInfoCtxFinalize(&(dsigCtx->keyInfoWriteCtx)); + xmlSecPtrListFinalize(&(dsigCtx->signedInfoReferences)); + xmlSecPtrListFinalize(&(dsigCtx->manifestReferences)); + + if(dsigCtx->enabledReferenceTransforms != NULL) { + xmlSecPtrListDestroy(dsigCtx->enabledReferenceTransforms); + } + if(dsigCtx->signKey != NULL) { + xmlSecKeyDestroy(dsigCtx->signKey); + } + if(dsigCtx->id != NULL) { + xmlFree(dsigCtx->id); + } + memset(dsigCtx, 0, sizeof(xmlSecDSigCtx)); +} + +/** + * xmlSecDSigCtxEnableReferenceTransform: + * @dsigCtx: the pointer to processing context. + * @transformId: the transform klass. + * + * Enables @transformId for elements processing. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformId transformId) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->result == NULL, -1); + xmlSecAssert2(transformId != xmlSecTransformIdUnknown, -1); + + if(dsigCtx->enabledReferenceTransforms == NULL) { + dsigCtx->enabledReferenceTransforms = xmlSecPtrListCreate(xmlSecTransformIdListId); + if(dsigCtx->enabledReferenceTransforms == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + ret = xmlSecPtrListAdd(dsigCtx->enabledReferenceTransforms, (void*)transformId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecDSigCtxEnableSignatureTransform: + * @dsigCtx: the pointer to processing context. + * @transformId: the transform klass. + * + * Enables @transformId for element processing. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformId transformId) { + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->result == NULL, -1); + xmlSecAssert2(transformId != xmlSecTransformIdUnknown, -1); + + return(xmlSecPtrListAdd(&(dsigCtx->transformCtx.enabledTransforms), (void*)transformId)); +} + +/** + * xmlSecDSigCtxGetPreSignBuffer: + * @dsigCtx: the pointer to processing context. + * + * Gets pointer to the buffer with serialized element + * just before signature claculation (valid if and only if + * #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE context flag is set. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecDSigCtxGetPreSignBuffer(xmlSecDSigCtxPtr dsigCtx) { + xmlSecAssert2(dsigCtx != NULL, NULL); + + return((dsigCtx->preSignMemBufMethod != NULL) ? + xmlSecTransformMemBufGetBuffer(dsigCtx->preSignMemBufMethod) : NULL); +} + +/** + * xmlSecDSigCtxSign: + * @dsigCtx: the pointer to processing context. + * @tmpl: the pointer to node with signature template. + * + * Signs the data as described in @tmpl node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecDSigCtxSign(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr tmpl) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->result == NULL, -1); + xmlSecAssert2(tmpl != NULL, -1); + xmlSecAssert2(tmpl->doc != NULL, -1); + + /* add ids for Signature nodes */ + dsigCtx->operation = xmlSecTransformOperationSign; + dsigCtx->status = xmlSecDSigStatusUnknown; + xmlSecAddIDs(tmpl->doc, tmpl, xmlSecDSigIds); + + /* read signature template */ + ret = xmlSecDSigCtxProcessSignatureNode(dsigCtx, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxSigantureProcessNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlSecAssert2(dsigCtx->signMethod != NULL, -1); + xmlSecAssert2(dsigCtx->signValueNode != NULL, -1); + + /* references processing might change the status */ + if(dsigCtx->status != xmlSecDSigStatusUnknown) { + return(0); + } + + /* check what we've got */ + dsigCtx->result = dsigCtx->transformCtx.result; + if((dsigCtx->result == NULL) || (xmlSecBufferGetData(dsigCtx->result) == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_RESULT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* write signed data to xml */ + xmlNodeSetContentLen(dsigCtx->signValueNode, + xmlSecBufferGetData(dsigCtx->result), + xmlSecBufferGetSize(dsigCtx->result)); + if ( OOM_FLAG ) + { + return(-1); + } + + /* set success status and we are done */ + dsigCtx->status = xmlSecDSigStatusSucceeded; + return(0); +} + +/** + * xmlSecDSigCtxVerify: + * @dsigCtx: the pointer to processing context. + * @node: the pointer with node. + * + * Vaidates signature in the @node. The verification result is returned + * in #status member of the @dsigCtx object. + * + * Returns 0 on success (check #status member of @dsigCtx to get + * signature verification result) or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(node->doc != NULL, -1); + + /* add ids for Signature nodes */ + dsigCtx->operation = xmlSecTransformOperationVerify; + dsigCtx->status = xmlSecDSigStatusUnknown; + xmlSecAddIDs(node->doc, node, xmlSecDSigIds); + + /* read siganture info */ + ret = xmlSecDSigCtxProcessSignatureNode(dsigCtx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxSigantureProcessNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlSecAssert2(dsigCtx->signMethod != NULL, -1); + xmlSecAssert2(dsigCtx->signValueNode != NULL, -1); + + /* references processing might change the status */ + if(dsigCtx->status != xmlSecDSigStatusUnknown) { + return(0); + } + + /* verify SignatureValue node content */ + ret = xmlSecTransformVerifyNodeContent(dsigCtx->signMethod, dsigCtx->signValueNode, + &(dsigCtx->transformCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformVerifyNodeContent", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* set status and we are done */ + if(dsigCtx->signMethod->status == xmlSecTransformStatusOk) { + dsigCtx->status = xmlSecDSigStatusSucceeded; + } else { + dsigCtx->status = xmlSecDSigStatusInvalid; + } + return(0); +} + +/** + * xmlSecDSigCtxProcessSignatureNode: + * + * The Signature element (http://www.w3.org/TR/xmldsig-core/#sec-Signature) + * + * The Signature element is the root element of an XML Signature. + * Implementation MUST generate laxly schema valid [XML-schema] Signature + * elements as specified by the following schema: + * The way in which the SignedInfo element is presented to the + * canonicalization method is dependent on that method. The following + * applies to algorithms which process XML as nodes or characters: + * + * - XML based canonicalization implementations MUST be provided with + * a [XPath] node-set originally formed from the document containing + * the SignedInfo and currently indicating the SignedInfo, its descendants, + * and the attribute and namespace nodes of SignedInfo and its descendant + * elements. + * + * - Text based canonicalization algorithms (such as CRLF and charset + * normalization) should be provided with the UTF-8 octets that represent + * the well-formed SignedInfo element, from the first character to the + * last character of the XML representation, inclusive. This includes + * the entire text of the start and end tags of the SignedInfo element + * as well as all descendant markup and character data (i.e., the text) + * between those tags. Use of text based canonicalization of SignedInfo + * is NOT RECOMMENDED. + * + * ================================= + * we do not support any non XML based C14N + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + * + */ +static int +xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + xmlSecTransformDataType firstType; + xmlNodePtr signedInfoNode = NULL; + xmlNodePtr keyInfoNode = NULL; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2((dsigCtx->operation == xmlSecTransformOperationSign) || (dsigCtx->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1); + xmlSecAssert2(dsigCtx->signValueNode == NULL, -1); + xmlSecAssert2(dsigCtx->signMethod == NULL, -1); + xmlSecAssert2(dsigCtx->c14nMethod == NULL, -1); + xmlSecAssert2(node != NULL, -1); + + if(!xmlSecCheckNodeName(node, xmlSecNodeSignature, xmlSecDSigNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeSignature)); + return(-1); + } + + /* read node data */ + xmlSecAssert2(dsigCtx->id == NULL, -1); + dsigCtx->id = xmlGetProp(node, xmlSecAttrId); + + /* first node is required SignedInfo */ + cur = xmlSecGetNextElementNode(node->children); + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeSignedInfo, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeSignedInfo)); + return(-1); + } + signedInfoNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + + /* next node is required SignatureValue */ + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeSignatureValue, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeSignatureValue)); + return(-1); + } + dsigCtx->signValueNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + + /* next node is optional KeyInfo */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs))) { + keyInfoNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + } else { + keyInfoNode = NULL; + } + + /* next nodes are optional Object nodes */ + while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeObject, xmlSecDSigNs))) { + /* read manifests from objects */ + if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS) == 0) { + ret = xmlSecDSigCtxProcessObjectNode(dsigCtx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxProcessObjectNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* if there is something left than it's an error */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* now validated all the references and prepare transform */ + ret = xmlSecDSigCtxProcessSignedInfoNode(dsigCtx, signedInfoNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxProcessSignedInfoNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + /* references processing might change the status */ + if(dsigCtx->status != xmlSecDSigStatusUnknown) { + return(0); + } + + /* as the result, we should have sign and c14n methods set */ + xmlSecAssert2(dsigCtx->signMethod != NULL, -1); + xmlSecAssert2(dsigCtx->c14nMethod != NULL, -1); + + ret = xmlSecDSigCtxProcessKeyInfoNode(dsigCtx, keyInfoNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxProcessKeyInfoNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + /* as the result, we should have a key */ + xmlSecAssert2(dsigCtx->signKey != NULL, -1); + + /* if we need to write result to xml node then we need base64 encode result */ + if(dsigCtx->operation == xmlSecTransformOperationSign) { + xmlSecTransformPtr base64Encode; + + /* we need to add base64 encode transform */ + base64Encode = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), + xmlSecTransformBase64Id); + if(base64Encode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + base64Encode->operation = xmlSecTransformOperationEncode; + } + + firstType = xmlSecTransformGetDataType(dsigCtx->transformCtx.first, + xmlSecTransformModePush, + &(dsigCtx->transformCtx)); + if((firstType & xmlSecTransformDataTypeXml) != 0) { + xmlSecNodeSetPtr nodeset = NULL; + + xmlSecAssert2(signedInfoNode != NULL, -1); + nodeset = xmlSecNodeSetGetChildren(signedInfoNode->doc, signedInfoNode, 1, 0); + if(nodeset == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetGetChildren", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(signedInfoNode))); + return(-1); + } + + /* calculate the signature */ + ret = xmlSecTransformCtxXmlExecute(&(dsigCtx->transformCtx), nodeset); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxXmlExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecNodeSetDestroy(nodeset); + return(-1); + } + xmlSecNodeSetDestroy(nodeset); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "the binary c14n transforms are not supported yet", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecDSigCtxProcessSignedInfoNode: + * + * The SignedInfo Element (http://www.w3.org/TR/xmldsig-core/#sec-SignedInfo) + * + * The structure of SignedInfo includes the canonicalization algorithm, + * a result algorithm, and one or more references. The SignedInfo element + * may contain an optional ID attribute that will allow it to be referenced by + * other signatures and objects. + * + * SignedInfo does not include explicit result or digest properties (such as + * calculation time, cryptographic device serial number, etc.). If an + * application needs to associate properties with the result or digest, + * it may include such information in a SignatureProperties element within + * an Object element. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + * + */ +static int +xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + xmlSecDSigReferenceCtxPtr dsigRefCtx; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1); + xmlSecAssert2(dsigCtx->signMethod == NULL, -1); + xmlSecAssert2(dsigCtx->c14nMethod == NULL, -1); + xmlSecAssert2((dsigCtx->operation == xmlSecTransformOperationSign) || (dsigCtx->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) == 0, -1); + xmlSecAssert2(node != NULL, -1); + + /* first node is required CanonicalizationMethod. */ + cur = xmlSecGetNextElementNode(node->children); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs))) { + dsigCtx->c14nMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx), + cur, xmlSecTransformUsageC14NMethod); + if(dsigCtx->c14nMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if(dsigCtx->defC14NMethodId != xmlSecTransformIdUnknown) { + /* the dsig spec does require CanonicalizationMethod node + * to be present but in some case it application might decide to + * minimize traffic */ + dsigCtx->c14nMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), + dsigCtx->defC14NMethodId); + if(dsigCtx->c14nMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod)); + return(-1); + } + + /* insert membuf if requested */ + if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) { + xmlSecAssert2(dsigCtx->preSignMemBufMethod == NULL, -1); + dsigCtx->preSignMemBufMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), + xmlSecTransformMemBufId); + if(dsigCtx->preSignMemBufMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId))); + } + } + + /* next node is required SignatureMethod. */ + if (cur != NULL){ + cur = xmlSecGetNextElementNode(cur->next); + } + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeSignatureMethod, xmlSecDSigNs))) { + dsigCtx->signMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx), + cur, xmlSecTransformUsageSignatureMethod); + if(dsigCtx->signMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if(dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) { + /* the dsig spec does require SignatureMethod node + * to be present but in some case it application might decide to + * minimize traffic */ + dsigCtx->signMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), + dsigCtx->defSignMethodId); + if(dsigCtx->signMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeSignatureMethod)); + return(-1); + } + dsigCtx->signMethod->operation = dsigCtx->operation; + + /* calculate references */ + if (cur != NULL) { + cur = xmlSecGetNextElementNode(cur->next); + } + while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReference, xmlSecDSigNs))) { + /* create reference */ + dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginSignedInfo); + if(dsigRefCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigReferenceCtxCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* add to the list */ + ret = xmlSecPtrListAdd(&(dsigCtx->signedInfoReferences), dsigRefCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecDSigReferenceCtxDestroy(dsigRefCtx); + return(-1); + } + + /* process */ + ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigReferenceCtxProcessNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + + /* bail out if next Reference processing failed */ + if(dsigRefCtx->status != xmlSecDSigStatusSucceeded) { + dsigCtx->status = xmlSecDSigStatusInvalid; + return(0); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* check that we have at least one Reference */ + if(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_DSIG_NO_REFERENCES, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* if there is something left than it's an error */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static int +xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->signMethod != NULL, -1); + + /* set key requirements */ + ret = xmlSecTransformSetKeyReq(dsigCtx->signMethod, &(dsigCtx->keyInfoReadCtx.keyReq)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformSetKeyReq", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod))); + return(-1); + } + + /* ignore if there is the key is already set */ + if((dsigCtx->signKey == NULL) && (dsigCtx->keyInfoReadCtx.keysMngr != NULL) + && (dsigCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) { + dsigCtx->signKey = (dsigCtx->keyInfoReadCtx.keysMngr->getKey)(node, &(dsigCtx->keyInfoReadCtx)); + } + + /* check that we have exactly what we want */ + if((dsigCtx->signKey == NULL) || (!xmlSecKeyMatch(dsigCtx->signKey, NULL, &(dsigCtx->keyInfoReadCtx.keyReq)))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_KEY_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* set the key to the transform */ + ret = xmlSecTransformSetKey(dsigCtx->signMethod, dsigCtx->signKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformSetKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod))); + return(-1); + } + + /* if we are signing document, update node */ + if((node != NULL) && (dsigCtx->operation == xmlSecTransformOperationSign)) { + ret = xmlSecKeyInfoNodeWrite(node, dsigCtx->signKey, &(dsigCtx->keyInfoWriteCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +/** + * xmlSecDSigCtxProcessObjectNode: + * + * The Object Element (http://www.w3.org/TR/xmldsig-core/#sec-Object) + * + * Object is an optional element that may occur one or more times. When + * present, this element may contain any data. The Object element may include + * optional MIME type, ID, and encoding attributes. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + */ +static int +xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1); + xmlSecAssert2(node != NULL, -1); + + /* we care about Manifest nodes only; ignore everything else */ + cur = xmlSecGetNextElementNode(node->children); + while(cur != NULL) { + if(xmlSecCheckNodeName(cur, xmlSecNodeManifest, xmlSecDSigNs)) { + ret = xmlSecDSigCtxProcessManifestNode(dsigCtx, cur); + if(ret < 0){ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigCtxProcessManifestNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + cur = xmlSecGetNextElementNode(cur->next); + } + return(0); +} + +/** + * xmlSecDSigCtxProcessManifestNode: + * + * The Manifest Element (http://www.w3.org/TR/xmldsig-core/#sec-Manifest) + * + * The Manifest element provides a list of References. The difference from + * the list in SignedInfo is that it is application defined which, if any, of + * the digests are actually checked against the objects referenced and what to + * do if the object is inaccessible or the digest compare fails. If a Manifest + * is pointed to from SignedInfo, the digest over the Manifest itself will be + * checked by the core result validation behavior. The digests within such + * a Manifest are checked at the application's discretion. If a Manifest is + * referenced from another Manifest, even the overall digest of this two level + * deep Manifest might not be checked. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * DTD: + * + * + * + */ +static int +xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) { + xmlSecDSigReferenceCtxPtr dsigRefCtx; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1); + xmlSecAssert2(node != NULL, -1); + + /* calculate references */ + cur = xmlSecGetNextElementNode(node->children); + while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReference, xmlSecDSigNs))) { + /* create reference */ + dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginManifest); + if(dsigRefCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigReferenceCtxCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* add to the list */ + ret = xmlSecPtrListAdd(&(dsigCtx->manifestReferences), dsigRefCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecDSigReferenceCtxDestroy(dsigRefCtx); + return(-1); + } + + /* process */ + ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigReferenceCtxProcessNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + + /* we don;t care if Reference processing failed because + * it's Manifest node */ + cur = xmlSecGetNextElementNode(cur->next); + } + + /* we should have nothing else here */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecDSigCtxDebugDump: + * @dsigCtx: the pointer to processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @dsigCtx to @output. + */ +EXPORT_C +void +xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) { + xmlSecAssert(dsigCtx != NULL); + xmlSecAssert(output != NULL); + + if(dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "= SIGNATURE CONTEXT\n"); + } else { + fprintf(output, "= VERIFICATION CONTEXT\n"); + } + switch(dsigCtx->status) { + case xmlSecDSigStatusUnknown: + fprintf(output, "== Status: unknown\n"); + break; + case xmlSecDSigStatusSucceeded: + fprintf(output, "== Status: succeeded\n"); + break; + case xmlSecDSigStatusInvalid: + fprintf(output, "== Status: invalid\n"); + break; + } + fprintf(output, "== flags: 0x%08x\n", dsigCtx->flags); + fprintf(output, "== flags2: 0x%08x\n", dsigCtx->flags2); + + if(dsigCtx->id != NULL) { + fprintf(output, "== Id: \"%s\"\n", dsigCtx->id); + } + + fprintf(output, "== Key Info Read Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(dsigCtx->keyInfoReadCtx), output); + fprintf(output, "== Key Info Write Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(dsigCtx->keyInfoWriteCtx), output); + + fprintf(output, "== Signature Transform Ctx:\n"); + xmlSecTransformCtxDebugDump(&(dsigCtx->transformCtx), output); + + if(dsigCtx->signMethod != NULL) { + fprintf(output, "== Signature Method:\n"); + xmlSecTransformDebugDump(dsigCtx->signMethod, output); + } + + if(dsigCtx->signKey != NULL) { + fprintf(output, "== Signature Key:\n"); + xmlSecKeyDebugDump(dsigCtx->signKey, output); + } + + fprintf(output, "== SignedInfo References List:\n"); + xmlSecPtrListDebugDump(&(dsigCtx->signedInfoReferences), output); + + fprintf(output, "== Manifest References List:\n"); + xmlSecPtrListDebugDump(&(dsigCtx->manifestReferences), output); + + if((dsigCtx->result != NULL) && + (xmlSecBufferGetData(dsigCtx->result) != NULL)) { + + fprintf(output, "== Result - start buffer:\n"); + fwrite(xmlSecBufferGetData(dsigCtx->result), + xmlSecBufferGetSize(dsigCtx->result), + 1, output); + fprintf(output, "\n== Result - end buffer\n"); + } + if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) && + (xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) && + (xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) { + + fprintf(output, "== PreSigned data - start buffer:\n"); + fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), + xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), + 1, output); + fprintf(output, "\n== PreSigned data - end buffer\n"); + } +} + +/** + * xmlSecDSigCtxDebugXmlDump: + * @dsigCtx: the pointer to processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @dsigCtx to @output in XML format. + */ +EXPORT_C +void +xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) { + xmlSecAssert(dsigCtx != NULL); + xmlSecAssert(output != NULL); + + if(dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "status) { + case xmlSecDSigStatusUnknown: + fprintf(output, "status=\"unknown\" >\n"); + break; + case xmlSecDSigStatusSucceeded: + fprintf(output, "status=\"succeeded\" >\n"); + break; + case xmlSecDSigStatusInvalid: + fprintf(output, "status=\"invalid\" >\n"); + break; + } + + fprintf(output, "%08x\n", dsigCtx->flags); + fprintf(output, "%08x\n", dsigCtx->flags2); + + if(dsigCtx->id != NULL) { + fprintf(output, "%s\n", dsigCtx->id); + } + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(dsigCtx->keyInfoReadCtx), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(dsigCtx->keyInfoWriteCtx), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecTransformCtxDebugXmlDump(&(dsigCtx->transformCtx), output); + fprintf(output, "\n"); + + if(dsigCtx->signMethod != NULL) { + fprintf(output, "\n"); + xmlSecTransformDebugXmlDump(dsigCtx->signMethod, output); + fprintf(output, "\n"); + } + + if(dsigCtx->signKey != NULL) { + fprintf(output, "\n"); + xmlSecKeyDebugXmlDump(dsigCtx->signKey, output); + fprintf(output, "\n"); + } + + fprintf(output, "\n"); + xmlSecPtrListDebugXmlDump(&(dsigCtx->signedInfoReferences), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecPtrListDebugXmlDump(&(dsigCtx->manifestReferences), output); + fprintf(output, "\n"); + + if((dsigCtx->result != NULL) && + (xmlSecBufferGetData(dsigCtx->result) != NULL)) { + + fprintf(output, ""); + fwrite(xmlSecBufferGetData(dsigCtx->result), + xmlSecBufferGetSize(dsigCtx->result), + 1, output); + fprintf(output, "\n"); + } + if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) && + (xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) && + (xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) { + + fprintf(output, ""); + fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), + xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), + 1, output); + fprintf(output, "\n"); + } + + if(dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "\n"); + } else { + fprintf(output, "\n"); + } +} + +/************************************************************************** + * + * xmlSecDSigReferenceCtx + * + *************************************************************************/ +/** + * xmlSecDSigReferenceCtxCreate: + * @dsigCtx: the pointer to parent node processing context. + * @origin: the reference origin ( or node). + * + * Creates new element processing context. Caller is responsible + * for destroying the returned context by calling #xmlSecDSigReferenceCtxDestroy + * function. + * + * Returns pointer to newly created context or NULL if an error occurs. + */ +EXPORT_C +xmlSecDSigReferenceCtxPtr +xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, xmlSecDSigReferenceOrigin origin) { + xmlSecDSigReferenceCtxPtr dsigRefCtx; + int ret; + + xmlSecAssert2(dsigCtx != NULL, NULL); + + dsigRefCtx = (xmlSecDSigReferenceCtxPtr) xmlMalloc(sizeof(xmlSecDSigReferenceCtx)); + if(dsigRefCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecDSigReferenceCtx)=%d", + sizeof(xmlSecDSigReferenceCtx)); + return(NULL); + } + + ret = xmlSecDSigReferenceCtxInitialize(dsigRefCtx, dsigCtx, origin); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecDSigReferenceCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecDSigReferenceCtxDestroy(dsigRefCtx); + return(NULL); + } + return(dsigRefCtx); +} + +/** + * xmlSecDSigReferenceCtxDestroy: + * @dsigRefCtx: the pointer to element processing context. + * + * Destroy context object created with #xmlSecDSigReferenceCtxCreate function. + */ +EXPORT_C +void +xmlSecDSigReferenceCtxDestroy(xmlSecDSigReferenceCtxPtr dsigRefCtx) { + xmlSecAssert(dsigRefCtx != NULL); + + xmlSecDSigReferenceCtxFinalize(dsigRefCtx); + xmlFree(dsigRefCtx); +} + +/** + * xmlSecDSigReferenceCtxInitialize: + * @dsigRefCtx: the pointer to element processing context. + * @dsigCtx: the pointer to parent node processing context. + * @origin: the reference origin ( or node). + * + * Initializes new element processing context. Caller is responsible + * for cleaning up the returned context by calling #xmlSecDSigReferenceCtxFinalize + * function. + * + * Returns 0 on succes or aa negative value otherwise. + */ +EXPORT_C +int +xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSigCtxPtr dsigCtx, + xmlSecDSigReferenceOrigin origin) { + int ret; + + xmlSecAssert2(dsigCtx != NULL, -1); + xmlSecAssert2(dsigRefCtx != NULL, -1); + + memset(dsigRefCtx, 0, sizeof(xmlSecDSigReferenceCtx)); + + dsigRefCtx->dsigCtx = dsigCtx; + dsigRefCtx->origin = origin; + + /* initializes transforms dsigRefCtx */ + ret = xmlSecTransformCtxInitialize(&(dsigRefCtx->transformCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* copy enabled transforms */ + if(dsigCtx->enabledReferenceTransforms != NULL) { + ret = xmlSecPtrListCopy(&(dsigRefCtx->transformCtx.enabledTransforms), + dsigCtx->enabledReferenceTransforms); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListCopy", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + dsigRefCtx->transformCtx.preExecCallback = dsigCtx->referencePreExecuteCallback; + dsigRefCtx->transformCtx.enabledUris = dsigCtx->enabledReferenceUris; + + if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK) != 0) { + dsigRefCtx->transformCtx.flags |= XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK; + } + return(0); +} + +/** + * xmlSecDSigReferenceCtxFinalize: + * @dsigRefCtx: the pointer to element processing context. + * + * Cleans up context object created with #xmlSecDSigReferenceCtxInitialize function. + */ +EXPORT_C +void +xmlSecDSigReferenceCtxFinalize(xmlSecDSigReferenceCtxPtr dsigRefCtx) { + xmlSecAssert(dsigRefCtx != NULL); + + xmlSecTransformCtxFinalize(&(dsigRefCtx->transformCtx)); + if(dsigRefCtx->id != NULL) { + xmlFree(dsigRefCtx->id); + } + if(dsigRefCtx->uri != NULL) { + xmlFree(dsigRefCtx->uri); + } + if(dsigRefCtx->type != NULL) { + xmlFree(dsigRefCtx->type); + } + memset(dsigRefCtx, 0, sizeof(xmlSecDSigReferenceCtx)); +} + +/** + * xmlSecDSigReferenceCtxGetPreDigestBuffer: + * @dsigRefCtx: the pointer to element processing context. + * + * Gets the results of node processing just before digesting + * (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or + * #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flas of signature context + * is set). + * + * Returns pointer to the buffer or NULL if an error occurs. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecDSigReferenceCtxGetPreDigestBuffer(xmlSecDSigReferenceCtxPtr dsigRefCtx) { + xmlSecAssert2(dsigRefCtx != NULL, NULL); + + return((dsigRefCtx->preDigestMemBufMethod != NULL) ? + xmlSecTransformMemBufGetBuffer(dsigRefCtx->preDigestMemBufMethod) : NULL); +} + +/** + * xmlSecDSigReferenceCtxProcessNode: + * @dsigRefCtx: the pointer to element processing context. + * @node: the pointer to node. + + * The Reference Element (http://www.w3.org/TR/xmldsig-core/#sec-Reference) + * + * Reference is an element that may occur one or more times. It specifies + * a digest algorithm and digest value, and optionally an identifier of the + * object being signed, the type of the object, and/or a list of transforms + * to be applied prior to digesting. The identification (URI) and transforms + * describe how the digested content (i.e., the input to the digest method) + * was created. The Type attribute facilitates the processing of referenced + * data. For example, while this specification makes no requirements over + * external data, an application may wish to signal that the referent is a + * Manifest. An optional ID attribute permits a Reference to be referenced + * from elsewhere. + * + * Returns 0 on succes or aa negative value otherwise. + */ +EXPORT_C +int +xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodePtr node) { + xmlSecTransformCtxPtr transformCtx; + xmlNodePtr digestValueNode; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(dsigRefCtx != NULL, -1); + xmlSecAssert2(dsigRefCtx->dsigCtx != NULL, -1); + xmlSecAssert2(dsigRefCtx->digestMethod == NULL, -1); + xmlSecAssert2(dsigRefCtx->digestMethod == NULL, -1); + xmlSecAssert2(dsigRefCtx->preDigestMemBufMethod == NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(node->doc != NULL, -1); + + transformCtx = &(dsigRefCtx->transformCtx); + + /* read attributes first */ + dsigRefCtx->uri = xmlGetProp(node, xmlSecAttrURI); + dsigRefCtx->id = xmlGetProp(node, xmlSecAttrId); + dsigRefCtx->type= xmlGetProp(node, xmlSecAttrType); + + /* set start URI (and check that it is enabled!) */ + ret = xmlSecTransformCtxSetUri(transformCtx, dsigRefCtx->uri, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxSetUri", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(dsigRefCtx->uri)); + return(-1); + } + + /* first is optional Transforms node */ + cur = xmlSecGetNextElementNode(node->children); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) { + ret = xmlSecTransformCtxNodesListRead(transformCtx, + cur, xmlSecTransformUsageDSigTransform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodesListRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* insert membuf if requested */ + if(((dsigRefCtx->origin == xmlSecDSigReferenceOriginSignedInfo) && + ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES) != 0)) || + ((dsigRefCtx->origin == xmlSecDSigReferenceOriginManifest) && + ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES) != 0))) { + + xmlSecAssert2(dsigRefCtx->preDigestMemBufMethod == NULL, -1); + dsigRefCtx->preDigestMemBufMethod = xmlSecTransformCtxCreateAndAppend( + transformCtx, + xmlSecTransformMemBufId); + if(dsigRefCtx->preDigestMemBufMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId))); + return(-1); + } + } + + /* next node is required DigestMethod. */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDigestMethod, xmlSecDSigNs))) { + dsigRefCtx->digestMethod = xmlSecTransformCtxNodeRead(&(dsigRefCtx->transformCtx), + cur, xmlSecTransformUsageDigestMethod); + if(dsigRefCtx->digestMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } else if(dsigRefCtx->dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) { + /* the dsig spec does require DigestMethod node + * to be present but in some case it application might decide to + * minimize traffic */ + dsigRefCtx->digestMethod = xmlSecTransformCtxCreateAndAppend(&(dsigRefCtx->transformCtx), + dsigRefCtx->dsigCtx->defSignMethodId); + if(dsigRefCtx->digestMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeDigestMethod)); + return(-1); + } + dsigRefCtx->digestMethod->operation = dsigRefCtx->dsigCtx->operation; + + /* last node is required DigestValue */ + if (cur != NULL) { + cur = xmlSecGetNextElementNode(cur->next); + } + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDigestValue, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDigestValue)); + return(-1); + } + digestValueNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + + /* if we have something else then it's an error */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* if we need to write result to xml node then we need base64 encode result */ + if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) { + xmlSecTransformPtr base64Encode; + + /* we need to add base64 encode transform */ + base64Encode = xmlSecTransformCtxCreateAndAppend(transformCtx, xmlSecTransformBase64Id); + if(base64Encode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + base64Encode->operation = xmlSecTransformOperationEncode; + } + + /* finally get transforms results */ + ret = xmlSecTransformCtxExecute(transformCtx, node->doc); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + dsigRefCtx->result = transformCtx->result; + + if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) { + if((dsigRefCtx->result == NULL) || (xmlSecBufferGetData(dsigRefCtx->result) == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* write signed data to xml */ + xmlNodeSetContentLen(digestValueNode, + xmlSecBufferGetData(dsigRefCtx->result), + xmlSecBufferGetSize(dsigRefCtx->result)); + if ( OOM_FLAG ) + { + return(-1); + } + + /* set success status and we are done */ + dsigRefCtx->status = xmlSecDSigStatusSucceeded; + } else { + /* verify SignatureValue node content */ + ret = xmlSecTransformVerifyNodeContent(dsigRefCtx->digestMethod, + digestValueNode, transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformVerifyNodeContent", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* set status and we are done */ + if(dsigRefCtx->digestMethod->status == xmlSecTransformStatusOk) { + dsigRefCtx->status = xmlSecDSigStatusSucceeded; + } else { + dsigRefCtx->status = xmlSecDSigStatusInvalid; + } + } + + return(0); +} + +/** + * xmlSecDSigReferenceCtxDebugDump: + * @dsigRefCtx: the pointer to element processing context. + * @output: the pointer to output FILE. + * + * Prints debug information about @dsigRefCtx to @output. + */ +EXPORT_C +void +xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* output) { + xmlSecAssert(dsigRefCtx != NULL); + xmlSecAssert(dsigRefCtx->dsigCtx != NULL); + xmlSecAssert(output != NULL); + + if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "= REFERENCE CALCULATION CONTEXT\n"); + } else { + fprintf(output, "= REFERENCE VERIFICATION CONTEXT\n"); + } + switch(dsigRefCtx->status) { + case xmlSecDSigStatusUnknown: + fprintf(output, "== Status: unknown\n"); + break; + case xmlSecDSigStatusSucceeded: + fprintf(output, "== Status: succeeded\n"); + break; + case xmlSecDSigStatusInvalid: + fprintf(output, "== Status: invalid\n"); + break; + } + if(dsigRefCtx->id != NULL) { + fprintf(output, "== Id: \"%s\"\n", dsigRefCtx->id); + } + if(dsigRefCtx->uri != NULL) { + fprintf(output, "== URI: \"%s\"\n", dsigRefCtx->uri); + } + if(dsigRefCtx->type != NULL) { + fprintf(output, "== Type: \"%s\"\n", dsigRefCtx->type); + } + + fprintf(output, "== Reference Transform Ctx:\n"); + xmlSecTransformCtxDebugDump(&(dsigRefCtx->transformCtx), output); + + if(dsigRefCtx->digestMethod != NULL) { + fprintf(output, "== Digest Method:\n"); + xmlSecTransformDebugDump(dsigRefCtx->digestMethod, output); + } + + if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) && + (xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) { + + fprintf(output, "== PreDigest data - start buffer:\n"); + fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), + xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), + 1, output); + fprintf(output, "\n== PreDigest data - end buffer\n"); + } + + if((dsigRefCtx->result != NULL) && + (xmlSecBufferGetData(dsigRefCtx->result) != NULL)) { + + fprintf(output, "== Result - start buffer:\n"); + fwrite(xmlSecBufferGetData(dsigRefCtx->result), + xmlSecBufferGetSize(dsigRefCtx->result), 1, + output); + fprintf(output, "\n== Result - end buffer\n"); + } +} + +/** + * xmlSecDSigReferenceCtxDebugXmlDump: + * @dsigRefCtx: the pointer to element processing context. + * @output: the pointer to output FILE. + * + * Prints debug information about @dsigRefCtx to @output in output format. + */ +EXPORT_C +void +xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* output) { + xmlSecAssert(dsigRefCtx != NULL); + xmlSecAssert(dsigRefCtx->dsigCtx != NULL); + xmlSecAssert(output != NULL); + + if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "status) { + case xmlSecDSigStatusUnknown: + fprintf(output, "status=\"unknown\" >\n"); + break; + case xmlSecDSigStatusSucceeded: + fprintf(output, "status=\"succeeded\" >\n"); + break; + case xmlSecDSigStatusInvalid: + fprintf(output, "status=\"invalid\" >\n"); + break; + } + + if(dsigRefCtx->id != NULL) { + fprintf(output, "%s\n", dsigRefCtx->id); + } + if(dsigRefCtx->uri != NULL) { + fprintf(output, "%s\n", dsigRefCtx->uri); + } + if(dsigRefCtx->type != NULL) { + fprintf(output, "%s\n", dsigRefCtx->type); + } + + fprintf(output, "\n"); + xmlSecTransformCtxDebugXmlDump(&(dsigRefCtx->transformCtx), output); + fprintf(output, "\n"); + + if(dsigRefCtx->digestMethod != NULL) { + fprintf(output, "\n"); + xmlSecTransformDebugXmlDump(dsigRefCtx->digestMethod, output); + fprintf(output, "\n"); + } + + if((dsigRefCtx->result != NULL) && + (xmlSecBufferGetData(dsigRefCtx->result) != NULL)) { + + fprintf(output, ""); + fwrite(xmlSecBufferGetData(dsigRefCtx->result), + xmlSecBufferGetSize(dsigRefCtx->result), 1, + output); + fprintf(output, "\n"); + } + + if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) && + (xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) { + + fprintf(output, ""); + fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), + xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), + 1, output); + fprintf(output, "\n"); + } + if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) { + fprintf(output, "\n"); + } else { + fprintf(output, "\n"); + } +} + + +/************************************************************************** + * + * xmlSecDSigReferenceCtxListKlass + * + *************************************************************************/ +static xmlSecPtrListKlass xmlSecDSigReferenceCtxListKlass = { + BAD_CAST "dsig-reference-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecDSigReferenceCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +/** + * xmlSecDSigReferenceCtxListGetKlass: + * + * The element processing contexts list klass. + * + * Returns element processing context list klass. + */ +EXPORT_C +xmlSecPtrListId +xmlSecDSigReferenceCtxListGetKlass(void) { + return(&xmlSecDSigReferenceCtxListKlass); +} + +#endif /* XMLSEC_NO_XMLDSIG */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xmlenc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xmlenc.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1283 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * "XML Encryption" implementation + * http://www.w3.org/TR/xmlenc-core + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XMLENC +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_buffer.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_xmlenc.h" +#include "xmlsec_errors.h" + +static int xmlSecEncCtxEncDataNodeRead (xmlSecEncCtxPtr encCtx, + xmlNodePtr node); +static int xmlSecEncCtxEncDataNodeWrite (xmlSecEncCtxPtr encCtx); +static int xmlSecEncCtxCipherDataNodeRead (xmlSecEncCtxPtr encCtx, + xmlNodePtr node); +static int xmlSecEncCtxCipherReferenceNodeRead (xmlSecEncCtxPtr encCtx, + xmlNodePtr node); + +/* The ID attribute in XMLEnc is 'Id' */ +static const xmlChar* xmlSecEncIds[] = { BAD_CAST "Id", NULL }; + + +/** + * xmlSecEncCtxCreate: + * @keysMngr: the pointer to keys manager. + * + * Creates element processing context. + * The caller is responsible for destroying returend object by calling + * #xmlSecEncCtxDestroy function. + * + * Returns pointer to newly allocated context object or NULL if an error + * occurs. + */ +EXPORT_C +xmlSecEncCtxPtr +xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr) { + xmlSecEncCtxPtr encCtx; + int ret; + + encCtx = (xmlSecEncCtxPtr) xmlMalloc(sizeof(xmlSecEncCtx)); + if(encCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecEncCtx)=%d", + sizeof(xmlSecEncCtx)); + return(NULL); + } + + ret = xmlSecEncCtxInitialize(encCtx, keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecEncCtxDestroy(encCtx); + return(NULL); + } + return(encCtx); +} + +/** + * xmlSecEncCtxDestroy: + * @encCtx: the pointer to processing context. + * + * Destroy context object created with #xmlSecEncCtxCreate function. + */ +EXPORT_C +void +xmlSecEncCtxDestroy(xmlSecEncCtxPtr encCtx) { + xmlSecAssert(encCtx != NULL); + + xmlSecEncCtxFinalize(encCtx); + xmlFree(encCtx); +} + +/** + * xmlSecEncCtxInitialize: + * @encCtx: the pointer to processing context. + * @keysMngr: the pointer to keys manager. + * + * Initializes element processing context. + * The caller is responsible for cleaing up returend object by calling + * #xmlSecEncCtxFinalize function. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) { + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + + memset(encCtx, 0, sizeof(xmlSecEncCtx)); + + /* initialize key info */ + ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoReadCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + encCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead; + + ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoWriteCtx), keysMngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + encCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite; + /* it's not wise to write private key :) */ + encCtx->keyInfoWriteCtx.keyReq.keyType = xmlSecKeyDataTypePublic; + + /* initializes transforms encCtx */ + ret = xmlSecTransformCtxInitialize(&(encCtx->transformCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecEncCtxFinalize: + * @encCtx: the pointer to processing context. + * + * Cleans up @encCtx object. + */ +EXPORT_C +void +xmlSecEncCtxFinalize(xmlSecEncCtxPtr encCtx) { + xmlSecAssert(encCtx != NULL); + + xmlSecEncCtxReset(encCtx); + + xmlSecTransformCtxFinalize(&(encCtx->transformCtx)); + xmlSecKeyInfoCtxFinalize(&(encCtx->keyInfoReadCtx)); + xmlSecKeyInfoCtxFinalize(&(encCtx->keyInfoWriteCtx)); + + memset(encCtx, 0, sizeof(xmlSecEncCtx)); +} + +/** + * xmlSecEncCtxReset: + * @encCtx: the pointer to processing context. + * + * Resets @encCtx object, user settings are not touched. + */ +EXPORT_C +void +xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) { + xmlSecAssert(encCtx != NULL); + + xmlSecTransformCtxReset(&(encCtx->transformCtx)); + xmlSecKeyInfoCtxReset(&(encCtx->keyInfoReadCtx)); + xmlSecKeyInfoCtxReset(&(encCtx->keyInfoWriteCtx)); + + encCtx->operation = xmlSecTransformOperationNone; + encCtx->result = NULL; + encCtx->resultBase64Encoded = 0; + encCtx->resultReplaced = 0; + encCtx->encMethod = NULL; + if(encCtx->encKey != NULL) { + xmlSecKeyDestroy(encCtx->encKey); + encCtx->encKey = NULL; + } + + if(encCtx->id != NULL) { + xmlFree(encCtx->id); + encCtx->id = NULL; + } + if(encCtx->type != NULL) { + xmlFree(encCtx->type); + encCtx->type = NULL; + } + if(encCtx->mimeType != NULL) { + xmlFree(encCtx->mimeType); + encCtx->mimeType = NULL; + } + if(encCtx->encoding != NULL) { + xmlFree(encCtx->encoding); + encCtx->encoding = NULL; + } + if(encCtx->recipient != NULL) { + xmlFree(encCtx->recipient); + encCtx->recipient = NULL; + } + if(encCtx->carriedKeyName != NULL) { + xmlFree(encCtx->carriedKeyName); + encCtx->carriedKeyName = NULL; + } + + encCtx->encDataNode = encCtx->encMethodNode = + encCtx->keyInfoNode = encCtx->cipherValueNode = NULL; +} + +/** + * xmlSecEncCtxCopyUserPref: + * @dst: the pointer to destination context. + * @src: the pointer to source context. + * + * Copies user preference from @src context to @dst. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) { + int ret; + + xmlSecAssert2(dst != NULL, -1); + xmlSecAssert2(src != NULL, -1); + + dst->userData = src->userData; + dst->flags = src->flags; + dst->flags2 = src->flags2; + dst->defEncMethodId = src->defEncMethodId; + dst->mode = src->mode; + + ret = xmlSecTransformCtxCopyUserPref(&(dst->transformCtx), &(src->transformCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoReadCtx), &(src->keyInfoReadCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoWriteCtx), &(src->keyInfoWriteCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoCtxCopyUserPref", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecEncCtxBinaryEncrypt: + * @encCtx: the pointer to processing context. + * @tmpl: the pointer to template node. + * @data: the pointer for binary buffer. + * @dataSize: the @data buffer size. + * + * Encrypts @data according to template @tmpl. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, + const xmlSecByte* data, xmlSecSize dataSize) { + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(encCtx->result == NULL, -1); + xmlSecAssert2(tmpl != NULL, -1); + xmlSecAssert2(data != NULL, -1); + + /* initialize context and add ID atributes to the list of known ids */ + encCtx->operation = xmlSecTransformOperationEncrypt; + xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds); + + /* read the template and set encryption method, key, etc. */ + ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecTransformCtxBinaryExecute(&(encCtx->transformCtx), data, dataSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxBinaryExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "dataSize=%d", + dataSize); + return(-1); + } + + encCtx->result = encCtx->transformCtx.result; + xmlSecAssert2(encCtx->result != NULL, -1); + + ret = xmlSecEncCtxEncDataNodeWrite(encCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecEncCtxXmlEncrypt: + * @encCtx: the pointer to processing context. + * @tmpl: the pointer to template node. + * @node: the pointer to node for encryption. + * + * Encrypts @node according to template @tmpl. If requested, @node is replaced + * with result node. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node) { + xmlOutputBufferPtr output; + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(encCtx->result == NULL, -1); + xmlSecAssert2(tmpl != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(node->doc != NULL, -1); + + /* initialize context and add ID atributes to the list of known ids */ + encCtx->operation = xmlSecTransformOperationEncrypt; + xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds); + + /* read the template and set encryption method, key, etc. */ + ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecTransformCtxPrepare(&(encCtx->transformCtx), xmlSecTransformDataTypeBin); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxPrepare", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "type=bin"); + return(-1); + } + + xmlSecAssert2(encCtx->transformCtx.first != NULL, -1); + output = xmlSecTransformCreateOutputBuffer(encCtx->transformCtx.first, + &(encCtx->transformCtx)); + if(output == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->transformCtx.first)), + "xmlSecTransformCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* push data thru */ + if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) { + /* get the content of the node */ + xmlNodeDumpOutput(output, node->doc, node, 0, 0, NULL); + } else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) { + xmlNodePtr cur; + + /* get the content of the nodes childs */ + for(cur = node->children; cur != NULL; cur = cur->next) { + xmlNodeDumpOutput(output, node->doc, cur, 0, 0, NULL); + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_TYPE, + "type=%s", + xmlSecErrorsSafeString(encCtx->type)); + xmlOutputBufferClose(output); + return(-1); + } + + /* close the buffer and flush everything */ + ret = xmlOutputBufferClose(output); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlOutputBufferClose", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + encCtx->result = encCtx->transformCtx.result; + xmlSecAssert2(encCtx->result != NULL, -1); + + ret = xmlSecEncCtxEncDataNodeWrite(encCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* now we need to update our original document */ + if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) { + ret = xmlSecReplaceNode(node, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecReplaceNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + encCtx->resultReplaced = 1; + } else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) { + ret = xmlSecReplaceContent(node, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecReplaceContent", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + encCtx->resultReplaced = 1; + } else { + /* we should've catached this error before */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_TYPE, + "type=%s", + xmlSecErrorsSafeString(encCtx->type)); + return(-1); + } + return(0); +} + +/** + * xmlSecEncCtxUriEncrypt: + * @encCtx: the pointer to processing context. + * @tmpl: the pointer to template node. + * @uri: the URI. + * + * Encrypts data from @uri according to template @tmpl. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *uri) { + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(encCtx->result == NULL, -1); + xmlSecAssert2(tmpl != NULL, -1); + xmlSecAssert2(uri != NULL, -1); + + /* initialize context and add ID atributes to the list of known ids */ + encCtx->operation = xmlSecTransformOperationEncrypt; + xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds); + + /* we need to add input uri transform first */ + ret = xmlSecTransformCtxSetUri(&(encCtx->transformCtx), uri, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxSetUri", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + return(-1); + } + + /* read the template and set encryption method, key, etc. */ + ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* encrypt the data */ + ret = xmlSecTransformCtxExecute(&(encCtx->transformCtx), tmpl->doc); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + encCtx->result = encCtx->transformCtx.result; + xmlSecAssert2(encCtx->result != NULL, -1); + + ret = xmlSecEncCtxEncDataNodeWrite(encCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecEncCtxDecrypt: + * @encCtx: the pointer to processing context. + * @node: the pointer to node. + * + * Decrypts @node and if necessary replaces @node with decrypted data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) { + xmlSecBufferPtr buffer; + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* decrypt */ + buffer = xmlSecEncCtxDecryptToBuffer(encCtx, node); + if(buffer == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxDecryptToBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* replace original node if requested */ + if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) { + ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecReplaceNodeBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + encCtx->resultReplaced = 1; + } else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) { + /* replace the node with the buffer */ + ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecReplaceNodeBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(node))); + return(-1); + } + encCtx->resultReplaced = 1; + } + return(0); +} + +/** + * xmlSecEncCtxDecryptToBuffer: + * @encCtx: the pointer to processing context. + * @node: the pointer to node. + * + * Decrypts @node data to the @encCtx buffer. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +xmlSecBufferPtr +xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) { + int ret; + + xmlSecAssert2(encCtx != NULL, NULL); + xmlSecAssert2(encCtx->result == NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + /* initialize context and add ID atributes to the list of known ids */ + encCtx->operation = xmlSecTransformOperationDecrypt; + xmlSecAddIDs(node->doc, node, xmlSecEncIds); + + ret = xmlSecEncCtxEncDataNodeRead(encCtx, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxEncDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* decrypt the data */ + if(encCtx->cipherValueNode != NULL) { + xmlChar* data = NULL; + xmlSecSize dataSize = 0; + + data = xmlNodeGetContent(encCtx->cipherValueNode); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->cipherValueNode)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + dataSize = xmlStrlen(data); + + ret = xmlSecTransformCtxBinaryExecute(&(encCtx->transformCtx), data, dataSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxBinaryExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if(data != NULL) { + xmlFree(data); + } + return(NULL); + } + if(data != NULL) { + xmlFree(data); + } + } else { + ret = xmlSecTransformCtxExecute(&(encCtx->transformCtx), node->doc); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxBinaryExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + } + + encCtx->result = encCtx->transformCtx.result; + xmlSecAssert2(encCtx->result != NULL, NULL); + + return(encCtx->result); +} + +static int +xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2((encCtx->operation == xmlSecTransformOperationEncrypt) || (encCtx->operation == xmlSecTransformOperationDecrypt), -1); + xmlSecAssert2(node != NULL, -1); + + switch(encCtx->mode) { + case xmlEncCtxModeEncryptedData: + if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedData, xmlSecEncNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptedData)); + return(-1); + } + break; + case xmlEncCtxModeEncryptedKey: + if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedKey, xmlSecEncNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeEncryptedKey)); + return(-1); + } + break; + } + + /* first read node data */ + xmlSecAssert2(encCtx->id == NULL, -1); + xmlSecAssert2(encCtx->type == NULL, -1); + xmlSecAssert2(encCtx->mimeType == NULL, -1); + xmlSecAssert2(encCtx->encoding == NULL, -1); + xmlSecAssert2(encCtx->recipient == NULL, -1); + xmlSecAssert2(encCtx->carriedKeyName == NULL, -1); + + encCtx->id = xmlGetProp(node, xmlSecAttrId); + encCtx->type = xmlGetProp(node, xmlSecAttrType); + encCtx->mimeType = xmlGetProp(node, xmlSecAttrMimeType); + encCtx->encoding = xmlGetProp(node, xmlSecAttrEncoding); + if(encCtx->mode == xmlEncCtxModeEncryptedKey) { + encCtx->recipient = xmlGetProp(node, xmlSecAttrRecipient); + } + cur = xmlSecGetNextElementNode(node->children); + + /* first node is optional EncryptionMethod, we'll read it later */ + xmlSecAssert2(encCtx->encMethodNode == NULL, -1); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeEncryptionMethod, xmlSecEncNs))) { + encCtx->encMethodNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next node is optional KeyInfo, we'll process it later */ + xmlSecAssert2(encCtx->keyInfoNode == NULL, -1); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs))) { + encCtx->keyInfoNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is required CipherData node */ + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeCipherData, xmlSecEncNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCipherData)); + return(-1); + } + + ret = xmlSecEncCtxCipherDataNodeRead(encCtx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxCipherDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* next is optional EncryptionProperties node (we simply ignore it) */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeEncryptionProperties, xmlSecEncNs))) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* there are more possible nodes for the node */ + if(encCtx->mode == xmlEncCtxModeEncryptedKey) { + /* next is optional ReferenceList node (we simply ignore it) */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReferenceList, xmlSecEncNs))) { + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is optional CarriedKeyName node (we simply ignore it) */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCarriedKeyName, xmlSecEncNs))) { + encCtx->carriedKeyName = xmlNodeGetContent(cur); + if(encCtx->carriedKeyName == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeCipherData)); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + } + + /* if there is something left than it's an error */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* now read the encryption method node */ + xmlSecAssert2(encCtx->encMethod == NULL, -1); + if(encCtx->encMethodNode != NULL) { + encCtx->encMethod = xmlSecTransformCtxNodeRead(&(encCtx->transformCtx), encCtx->encMethodNode, + xmlSecTransformUsageEncryptionMethod); + if(encCtx->encMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode))); + return(-1); + } + } else if(encCtx->defEncMethodId != xmlSecTransformIdUnknown) { + encCtx->encMethod = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), + encCtx->defEncMethodId); + if(encCtx->encMethod == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "encryption method not specified"); + return(-1); + } + encCtx->encMethod->operation = encCtx->operation; + + /* we have encryption method, find key */ + ret = xmlSecTransformSetKeyReq(encCtx->encMethod, &(encCtx->keyInfoReadCtx.keyReq)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformSetKeyReq", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod))); + return(-1); + } + + if((encCtx->encKey == NULL) && (encCtx->keyInfoReadCtx.keysMngr != NULL) + && (encCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) { + encCtx->encKey = (encCtx->keyInfoReadCtx.keysMngr->getKey)(encCtx->keyInfoNode, + &(encCtx->keyInfoReadCtx)); + } + + /* check that we have exactly what we want */ + if((encCtx->encKey == NULL) || + (!xmlSecKeyMatch(encCtx->encKey, NULL, &(encCtx->keyInfoReadCtx.keyReq)))) { + + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_KEY_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* set the key to the transform */ + ret = xmlSecTransformSetKey(encCtx->encMethod, encCtx->encKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformSetKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod))); + return(-1); + } + + /* if we need to write result to xml node then we need base64 encode it */ + if((encCtx->operation == xmlSecTransformOperationEncrypt) && (encCtx->cipherValueNode != NULL)) { + xmlSecTransformPtr base64Encode; + + /* we need to add base64 encode transform */ + base64Encode = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), xmlSecTransformBase64Id); + if(base64Encode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + base64Encode->operation = xmlSecTransformOperationEncode; + encCtx->resultBase64Encoded = 1; + } + + return(0); +} + +static int +xmlSecEncCtxEncDataNodeWrite(xmlSecEncCtxPtr encCtx) { + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(encCtx->result != NULL, -1); + xmlSecAssert2(encCtx->encKey != NULL, -1); + + /* write encrypted data to xml (if requested) */ + if(encCtx->cipherValueNode != NULL) { + xmlSecAssert2(xmlSecBufferGetData(encCtx->result) != NULL, -1); + + xmlNodeSetContentLen(encCtx->cipherValueNode, + xmlSecBufferGetData(encCtx->result), + xmlSecBufferGetSize(encCtx->result)); + if (OOM_FLAG) + { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeSetContentLen", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + encCtx->resultReplaced = 1; + } + + /* update node */ + if(encCtx->keyInfoNode != NULL) { + ret = xmlSecKeyInfoNodeWrite(encCtx->keyInfoNode, encCtx->encKey, &(encCtx->keyInfoWriteCtx)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyInfoNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +static int +xmlSecEncCtxCipherDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + cur = xmlSecGetNextElementNode(node->children); + + /* we either have CipherValue or CipherReference node */ + xmlSecAssert2(encCtx->cipherValueNode == NULL, -1); + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCipherValue, xmlSecEncNs))) { + /* don't need data from CipherData node when we are encrypting */ + if(encCtx->operation == xmlSecTransformOperationDecrypt) { + xmlSecTransformPtr base64Decode; + + /* we need to add base64 decode transform */ + base64Decode = xmlSecTransformCtxCreateAndPrepend(&(encCtx->transformCtx), xmlSecTransformBase64Id); + if(base64Decode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxCreateAndPrepend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + encCtx->cipherValueNode = cur; + cur = xmlSecGetNextElementNode(cur->next); + } else if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCipherReference, xmlSecEncNs))) { + /* don't need data from CipherReference node when we are encrypting */ + if(encCtx->operation == xmlSecTransformOperationDecrypt) { + ret = xmlSecEncCtxCipherReferenceNodeRead(encCtx, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecEncCtxCipherReferenceNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + } + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static int +xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) { + xmlNodePtr cur; + xmlChar* uri; + int ret; + + xmlSecAssert2(encCtx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* first read the optional uri attr and check that we can process it */ + uri = xmlGetProp(node, xmlSecAttrURI); + ret = xmlSecTransformCtxSetUri(&(encCtx->transformCtx), uri, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxSetUri", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", + xmlSecErrorsSafeString(uri)); + xmlFree(uri); + return(-1); + } + xmlFree(uri); + + cur = xmlSecGetNextElementNode(node->children); + + /* the only one node is optional Transforms node */ + if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecEncNs))) { + ret = xmlSecTransformCtxNodesListRead(&(encCtx->transformCtx), cur, + xmlSecTransformUsageDSigTransform); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformCtxNodesListRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode))); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* if there is something left than it's an error */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/** + * xmlSecEncCtxDebugDump: + * @encCtx: the pointer to processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @encCtx to @output. + */ +EXPORT_C +void +xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) { + xmlSecAssert(encCtx != NULL); + xmlSecAssert(output != NULL); + + switch(encCtx->mode) { + case xmlEncCtxModeEncryptedData: + if(encCtx->operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "= DATA ENCRYPTION CONTEXT\n"); + } else { + fprintf(output, "= DATA DECRYPTION CONTEXT\n"); + } + break; + case xmlEncCtxModeEncryptedKey: + if(encCtx->operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "= KEY ENCRYPTION CONTEXT\n"); + } else { + fprintf(output, "= KEY DECRYPTION CONTEXT\n"); + } + break; + } + fprintf(output, "== Status: %s\n", + (encCtx->resultReplaced) ? "replaced" : "not-replaced" ); + + fprintf(output, "== flags: 0x%08x\n", encCtx->flags); + fprintf(output, "== flags2: 0x%08x\n", encCtx->flags2); + + if(encCtx->id != NULL) { + fprintf(output, "== Id: \"%s\"\n", encCtx->id); + } + if(encCtx->type != NULL) { + fprintf(output, "== Type: \"%s\"\n", encCtx->type); + } + if(encCtx->mimeType != NULL) { + fprintf(output, "== MimeType: \"%s\"\n", encCtx->mimeType); + } + if(encCtx->encoding != NULL) { + fprintf(output, "== Encoding: \"%s\"\n", encCtx->encoding); + } + if(encCtx->recipient != NULL) { + fprintf(output, "== Recipient: \"%s\"\n", encCtx->recipient); + } + if(encCtx->carriedKeyName != NULL) { + fprintf(output, "== CarriedKeyName: \"%s\"\n", encCtx->carriedKeyName); + } + + fprintf(output, "== Key Info Read Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(encCtx->keyInfoReadCtx), output); + + fprintf(output, "== Key Info Write Ctx:\n"); + xmlSecKeyInfoCtxDebugDump(&(encCtx->keyInfoWriteCtx), output); + + fprintf(output, "== Encryption Transform Ctx:\n"); + xmlSecTransformCtxDebugDump(&(encCtx->transformCtx), output); + + if(encCtx->encMethod != NULL) { + fprintf(output, "== Encryption Method:\n"); + xmlSecTransformDebugDump(encCtx->encMethod, output); + } + + if(encCtx->encKey != NULL) { + fprintf(output, "== Encryption Key:\n"); + xmlSecKeyDebugDump(encCtx->encKey, output); + } + + if((encCtx->result != NULL) && + (xmlSecBufferGetData(encCtx->result) != NULL) && + (encCtx->resultBase64Encoded != 0)) { + + fprintf(output, "== Result - start buffer:\n"); + fwrite(xmlSecBufferGetData(encCtx->result), + xmlSecBufferGetSize(encCtx->result), 1, + output); + fprintf(output, "\n== Result - end buffer\n"); + } +} + +/** + * xmlSecEncCtxDebugXmlDump: + * @encCtx: the pointer to processing context. + * @output: the pointer to output FILE. + * + * Prints the debug information about @encCtx to @output in XML format. + */ +EXPORT_C +void +xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) { + xmlSecAssert(encCtx != NULL); + xmlSecAssert(output != NULL); + + switch(encCtx->mode) { + case xmlEncCtxModeEncryptedData: + if(encCtx->operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "\n", (encCtx->resultReplaced) ? "replaced" : "not-replaced" ); + + fprintf(output, "%08x\n", encCtx->flags); + fprintf(output, "%08x\n", encCtx->flags2); + + if(encCtx->id != NULL) { + fprintf(output, "%s\n", encCtx->id); + } + if(encCtx->type != NULL) { + fprintf(output, "%s\n", encCtx->type); + } + if(encCtx->mimeType != NULL) { + fprintf(output, "%s\n", encCtx->mimeType); + } + if(encCtx->encoding != NULL) { + fprintf(output, "%s\n", encCtx->encoding); + } + if(encCtx->recipient != NULL) { + fprintf(output, "%s\n", encCtx->recipient); + } + if(encCtx->carriedKeyName != NULL) { + fprintf(output, "%s\n", encCtx->carriedKeyName); + } + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(encCtx->keyInfoReadCtx), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecKeyInfoCtxDebugXmlDump(&(encCtx->keyInfoWriteCtx), output); + fprintf(output, "\n"); + + fprintf(output, "\n"); + xmlSecTransformCtxDebugXmlDump(&(encCtx->transformCtx), output); + fprintf(output, "\n"); + + if(encCtx->encMethod != NULL) { + fprintf(output, "\n"); + xmlSecTransformDebugXmlDump(encCtx->encMethod, output); + fprintf(output, "\n"); + } + + if(encCtx->encKey != NULL) { + fprintf(output, "\n"); + xmlSecKeyDebugXmlDump(encCtx->encKey, output); + fprintf(output, "\n"); + } + + if((encCtx->result != NULL) && + (xmlSecBufferGetData(encCtx->result) != NULL) && + (encCtx->resultBase64Encoded != 0)) { + + fprintf(output, ""); + fwrite(xmlSecBufferGetData(encCtx->result), + xmlSecBufferGetSize(encCtx->result), 1, + output); + fprintf(output, "\n"); + } + + switch(encCtx->mode) { + case xmlEncCtxModeEncryptedData: + if(encCtx->operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "\n"); + } else { + fprintf(output, "\n"); + } + break; + case xmlEncCtxModeEncryptedKey: + if(encCtx->operation == xmlSecTransformOperationEncrypt) { + fprintf(output, "\n"); + } else { + fprintf(output, "\n"); + } + break; + } +} + +#endif /* XMLSEC_NO_XMLENC */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xmlsec.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xmlsec.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,191 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * General functions. + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_app.h" +#include "xmlsec_io.h" +#include "xmlsec_xkms.h" +#include "xmlsec_errors.h" + +/** + * xmlSecInit: + * + * Initializes XML Security Library. The depended libraries + * (LibXML and LibXSLT) must be initialized before. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecInit(void) { + + xmlSecErrorsInit(); + xmlSecIOInit(); + +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + if(xmlSecCryptoDLInit() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + + if(xmlSecKeyDataIdsInit() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataIdsInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if(xmlSecTransformIdsInit() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecTransformIdsInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#ifndef XMLSEC_NO_XKMS + if(xmlSecXkmsRespondWithIdsInit() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsRespondWithIdsInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if(xmlSecXkmsServerRequestIdsInit() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXkmsServerRequestIdsInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } +#endif /* XMLSEC_NO_XKMS */ + + /* we use rand() function to generate id attributes */ + srand(time(NULL)); + return(0); +} + +/** + * xmlSecShutdown: + * + * Clean ups the XML Security Library. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecShutdown(void) { + int res = 0; + +#ifndef XMLSEC_NO_XKMS + xmlSecXkmsServerRequestIdsShutdown(); + xmlSecXkmsRespondWithIdsShutdown(); +#endif /* XMLSEC_NO_XKMS */ + + xmlSecTransformIdsShutdown(); + xmlSecKeyDataIdsShutdown(); + +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + if(xmlSecCryptoDLShutdown() < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLShutdown", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + res = -1; + } +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + + xmlSecIOShutdown(); + xmlSecErrorsShutdown(); + + return(res); +} + +/** + * xmlSecCheckVersionExt: + * @major: the major version number. + * @minor: the minor version number. + * @subminor: the subminor version number. + * @mode: the version check mode. + * + * Checks if the loaded version of xmlsec library could be used. + * + * Returns 1 if the loaded xmlsec library version is OK to use + * 0 if it is not or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode mode) { + /* we always want to have a match for major version number */ + if(major != XMLSEC_VERSION_MAJOR) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "expected major version=%d;real major version=%d", + XMLSEC_VERSION_MAJOR, major); + return(0); + } + + switch(mode) { + case xmlSecCheckVersionExact: + if((minor != XMLSEC_VERSION_MINOR) || (subminor != XMLSEC_VERSION_SUBMINOR)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "mode=exact;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d", + XMLSEC_VERSION_MINOR, minor, + XMLSEC_VERSION_SUBMINOR, subminor); + return(0); + } + break; + case xmlSecCheckVersionABICompatible: + if((minor < XMLSEC_VERSION_MINOR) || + ((minor == XMLSEC_VERSION_MINOR) && + (subminor < XMLSEC_VERSION_SUBMINOR))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "mode=abi compatible;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d", + XMLSEC_VERSION_MINOR, minor, + XMLSEC_VERSION_SUBMINOR, subminor); + return(0); + } + break; + } + + return(1); +} + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xmltree.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xmltree.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1792 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * Common XML Doc utility functions + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_parser.h" +#include "xmlsec_private.h" +#include "xmlsec_base64.h" +#include "xmlsec_errors.h" +#include "xmlsec_templates.h" + +/** + * xmlSecFindChild: + * @parent: the pointer to XML node. + * @name: the name. + * @ns: the namespace href (may be NULL). + * + * Searches a direct child of the @parent node having given name and + * namespace href. + * + * Returns the pointer to the found node or NULL if an error occurs or + * node is not found. + */ +EXPORT_C +xmlNodePtr +xmlSecFindChild(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) { + xmlNodePtr cur; + + xmlSecAssert2(parent != NULL, NULL); + xmlSecAssert2(name != NULL, NULL); + + cur = parent->children; + while(cur != NULL) { + if(cur->type == XML_ELEMENT_NODE) { + if(xmlSecCheckNodeName(cur, name, ns)) { + return(cur); + } + } + cur = cur->next; + } + return(NULL); +} + +/** + * xmlSecFindParent: + * @cur: the pointer to an XML node. + * @name: the name. + * @ns: the namespace href (may be NULL). + * + * Searches the ancestors axis of the @cur node for a node having given name + * and namespace href. + * + * Returns the pointer to the found node or NULL if an error occurs or + * node is not found. + */ +EXPORT_C +xmlNodePtr +xmlSecFindParent(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) { + xmlSecAssert2(cur != NULL, NULL); + xmlSecAssert2(name != NULL, NULL); + + if(xmlSecCheckNodeName(cur, name, ns)) { + return(cur); + } else if(cur->parent != NULL) { + return(xmlSecFindParent(cur->parent, name, ns)); + } + return(NULL); +} + +/** + * xmlSecFindNode: + * @parent: the pointer to XML node. + * @name: the name. + * @ns: the namespace href (may be NULL). + * + * Searches all children of the @parent node having given name and + * namespace href. + * + * Returns the pointer to the found node or NULL if an error occurs or + * node is not found. + */ +EXPORT_C +xmlNodePtr +xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) { + xmlNodePtr cur; + xmlNodePtr ret; + + xmlSecAssert2(name != NULL, NULL); + + cur = parent; + while(cur != NULL) { + if((cur->type == XML_ELEMENT_NODE) && xmlSecCheckNodeName(cur, name, ns)) { + return(cur); + } + if(cur->children != NULL) { + ret = xmlSecFindNode(cur->children, name, ns); + if(ret != NULL) { + return(ret); + } + } + cur = cur->next; + } + return(NULL); +} + +/** + * xmlSecGetNodeNsHref: + * @cur: the pointer to node. + * + * Get's node's namespace href. + * + * Returns node's namespace href. + */ +EXPORT_C +const xmlChar* +xmlSecGetNodeNsHref(const xmlNodePtr cur) { + xmlNsPtr ns; + + xmlSecAssert2(cur != NULL, NULL); + + /* do we have a namespace in the node? */ + if(cur->ns != NULL) { + return(cur->ns->href); + } + + /* search for default namespace */ + ns = xmlSearchNs(cur->doc, cur, NULL); + if(ns != NULL) { + return(ns->href); + } + + return(NULL); +} + +/** + * xmlSecCheckNodeName: + * @cur: the pointer to an XML node. + * @name: the name, + * @ns: the namespace href. + * + * Checks that the node has a given name and a given namespace href. + * + * Returns 1 if the node matches or 0 otherwise. + */ +EXPORT_C +int +xmlSecCheckNodeName(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) { + xmlSecAssert2(cur != NULL, 0); + + return(xmlStrEqual(cur->name, name) && + xmlStrEqual(xmlSecGetNodeNsHref(cur), ns)); +} + +/** + * xmlSecAddChild: + * @parent: the pointer to an XML node. + * @name: the new node name. + * @ns: the new node namespace. + * + * Adds a child to the node @parent with given @name and namespace @ns. + * + * Returns pointer to the new node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) { + xmlNodePtr cur; + xmlNodePtr text; + + xmlSecAssert2(parent != NULL, NULL); + xmlSecAssert2(name != NULL, NULL); + + if(xmlGetNewLineFlag() && parent->children == NULL) { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddChild(parent, text); + } + + cur = xmlNewChild(parent, NULL, name, NULL); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewChild", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* namespaces support */ + if(ns != NULL) { + xmlNsPtr nsPtr; + + nsPtr = xmlSearchNsByHref(cur->doc, cur, ns); + if((nsPtr == NULL) || !xmlStrEqual(nsPtr->href, ns)) { + nsPtr = xmlNewNs(cur, ns, NULL); + } + xmlSetNs(cur, nsPtr); + } + + if(xmlGetNewLineFlag()) + { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddChild(parent, text); + } + return(cur); +} + +/** + * xmlSecAddChildNode: + * @parent: the pointer to an XML node. + * @child: the new node. + * + * Adds @child node to the @parent node. + * + * Returns pointer to the new node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) { + xmlNodePtr text; + + xmlSecAssert2(parent != NULL, NULL); + xmlSecAssert2(child != NULL, NULL); + + if(xmlGetNewLineFlag() && parent->children == NULL) { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddChild(parent, text); + } + + xmlAddChild(parent, child); + + if(xmlGetNewLineFlag()) + { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddChild(parent, text); + } + + return(child); +} + +/** + * xmlSecAddNextSibling + * @node: the pointer to an XML node. + * @name: the new node name. + * @ns: the new node namespace. + * + * Adds next sibling to the node @node with given @name and namespace @ns. + * + * Returns pointer to the new node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) { + xmlNodePtr cur; + xmlNodePtr text; + + xmlSecAssert2(node != NULL, NULL); + xmlSecAssert2(name != NULL, NULL); + + cur = xmlNewNode(NULL, name); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNode", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddNextSibling(node, cur); + + /* namespaces support */ + if(ns != NULL) { + xmlNsPtr nsPtr; + + nsPtr = xmlSearchNsByHref(cur->doc, cur, ns); + if((nsPtr == NULL) || !xmlStrEqual(nsPtr->href, ns)) { + nsPtr = xmlNewNs(cur, ns, NULL); + } + xmlSetNs(cur, nsPtr); + } + + if(xmlGetNewLineFlag()) + { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddNextSibling(node, text); + } + + return(cur); +} + +/** + * xmlSecAddPrevSibling + * @node: the pointer to an XML node. + * @name: the new node name. + * @ns: the new node namespace. + * + * Adds prev sibling to the node @node with given @name and namespace @ns. + * + * Returns pointer to the new node or NULL if an error occurs. + */ +EXPORT_C +xmlNodePtr +xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) { + xmlNodePtr cur; + xmlNodePtr text; + + xmlSecAssert2(node != NULL, NULL); + xmlSecAssert2(name != NULL, NULL); + + cur = xmlNewNode(NULL, name); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNode", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddPrevSibling(node, cur); + + /* namespaces support */ + if(ns != NULL) { + xmlNsPtr nsPtr; + + nsPtr = xmlSearchNsByHref(cur->doc, cur, ns); + if((nsPtr == NULL) || !xmlStrEqual(nsPtr->href, ns)) { + nsPtr = xmlNewNs(cur, ns, NULL); + if (nsPtr == NULL) + return(NULL); + } + xmlSetNs(cur, nsPtr); + } + + if(xmlGetNewLineFlag()) + { + text = xmlNewText(xmlSecStringCR); + if(text == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewText", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlAddPrevSibling(node, text); + } + return(cur); +} + +/** + * xmlSecGetNextElementNode: + * @cur: the pointer to an XML node. + * + * Seraches for the next element node. + * + * Returns the pointer to next element node or NULL if it is not found. + */ +EXPORT_C +xmlNodePtr +xmlSecGetNextElementNode(xmlNodePtr cur) { + + while((cur != NULL) && (cur->type != XML_ELEMENT_NODE)) { + cur = cur->next; + } + return(cur); +} + +/** + * xmlSecReplaceNode: + * @node: the current node. + * @newNode: the new node. + * + * Swaps the @node and @newNode in the XML tree. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecReplaceNode(xmlNodePtr node, xmlNodePtr newNode) { + xmlNodePtr oldNode; + int restoreRoot = 0; + + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(newNode != NULL, -1); + + /* fix documents children if necessary first */ + if((node->doc != NULL) && (node->doc->children == node)) { + node->doc->children = node->next; + restoreRoot = 1; + } + if((newNode->doc != NULL) && (newNode->doc->children == newNode)) { + newNode->doc->children = newNode->next; + } + + oldNode = xmlReplaceNode(node, newNode); + if(oldNode == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlReplaceNode", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if(restoreRoot != 0) { + xmlDocSetRootElement(oldNode->doc, newNode); + } + + xmlFreeNode(oldNode); + return(0); +} + +/** + * xmlSecReplaceContent + * @node: the current node. + * @newNode: the new node. + * + * Swaps the content of @node and @newNode. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecReplaceContent(xmlNodePtr node, xmlNodePtr newNode) { + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(newNode != NULL, -1); + + xmlUnlinkNode(newNode); + xmlSetTreeDoc(newNode, node->doc); + xmlNodeSetContent(node, NULL); + xmlAddChild(node, newNode); + xmlSetTreeDoc(newNode, node->doc); + + return(0); +} + + +/** + * xmlSecReplaceNodeBuffer: + * @node: the current node. + * @buffer: the XML data. + * @size: the XML data size. + * + * Swaps the @node and the parsed XML data from the @buffer in the XML tree. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecReplaceNodeBuffer(xmlNodePtr node, + const xmlSecByte *buffer, xmlSecSize size) { + xmlNodePtr results = NULL; + xmlNodePtr next = NULL; + xmlNodePtr tmp = NULL; // MK added + + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(node->parent != NULL, -1); + + /* parse buffer in the context of node's parent */ + if(xmlParseInNodeContext(node->parent, (const char*)buffer, size, XML_PARSE_NODICT, &results) != XML_ERR_OK) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlParseInNodeContext", + XMLSEC_ERRORS_R_XML_FAILED, + "Failed to parse content"); + return(-1); + } + + if(results == NULL && node->parent->type == XML_DOCUMENT_NODE) + { + tmp = node->last; + xmlUnlinkNode(tmp); + results = tmp; + } + + /* add new nodes */ + while (results != NULL) { + next = results->next; + xmlAddPrevSibling(node, results); + results = next; + } + + /* remove old node */ + xmlUnlinkNode(node); + xmlFreeNode(node); + + return(0); +} + +/** + * xmlSecAddIDs: + * @doc: the pointer to an XML document. + * @cur: the pointer to an XML node. + * @ids: the pointer to a NULL terminated list of ID attributes. + * + * Walks thru all children of the @cur node and adds all attributes + * from the @ids list to the @doc document IDs attributes hash. + */ +EXPORT_C +void +xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) { + xmlNodePtr children = NULL; + + xmlSecAssert(doc != NULL); + xmlSecAssert(ids != NULL); + + if((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) { + xmlAttrPtr attr; + xmlAttrPtr tmp; + int i; + xmlChar* name; + + for(attr = cur->properties; attr != NULL; attr = attr->next) { + for(i = 0; ids[i] != NULL; ++i) { + if(xmlStrEqual(attr->name, ids[i])) { + name = xmlNodeListGetString(doc, attr->children, 1); + if(name != NULL) { + tmp = xmlGetID(doc, name); + if(tmp == NULL) { + xmlAddID(NULL, doc, name, attr); + } else if(tmp != attr) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "id=%s already defined", + xmlSecErrorsSafeString(name)); + } + xmlFree(name); + } + } + } + } + + children = cur->children; + } else if(cur == NULL) { + children = doc->children; + } + + while(children != NULL) { + if(children->type == XML_ELEMENT_NODE) { + xmlSecAddIDs(doc, children, ids); + } + children = children->next; + } +} + +/** + * xmlSecGenerateAndAddID: + * @node: the node to ID attr to. + * @attrName: the ID attr name. + * @prefix: the prefix to add to the generated ID (can be NULL). + * @len: the length of ID. + * + * Generates a unique ID in the format <@prefix>base64-encoded(@len random bytes) + * and puts it in the attribute @attrName. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar* prefix, xmlSecSize len) { + xmlChar* id; + int count; + + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(attrName != NULL, -1); + + /* we will try 5 times before giving up */ + for(count = 0; count < 5; count++) { + id = xmlSecGenerateID(prefix, len); + if(id == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGenerateID", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((node->doc == NULL) || (xmlGetID(node->doc, id) == NULL)) { + /* this is a unique ID in the document and we can use it */ + if(xmlSetProp(node, attrName, id) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSetProp", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(id); + return(-1); + } + + xmlFree(id); + return(0); + } + xmlFree(id); + } + + return(-1); +} + +/** + * xmlSecGenerateID: + * @prefix: the prefix to add to the generated ID (can be NULL). + * @len: the length of ID. + * + * Generates a unique ID in the format <@prefix>base64-encoded(@len random bytes). + * The caller is responsible for freeing returned string using @xmlFree function. + * + * Returns pointer to generated ID string or NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) { + xmlSecBuffer buffer; + xmlSecSize i, binLen; + xmlChar* res; + xmlChar* p; + int ret; + + xmlSecAssert2(len > 0, NULL); + + /* we will do base64 decoding later */ + binLen = (3 * len + 1) / 4; + + ret = xmlSecBufferInitialize(&buffer, binLen + 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + xmlSecAssert2(xmlSecBufferGetData(&buffer) != NULL, NULL); + xmlSecAssert2(xmlSecBufferGetMaxSize(&buffer) >= binLen, NULL); + + ret = xmlSecBufferSetSize(&buffer, binLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + xmlSecAssert2(xmlSecBufferGetSize(&buffer) == binLen, NULL); + + /* create random bytes */ + for(i = 0; i < binLen; i++) { + (xmlSecBufferGetData(&buffer)) [i] = (xmlSecByte) (256.0 * rand() / (RAND_MAX + 1.0)); + } + + /* base64 encode random bytes */ + res = xmlSecBase64Encode(xmlSecBufferGetData(&buffer), xmlSecBufferGetSize(&buffer), 0); + if((res == NULL) || (xmlStrlen(res) == 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecBufferFinalize(&buffer); + return(NULL); + } + xmlSecBufferFinalize(&buffer); + + /* truncate the generated id attribute if needed */ + if(xmlStrlen(res) > (int)len) { + res[len] = '\0'; + } + + /* we need to cleanup base64 encoded id because ID attr can't have '+' or '/' characters */ + for(p = res; (*p) != '\0'; p++) { + if(((*p) == '+') || ((*p) == '/')) { + (*p) = '_'; + } + } + + /* add prefix if exist */ + if(prefix) { + xmlChar* tmp; + xmlSecSize tmpLen; + + tmpLen = xmlStrlen(prefix) + xmlStrlen(res) + 1; + tmp = xmlMalloc(tmpLen + 1); + if(tmp == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(res); + return(NULL); + } + + xmlSecStrPrintf(tmp, tmpLen, BAD_CAST "%s%s", prefix, res); + xmlFree(res); + res = tmp; + } else { + /* no prefix: check that ID attribute starts from a letter */ + if(!(((res[0] >= 'A') && (res[0] <= 'Z')) || + ((res[0] >= 'a') && (res[0] <= 'z')))) { + res[0] = 'A'; + } + } + + return(res); +} + + +/** + * xmlSecCreateTree: + * @rootNodeName: the root node name. + * @rootNodeNs: the root node namespace (otpional). + * + * Creates a new XML tree with one root node @rootNodeName. + * + * Returns pointer to the newly created tree or NULL if an error occurs. + */ +EXPORT_C +xmlDocPtr +xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) { + xmlDocPtr doc; + xmlNodePtr root; + xmlNsPtr ns; + + xmlSecAssert2(rootNodeName != NULL, NULL); + + /* create doc */ + doc = xmlNewDoc(BAD_CAST "1.0"); + if(doc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDoc", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + /* create root node */ + root = xmlNewDocNode(doc, NULL, rootNodeName, NULL); + if(root == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewDocNode", + XMLSEC_ERRORS_R_XML_FAILED, + "node=Keys"); + xmlFreeDoc(doc); + return(NULL); + } + xmlDocSetRootElement(doc, root); + + /* and set root node namespace */ + ns = xmlNewNs(root, rootNodeNs, NULL); + if(ns == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNewNs", + XMLSEC_ERRORS_R_XML_FAILED, + "ns=%s", + xmlSecErrorsSafeString(rootNodeNs)); + xmlFreeDoc(doc); + return(NULL); + } + xmlSetNs(root, ns); + + return(doc); +} + +/** + * xmlSecIsEmptyNode: + * @node: the node to check + * + * Checks whethere the @node is empty (i.e. has only whitespaces children). + * + * Returns 1 if @node is empty, 0 otherwise or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecIsEmptyNode(xmlNodePtr node) { + xmlChar* content; + int res; + + xmlSecAssert2(node != NULL, -1); + + if(xmlSecGetNextElementNode(node->children) != NULL) { + return(0); + } + + content = xmlNodeGetContent(node); + if(content == NULL) { + return(1); + } + + res = xmlSecIsEmptyString(content); + xmlFree(content); + return(res); +} + +/** + * xmlSecIsEmptyString: + * @str: the string to check + * + * Checks whethere the @str is empty (i.e. has only whitespaces children). + * + * Returns 1 if @str is empty, 0 otherwise or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecIsEmptyString(const xmlChar* str) { + xmlSecAssert2(str != NULL, -1); + + for( ;*str != '\0'; ++str) { + if(!isspace((int)(*str))) { + return(0); + } + } + return(1); +} + +/** + * xmlSecGetQName: + * @node: the context node. + * @href: the QName href (can be NULL). + * @local: the QName local part. + * + * Creates QName (prefix:local) from @href and @local in the context of the @node. + * Caller is responsible for freeing returned string with xmlFree. + * + * Returns qname or NULL if an error occurs. + */ +EXPORT_C +xmlChar* +xmlSecGetQName(xmlNodePtr node, const xmlChar* href, const xmlChar* local) { + xmlChar* qname; + xmlNsPtr ns; + + xmlSecAssert2(node != NULL, NULL); + xmlSecAssert2(local != NULL, NULL); + + /* we don't want to create namespace node ourselves because + * it might cause collisions */ + ns = xmlSearchNsByHref(node->doc, node, href); + if((ns == NULL) && (href != NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSearchNsByHref", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s,href=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(href)); + return(NULL); + } + + if((ns != NULL) && (ns->prefix != NULL)) { + xmlSecSize len; + + len = xmlStrlen(local) + xmlStrlen(ns->prefix) + 4; + qname = xmlMalloc(len); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_MALLOC_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + return(NULL); + } + xmlSecStrPrintf(qname, len, BAD_CAST "%s:%s", ns->prefix, local); + } else { + qname = xmlStrdup(local); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + return(NULL); + } + } + + + return(qname); +} + + +/************************************************************************* + * + * QName <-> Integer mapping + * + ************************************************************************/ +/** + * xmlSecQName2IntegerGetInfo: + * @info: the qname<->integer mapping information. + * @intValue: the integer value. + * + * Maps integer @intValue to a QName prefix. + * + * Returns the QName info that is mapped to @intValue or NULL if such value + * is not found. + */ +EXPORT_C +xmlSecQName2IntegerInfoConstPtr +xmlSecQName2IntegerGetInfo(xmlSecQName2IntegerInfoConstPtr info, int intValue) { + unsigned int ii; + + xmlSecAssert2(info != NULL, NULL); + + for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) { + if(info[ii].intValue == intValue) { + return(&info[ii]); + } + } + + return(NULL); +} + +/** + * xmlSecQName2IntegerGetInteger: + * @info: the qname<->integer mapping information. + * @qnameHref: the qname href value. + * @qnameLocalPart: the qname local part value. + * @intValue: the pointer to result integer value. + * + * Maps qname qname to an integer and returns it in @intValue. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info, + const xmlChar* qnameHref, const xmlChar* qnameLocalPart, + int* intValue) { + unsigned int ii; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(qnameLocalPart != NULL, -1); + xmlSecAssert2(intValue != NULL, -1); + + for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) { + if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) && + xmlStrEqual(info[ii].qnameHref, qnameHref)) { + (*intValue) = info[ii].intValue; + return(0); + } + } + + return(-1); +} + +/** + * xmlSecQName2IntegerGetIntegerFromInteger: + * @info: the qname<->integer mapping information. + * @node: the pointer to node. + * @qname: the qname string. + * @intValue: the pointer to result integer value. + * + * Converts @qname into integer in context of @node. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, const xmlChar* qname, + int* intValue) { + const xmlChar* qnameLocalPart = NULL; + xmlChar* qnamePrefix = NULL; + const xmlChar* qnameHref; + xmlNsPtr ns; + int ret; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(qname != NULL, -1); + xmlSecAssert2(intValue != NULL, -1); + + qnameLocalPart = xmlStrchr(qname, ':'); + if(qnameLocalPart != NULL) { + qnamePrefix = xmlStrndup(qname, qnameLocalPart - qname); + if(qnamePrefix == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrndup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + "node=%s,value=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qname)); + return(-1); + } + qnameLocalPart++; + } else { + qnamePrefix = NULL; + qnameLocalPart = qname; + } + + /* search namespace href */ + ns = xmlSearchNs(node->doc, node, qnamePrefix); + if((ns == NULL) && (qnamePrefix != NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSearchNs", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s,qnamePrefix=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qnamePrefix)); + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(-1); + } + qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL; + + /* and finally search for integer */ + ret = xmlSecQName2IntegerGetInteger(info, qnameHref, qnameLocalPart, intValue); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetInteger", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,qnameLocalPart=%s,qnameHref=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qnameLocalPart), + xmlSecErrorsSafeString(qnameHref)); + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(-1); + } + + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(0); +} + + +/** + * xmlSecQName2IntegerGetStringFromInteger: + * @info: the qname<->integer mapping information. + * @node: the pointer to node. + * @intValue: the integer value. + * + * Creates qname string for @intValue in context of given @node. Caller + * is responsible for freeing returned string with @xmlFree. + * + * Returns pointer to newly allocated string on success or NULL if an error occurs, + */ +EXPORT_C +xmlChar* +xmlSecQName2IntegerGetStringFromInteger(xmlSecQName2IntegerInfoConstPtr info, + xmlNodePtr node, int intValue) { + xmlSecQName2IntegerInfoConstPtr qnameInfo; + + xmlSecAssert2(info != NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue); + if(qnameInfo == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetInfo", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,intValue=%d", + xmlSecErrorsSafeString(node->name), + intValue); + return(NULL); + } + + return (xmlSecGetQName(node, qnameInfo->qnameHref, qnameInfo->qnameLocalPart)); +} + +/** + * xmlSecQName2IntegerNodeRead: + * @info: the qname<->integer mapping information. + * @node: the pointer to node. + * @intValue: the pointer to result integer value. + * + * Reads the content of @node and converts it to an integer using mapping + * from @info. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node, int* intValue) { + xmlChar* content = NULL; + int ret; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(intValue != NULL, -1); + + content = xmlNodeGetContent(node); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeGetContent", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(node->name)); + return(-1); + } + + ret = xmlSecQName2IntegerGetIntegerFromString(info, node, content, intValue); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetIntegerFromString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,value=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(content)); + xmlFree(content); + return(-1); + } + + xmlFree(content); + return(0); +} + +/** + * xmlSecQName2IntegerNodeWrite: + * @info: the qname<->integer mapping information. + * @node: the parent node. + * @nodeName: the child node name. + * @nodeNs: the child node namespace. + * @intValue: the integer value. + * + * Creates new child node in @node and sets its value to @intValue. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node, + const xmlChar* nodeName, const xmlChar* nodeNs, int intValue) { + xmlNodePtr cur; + xmlChar* qname = NULL; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(nodeName != NULL, -1); + + /* find and build qname */ + qname = xmlSecQName2IntegerGetStringFromInteger(info, node, intValue); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetStringFromInteger", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,intValue=%d", + xmlSecErrorsSafeString(node->name), + intValue); + return(-1); + } + + cur = xmlSecAddChild(node, nodeName, nodeNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,intValue=%d", + xmlSecErrorsSafeString(nodeName), + intValue); + xmlFree(qname); + return(-1); + } + + xmlNodeSetContent(cur, qname); + xmlFree(qname); + return(0); +} + +/** + * xmlSecQName2IntegerAttributeRead: + * @info: the qname<->integer mapping information. + * @node: the element node. + * @attrName: the attribute name. + * @intValue: the pointer to result integer value. + * + * Gets the value of @attrName atrtibute from @node and converts it to integer + * according to @info. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node, + const xmlChar* attrName, int* intValue) { + xmlChar* attrValue; + int ret; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(attrName != NULL, -1); + xmlSecAssert2(intValue != NULL, -1); + + attrValue = xmlGetProp(node, attrName); + if(attrValue == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlGetProp", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s,attrValue=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(attrName)); + return(-1); + } + + ret = xmlSecQName2IntegerGetIntegerFromString(info, node, attrValue, intValue); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetIntegerFromString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,attrName=%s,attrValue=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(attrName), + xmlSecErrorsSafeString(attrValue)); + xmlFree(attrValue); + return(-1); + } + + xmlFree(attrValue); + return(0); +} + +/** + * xmlSecQName2IntegerAttributeWrite: + * @info: the qname<->integer mapping information. + * @node: the parent node. + * @attrName: the name of attribute. + * @intValue: the integer value. + * + * Converts @intValue to a qname and sets it to the value of + * attribute @attrName in @node. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node, + const xmlChar* attrName, int intValue) { + xmlChar* qname; + xmlAttrPtr attr; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(attrName != NULL, -1); + + /* find and build qname */ + qname = xmlSecQName2IntegerGetStringFromInteger(info, node, intValue); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2IntegerGetStringFromInteger", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,attrName=%s,intValue=%d", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(attrName), + intValue); + return(-1); + } + + attr = xmlSetProp(node, attrName, qname); + if(attr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChildNode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,attrName=%s,intValue=%d", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(attrName), + intValue); + xmlFree(qname); + return(-1); + } + + xmlFree(qname); + return(0); +} + +/** + * xmlSecQName2IntegerDebugDump: + * @info: the qname<->integer mapping information. + * @intValue: the integer value. + * @output: the pointer to output FILE. + * + * Prints @intValue into @output. + */ +EXPORT_C +void +xmlSecQName2IntegerDebugDump(xmlSecQName2IntegerInfoConstPtr info, int intValue, + const xmlChar* name, FILE* output) { + xmlSecQName2IntegerInfoConstPtr qnameInfo; + + xmlSecAssert(info != NULL); + xmlSecAssert(name != NULL); + xmlSecAssert(output != NULL); + + qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue); + if(qnameInfo != NULL) { + fprintf(output, "== %s: %d (name=\"%s\", href=\"%s\")\n", name, intValue, + (qnameInfo->qnameLocalPart) ? qnameInfo->qnameLocalPart : BAD_CAST NULL, + (qnameInfo->qnameHref) ? qnameInfo->qnameHref : BAD_CAST NULL); + } +} + +/** + * xmlSecQName2IntegerDebugXmlDump: + * @info: the qname<->integer mapping information. + * @intValue: the integer value. + * @output: the pointer to output FILE. + * + * Prints @intValue into @output in XML format. + */ +EXPORT_C +void +xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, int intValue, + const xmlChar* name, FILE* output) { + xmlSecQName2IntegerInfoConstPtr qnameInfo; + + xmlSecAssert(info != NULL); + xmlSecAssert(name != NULL); + xmlSecAssert(output != NULL); + + qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue); + if(qnameInfo != NULL) { + fprintf(output, "<%s value=\"%d\" href=\"%s\">%s<%s>\n", name, intValue, + (qnameInfo->qnameHref) ? qnameInfo->qnameHref : BAD_CAST NULL, + (qnameInfo->qnameLocalPart) ? qnameInfo->qnameLocalPart : BAD_CAST NULL, + name); + } +} + + +/************************************************************************* + * + * QName <-> Bits mask mapping + * + ************************************************************************/ +/** + * xmlSecQName2BitMaskGetInfo: + * @info: the qname<->bit mask mapping information. + * @mask: the bit mask. + * + * Converts @mask to qname. + * + * Returns pointer to the qname info for @mask or NULL if mask is unknown. + */ +EXPORT_C +xmlSecQName2BitMaskInfoConstPtr +xmlSecQName2BitMaskGetInfo(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask) { + unsigned int ii; + + xmlSecAssert2(info != NULL, NULL); + + for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) { + xmlSecAssert2(info[ii].mask != 0, NULL); + if(info[ii].mask == mask) { + return(&info[ii]); + } + } + + return(NULL); +} + +/** + * xmlSecQName2BitMaskGetBitMask: + * @info: the qname<->bit mask mapping information. + * @qnameHref: the qname Href value. + * @qnameLocalPart: the qname LocalPart value. + * @mask: the pointer to result mask. + * + * Converts @qnameLocalPart to @mask. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info, + const xmlChar* qnameHref, const xmlChar* qnameLocalPart, + xmlSecBitMask* mask) { + unsigned int ii; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(qnameLocalPart != NULL, -1); + xmlSecAssert2(mask != NULL, -1); + + for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) { + xmlSecAssert2(info[ii].mask != 0, -1); + if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) && + xmlStrEqual(info[ii].qnameHref, qnameHref)) { + + (*mask) = info[ii].mask; + return(0); + } + } + + return(-1); +} + +/** + * xmlSecQName2BitMaskGetBitMaskFromBitMask: + * @info: the qname<->integer mapping information. + * @node: the pointer to node. + * @qname: the qname string. + * @mask: the pointer to result msk value. + * + * Converts @qname into integer in context of @node. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr node, const xmlChar* qname, + xmlSecBitMask* mask) { + const xmlChar* qnameLocalPart = NULL; + xmlChar* qnamePrefix = NULL; + const xmlChar* qnameHref; + xmlNsPtr ns; + int ret; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(qname != NULL, -1); + xmlSecAssert2(mask != NULL, -1); + + qnameLocalPart = xmlStrchr(qname, ':'); + if(qnameLocalPart != NULL) { + qnamePrefix = xmlStrndup(qname, qnameLocalPart - qname); + if(qnamePrefix == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlStrndup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + "node=%s,value=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qname)); + return(-1); + } + qnameLocalPart++; + } else { + qnamePrefix = NULL; + qnameLocalPart = qname; + } + + /* search namespace href */ + ns = xmlSearchNs(node->doc, node, qnamePrefix); + if((ns == NULL) && (qnamePrefix != NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSearchNs", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s,qnamePrefix=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qnamePrefix)); + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(-1); + } + qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL; + + /* and finally search for integer */ + ret = xmlSecQName2BitMaskGetBitMask(info, qnameHref, qnameLocalPart, mask); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskGetBitMask", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,qnameLocalPart=%s,qnameHref=%s", + xmlSecErrorsSafeString(node->name), + xmlSecErrorsSafeString(qnameLocalPart), + xmlSecErrorsSafeString(qnameHref)); + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(-1); + } + + if(qnamePrefix != NULL) { + xmlFree(qnamePrefix); + } + return(0); +} + + +/** + * xmlSecQName2BitMaskGetStringFromBitMask: + * @info: the qname<->integer mapping information. + * @node: the pointer to node. + * @mask: the mask. + * + * Creates qname string for @mask in context of given @node. Caller + * is responsible for freeing returned string with @xmlFree. + * + * Returns pointer to newly allocated string on success or NULL if an error occurs, + */ +EXPORT_C +xmlChar* +xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info, + xmlNodePtr node, xmlSecBitMask mask) { + xmlSecQName2BitMaskInfoConstPtr qnameInfo; + + xmlSecAssert2(info != NULL, NULL); + xmlSecAssert2(node != NULL, NULL); + + qnameInfo = xmlSecQName2BitMaskGetInfo(info, mask); + if(qnameInfo == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskGetInfo", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s,mask=%d", + xmlSecErrorsSafeString(node->name), + mask); + return(NULL); + } + + return(xmlSecGetQName(node, qnameInfo->qnameHref, qnameInfo->qnameLocalPart)); +} + +/** + * xmlSecQName2BitMaskNodesRead: + * @info: the qname<->bit mask mapping information. + * @node: the start. + * @nodeName: the mask nodes name. + * @nodeNs: the mask nodes namespace. + * @stopOnUnknown: if this flag is set then function exits if unknown + * value was found. + * @mask: the pointer to result mask. + * + * Reads <@nodeNs:@nodeName> elements and puts the result bit mask + * into @mask. When function exits, @node points to the first element node + * after all the <@nodeNs:@nodeName> elements. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* node, + const xmlChar* nodeName, const xmlChar* nodeNs, + int stopOnUnknown, xmlSecBitMask* mask) { + xmlNodePtr cur; + xmlChar* content; + xmlSecBitMask tmp; + int ret; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(mask != NULL, -1); + + (*mask) = 0; + cur = (*node); + while((cur != NULL) && (xmlSecCheckNodeName(cur, nodeName, nodeNs))) { + content = xmlNodeGetContent(cur); + if(content == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlNodeGetContent", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(cur->name)); + return(-1); + } + + ret = xmlSecQName2BitMaskGetBitMaskFromString(info, cur, content, &tmp); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskGetBitMaskFromString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "value=%s", + xmlSecErrorsSafeString(content)); + xmlFree(content); + return(-1); + } + xmlFree(content); + + if((stopOnUnknown != 0) && (tmp == 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecQName2BitMaskGetBitMaskFromString", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "value=%s", + xmlSecErrorsSafeString(content)); + return(-1); + } + + (*mask) |= tmp; + cur = xmlSecGetNextElementNode(cur->next); + } + + (*node) = cur; + return(0); +} + +/** + * xmlSecQName2BitMaskNodesWrite: + * @info: the qname<->bit mask mapping information. + * @node: the parent element for mask nodes. + * @nodeName: the mask nodes name. + * @nodeNs: the mask nodes namespace. + * @mask: the bit mask. + * + * Writes <@nodeNs:@nodeName> elemnts with values from @mask to @node. + * + * Returns 0 on success or a negative value if an error occurs, + */ +EXPORT_C +int +xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr node, + const xmlChar* nodeName, const xmlChar* nodeNs, + xmlSecBitMask mask) { + unsigned int ii; + + xmlSecAssert2(info != NULL, -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(nodeName != NULL, -1); + + for(ii = 0; (mask != 0) && (info[ii].qnameLocalPart != NULL); ii++) { + xmlSecAssert2(info[ii].mask != 0, -1); + + if((mask & info[ii].mask) != 0) { + xmlNodePtr cur; + xmlChar* qname; + + qname = xmlSecGetQName(node, info[ii].qnameHref, info[ii].qnameLocalPart); + if(qname == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecGetQName", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(nodeName)); + return(-1); + } + + cur = xmlSecAddChild(node, nodeName, nodeNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XML_FAILED, + "node=%s", + xmlSecErrorsSafeString(nodeName)); + xmlFree(qname); + return(-1); + } + + xmlNodeSetContent(cur, qname); + xmlFree(qname); + } + } + return(0); +} + +/** + * xmlSecQName2BitMaskDebugDump: + * @info: the qname<->bit mask mapping information. + * @mask: the bit mask. + * @output: the pointer to output FILE. + * + * Prints debug information about @mask to @output. + */ +EXPORT_C +void +xmlSecQName2BitMaskDebugDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask, + const xmlChar* name, FILE* output) { + unsigned int ii; + + xmlSecAssert(info != NULL); + xmlSecAssert(name != NULL); + xmlSecAssert(output != NULL); + + if(mask == 0) { + return; + } + + fprintf(output, "== %s (0x%08x): ", name, mask); + for(ii = 0; (mask != 0) && (info[ii].qnameLocalPart != NULL); ii++) { + xmlSecAssert(info[ii].mask != 0); + + if((mask & info[ii].mask) != 0) { + fprintf(output, "name=\"%s\" (href=\"%s\"),", info[ii].qnameLocalPart, info[ii].qnameHref); + } + } + fprintf(output, "\n"); +} + +/** + * xmlSecQName2BitMaskDebugXmlDump: + * @info: the qname<->bit mask mapping information. + * @mask: the bit mask. + * @output: the pointer to output FILE. + * + * Prints debug information about @mask to @output in XML format. + */ +EXPORT_C +void +xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask, + const xmlChar* name, FILE* output) { + unsigned int ii; + + xmlSecAssert(info != NULL); + xmlSecAssert(name != NULL); + xmlSecAssert(output != NULL); + + if(mask == 0) { + return; + } + + fprintf(output, "<%sList>\n", name); + for(ii = 0; (mask != 0) && (info[ii].qnameLocalPart != NULL); ii++) { + xmlSecAssert(info[ii].mask != 0); + + if((mask & info[ii].mask) != 0) { + fprintf(output, "<%s href=\"%s\">%s\n", name, + info[ii].qnameHref, info[ii].qnameLocalPart, name); + } + } + fprintf(output, "\n", name); +} + + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xpath.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xpath.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1158 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * XPath transform + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_globals.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_list.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" + + +/************************************************************************** + * + * xmlSecXPathHereFunction: + * @ctxt: the ponter to XPath context. + * @nargs: the arguments nubmer. + * + * The implementation of XPath "here()" function. + * See xmlXPtrHereFunction() in xpointer.c. the only change is that + * we return NodeSet instead of NodeInterval. + * + *****************************************************************************/ +static void +xmlSecXPathHereFunction(xmlXPathParserContextPtr ctxt, int nargs) { + CHECK_ARITY(0); + + if((ctxt == NULL) || (ctxt->context == NULL) || (ctxt->context->here == NULL)) { + XP_ERROR(XPTR_SYNTAX_ERROR); + } + valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->here)); +} + +/************************************************************************** + * + * XPath/XPointer data + * + *****************************************************************************/ +typedef struct _xmlSecXPathData xmlSecXPathData, + *xmlSecXPathDataPtr; +typedef enum { + xmlSecXPathDataTypeXPath, + xmlSecXPathDataTypeXPath2, + xmlSecXPathDataTypeXPointer +} xmlSecXPathDataType; + +struct _xmlSecXPathData { + xmlSecXPathDataType type; + xmlXPathContextPtr ctx; + xmlChar* expr; + xmlSecNodeSetOp nodeSetOp; + xmlSecNodeSetType nodeSetType; +}; + +static xmlSecXPathDataPtr xmlSecXPathDataCreate (xmlSecXPathDataType type); +static void xmlSecXPathDataDestroy (xmlSecXPathDataPtr data); +static int xmlSecXPathDataSetExpr (xmlSecXPathDataPtr data, + const xmlChar* expr); +static int xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, + xmlNodePtr node); +static int xmlSecXPathDataNodeRead (xmlSecXPathDataPtr data, + xmlNodePtr node); +static xmlSecNodeSetPtr xmlSecXPathDataExecute (xmlSecXPathDataPtr data, + xmlDocPtr doc, + xmlNodePtr hereNode); + +static xmlSecXPathDataPtr +xmlSecXPathDataCreate(xmlSecXPathDataType type) { + xmlSecXPathDataPtr data; + + data = (xmlSecXPathDataPtr) xmlMalloc(sizeof(xmlSecXPathData)); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "sizeof(xmlSecXPathData)=%d", + sizeof(xmlSecXPathData)); + return(NULL); + } + memset(data, 0, sizeof(xmlSecXPathData)); + + data->type = type; + data->nodeSetType = xmlSecNodeSetTree; + + /* create xpath or xpointer context */ + switch(data->type) { + case xmlSecXPathDataTypeXPath: + case xmlSecXPathDataTypeXPath2: + data->ctx = xmlXPathNewContext(NULL); /* we'll set doc in the context later */ + if(data->ctx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPathNewContext", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(NULL); + } + break; + case xmlSecXPathDataTypeXPointer: + data->ctx = xmlXPtrNewContext(NULL, NULL, NULL); /* we'll set doc in the context later */ + if(data->ctx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPtrNewContext", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(NULL); + } + break; + } + + return(data); +} + +static void +xmlSecXPathDataDestroy(xmlSecXPathDataPtr data) { + xmlSecAssert(data != NULL); + + if(data->expr != NULL) { + xmlFree(data->expr); + } + if(data->ctx != NULL) { + xmlXPathFreeContext(data->ctx); + } + memset(data, 0, sizeof(xmlSecXPathData)); + xmlFree(data); +} + +static int +xmlSecXPathDataSetExpr(xmlSecXPathDataPtr data, const xmlChar* expr) { + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(data->expr == NULL, -1); + xmlSecAssert2(data->ctx != NULL, -1); + xmlSecAssert2(expr != NULL, -1); + + data->expr = xmlStrdup(expr); + if(data->expr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_STRDUP_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + + +static int +xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, xmlNodePtr node) { + xmlNodePtr cur; + xmlNsPtr ns; + int ret; + + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(data->ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + /* register namespaces */ + for(cur = node; cur != NULL; cur = cur->parent) { + for(ns = cur->nsDef; ns != NULL; ns = ns->next) { + /* check that we have no other namespace with same prefix already */ + if((ns->prefix != NULL) && (xmlXPathNsLookup(data->ctx, ns->prefix) == NULL)){ + ret = xmlXPathRegisterNs(data->ctx, ns->prefix, ns->href); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPathRegisterNs", + XMLSEC_ERRORS_R_XML_FAILED, + "href=%s;prefix=%s", + xmlSecErrorsSafeString(ns->href), + xmlSecErrorsSafeString(ns->prefix)); + return(-1); + } + } + } + } + + return(0); +} + +static int +xmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) { + int ret; + + xmlSecAssert2(data != NULL, -1); + xmlSecAssert2(data->expr == NULL, -1); + xmlSecAssert2(data->ctx != NULL, -1); + xmlSecAssert2(node != NULL, -1); + + ret = xmlSecXPathDataRegisterNamespaces (data, node); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXPathDataRegisterNamespaces", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* read node content and set expr */ + data->expr = xmlNodeGetContent(node); + if(data->expr == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static xmlSecNodeSetPtr +xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNode) { + xmlXPathObjectPtr xpathObj = NULL; + xmlSecNodeSetPtr nodes = NULL; + + xmlSecAssert2(data != NULL, NULL); + xmlSecAssert2(data->expr != NULL, NULL); + xmlSecAssert2(data->ctx != NULL, NULL); + xmlSecAssert2(doc != NULL, NULL); + xmlSecAssert2(hereNode != NULL, NULL); + + /* do not forget to set the doc */ + data->ctx->doc = doc; + + /* here function works only on the same document */ + if(hereNode->doc == doc) { + xmlXPathRegisterFunc(data->ctx, (xmlChar *)"here", xmlSecXPathHereFunction); + data->ctx->here = hereNode; + data->ctx->xptr = 1; + } + + /* execute xpath or xpointer expression */ + switch(data->type) { + case xmlSecXPathDataTypeXPath: + case xmlSecXPathDataTypeXPath2: + xpathObj = xmlXPathEvalExpression(data->expr, data->ctx); + if(xpathObj == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPathEvalExpression", + XMLSEC_ERRORS_R_XML_FAILED, + "expr=%s", + xmlSecErrorsSafeString(data->expr)); + return(NULL); + } + break; + case xmlSecXPathDataTypeXPointer: + xpathObj = xmlXPtrEval(data->expr, data->ctx); + if(xpathObj == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlXPtrEval", + XMLSEC_ERRORS_R_XML_FAILED, + "expr=%s", + xmlSecErrorsSafeString(data->expr)); + return(NULL); + } + break; + } + + if (xpathObj != NULL) { + nodes = xmlSecNodeSetCreate(doc, xpathObj->nodesetval, data->nodeSetType); + } + if(nodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "type=%d", data->nodeSetType); + xmlXPathFreeObject(xpathObj); + return(NULL); + } + xpathObj->nodesetval = NULL; + xmlXPathFreeObject(xpathObj); + + return(nodes); +} + + +/************************************************************************** + * + * XPath data list + * + *****************************************************************************/ +#define xmlSecXPathDataListId \ + xmlSecXPathDataListGetKlass() +static xmlSecPtrListId xmlSecXPathDataListGetKlass (void); +static xmlSecNodeSetPtr xmlSecXPathDataListExecute (xmlSecPtrListPtr dataList, + xmlDocPtr doc, + xmlNodePtr hereNode, + xmlSecNodeSetPtr nodes); + +static xmlSecPtrListKlass xmlSecXPathDataListKlass = { + BAD_CAST "xpath-data-list", + NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */ + (xmlSecPtrDestroyItemMethod)xmlSecXPathDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */ + NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */ +}; + +static xmlSecPtrListId +xmlSecXPathDataListGetKlass(void) { + return(&xmlSecXPathDataListKlass); +} + +static xmlSecNodeSetPtr +xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc, + xmlNodePtr hereNode, xmlSecNodeSetPtr nodes) { + xmlSecXPathDataPtr data; + xmlSecNodeSetPtr res, tmp, tmp2; + xmlSecSize pos; + + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), NULL); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) > 0, NULL); + xmlSecAssert2(doc != NULL, NULL); + xmlSecAssert2(hereNode != NULL, NULL); + + res = nodes; + for(pos = 0; pos < xmlSecPtrListGetSize(dataList); ++pos) { + data = (xmlSecXPathDataPtr)xmlSecPtrListGetItem(dataList, pos); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecPtrListGetItem", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + if((res != NULL) && (res != nodes)) { + xmlSecNodeSetDestroy(res); + } + return(NULL); + } + + tmp = xmlSecXPathDataExecute(data, doc, hereNode); + if(tmp == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecXPathDataExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if((res != NULL) && (res != nodes)) { + xmlSecNodeSetDestroy(res); + } + return(NULL); + } + + tmp2 = xmlSecNodeSetAdd(res, tmp, data->nodeSetOp); + if(tmp2 == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecNodeSetAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecNodeSetIntersection"); + if((res != NULL) && (res != nodes)) { + xmlSecNodeSetDestroy(res); + } + xmlSecNodeSetDestroy(tmp); + return(NULL); + } + res = tmp2; + } + + return(res); +} + +/****************************************************************************** + * + * XPath/XPointer transforms + * + * xmlSecXPathDataList is located after xmlSecTransform structure + * + *****************************************************************************/ +#define xmlSecXPathTransformSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecPtrList)) +#define xmlSecXPathTransformGetDataList(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecXPathTransformSize)) ? \ + (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlSecPtrListPtr)NULL) +#define xmlSecTransformXPathCheckId(transform) \ + (xmlSecTransformCheckId((transform), xmlSecTransformXPathId) || \ + xmlSecTransformCheckId((transform), xmlSecTransformXPath2Id) || \ + xmlSecTransformCheckId((transform), xmlSecTransformXPointerId)) + +static int xmlSecTransformXPathInitialize (xmlSecTransformPtr transform); +static void xmlSecTransformXPathFinalize (xmlSecTransformPtr transform); +static int xmlSecTransformXPathExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +static int +xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) { + xmlSecPtrListPtr dataList; + int ret; + + xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(dataList != NULL, -1); + + ret = xmlSecPtrListInitialize(dataList, xmlSecXPathDataListId); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListInitialize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static void +xmlSecTransformXPathFinalize(xmlSecTransformPtr transform) { + xmlSecPtrListPtr dataList; + + xmlSecAssert(xmlSecTransformXPathCheckId(transform)); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId)); + + xmlSecPtrListFinalize(dataList); +} + +static int +xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last, + xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr dataList; + xmlDocPtr doc; + + xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1); + xmlSecAssert2(transform->hereNode != NULL, -1); + xmlSecAssert2(transform->outNodes == NULL, -1); + xmlSecAssert2(last != 0, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) > 0, -1); + + doc = (transform->inNodes != NULL) ? transform->inNodes->doc : transform->hereNode->doc; + xmlSecAssert2(doc != NULL, -1); + + transform->outNodes = xmlSecXPathDataListExecute(dataList, doc, + transform->hereNode, transform->inNodes); + if(transform->outNodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataExecute", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/****************************************************************************** + * + * XPath transform + * + *****************************************************************************/ +static int xmlSecTransformXPathNodeRead (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); + +static xmlSecTransformKlass xmlSecTransformXPathKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecXPathTransformSize, /* xmlSecSize objSize */ + + xmlSecNameXPath, /* const xmlChar* name; */ + xmlSecXPathNs, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecTransformXPathNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformXPathGetKlass: + * + * The XPath transform evaluates given XPath expression and + * intersects the result with the previous nodes set. See + * http://www.w3.org/TR/xmldsig-core/#sec-XPath for more details. + * + * Returns XPath transform id. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformXPathGetKlass(void) { + return(&xmlSecTransformXPathKlass); +} + +static const char xpathPattern[] = "(//. | //@* | //namespace::*)[%s]"; +static int +xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr dataList; + xmlSecXPathDataPtr data; + xmlNodePtr cur; + xmlChar* tmp; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPathId), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1); + + /* there is only one required node */ + cur = xmlSecGetNextElementNode(node->children); + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPath, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeXPath)); + return(-1); + } + + /* read information from the node */ + data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecXPathDataNodeRead(data, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* append it to the list */ + ret = xmlSecPtrListAdd(dataList, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* create full XPath expression */ + xmlSecAssert2(data->expr != NULL, -1); + tmp = (xmlChar*) xmlMalloc(sizeof(xmlChar) * (xmlStrlen(data->expr) + + strlen(xpathPattern) + 1)); + if(tmp == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_MALLOC_FAILED, + "size=%d", + xmlStrlen(data->expr) + strlen(xpathPattern) + 1); + return(-1); + } + sprintf((char*)tmp, xpathPattern, (char*)data->expr); + xmlFree(data->expr); + data->expr = tmp; + + /* set correct node set type and operation */ + data->nodeSetOp = xmlSecNodeSetIntersection; + data->nodeSetType = xmlSecNodeSetNormal; + + /* check that we have nothing else */ + cur = xmlSecGetNextElementNode(cur->next); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/****************************************************************************** + * + * XPath2 transform + * + *****************************************************************************/ +static int xmlSecTransformXPath2NodeRead (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +static xmlSecTransformKlass xmlSecTransformXPath2Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecXPathTransformSize, /* xmlSecSize objSize */ + + xmlSecNameXPath2, /* const xmlChar* name; */ + xmlSecXPath2Ns, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecTransformXPath2NodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformXPath2GetKlass: + * + * The XPath2 transform (http://www.w3.org/TR/xmldsig-filter2/). + * + * Returns XPath2 transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformXPath2GetKlass(void) { + return(&xmlSecTransformXPath2Klass); +} + +static int +xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr dataList; + xmlSecXPathDataPtr data; + xmlNodePtr cur; + xmlChar* op; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPath2Id), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1); + + /* There are only xpath nodes */ + cur = xmlSecGetNextElementNode(node->children); + while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeXPath2, xmlSecXPath2Ns)) { + /* read information from the node */ + data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath2); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecXPathDataNodeRead(data, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* append it to the list */ + ret = xmlSecPtrListAdd(dataList, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* set correct node set type and operation */ + data->nodeSetType = xmlSecNodeSetTree; + op = xmlGetProp(cur, xmlSecAttrFilter); + if(op == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecAttrFilter), + XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + if(xmlStrEqual(op, xmlSecXPath2FilterIntersect)) { + data->nodeSetOp = xmlSecNodeSetIntersection; + } else if(xmlStrEqual(op, xmlSecXPath2FilterSubtract)) { + data->nodeSetOp = xmlSecNodeSetSubtraction; + } else if(xmlStrEqual(op, xmlSecXPath2FilterUnion)) { + data->nodeSetOp = xmlSecNodeSetUnion; + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecAttrFilter), + XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, + "filter=%s", + xmlSecErrorsSafeString(op)); + xmlFree(op); + return(-1); + } + xmlFree(op); + + cur = xmlSecGetNextElementNode(cur->next); + } + + /* check that we have nothing else */ + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +/****************************************************************************** + * + * XPointer transform + * + *****************************************************************************/ +static int xmlSecTransformXPointerNodeRead (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +static xmlSecTransformKlass xmlSecTransformXPointerKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecXPathTransformSize, /* xmlSecSize objSize */ + + xmlSecNameXPointer, /* const xmlChar* name; */ + xmlSecXPointerNs, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecTransformXPointerNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformXPointerGetKlass: + * + * The XPointer transform klass + * (http://www.ietf.org/internet-drafts/draft-eastlake-xmldsig-uri-02.txt). + * + * Returns XPointer transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformXPointerGetKlass(void) { + return(&xmlSecTransformXPointerKlass); +} + +/** + * xmlSecTransformXPointerSetExpr: + * @transform: the pointer to XPointer transform. + * @expr: the XPointer expression. + * @nodeSetType: the type of evaluated XPointer expression. + * @hereNode: the pointer to "here" node. + * + * Sets the XPointer expression for an XPointer @transform. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr, + xmlSecNodeSetType nodeSetType, xmlNodePtr hereNode) { + xmlSecPtrListPtr dataList; + xmlSecXPathDataPtr data; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPointerId), -1); + xmlSecAssert2(transform->hereNode == NULL, -1); + xmlSecAssert2(expr != NULL, -1); + xmlSecAssert2(hereNode != NULL, -1); + + transform->hereNode = hereNode; + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1); + + data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecXPathDataRegisterNamespaces(data, hereNode); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataRegisterNamespaces", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + ret = xmlSecXPathDataSetExpr(data, expr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataSetExpr", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* append it to the list */ + ret = xmlSecPtrListAdd(dataList, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* set correct node set type and operation */ + data->nodeSetOp = xmlSecNodeSetIntersection; + data->nodeSetType = nodeSetType; + + return(0); +} + +static int +xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) { + xmlSecPtrListPtr dataList; + xmlSecXPathDataPtr data; + xmlNodePtr cur; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPointerId), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + dataList = xmlSecXPathTransformGetDataList(transform); + xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1); + xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1); + + /* there is only one required node */ + cur = xmlSecGetNextElementNode(node->children); + if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPointer, xmlSecXPointerNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "expected=%s", + xmlSecErrorsSafeString(xmlSecNodeXPath)); + return(-1); + } + + /* read information from the node */ + data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer); + if(data == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecXPathDataNodeRead(data, cur); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXPathDataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* append it to the list */ + ret = xmlSecPtrListAdd(dataList, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecPtrListAdd", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecXPathDataDestroy(data); + return(-1); + } + + /* set correct node set type and operation */ + data->nodeSetOp = xmlSecNodeSetIntersection; + data->nodeSetType = xmlSecNodeSetTree; + + /* check that we have nothing else */ + cur = xmlSecGetNextElementNode(cur->next); + if(cur != NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + + +/****************************************************************************** + * + * Visa3DHack transform + * + *****************************************************************************/ +#define xmlSecVisa3DHackTransformSize \ + (sizeof(xmlSecTransform) + sizeof(xmlChar*)) +#define xmlSecVisa3DHackTransformGetIDPtr(transform) \ + ((xmlSecTransformCheckSize((transform), xmlSecVisa3DHackTransformSize)) ? \ + (xmlChar**)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \ + (xmlChar**)NULL) +#define xmlSecTransformVisa3DHackCheckId(transform) \ + (xmlSecTransformCheckId((transform), xmlSecTransformVisa3DHackId)) + +static int xmlSecTransformVisa3DHackInitialize (xmlSecTransformPtr transform); +static void xmlSecTransformVisa3DHackFinalize (xmlSecTransformPtr transform); +static int xmlSecTransformVisa3DHackExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +static xmlSecTransformKlass xmlSecTransformVisa3DHackKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecVisa3DHackTransformSize, /* xmlSecSize objSize */ + + BAD_CAST "Visa3DHackTransform", /* const xmlChar* name; */ + NULL, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */ + + xmlSecTransformVisa3DHackInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecTransformVisa3DHackFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + NULL, /* xmlSecTransformPushBinMethod pushBin; */ + NULL, /* xmlSecTransformPopBinMethod popBin; */ + xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */ + xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecTransformVisa3DHackExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformVisa3DHackGetKlass: + * + * The Visa3DHack transform klass. The only reason why we need this + * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows + * something like "#12345" in the URI attribute. + * + * Returns Visa3DHack transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecTransformVisa3DHackGetKlass(void) { + return(&xmlSecTransformVisa3DHackKlass); +} + +/** + * xmlSecTransformVisa3DHackSetID: + * @transform: the pointer to Visa3DHack transform. + * @id: the ID value. + * + * Sets the ID value for an Visa3DHack @transform. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecTransformVisa3DHackSetID(xmlSecTransformPtr transform, const xmlChar* id) { + xmlChar** idPtr; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformVisa3DHackId), -1); + xmlSecAssert2(id != NULL, -1); + + idPtr = xmlSecVisa3DHackTransformGetIDPtr(transform); + xmlSecAssert2(idPtr != NULL, -1); + xmlSecAssert2((*idPtr) == NULL, -1); + + (*idPtr) = xmlStrdup(id); + if((*idPtr) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecTransformVisa3DHackInitialize(xmlSecTransformPtr transform) { + xmlSecAssert2(xmlSecTransformVisa3DHackCheckId(transform), -1); + + return(0); +} + +static void +xmlSecTransformVisa3DHackFinalize(xmlSecTransformPtr transform) { + xmlChar** idPtr; + + xmlSecAssert(xmlSecTransformVisa3DHackCheckId(transform)); + + idPtr = xmlSecVisa3DHackTransformGetIDPtr(transform); + xmlSecAssert(idPtr != NULL); + + if((*idPtr) != NULL) { + xmlFree((*idPtr)); + } + (*idPtr) = NULL; +} + +static int +xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last, + xmlSecTransformCtxPtr transformCtx) { + xmlChar** idPtr; + xmlDocPtr doc; + xmlAttrPtr attr; + xmlNodeSetPtr nodeSet; + + xmlSecAssert2(xmlSecTransformVisa3DHackCheckId(transform), -1); + xmlSecAssert2(transform->outNodes == NULL, -1); + xmlSecAssert2(last != 0, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + idPtr = xmlSecVisa3DHackTransformGetIDPtr(transform); + xmlSecAssert2(idPtr != NULL, -1); + xmlSecAssert2((*idPtr) != NULL, -1); + + doc = (transform->inNodes != NULL) ? transform->inNodes->doc : transform->hereNode->doc; + xmlSecAssert2(doc != NULL, -1); + + attr = xmlGetID(doc, (*idPtr)); + if((attr == NULL) || (attr->parent == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlGetID", + XMLSEC_ERRORS_R_XML_FAILED, + "id=\"%s\"", + xmlSecErrorsSafeString((*idPtr))); + return(-1); + } + + nodeSet = xmlXPathNodeSetCreate(attr->parent); + if(nodeSet == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlXPathNodeSetCreate", + XMLSEC_ERRORS_R_XML_FAILED, + "id=\"%s\"", + xmlSecErrorsSafeString((*idPtr))); + return(-1); + } + + transform->outNodes = xmlSecNodeSetCreate(doc, nodeSet, xmlSecNodeSetTreeWithoutComments); + if(transform->outNodes == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecNodeSetCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlXPathFreeNodeSet(nodeSet); + return(-1); + } + return(0); +} + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsec/src/xmlsec_xslt.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsec/src/xmlsec_xslt.c Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,521 @@ +/** + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * XSLT Transform (http://www.w3.org/TR/xmldsig-core/#sec-XSLT) + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsec_config.h" +#ifndef XMLSEC_NO_XSLT +#include "xmlsec_globals.h" + +#include +#include + +#include +#include //added for symbian port +#include +#include +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keys.h" +#include "xmlsec_parser.h" +#include "xmlsec_errors.h" + +/************************************************************************** + * + * Internal xslt ctx + * + *****************************************************************************/ +typedef struct _xmlSecXsltCtx xmlSecXsltCtx, *xmlSecXsltCtxPtr; +struct _xmlSecXsltCtx { + xsltStylesheetPtr xslt; + xmlParserCtxtPtr parserCtx; +}; + +/**************************************************************************** + * + * XSLT transform + * + * xmlSecXsltCtx is located after xmlSecTransform + * + ***************************************************************************/ +#define xmlSecXsltSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecXsltCtx)) +#define xmlSecXsltGetCtx(transform) \ + ((xmlSecXsltCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) + +static int xmlSecXsltInitialize (xmlSecTransformPtr transform); +static void xmlSecXsltFinalize (xmlSecTransformPtr transform); +static int xmlSecXsltReadNode (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecXsltPushBin (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + int final, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecXsltExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecXslProcess (xmlSecBufferPtr in, + xmlSecBufferPtr out, + xsltStylesheetPtr stylesheet); +static xmlSecTransformKlass xmlSecXsltKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecXsltSize, /* xmlSecSize objSize */ + + xmlSecNameXslt, /* const xmlChar* name; */ + xmlSecHrefXslt, /* const xmlChar* href; */ + xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */ + + xmlSecXsltInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecXsltFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecXsltReadNode, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecXsltPushBin, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecXsltExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecTransformXsltGetKlass: + * + * XSLT transform klass (http://www.w3.org/TR/xmldsig-core/#sec-XSLT): + * + * The normative specification for XSL Transformations is [XSLT]. + * Specification of a namespace-qualified stylesheet element, which MUST be + * the sole child of the Transform element, indicates that the specified style + * sheet should be used. Whether this instantiates in-line processing of local + * XSLT declarations within the resource is determined by the XSLT processing + * model; the ordered application of multiple stylesheet may require multiple + * Transforms. No special provision is made for the identification of a remote + * stylesheet at a given URI because it can be communicated via an xsl:include + * or xsl:import within the stylesheet child of the Transform. + * + * This transform requires an octet stream as input. If the actual input is an + * XPath node-set, then the signature application should attempt to convert it + * to octets (apply Canonical XML]) as described in the Reference Processing + * Model (section 4.3.3.2).] + * + * The output of this transform is an octet stream. The processing rules for + * the XSL style sheet or transform element are stated in the XSLT specification + * [XSLT]. We RECOMMEND that XSLT transform authors use an output method of xml + * for XML and HTML. As XSLT implementations do not produce consistent + * serializations of their output, we further RECOMMEND inserting a transform + * after the XSLT transform to canonicalize the output. These steps will help + * to ensure interoperability of the resulting signatures among applications + * that support the XSLT transform. Note that if the output is actually HTML, + * then the result of these steps is logically equivalent [XHTML]. + * + * Returns pointer to XSLT transform klass. + */ +xmlSecTransformId +xmlSecTransformXsltGetKlass(void) { + return(&xmlSecXsltKlass); +} + +static int +xmlSecXsltInitialize(xmlSecTransformPtr transform) { + xmlSecXsltCtxPtr ctx; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1); + + ctx = xmlSecXsltGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + + /* initialize context */ + memset(ctx, 0, sizeof(xmlSecXsltCtx)); + return(0); +} + +static void +xmlSecXsltFinalize(xmlSecTransformPtr transform) { + xmlSecXsltCtxPtr ctx; + + xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformXsltId)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecXsltSize)); + + ctx = xmlSecXsltGetCtx(transform); + xmlSecAssert(ctx != NULL); + + if(ctx->xslt != NULL) { + xsltFreeStylesheet(ctx->xslt); + } + if(ctx->parserCtx != NULL) { + xmlFreeParserCtxt(ctx->parserCtx); + } + memset(ctx, 0, sizeof(xmlSecXsltCtx)); +} + +/** + * xmlSecXsltReadNode: + */ +static int +xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) { + xmlSecXsltCtxPtr ctx; + xmlBufferPtr buffer; + xmlDocPtr doc; + xmlNodePtr cur; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1); + xmlSecAssert2(node != NULL, -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecXsltGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->xslt == NULL, -1); + + /* read content in the buffer */ + buffer = xmlBufferCreate(); + if(buffer == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlBufferCreate", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + cur = node->children; + while(cur != NULL) { + xmlNodeDump(buffer, cur->doc, cur, 0, 0); + cur = cur->next; + } + + /* parse the buffer */ + doc = xmlSecParseMemory(xmlBufferContent(buffer), + xmlBufferLength(buffer), 1); + if(doc == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecParseMemory", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlBufferFree(buffer); + return(-1); + } + + /* pre-process stylesheet */ + ctx->xslt = xsltParseStylesheetDoc(doc); + if(ctx->xslt == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xsltParseStylesheetDoc", + XMLSEC_ERRORS_R_XSLT_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + /* after parsing stylesheet doc is assigned + * to it and will be freed by xsltFreeStylesheet() */ + xmlFreeDoc(doc); + xmlBufferFree(buffer); + return(-1); + } + + xmlBufferFree(buffer); + return(0); +} + +static int +xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data, + xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) { + xmlSecXsltCtxPtr ctx; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecXsltGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->xslt != NULL, -1); + + /* check/update current transform status */ + if(transform->status == xmlSecTransformStatusNone) { + xmlSecAssert2(ctx->parserCtx == NULL, -1); + + ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL); + if(ctx->parserCtx == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlCreatePushParserCtxt", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* required for c14n! */ + ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + ctx->parserCtx->replaceEntities = 1; + + transform->status = xmlSecTransformStatusWorking; + } else if(transform->status == xmlSecTransformStatusFinished) { + return(0); + } else if(transform->status != xmlSecTransformStatusWorking) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1); + xmlSecAssert2(ctx->parserCtx != NULL, -1); + + /* push data to the input buffer */ + if((data != NULL) && (dataSize > 0)) { + ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + "size=%d", dataSize); + return(-1); + } + } + + /* finish parsing, apply xslt transforms and push to next in the chain */ + if(final != 0) { + xmlDocPtr docIn; + xmlDocPtr docOut; + xmlOutputBufferPtr output; + + /* finalize */ + ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1); + if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlParseChunk", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + docIn = ctx->parserCtx->myDoc; + ctx->parserCtx->myDoc = NULL; + + docOut = xsltApplyStylesheet(ctx->xslt, docIn, NULL); + if(docOut == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xsltApplyStylesheet", + XMLSEC_ERRORS_R_XSLT_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(docIn); + return(-1); + } + xmlFreeDoc(docIn); + + if(transform->next != NULL) { + output = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx); + if(output == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecTransformCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(docOut); + return(-1); + } + } else { + output = xmlSecBufferCreateOutputBuffer(&(transform->outBuf)); + if(output == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(docOut); + return(-1); + } + } + + ret = xsltSaveResultTo(output, docOut, ctx->xslt); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xsltSaveResultTo", + XMLSEC_ERRORS_R_XSLT_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlOutputBufferClose(output); + xmlFreeDoc(docOut); + return(-1); + } + ret = xmlOutputBufferClose(output); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlOutputBufferClose", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFreeDoc(docOut); + return(-1); + } + xmlFreeDoc(docOut); + + transform->status = xmlSecTransformStatusFinished; + } + + return(0); +} + +static int +xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) { + xmlSecXsltCtxPtr ctx; + xmlSecBufferPtr in, out; + xmlSecSize inSize, outSize; + int ret; + + xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1); + xmlSecAssert2(transformCtx != NULL, -1); + + ctx = xmlSecXsltGetCtx(transform); + xmlSecAssert2(ctx != NULL, -1); + xmlSecAssert2(ctx->xslt != NULL, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + inSize = xmlSecBufferGetSize(in); + outSize = xmlSecBufferGetSize(out); + + if(transform->status == xmlSecTransformStatusNone) { + transform->status = xmlSecTransformStatusWorking; + } + + if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) { + /* just do nothing */ + xmlSecAssert2(outSize == 0, -1); + + } else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) { + xmlSecAssert2(outSize == 0, -1); + + ret = xmlSecXslProcess(in, out, ctx->xslt); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecXslProcess", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + + transform->status = xmlSecTransformStatusFinished; + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(inSize == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + return(0); +} + +static int +xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out, xsltStylesheetPtr stylesheet) { + xmlDocPtr docIn = NULL; + xmlDocPtr docOut = NULL; + xmlOutputBufferPtr output = NULL; + int res = -1; + int ret; + + xmlSecAssert2(in != NULL, -1); + xmlSecAssert2(out != NULL, -1); + xmlSecAssert2(stylesheet != NULL, -1); + + docIn = xmlSecParseMemory(xmlSecBufferGetData(in), xmlSecBufferGetSize(in), 1); + if(docIn == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecParseMemory", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + docOut = xsltApplyStylesheet(stylesheet, docIn, NULL); + if(docOut == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xsltApplyStylesheet", + XMLSEC_ERRORS_R_XSLT_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + output = xmlSecBufferCreateOutputBuffer(out); + if(output == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferCreateOutputBuffer", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + ret = xsltSaveResultTo(output, docOut, stylesheet); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xsltSaveResultTo", + XMLSEC_ERRORS_R_XSLT_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + ret = xmlOutputBufferClose(output); + output = NULL; + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlOutputBufferClose", + XMLSEC_ERRORS_R_XML_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + res = 0; + +done: + if(output != NULL) xmlOutputBufferClose(output); + if(docIn != NULL) xmlFreeDoc(docIn); + if(docOut != NULL) xmlFreeDoc(docOut); + return(res); +} + +#endif /* XMLSEC_NO_XSLT */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/bwinscw/xmlseccertman.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/bwinscw/xmlseccertman.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,38 @@ +EXPORTS + ??1CSymbianCertChain@@UAE@XZ @ 1 NONAME ; CSymbianCertChain::~CSymbianCertChain(void) + ?AddCert@CSymbianCertStore@@QAEXABVTDesC8@@0@Z @ 2 NONAME ; void CSymbianCertStore::AddCert(class TDesC8 const &, class TDesC8 const &) + ?CreateRSAKey@CSymbianKeyStore@@QAEXIABVTDesC8@@@Z @ 3 NONAME ; void CSymbianKeyStore::CreateRSAKey(unsigned int, class TDesC8 const &) + ?CreateUnifiedCertStoreL@CSymbianCertStore@@QAEXXZ @ 4 NONAME ; void CSymbianCertStore::CreateUnifiedCertStoreL(void) + ?CreateUnifiedKeyStoreL@CSymbianKeyStore@@QAEXXZ @ 5 NONAME ; void CSymbianKeyStore::CreateUnifiedKeyStoreL(void) + ?FindCertL@CSymbianCertStore@@QAEXABVTDesC8@@@Z @ 6 NONAME ; void CSymbianCertStore::FindCertL(class TDesC8 const &) + ?FindKey@CSymbianKeyStore@@QAEXABVTDesC8@@W4EKeyAlgorithm@CKeyInfoBase@@@Z @ 7 NONAME ; void CSymbianKeyStore::FindKey(class TDesC8 const &, enum CKeyInfoBase::EKeyAlgorithm) + ?GetCertList@CSymbianCertStore@@QAE?AV?$RMPointerArray@VCCTCertInfo@@@@XZ @ 8 NONAME ; class RMPointerArray CSymbianCertStore::GetCertList(void) + ?GetCertSize@CSymbianCertStore@@QAEIXZ @ 9 NONAME ; unsigned int CSymbianCertStore::GetCertSize(void) + ?GetError@CSymbianCertChain@@QAEHXZ @ 10 NONAME ; int CSymbianCertChain::GetError(void) + ?GetError@CSymbianCertStore@@QAEHXZ @ 11 NONAME ; int CSymbianCertStore::GetError(void) + ?GetError@CSymbianKeyStore@@QAEHXZ @ 12 NONAME ; int CSymbianKeyStore::GetError(void) + ?GetKeyAlgorithm@CSymbianKeyStore@@QAE?AW4EKeyAlgorithm@CKeyInfoBase@@XZ @ 13 NONAME ; enum CKeyInfoBase::EKeyAlgorithm CSymbianKeyStore::GetKeyAlgorithm(void) + ?GetKeySize@CSymbianKeyStore@@QAEIXZ @ 14 NONAME ; unsigned int CSymbianKeyStore::GetKeySize(void) + ?GetRetrieveCertData@CSymbianCertStore@@QAEPAVHBufC8@@XZ @ 15 NONAME ; class HBufC8 * CSymbianCertStore::GetRetrieveCertData(void) + ?GetRetrieveCertObject@CSymbianCertStore@@QAEPAVCCertificate@@XZ @ 16 NONAME ; class CCertificate * CSymbianCertStore::GetRetrieveCertObject(void) + ?GetSignedData@CSymbianKeyStore@@QAEPBEPAI@Z @ 17 NONAME ; unsigned char const * CSymbianKeyStore::GetSignedData(unsigned int *) + ?GetValidateResult@CSymbianCertChain@@QAEHXZ @ 18 NONAME ; int CSymbianCertChain::GetValidateResult(void) + ?GetVerifyResult@CSymbianKeyStore@@QAEHXZ @ 19 NONAME ; int CSymbianKeyStore::GetVerifyResult(void) + ?ImportKey@CSymbianKeyStore@@QAEXABVTDesC8@@0@Z @ 20 NONAME ; void CSymbianKeyStore::ImportKey(class TDesC8 const &, class TDesC8 const &) + ?InitializeL@CSymbianCertChain@@QAEXPAEIABV?$RPointerArray@VCX509Certificate@@@@@Z @ 21 NONAME ; void CSymbianCertChain::InitializeL(unsigned char *, unsigned int, class RPointerArray const &) + ?ListCertL@CSymbianCertStore@@QAEXXZ @ 22 NONAME ; void CSymbianCertStore::ListCertL(void) + ?NewL@CSymbianCertChain@@SAPAV1@XZ @ 23 NONAME ; class CSymbianCertChain * CSymbianCertChain::NewL(void) + ?NewL@CSymbianCertStore@@SAPAV1@XZ @ 24 NONAME ; class CSymbianCertStore * CSymbianCertStore::NewL(void) + ?NewL@CSymbianKeyStore@@SAPAV1@XZ @ 25 NONAME ; class CSymbianKeyStore * CSymbianKeyStore::NewL(void) + ?NewLC@CSymbianCertStore@@SAPAV1@XZ @ 26 NONAME ; class CSymbianCertStore * CSymbianCertStore::NewLC(void) + ?NewLC@CSymbianKeyStore@@SAPAV1@XZ @ 27 NONAME ; class CSymbianKeyStore * CSymbianKeyStore::NewLC(void) + ?RSASignL@CSymbianKeyStore@@QAEXPBEI@Z @ 28 NONAME ; void CSymbianKeyStore::RSASignL(unsigned char const *, unsigned int) + ?RSAVerifyL@CSymbianKeyStore@@QAEXPBEI0I@Z @ 29 NONAME ; void CSymbianKeyStore::RSAVerifyL(unsigned char const *, unsigned int, unsigned char const *, unsigned int) + ?RSAVerifyWithPublicKeyL@CSymbianKeyStore@@QAEHPBEI0IPAVCSubjectPublicKeyInfo@@@Z @ 30 NONAME ; int CSymbianKeyStore::RSAVerifyWithPublicKeyL(unsigned char const *, unsigned int, unsigned char const *, unsigned int, class CSubjectPublicKeyInfo *) + ?RetrieveCertDataL@CSymbianCertStore@@QAEXXZ @ 31 NONAME ; void CSymbianCertStore::RetrieveCertDataL(void) + ?RetrieveCertObjectL@CSymbianCertStore@@QAEXXZ @ 32 NONAME ; void CSymbianCertStore::RetrieveCertObjectL(void) + ?SetCert@CSymbianCertStore@@QAEXPAVCCTCertInfo@@@Z @ 33 NONAME ; void CSymbianCertStore::SetCert(class CCTCertInfo *) + ?ValidateL@CSymbianCertChain@@QAEXXZ @ 34 NONAME ; void CSymbianCertChain::ValidateL(void) + ?hasCert@CSymbianCertStore@@QAEHXZ @ 35 NONAME ; int CSymbianCertStore::hasCert(void) + ?hasKey@CSymbianKeyStore@@QAEHXZ @ 36 NONAME ; int CSymbianKeyStore::hasKey(void) + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/eabi/wsstarxmlseccertman.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/eabi/wsstarxmlseccertman.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +EXPORTS + _ZN16CSymbianKeyStore10GetKeySizeEv @ 1 NONAME + _ZN16CSymbianKeyStore10RSAVerifyLEPKhjS1_j @ 2 NONAME + _ZN16CSymbianKeyStore12CreateRSAKeyEjRK6TDesC8 @ 3 NONAME + _ZN16CSymbianKeyStore13GetSignedDataEPj @ 4 NONAME + _ZN16CSymbianKeyStore15GetKeyAlgorithmEv @ 5 NONAME + _ZN16CSymbianKeyStore15GetVerifyResultEv @ 6 NONAME + _ZN16CSymbianKeyStore22CreateUnifiedKeyStoreLEv @ 7 NONAME + _ZN16CSymbianKeyStore23RSAVerifyWithPublicKeyLEPKhjS1_jP21CSubjectPublicKeyInfo @ 8 NONAME + _ZN16CSymbianKeyStore4NewLEv @ 9 NONAME + _ZN16CSymbianKeyStore5NewLCEv @ 10 NONAME + _ZN16CSymbianKeyStore6hasKeyEv @ 11 NONAME + _ZN16CSymbianKeyStore7FindKeyERK6TDesC8N12CKeyInfoBase13EKeyAlgorithmE @ 12 NONAME + _ZN16CSymbianKeyStore8GetErrorEv @ 13 NONAME + _ZN16CSymbianKeyStore8RSASignLEPKhj @ 14 NONAME + _ZN16CSymbianKeyStore9ImportKeyERK6TDesC8S2_ @ 15 NONAME + _ZN17CSymbianCertChain11InitializeLEPhjRK13RPointerArrayI16CX509CertificateE @ 16 NONAME + _ZN17CSymbianCertChain17GetValidateResultEv @ 17 NONAME + _ZN17CSymbianCertChain4NewLEv @ 18 NONAME + _ZN17CSymbianCertChain8GetErrorEv @ 19 NONAME + _ZN17CSymbianCertChain9ValidateLEv @ 20 NONAME + _ZN17CSymbianCertChainD0Ev @ 21 NONAME + _ZN17CSymbianCertChainD1Ev @ 22 NONAME + _ZN17CSymbianCertChainD2Ev @ 23 NONAME + _ZN17CSymbianCertStore11GetCertListEv @ 24 NONAME + _ZN17CSymbianCertStore11GetCertSizeEv @ 25 NONAME + _ZN17CSymbianCertStore17RetrieveCertDataLEv @ 26 NONAME + _ZN17CSymbianCertStore19GetRetrieveCertDataEv @ 27 NONAME + _ZN17CSymbianCertStore19RetrieveCertObjectLEv @ 28 NONAME + _ZN17CSymbianCertStore21GetRetrieveCertObjectEv @ 29 NONAME + _ZN17CSymbianCertStore23CreateUnifiedCertStoreLEv @ 30 NONAME + _ZN17CSymbianCertStore4NewLEv @ 31 NONAME + _ZN17CSymbianCertStore5NewLCEv @ 32 NONAME + _ZN17CSymbianCertStore7AddCertERK6TDesC8S2_ @ 33 NONAME + _ZN17CSymbianCertStore7SetCertEP11CCTCertInfo @ 34 NONAME + _ZN17CSymbianCertStore7hasCertEv @ 35 NONAME + _ZN17CSymbianCertStore8GetErrorEv @ 36 NONAME + _ZN17CSymbianCertStore9FindCertLERK6TDesC8 @ 37 NONAME + _ZN17CSymbianCertStore9ListCertLEv @ 38 NONAME + _ZTI16CSymbianKeyStore @ 39 NONAME ; ## + _ZTI17CSymbianCertChain @ 40 NONAME ; ## + _ZTI17CSymbianCertStore @ 41 NONAME ; ## + _ZTV16CSymbianKeyStore @ 42 NONAME ; ## + _ZTV17CSymbianCertChain @ 43 NONAME ; ## + _ZTV17CSymbianCertStore @ 44 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/eabi/xmlseccertman.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/eabi/xmlseccertman.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,46 @@ +EXPORTS + _ZN16CSymbianKeyStore10GetKeySizeEv @ 1 NONAME + _ZN16CSymbianKeyStore10RSAVerifyLEPKhjS1_j @ 2 NONAME + _ZN16CSymbianKeyStore12CreateRSAKeyEjRK6TDesC8 @ 3 NONAME + _ZN16CSymbianKeyStore13GetSignedDataEPj @ 4 NONAME + _ZN16CSymbianKeyStore15GetKeyAlgorithmEv @ 5 NONAME + _ZN16CSymbianKeyStore15GetVerifyResultEv @ 6 NONAME + _ZN16CSymbianKeyStore22CreateUnifiedKeyStoreLEv @ 7 NONAME + _ZN16CSymbianKeyStore23RSAVerifyWithPublicKeyLEPKhjS1_jP21CSubjectPublicKeyInfo @ 8 NONAME + _ZN16CSymbianKeyStore4NewLEv @ 9 NONAME + _ZN16CSymbianKeyStore5NewLCEv @ 10 NONAME + _ZN16CSymbianKeyStore6hasKeyEv @ 11 NONAME + _ZN16CSymbianKeyStore7FindKeyERK6TDesC8N12CKeyInfoBase13EKeyAlgorithmE @ 12 NONAME + _ZN16CSymbianKeyStore8GetErrorEv @ 13 NONAME + _ZN16CSymbianKeyStore8RSASignLEPKhj @ 14 NONAME + _ZN16CSymbianKeyStore9ImportKeyERK6TDesC8S2_ @ 15 NONAME + _ZN17CSymbianCertChain11InitializeLEPhjRK13RPointerArrayI16CX509CertificateE @ 16 NONAME + _ZN17CSymbianCertChain17GetValidateResultEv @ 17 NONAME + _ZN17CSymbianCertChain4NewLEv @ 18 NONAME + _ZN17CSymbianCertChain8GetErrorEv @ 19 NONAME + _ZN17CSymbianCertChain9ValidateLEv @ 20 NONAME + _ZN17CSymbianCertChainD0Ev @ 21 NONAME + _ZN17CSymbianCertChainD1Ev @ 22 NONAME + _ZN17CSymbianCertChainD2Ev @ 23 NONAME + _ZN17CSymbianCertStore11GetCertListEv @ 24 NONAME + _ZN17CSymbianCertStore11GetCertSizeEv @ 25 NONAME + _ZN17CSymbianCertStore17RetrieveCertDataLEv @ 26 NONAME + _ZN17CSymbianCertStore19GetRetrieveCertDataEv @ 27 NONAME + _ZN17CSymbianCertStore19RetrieveCertObjectLEv @ 28 NONAME + _ZN17CSymbianCertStore21GetRetrieveCertObjectEv @ 29 NONAME + _ZN17CSymbianCertStore23CreateUnifiedCertStoreLEv @ 30 NONAME + _ZN17CSymbianCertStore4NewLEv @ 31 NONAME + _ZN17CSymbianCertStore5NewLCEv @ 32 NONAME + _ZN17CSymbianCertStore7AddCertERK6TDesC8S2_ @ 33 NONAME + _ZN17CSymbianCertStore7SetCertEP11CCTCertInfo @ 34 NONAME + _ZN17CSymbianCertStore7hasCertEv @ 35 NONAME + _ZN17CSymbianCertStore8GetErrorEv @ 36 NONAME + _ZN17CSymbianCertStore9FindCertLERK6TDesC8 @ 37 NONAME + _ZN17CSymbianCertStore9ListCertLEv @ 38 NONAME + _ZTI16CSymbianKeyStore @ 39 NONAME DATA 12 ; ## + _ZTI17CSymbianCertChain @ 40 NONAME DATA 12 ; ## + _ZTI17CSymbianCertStore @ 41 NONAME DATA 12 ; ## + _ZTV16CSymbianKeyStore @ 42 NONAME DATA 32 ; ## + _ZTV17CSymbianCertChain @ 43 NONAME DATA 32 ; ## + _ZTV17CSymbianCertStore @ 44 NONAME DATA 32 ; ## + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description : Build information file for XMLSec CertMan component +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +PRJ_EXPORTS +../inc/xmlsecmsymbiancertchain.h |../../inc/xmlsecmsymbiancertchain.h +../inc/xmlsecmsymbiancertstore.h |../../inc/xmlsecmsymbiancertstore.h +../inc/xmlsecmsymbiankeystore.h |../../inc/xmlsecmsymbiankeystore.h +../rom/xmlseccertman.iby CORE_OS_LAYER_IBY_EXPORT_PATH(xmlseccertman.iby) + + +PRJ_MMPFILES +xmlseccertman.mmp + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/group/xmlseccertman.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/group/xmlseccertman.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description : Project definition file for XMLSec CertMan component +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +TARGET xmlseccertman.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9791 + +SOURCEPATH ../src +SOURCE xmlsecmsymbiankeystore.cpp +SOURCE xmlsecmsymbiancertstore.cpp +SOURCE xmlsecmsymbiancertchain.cpp + +OS_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/libc + +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY certstore.lib +LIBRARY efsrv.lib +LIBRARY ctframework.lib +LIBRARY cryptography.lib +LIBRARY x509.lib +LIBRARY crypto.lib +LIBRARY pkixcert.lib +LIBRARY charconv.lib +LIBRARY asn1.lib + +nostrictdef + +#if defined(ARMCC) +#if !defined(__RD_XMLSEC_MEMCOPY_PROBLEM_FIX__) + DEFFILE ../eabi/xmlseccertman.def +#else + DEFFILE ../eabi/wsstarxmlseccertman.def +#endif +#elif defined(WINSCW) || defined(WINS) + DEFFILE ../bwinscw/xmlseccertman.def +#endif + +#ifdef CAP_GENERAL_DLL + CAPABILITY CAP_GENERAL_DLL +#else + CAPABILITY ALL -TCB +#endif + + VENDORID VID_DEFAULT + +SMPSAFE diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiancertchain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiancertchain.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An XmlSec interface to the Symbian PKIXCertChain. +* +*/ + +#ifndef __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__ +#define __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__ + +// INCLUDES +#include +#include + +class CSymbianCertChain : public CActive + { +public: // Constructors and destructor + + /** + * Create new object. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CSymbianCertChain* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CSymbianCertChain(); + + /** + * Create the PKIXCertChain iCertChain + * + * @since S60 v3.2 + * @param aEncodedCerts One or more concatenated DER encoded X.509 certificates in TUint8 format + * @param aEncodedCertsLen Length of the DER encoded X.509 certificates + * @param aRootCerts An array of certificates which the chain will treat as candidate root certificates + */ + IMPORT_C void CSymbianCertChain::InitializeL(TUint8 *aEncodedCerts, + TUint aEncodedCertsLen, + const RPointerArray< CX509Certificate > &aRootCerts); + + /** + * Call ValidateL() of the iCertChain + * @since S60 v3.2 + */ + IMPORT_C void CSymbianCertChain::ValidateL(); + + /** + * Get the validation result + * + * @since S60 v3.2 + * @return EValidatedOK (0) if validation succeeds + * @return -1 if no result can be fetched + * @return enum TValidationError if validation fails + */ + IMPORT_C TInt CSymbianCertChain::GetValidateResult(); + + /** + * Get the error flag + * + * @since S60 v3.2 + * @return error code + */ + IMPORT_C TInt CSymbianCertChain::GetError(); + +protected: + /** + * From CActive Callback function, invoked to handle responses from the server + */ + void RunL(); + + /** + * This function is called as part of the active object's Cancel(). + */ + void DoCancel(); + + /** + * Handles Leaves from RunL function. + */ + TInt RunError(TInt aError); + +private: + /** + * C++ default constructor. + */ + CSymbianCertChain(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** + * State of active object. + * EUnitialized before validation + * EValidate after validation + */ + enum TState + { + EUnitialized, + EValidate + }; + + /** + * A reference to the cert chain + */ + CPKIXCertChain *iCertChain; + + /** + * Contain result of the validation + */ + CPKIXValidationResult *iValidationResult; + + /** + * An internal state + */ + TState iState; + + /** + * A reference to the File Server Client + */ + RFs iFs; + + /** + * Error flag + */ + TInt iError; + }; + +#endif // __XMLSECCERTMAN_SYMBIANCERTCHAIN_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiancertstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiancertstore.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An XmlSec interface to the Symbian Unified Certificate Store. +* +*/ + +#ifndef __XMLSECCERTMAN_SYMBIANCERTSTORE_H_ +#define __XMLSECCERTMAN_SYMBIANCERTSTORE_H__ + +#include +#include +#include +#include +#include + +class CSymbianCertStore : public CActive + { +public: + + /** + * Create new object. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CSymbianCertStore* NewL(); + + /** + * Create new object and put it on clean stack. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CSymbianCertStore* NewLC(); + + /** + * Destructor. + */ + virtual ~CSymbianCertStore(); + + /** + * Create Unified Cert Store + * + * @since S60 v3.2 + */ + void CreateUnifiedCertStoreL(); + + /** + * Find a cert in the Unified Cert Store + * + * @since S60 v3.2 + * @param aLabel The name of the cert to be found + */ + IMPORT_C void FindCertL(const TDesC8 &aLabel); + + /** + * List certs from the Unified Cert Store + * + * @since S60 v3.2 + * @param aLabel The name of the cert to be found + */ + IMPORT_C void ListCertL(); + + /** + * Get list of certs from SymbianCertStore + * + * @since S60 v3.2 + * @return RMPointerArray list + */ + IMPORT_C RMPointerArray GetCertList(); + + /** + * Check if a cert is found in the Unified Cert Store + * + * @since S60 v3.2 + * @return KErrNone if the cert is found + * @return KErrNotFound if the cert is not found + */ + IMPORT_C TInt CSymbianCertStore::hasCert(); + + /** + * Sets iCert + * + * @since S60 v3.2 + */ + IMPORT_C void SetCert(CCTCertInfo* cert); + + /** + * Get the size of the cert stored + * + * @since S60 v3.2 + * @return TUint Size of the cert + */ + IMPORT_C TUint GetCertSize(); + + /** + * AddCert + * + * @since S60 v3.2 + * @param aCertData The cert data + * @param aCertName Name of the cert + */ + IMPORT_C void AddCert (const TDesC8 &aCertData, const TDesC8 &aCertName); + + /** + * Retrieve Cert Data. Sets iCertData from iCert + * + * @since S60 v3.2 + */ + IMPORT_C void RetrieveCertDataL(); + + /** + * Get Cert Data. + * + * @since S60 v3.2 + * @return the buffer with cert data + */ + IMPORT_C HBufC8* GetRetrieveCertData(); + + /** + * Retrieve Cert Object. Sets iCertObject from iCert + * + * @since S60 v3.2 + */ + IMPORT_C void RetrieveCertObjectL(); + + /** + * Get Cert Object. + * + * @since S60 v3.2 + * @return reference to object type CCertificate + */ + IMPORT_C CCertificate* GetRetrieveCertObject(); + + /** + * Get the error flag + * + * @since S60 v3.2 + * @return error code + */ + IMPORT_C TInt CSymbianCertStore::GetError(); + +protected: + /** + * From CActive Callback function, invoked to handle responses from the server + */ + void RunL(); + + /** + * This function is called as part of the active object's Cancel(). + */ + void DoCancel(); + + /** + * Handles Leaves from RunL function. + */ + TInt RunError(TInt aError); + +private: + /** + * C++ default constructor. + */ + CSymbianCertStore(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Release all resources kept in iCerts array (exept for iCert + * which is released separetly) and empty iCerts array + */ + void ResetAndDestroyCertsArray(); + + /** + * Release all resources kept in iCerts array and empty iCerts array + */ + void ResetCertsList(); + + /** + * To find matched key in the phase EFindingKeys + */ + void FindMatchedCert(); + +private: + /** + * State of active object. + * EUnitialized standard state + * EInitializingCertStore during initialize certstore + * EFindingCerts during finding cert + * EListCerts during listing certs + * EAddingCert during adding cert + * ERetrievingCertData during retrieving cert data + * ERetrievingCertObject during retrieving cert object + */ + enum TState + { + EUnitialized, + EInitializingCertStore, + EFindingCerts, + EListCerts, + EAddingCert, + ERetrievingCertData, + ERetrievingCertObject + }; + +private: + /** + * A reference to the CUnifiedCertStore class + */ + CUnifiedCertStore *iCertStore; + + /** + * A reference to the WritableCertStore + */ + MCTWritableCertStore *iWritableCertStore; + + /** + * Store the retrived cert + */ + CCTCertInfo *iCert; + + /** + * An internal state + */ + TState iState; + + /** + * Store filter to search in SymbianCertStore + */ + CCertAttributeFilter* iCertFilter; + + /** + * To store the cert label + */ + HBufC* iCertLabel; + + /** + * To store the cert data + */ + HBufC8* iCertData; + + /** + * store the retrived parsed representation, derived object + */ + CCertificate* iCertObject; + + /** + * Store the certs found + */ + RMPointerArray< CCTCertInfo > iCerts; + + /** + * A reference to the File Server Client + */ + RFs iFs; + + /** + * Error flag + */ + TInt iError; + }; + +#endif // __XMLSECCERTMAN_SYMBIANCERTSTORE_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiankeystore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/inc/xmlsecmsymbiankeystore.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,341 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to the Symbian Unified Key Store +* +*/ + +#ifndef __XMLSECCERTMAN_SYMBIANKEYSTORE_H_ +#define __XMLSECCERTMAN_SYMBIANKEYSTORE_H__ + +#include +#include +#include +#include + +class CSymbianKeyStore : public CActive + { +public: + + /** + * Create new object. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CSymbianKeyStore* NewL(); + + /** + * Create new object and put it on clean stack. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CSymbianKeyStore* NewLC(); + + /** + * Destructor. + */ + virtual ~CSymbianKeyStore(); + + /** + * Create Unified Key Store + * + * @since S60 v3.2 + */ + void CreateUnifiedKeyStoreL(); + + /** + * Find a key in the Unified Key Store + * + * @since S60 v3.2 + * @param aLabel The name of the key to be found + * @param aAlgo The algorithm of the key to be found + */ + IMPORT_C void FindKey(const TDesC8 &aLabel, CKeyInfoBase::EKeyAlgorithm aAlgo); + + /** + * Check if a key is found in the Unified Key Store + * + * @since S60 v3.2 + * @return KErrNone if the key is found + * @return KErrNotFound if the key is not found + */ + IMPORT_C TInt hasKey(); + + /** + * Get the size of the key stored + * + * @since S60 v3.2 + * @return TUint Size of the key + */ + IMPORT_C TUint GetKeySize(); + + /** + * Get the algorithm of the key stored + * + * @since S60 v3.2 + * @return CCTKeyInfo::EKeyAlgorithm + */ + IMPORT_C CCTKeyInfo::EKeyAlgorithm GetKeyAlgorithm(); + + /** + * Create RSA Key + * + * @since S60 v3.2 + * @param aSize Bit size of the key + * @param aKeyName Name of the key + */ + IMPORT_C void CreateRSAKey(TUint aSize, const TDesC8 &aKeyName); + + /** + * Import key + * + * @since S60 v3.2 + * @param aKeyData The key data to import, ASN.1 DER encoded PKCS#8 + * @aKeyName Name of the key + */ + IMPORT_C void ImportKey(const TDesC8 &aKeyData, const TDesC8 &aKeyName); + + /** + * Opens RSA key for signing the data + * + * @since S60 v3.2 + * @param aDataToSign The data to be signed + * @param aLen Length of the data + */ + IMPORT_C void RSASignL(const TUint8* aDataToSign, TUint aLen); + + /** + * Verify a RSA signed data + * + * @since S60 v3.2 + * @param aDataToVerify The signed data to be verified + * @param aDataLen Length of the signed data + * @param aSig A reference to the signature that signed the data + * @param aSigLen Length of the signature + */ + IMPORT_C void RSAVerifyL(const TUint8* aDataToVerify, + TUint aDataLen, + const TUint8* aSig, + TUint aSigLen); + + /** + * Verify an RSA signed data with a public key passed from a certificate + * + * @since S60 v3.2 + * @param aDataToVerify The signed data to be verified + * @param aDataLen Length of the signed data + * @param aSig A reference to the signature that signed the data + * @param aSigLen Length of the signature + * @param aSubPubKeyInfo A handle to the public key passed from a certificate + * @return ETrue The verification is succeeded + * @return EFalse The verification is failed + */ + IMPORT_C TBool RSAVerifyWithPublicKeyL(const TUint8* aDataToVerify, + TUint aDataLen, + const TUint8* aSig, + TUint aSigLen, + CSubjectPublicKeyInfo *aSubPubKeyInfo); + + /** + * Gets Signed data + * + * @since S60 v3.2 + * @param aLen sets length of signed data + */ + IMPORT_C const TUint8* GetSignedData(TUint* aLen); + + /** + * Gets verification result + * + * @since S60 v3.2 + * @return ETrue The verification was succeeded + * @return EFalse The cerification was failed + */ + IMPORT_C TBool GetVerifyResult(); + + /** + * Get the error flag + * + * @since S60 v3.2 + * @return error code + */ + IMPORT_C TInt CSymbianKeyStore::GetError(); + + /** + * Perform RSA sign operation + * + * @since S60 v3.2 + */ + void PerformRSASignOperation(); + + /** + * Perform RSA verify operation + * + * @since S60 v3.2 + */ + void PerformRSAVerifyOperationL(); + + /** + * Export public key if none present + * + * @since S60 v3.2 + */ + void ExportRSAPublicKeyL(); + +protected: + /** + * From CActive Callback function, invoked to handle responses from the server + */ + void RunL(); + + /** + * This function is called as part of the active object's Cancel(). + */ + void DoCancel(); + + /** + * Handles Leaves from RunL function. + */ + TInt RunError(TInt aError); + +private: + /** + * C++ default constructor. + */ + CSymbianKeyStore(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * To find matched key in the phase EFindingKeys + */ + void FindMatchedKey(); + + /** + * Sets iSignature buffer + */ + void GetRSASignatureL(); + + /** + * Release all resources kept in iKeys array (exept for iKey + * which is released separetly) and empty iKeys array + */ + void ResetAndDestroyKeysArray(); + +private: + /** + * State of active object. + * EUnitialized standard state + * EInitializingKeystore during initialize keystore + * EFindingKeys during finding keys + * ECreateKey during creating key + * EImportKey during importing key + * EOpenRsaKeyForSigning during preparing key for signing + * EPerformRSASignOperation during signing + * EExportPublic during exporting public key + */ + enum TState + { + EUnitialized, + EInitializingKeystore, + EFindingKeys, + ECreateKey, + EImportKey, + EOpenRSAKeyForSigning, + EPerformRSASignOperation, + EExportPublic + }; + +private: + /** + * A reference to the CUnifiedKeyStore class + */ + CUnifiedKeyStore *iKeyStore; + + /** + * Store the generated key + */ + CCTKeyInfo *iKey; + + /** + * Store the RSA Signer + */ + MRSASigner *iRSASigner; + + /** + * Store the data to be signed + */ + HBufC8* iDataToSign; + + /** + * Store the data to be verified + */ + HBufC8* iDataToVerify; + + /** + * Contain the result of the RSA Signer + */ + CRSASignature* iRSASignature; + + /** + * Store the signed signature + */ + HBufC8* iSignature; + + /** + * Contain the exported public key + */ + HBufC8* iPublicKeyData; + + /** + * An internal state + */ + TState iState; + + /** + * To store the key label to find + */ + HBufC *iKeyLabelToFind; + + /** + * Store the result of signature verification + */ + TBool iVerifyResult; + + /** + * To check if it was out of memory during previous verify operation + */ + TBool iOutOfMemoryFlag; + + /** + * Store the keys found + */ + RMPointerArray< CCTKeyInfo > iKeys; + + /** + * A reference to the File Server Client + */ + RFs iFs; + + /** + * Error flag + */ + TInt iError; + }; + +#endif // __XMLSECCERTMAN_SYMBIANKEYSTORE_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/rom/xmlseccertman.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/rom/xmlseccertman.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for XMLSec CertMan component +* +*/ + +#ifndef __XMLSECCERTMAN_IBY__ +#define __XMLSECCERTMAN_IBY__ + +file=ABI_DIR\BUILD_DIR\xmlseccertman.dll SHARED_LIB_DIR\xmlseccertman.dll + +#endif //__XMLSECCERTMAN_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiancertchain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiancertchain.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An XmlSec interface to the Symbian Unified Certificate Store +* +*/ + +#include "xmlsecmsymbiancertchain.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CSymbianCertChain::CSymbianCertChain() +: CActive( EPriorityStandard ), + iCertChain( NULL ), + iValidationResult( NULL ), + iState( EUnitialized ) + { + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CSymbianCertChain::ConstructL() + { + User::LeaveIfError(iFs.Connect()); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CSymbianCertChain* CSymbianCertChain::NewL() + { + CSymbianCertChain* self = new( ELeave ) CSymbianCertChain; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CSymbianCertChain::~CSymbianCertChain() + { + Cancel(); + + if (iCertChain) + { + delete iCertChain; + } + + if (iValidationResult) + { + delete iValidationResult; + } + + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// RunL +// Handles an active object's request completion event. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CSymbianCertChain::RunL() + { + TInt errorCode = iStatus.Int(); + if ( errorCode ) + { + User::Leave(errorCode); + } + + switch(iState) + { + case EValidate: + CActiveScheduler::Stop(); + break; + default: + break; + + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// This function is called as part of the active object's Cancel(). +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CSymbianCertChain::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CSymbianCertStore::RunError +// Handles Leaves from RunL function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CSymbianCertChain::RunError(TInt aError) + { + iError=aError; + CActiveScheduler::Stop(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// InitializeL +// Creates the CPKIXCertChain +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianCertChain::InitializeL( + TUint8 *aEncodedCerts, // One or more concatenated DER encoded X.509 certificates + TUint aEncodedCertsLen, // Length of the DER encoded X.509 certificates + const RPointerArray< CX509Certificate > &aRootCerts) // An array of certificates which the chain will treat as candidate root certificates + { + + TPtrC8 certPtr(aEncodedCerts, aEncodedCertsLen); + + if (iCertChain) + { + delete iCertChain; + iCertChain = NULL; + } + + iCertChain = CPKIXCertChain::NewL(iFs, certPtr, aRootCerts); + } + +// ----------------------------------------------------------------------------- +// ValidateL +// Validate the certificate +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianCertChain::ValidateL() + { + // iValidationResult will contain the result of the validation + __ASSERT_ALWAYS(iCertChain, User::Leave(KErrGeneral)); + + if (iValidationResult) + { + delete iValidationResult; + iValidationResult = NULL; + } + + TTime validationTime; + validationTime.HomeTime(); + + iValidationResult = CPKIXValidationResult::NewL(); + + iCertChain->ValidateL(*iValidationResult, validationTime, iStatus); + + iState = EValidate; + SetActive(); + } + +// ----------------------------------------------------------------------------- +// GetValidateResult +// Get the result of the validation +// Returns: EValidatedOK (0) if validation succeeds +// -1 if no result can be fetched +// enum TValidationError if validation fails +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSymbianCertChain::GetValidateResult() + { + // iValidationResult contains the result of the validation + if (!iValidationResult) + return -1; + + return iValidationResult->Error().iReason; + + } + +// ----------------------------------------------------------------------------- +// GetError +// Get the error flag +// Returns: error code +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSymbianCertChain::GetError() + { + return iError; + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiancertstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiancertstore.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1846 @@ +/* + +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + +* All rights reserved. + +* This component and the accompanying materials are made available + +* under the terms of "Eclipse Public License v1.0" + +* which accompanies this distribution, and is available + +* at the URL "http://www.eclipse.org/legal/epl-v10.html". + +* + +* Initial Contributors: + +* Nokia Corporation - initial contribution. + +* + +* Contributors: + +* + +* Description: An XmlSec interface to the Symbian Unified Certificate Store + +* + +*/ + + + + + +#include + + + +#include + + + +#include + + + +#include + + + + + + + +#include "xmlsecmsymbiancertstore.h" + + + +// ----------------------------------------------------------------------------- + + + +// FindMatchedCert + + + +// Find the cert that matched iCertLabel from iCerts. + + + +// The cert found will be stored in iCert. + + + +// ----------------------------------------------------------------------------- + + + +// + + + +void CSymbianCertStore::FindMatchedCert() + + + + { + + + + TInt numCert = iCerts.Count(); + + + + // Reset iCert + + + + if (iCert) + + + + { + + + + //delete iCert; + + + + iCert->Release(); + + + + iCert = NULL; + + + + } + + + + // No label to be found + + + + if (!iCertLabel) + + + + return; + + + + for (int i=0;iCompare(cert->Label()) == 0) + + + + { + + + + iCert = cert; + + + + } + + + + } + + + + ResetAndDestroyCertsArray(); //iCerts + + + + } + + + + + + + +// --------------------------------------------------------------------------- + + + +// Constructor + + + +// --------------------------------------------------------------------------- + + + +// + + + +CSymbianCertStore::CSymbianCertStore() + + + +: CActive( EPriorityStandard ), + + + + iState( EUnitialized ) + + + + { + + + + } + + + + + + + +// --------------------------------------------------------------------------- + + + +// Second phase constructor + + + +// --------------------------------------------------------------------------- + + + +// + + + +void CSymbianCertStore::ConstructL() + + + + { + + + + User::LeaveIfError(iFs.Connect()); + + + + CActiveScheduler::Add(this); + + + + } + + + + + + + +// --------------------------------------------------------------------------- + + + +// Two phase constructor + + + +// --------------------------------------------------------------------------- + + + +// + + + +EXPORT_C CSymbianCertStore* CSymbianCertStore::NewL() + + + + { + + + + CSymbianCertStore* self = NewLC(); + + + + CleanupStack::Pop(self); + + + + return self; + + + + } + + + + + + + +// --------------------------------------------------------------------------- + + + +// Two phase constructor + + + +// --------------------------------------------------------------------------- + + + +// + + + +EXPORT_C CSymbianCertStore* CSymbianCertStore::NewLC() + + + + { + + + + CSymbianCertStore* self = new( ELeave ) CSymbianCertStore; + + + + CleanupStack::PushL( self ); + + + + self->ConstructL(); + + + + return self; + + + + } + + + + + + + +// --------------------------------------------------------------------------- + + + +// Destructor + + + +// --------------------------------------------------------------------------- + + + +// + + + +CSymbianCertStore::~CSymbianCertStore() + + + + { + + + + Cancel(); + + + + ResetAndDestroyCertsArray(); //iCerts + + + + // Free memory + + + + delete iCertFilter; + + + + delete iCertLabel; + + + + delete iCertData; + + + + delete iCertObject; + + + + if (iCert) + + + + { + + + + iCert->Release(); + + + + } + + + + + + + + delete iCertStore; + + + + iFs.Close(); + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// Release all resources kept in iCerts array (exept for iCert which is released + + + +// separetly) and empty iCerts array + + + +// ----------------------------------------------------------------------------- + + + +// + + + + void CSymbianCertStore::ResetAndDestroyCertsArray() + + + + { + + + + TInt count = iCerts.Count(); + + + + for ( int i=0; iRelease(); + + + + } + + + + } + + + + iCerts.Reset(); + + + + } + + + +// ----------------------------------------------------------------------------- + + + +// Release all resources kept in iCerts array and empty iCerts array + + + +// ----------------------------------------------------------------------------- + + + +// + + + + void CSymbianCertStore::ResetCertsList() + + + + { + + + + TInt count = iCerts.Count(); + + + + for ( int i=0; iRelease(); + + + + } + + + + iCerts.Reset(); + + + + } + + + +// ----------------------------------------------------------------------------- + + + +//RunL + + + +// Handles an active object's request completion event. + + + +// (other items were commented in a header). + + + +// ----------------------------------------------------------------------------- + + + +// + + + +void CSymbianCertStore::RunL() + + + + { + + + + if (iStatus!=KErrNone) + + + + { + + + + TInt err = iStatus.Int(); + + + + User::Leave(iStatus.Int()); + + + + } + + + + switch(iState) + + + + { + + + + case EInitializingCertStore: + + + + CActiveScheduler::Stop(); + + + + break; + + + + case EFindingCerts: + + + + FindMatchedCert(); + + + + CActiveScheduler::Stop(); + + + + break; + + + + case EListCerts: + + + + CActiveScheduler::Stop(); + + + + break; + + + + case EAddingCert: + + + + CActiveScheduler::Stop(); + + + + break; + + + + case ERetrievingCertData: + + + + CActiveScheduler::Stop(); + + + + break; + + + + case ERetrievingCertObject: + + + + CActiveScheduler::Stop(); + + + + break; + + + + } + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// DoCancel + + + +// This function is called as part of the active object's Cancel(). + + + +// (other items were commented in a header). + + + +// ----------------------------------------------------------------------------- + + + +// + + + +void CSymbianCertStore::DoCancel() + + + + { + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// RunError + + + +// Handles Leaves from RunL function. + + + +// (other items were commented in a header). + + + +// ----------------------------------------------------------------------------- + + + +// + + + +TInt CSymbianCertStore::RunError(TInt aError) + + + + { + + + + iError=aError; + + + + CActiveScheduler::Stop(); + + + + return KErrNone; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// CreateUnifiedCertStoreL + + + +// Create the Unified Cert Store structure iCertStore + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::CreateUnifiedCertStoreL() + + + + { + + + + if (iCertStore) + + + + { + + + + delete iCertStore; + + + + iCertStore = NULL; + + + + } + + + + + + + + iCertStore = CUnifiedCertStore::NewL(iFs,ETrue); + + + + iCertStore->Initialize(iStatus); + + + + iState = EInitializingCertStore; + + + + SetActive(); + + + + // RunL() called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// FindCert + + + +// Lists certs from Unified Cert Store in iCerts with label + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::FindCertL(const TDesC8 &aLabel) + + + + { + + + + if(iCertFilter) + + + + { + + + + delete iCertFilter; + + + + iCertFilter = NULL; + + + + } + + + + iCertFilter = CCertAttributeFilter::NewL(); + + + + iCertFilter->SetFormat(EX509Certificate); + + + + iCertFilter->SetOwnerType(ECACertificate); + + + + // Store aLabel + + + + if (iCertLabel) + + + + { + + + + delete iCertLabel; + + + + iCertLabel = NULL; + + + + } + + + + TRAPD(err,iCertLabel = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aLabel)); + + + + if (err != KErrNone) + + + + { + + + + iError=err; + + + + } + + + + iCertStore->List(iCerts, *iCertFilter, iStatus); + + + + iState = EFindingCerts; + + + + SetActive(); + + + + // RunL() called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// ListCert + + + +// List certs from Unified Cert Store in iCerts. + + + +// The found certs will be stored in iCerts + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::ListCertL() + + + + { + + + + if(iCertFilter) + + + + { + + + + delete iCertFilter; + + + + iCertFilter = NULL; + + + + } + + + + if(iCerts.Count()) + + + + { + + + + ResetCertsList(); + + + + } + + + + iCertFilter = CCertAttributeFilter::NewL(); + + + + iCertFilter->SetFormat(EX509Certificate); + + + + iCertFilter->SetOwnerType(ECACertificate); + + + + + + + + iCertStore->List(iCerts, *iCertFilter, iStatus); + + + + iState = EListCerts; + + + + SetActive(); + + + + // RunL() called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// GetCertsList + + + +// Returns certs list from SymbianCertStore. + + + +// Returns: RMPointerArray list + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C RMPointerArray CSymbianCertStore::GetCertList() + + + + { + + + + return iCerts; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// hasCert + + + +// Check if a cert is found in the Unified Cert Store + + + +// Returns: KErrNone if iCert is set + + + +// KErrNotFound in other case + + + +// ----------------------------------------------------------------------------- + + + +EXPORT_C TInt CSymbianCertStore::hasCert() + + + + { + + + + if (iCert) + + + + return KErrNone; + + + + else + + + + return KErrNotFound; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// SetCert + + + +// Sets iCert. + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::SetCert(CCTCertInfo* cert) + + + + { + + + + iCert=cert; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// GetCertSize + + + +// Returns size of the cert. + + + +// Returns: TUint size + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C TUint CSymbianCertStore::GetCertSize() + + + + { + + + + // assert iCert + + + + return iCert->Size(); + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// AddCertL + + + +// Add cert to Unified Cert Store + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::AddCert( + + + + const TDesC8 &aCertData, + + + + const TDesC8 &aCertName) + + + + { + + + + if (iCert) + + + + { + + + + //delete iCert; + + + + iCert->Release(); + + + + iCert = NULL; + + + + } + + + + //iWritableCertStore=&(iCertStore->WritableCertStore(0)); + + + + TInt num = iCertStore->WritableCertStoreCount(); + + + + TBool found = EFalse; + + + + + + + + for (TInt i = 0;iWritableCertStore(i)); + + + + MCTToken& token = iWritableCertStore->Token(); + + + + TUid tokenuid = token.Handle().iTokenTypeUid; + + + + if ( tokenuid == TUid::Uid(KTokenTypeFileCertstore) ) // Symbian's file cert store, defined in mctcertstore.h + + + + { + + + + found = ETrue; + + + + break; + + + + } + + + + } + + + + + + + + if ( !found && (num > 0) ) + + + + { + + + + // Not found, let's use the first one as a default anyway + + + + iWritableCertStore = &(iCertStore->WritableCertStore(0)); + + + + } + + + + + + + + // Convert key name from TDesC8 to TDesC16 + + + + HBufC16* unicodeCertName=NULL; + + + + TRAPD(err,unicodeCertName=CnvUtfConverter::ConvertToUnicodeFromUtf8L(aCertName)); + + + + if (err != KErrNone) + + + + { + + + + iError=err; + + + + } + + + + iWritableCertStore->Add(*unicodeCertName, + + + + EX509Certificate, + + + + ECACertificate, + + + + NULL, + + + + NULL, + + + + aCertData, + + + + iStatus); + + + + delete unicodeCertName; + + + + iState = EAddingCert; + + + + SetActive(); + + + + // RunL() called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// RetrieveCertDataL + + + +// Sets iCertData from iCert + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::RetrieveCertDataL() + + + + { + + + + if(!iCert) + + + + User::Leave(KErrNotFound); + + + + if(iCertData) + + + + { + + + + delete iCertData; + + + + iCertData = NULL; + + + + } + + + + iCertData = HBufC8::NewMaxL(iCert->Size()); + + + + TPtr8 data=iCertData->Des(); + + + + iCertStore->Retrieve(*iCert, data, iStatus); + + + + iState = ERetrievingCertData; + + + + SetActive(); + + + + // RunL called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// GetRetrieveCertData + + + +// Returns cert data. + + + +// Returns: HBufC8* iCertData + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C HBufC8* CSymbianCertStore::GetRetrieveCertData() + + + + { + + + + return iCertData; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// RetrieveCertObjectL + + + +// Set iCertObject from iCert + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C void CSymbianCertStore::RetrieveCertObjectL() + + + + { + + + + if(!iCert) + + + + User::Leave(KErrNotFound); + + + + if(iCertObject) + + + + { + + + + delete iCertObject; + + + + iCertObject = NULL; + + + + } + + + + iCertStore->Retrieve(*iCert, iCertObject, iStatus); + + + + iState = ERetrievingCertObject; + + + + SetActive(); + + + + // RunL called when this completes + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// GetRetrieveCertObject + + + +// Returns cert object. + + + +// Returns: CCertificate* iCertObject + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C CCertificate* CSymbianCertStore::GetRetrieveCertObject() + + + + { + + + + return iCertObject; + + + + } + + + + + + + +// ----------------------------------------------------------------------------- + + + +// GetError + + + +// Get the error flag + + + +// Returns: error code + + + +// ----------------------------------------------------------------------------- + + + +// + + + +EXPORT_C TInt CSymbianCertStore::GetError() + + + + { + + + + return iError; + + + + } + + + + + + + + + + + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiankeystore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccertman/src/xmlsecmsymbiankeystore.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,788 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An XmlSec interface to the Symbian Unified Key Store. +* +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "xmlsecmsymbiankeystore.h" + +// ----------------------------------------------------------------------------- +// FindMatchedKey Find the key that matched iKeyLabelToFind from iKeys. +// The key found will be stored in iKey +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::FindMatchedKey() + { + + TInt numKey = iKeys.Count(); + + // Reset iKey + if (iKey) + { + iKey->Release(); + iKey = NULL; + } + + // No label to be found + if (!iKeyLabelToFind) + return; + + for (int i=0;iCompare(key->Label()) == 0) + { + iKey = key; + } + } + + ResetAndDestroyKeysArray(); //iKeys + } + +// ----------------------------------------------------------------------------- +// GetRSASignatureL +// Sets iSignature buffer +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::GetRSASignatureL() + { + if (iSignature) + { + delete iSignature; + iSignature = NULL; + } + iSignature = iRSASignature->S().BufferLC(); + CleanupStack::Pop(iSignature); // BufferLC + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CSymbianKeyStore::CSymbianKeyStore() +: CActive( EPriorityStandard ), + iState( EUnitialized ), + iVerifyResult( EFalse ) + { + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CSymbianKeyStore::ConstructL() + { + User::LeaveIfError(iFs.Connect()); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CSymbianKeyStore* CSymbianKeyStore::NewL() + { + CSymbianKeyStore* self = NewLC(); + CleanupStack::Pop(self); + + return self; + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CSymbianKeyStore* CSymbianKeyStore::NewLC() + { + CSymbianKeyStore* self = new( ELeave ) CSymbianKeyStore; + + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CSymbianKeyStore::~CSymbianKeyStore() + { + Cancel(); + + ResetAndDestroyKeysArray(); //iKeys + + // Free memory + delete iDataToSign; + delete iDataToVerify; + delete iSignature; + delete iPublicKeyData; + delete iKeyLabelToFind; + delete iRSASignature; + if (iKey) + { + iKey->Release(); + } + + if (iRSASigner) + { + iRSASigner->Release(); + } + + delete iKeyStore; + + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// Release all resources kept in iKeys array (exept for iKey which is released +// separetly) and empty iKeys array +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::ResetAndDestroyKeysArray() + { + TInt count = iKeys.Count(); + + for ( int i=0; iRelease(); + } + } + iKeys.Reset(); + } + +// ----------------------------------------------------------------------------- +// PerformRSASignOperation +// Sign data +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::PerformRSASignOperation() +{ + if (!iKey || !iKeyStore) + { + return; + } + + iRSASigner->Sign(*iDataToSign, iRSASignature, iStatus); + iState = EPerformRSASignOperation; + SetActive(); + + // RunL called again when this completes +} + +// ----------------------------------------------------------------------------- +// ExportRSAPublicKeyL +// Export public key if none present +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::ExportRSAPublicKeyL() +{ + // iKey is a CCTKeyInfo* + // iPublicKeyData is an HBufC8* + __ASSERT_ALWAYS(iKey, User::Leave(KErrGeneral)); + + if (iPublicKeyData) + { + delete iPublicKeyData; + iPublicKeyData = NULL; + } + + iKeyStore->ExportPublic(*iKey, iPublicKeyData, iStatus); + iState = EExportPublic; + SetActive(); + + } + +// ----------------------------------------------------------------------------- +// PerformRSAVerifyOperationL +// Verify an RSA signed data +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::PerformRSAVerifyOperationL() + { + // iRSAPublicKey is a CRSAPublicKey* + if (!iPublicKeyData) + { + return; + } + + CX509SubjectPublicKeyInfo* ki = + CX509SubjectPublicKeyInfo::NewLC(*iPublicKeyData); + + TAlgorithmId algorithmId = ESHA1; + CAlgorithmIdentifier* digestId=CAlgorithmIdentifier::NewLC(algorithmId,KNullDesC8()); + + TX509KeyFactory factory; + CRSAPublicKey *publicKey = factory.RSAPublicKeyL(ki->KeyData()); + CleanupStack::PushL(publicKey); + + CRSAPKCS1v15Verifier* verifier = CRSAPKCS1v15Verifier::NewLC(*publicKey); + + HBufC8* publicDecryptOutput = verifier->InverseSignLC(*iRSASignature); + CRSASignatureResult* decoder = factory.RSASignatureResultL(*digestId, *iDataToVerify); + CleanupStack::PushL(decoder); + + TPtr8 outputPtr(publicDecryptOutput->Des()); + iVerifyResult = decoder->VerifyL(outputPtr); + + CleanupStack::PopAndDestroy(decoder); + CleanupStack::PopAndDestroy(publicDecryptOutput); + CleanupStack::PopAndDestroy(verifier); + CleanupStack::PopAndDestroy(publicKey); + CleanupStack::PopAndDestroy(digestId); + CleanupStack::PopAndDestroy(ki); + } + +// ----------------------------------------------------------------------------- +// CSymbianKeyStore::RunL +// Handles an active object's request completion event. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::RunL() + { + if (iStatus!=KErrNone) + { + User::Leave(iStatus.Int()); + } + + switch(iState) + { + case EInitializingKeystore: + CActiveScheduler::Stop(); + break; + case EFindingKeys: + FindMatchedKey(); + CActiveScheduler::Stop(); + break; + case EImportKey: + case ECreateKey: + CActiveScheduler::Stop(); + break; + case EOpenRSAKeyForSigning: + PerformRSASignOperation(); + break; + case EPerformRSASignOperation: + CActiveScheduler::Stop(); + break; + case EExportPublic: + PerformRSAVerifyOperationL(); + CActiveScheduler::Stop(); + break; + + } + + } + +// ----------------------------------------------------------------------------- +// CSymbianKeyStore::DoCancel +// This function is called as part of the active object's Cancel(). +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CSymbianKeyStore::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CSymbianKeyStore::RunError +// Handles Leaves from RunL function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CSymbianKeyStore::RunError(TInt aError) + { + iError=aError; + CActiveScheduler::Stop(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSymbianKeyStore::CreateUnifiedKeyStoreL +// Create the Unified Key Store structure iKeyStore +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianKeyStore::CreateUnifiedKeyStoreL() + { + + if (iKeyStore) + { + delete iKeyStore; + iKeyStore = NULL; + } + iKeyStore = CUnifiedKeyStore::NewL(iFs); + iKeyStore->Initialize(iStatus); + iState = EInitializingKeystore; + SetActive(); + + // RunL() called when this completes + + } + +// ----------------------------------------------------------------------------- +// FindKey +// Lists keys from Unified Key Store +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianKeyStore::FindKey( + const TDesC8 &aLabel, CKeyInfoBase::EKeyAlgorithm aAlgo) + { + // KApplicationUID is the UID of the key owner application + // iKeys is an RMPointerArray that is filled with the keys found + + TCTKeyAttributeFilter filter; + filter.iUsage = EPKCS15UsageSign; + if (aAlgo!=CCTKeyInfo::EInvalidAlgorithm) + filter.iKeyAlgorithm = aAlgo; + + // Store aLabel + if (iKeyLabelToFind) + { + delete iKeyLabelToFind; + iKeyLabelToFind = NULL; + } + TRAPD(err,iKeyLabelToFind = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aLabel)); + if (err != KErrNone) + { + iError=err; + return; + } + + iKeyStore->List(iKeys, filter, iStatus); + iState = EFindingKeys; + SetActive(); + // RunL() called when this completes + } + +// ----------------------------------------------------------------------------- +// hasKey +// Check if a key is found in the Unified Key Store +// Returns: KErrNone if the key is found +// KErrNotFound if the key is not found +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSymbianKeyStore::hasKey() + { + if (iKey) + return KErrNone; + else + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// GetKeySize +// Get the size of the key stored +// Returns: Size of the key +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint CSymbianKeyStore::GetKeySize() + { + // assert iKey + return iKey->Size(); + } + +// ----------------------------------------------------------------------------- +// GetKeyAlgorithm +// Get the algorithm of the key stored +// Returns: CCTKeyInfo::EKeyAlgorithm +// ----------------------------------------------------------------------------- +// +EXPORT_C CCTKeyInfo::EKeyAlgorithm CSymbianKeyStore::GetKeyAlgorithm() + { + // assert iKey + return iKey->Algorithm(); + } + +// ----------------------------------------------------------------------------- +// CreateRSAKey +// Creates RSA key and adds it to Unified Key Store +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianKeyStore::CreateRSAKey( + const TUint aSize, const TDesC8 &aKeyName) + { + HBufC16* unicodeKeyName=NULL; + // iKey is a CCTKeyInfo* that will be set if the function succeeds + if (iKey) + { + //delete iKey; + iKey->Release(); + iKey = NULL; + } + // Convert key name from TDesC8 to TDesC16 + TRAPD(err,unicodeKeyName=CnvUtfConverter::ConvertToUnicodeFromUtf8L(aKeyName)); + if (err != KErrNone) + { + iError=err; + return; + } + + // Find the number of file key stores present + TInt num = iKeyStore->KeyStoreManagerCount(); + TBool found = EFalse; + TInt keyStoreIndex = 0; + TInt index; + + // Find the Symbian file key store index + for (index = 0;index < num;index++) + { + MCTKeyStoreManager& manager = iKeyStore->KeyStoreManager(index); + MCTToken& token = manager.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + + if ( tokenuid == TUid::Uid(KTokenTypeFileKeystore) ) // Symbian's file key store, defined in mctkeystore.h + { + found = ETrue; + break; + } + } + + if ( found ) + { + // If found, then store in the place pointed by the index else it shall take the first key store + keyStoreIndex = index; + } + + TTime startDate, endDate; + startDate.UniversalTime(); + endDate.UniversalTime(); + endDate += TTimeIntervalYears(1); // key valid for a year + + iKeyStore->CreateKey( + keyStoreIndex, + EPKCS15UsageSign, + aSize, + *unicodeKeyName, + CCTKeyInfo::ERSA, + CCTKeyInfo::EExtractable, + startDate, + endDate, + iKey, + iStatus); + delete unicodeKeyName; + iState = ECreateKey; + SetActive(); + + // RunL() called when this completes + } + +// ----------------------------------------------------------------------------- +// ImportKey +// Import Key from Unified Key Store +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianKeyStore::ImportKey( + const TDesC8 &aKeyData, + const TDesC8 &aKeyName) + { + HBufC16* unicodeKeyName=NULL; + // iKey is a CCTKeyInfo* that will be set if the function succeeds + if (iKey) + { + //delete iKey; + iKey->Release(); + iKey = NULL; + } + + // Convert key name from TDesC8 to TDesC16 + TRAPD(err,unicodeKeyName=CnvUtfConverter::ConvertToUnicodeFromUtf8L(aKeyName)); + if (err != KErrNone) + { + iError=err; + return; + } + + // Find the number of file key stores present + TInt num = iKeyStore->KeyStoreManagerCount(); + TBool found = EFalse; + TInt keyStoreIndex = 0; + TInt index; + + // Find the Symbian file key store index + for (index = 0;index < num;index++) + { + MCTKeyStoreManager& manager = iKeyStore->KeyStoreManager(index); + MCTToken& token = manager.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + + if ( tokenuid == TUid::Uid(KTokenTypeFileKeystore) ) // Symbian's file key store, defined in mctkeystore.h + { + found = ETrue; + break; + } + } + + if ( found ) + { + // If found, then store in the place pointed by the index else it shall take the first key store + keyStoreIndex = index; + } + + + TTime startDate, endDate; + startDate.UniversalTime(); + endDate.UniversalTime(); + endDate += TTimeIntervalYears(1); // key valid for a year + + iKeyStore->ImportKey( + keyStoreIndex, + aKeyData, + EPKCS15UsageSign, + *unicodeKeyName, + CCTKeyInfo::EExtractable, + startDate, + endDate, + iKey, + iStatus); + iState = EImportKey; + delete unicodeKeyName; + SetActive(); + + // RunL() called when this completes + } + +// ----------------------------------------------------------------------------- +// RSASignL +// Opens RSA key for signing the data +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSymbianKeyStore::RSASignL( + const TUint8* aDataToSign, TUint aLen) + { + // iRSASigner is an MRSASigner* object returned from Open() + // iDataToSign is a HBufC8* containing data to be signed + // iRSASignature is a CRSASignature* which will contain the result + __ASSERT_ALWAYS(iKey, User::Leave(KErrGeneral)); + + if (iDataToSign) + { + delete iDataToSign; + iDataToSign = NULL; + } + + if (iRSASigner) + { + iRSASigner->Release(); + iRSASigner = NULL; + } + + if (iRSASignature) + { + delete iRSASignature; + iRSASignature = NULL; + } + + TPtrC8 dataPtr(aDataToSign, aLen); + // Build ASN1 encoding of digestAlgId and digest.. + CASN1EncSequence* encAll = CASN1EncSequence::NewLC(); + + // Build AlgID encoder (for SHA1) + CASN1EncSequence* encAlgId = CASN1EncSequence::NewLC(); + + CASN1EncObjectIdentifier* encObjId = CASN1EncObjectIdentifier::NewLC(KSHA1); + encAlgId->AddChildL(encObjId); + CleanupStack::Pop(encObjId); // encObjId, now owned by endAlgId + + CASN1EncNull* encNull = CASN1EncNull::NewLC(); + encAlgId->AddChildL(encNull); + CleanupStack::Pop(encNull); // encNull, now owned by endAlgId + + encAll->AddChildL(encAlgId); + CleanupStack::Pop(encAlgId); // encAlgId, now owned by encAll + + CASN1EncOctetString* encDigest = CASN1EncOctetString::NewLC(dataPtr); + encAll->AddChildL(encDigest); + CleanupStack::Pop(encDigest); // encDigest, now owned by encAll + + iDataToSign = HBufC8::NewMaxL(encAll->LengthDER()); + TUint pos = 0; + TPtr8 digestInfoPtr = iDataToSign->Des(); + encAll->WriteDERL(digestInfoPtr, pos); + CleanupStack::PopAndDestroy(encAll); + + iKeyStore->Open(*iKey, iRSASigner, iStatus); + iState = EOpenRSAKeyForSigning; + SetActive(); + + } + +// ----------------------------------------------------------------------------- +// RSAVerifyL +// Verify an RSA signature with a self-created private key in Unified Key Store +// ----------------------------------------------------------------------------- +// + +EXPORT_C void CSymbianKeyStore::RSAVerifyL( + const TUint8* aDataToVerify, // Data to be verified with the signature + TUint aDataLen, // Length of the data to be verified + const TUint8* aSig, // A reference to the signature that signed the data + TUint aSigLen) // Length of the signature + { + iOutOfMemoryFlag = EFalse; + if (iDataToVerify) + { + delete iDataToVerify; + iDataToVerify = NULL; + } + + // Store the data + + TPtrC8 ptr(aDataToVerify, aDataLen); + iDataToVerify = ptr.AllocL(); + // Store the signature + ptr.Set(aSig, aSigLen); + RInteger sigInt = RInteger::NewL(ptr); + CleanupClosePushL(sigInt); + if (iRSASignature) + { + delete iRSASignature; + iRSASignature = NULL; + } + iRSASignature = CRSASignature::NewL(sigInt); + CleanupStack::Pop(&sigInt); + + // Export public key if none present + // iPublicKeyData is an HBufC8* + ExportRSAPublicKeyL(); + + } + +// ----------------------------------------------------------------------------- +// RSAVerifyWithPublicKeyL +// Verify an RSA signed data with a public key passed from a certificate +// Returns: ETrue The verification is succeeded +// EFalse The verification is failed +// ----------------------------------------------------------------------------- +// + +EXPORT_C TBool CSymbianKeyStore::RSAVerifyWithPublicKeyL( + const TUint8* aDataToVerify, // Signed data to be verified + TUint aDataLen, // Length of the signed data + const TUint8* aSig, // A reference to the signature that signed the data + TUint aSigLen, // Length of the signature + CSubjectPublicKeyInfo *aSubPubKeyInfo) // A handle to the public key passed from a certificate + { + iOutOfMemoryFlag = EFalse; + if (iDataToVerify) + { + delete iDataToVerify; + iDataToVerify = NULL; + } + + // Store the data + TPtrC8 ptr(aDataToVerify, aDataLen); + iDataToVerify = ptr.AllocL(); + + // Store the signature + ptr.Set(aSig, aSigLen); + RInteger sigInt = RInteger::NewL(ptr); + CleanupClosePushL(sigInt); + if (iRSASignature) + { + delete iRSASignature; + iRSASignature = NULL; + } + iRSASignature = CRSASignature::NewL(sigInt); + CleanupStack::Pop(&sigInt); + + TAlgorithmId algorithmId = ESHA1; + CAlgorithmIdentifier* digestId=CAlgorithmIdentifier::NewLC(algorithmId,KNullDesC8()); + TX509KeyFactory factory; + CRSAPublicKey *publicKey = factory.RSAPublicKeyL(aSubPubKeyInfo->KeyData()); + CleanupStack::PushL(publicKey); + + CRSAPKCS1v15Verifier* verifier = CRSAPKCS1v15Verifier::NewLC(*publicKey); + HBufC8* publicDecryptOutput = verifier->InverseSignLC(*iRSASignature); + CRSASignatureResult* decoder = factory.RSASignatureResultL(*digestId, *iDataToVerify); + CleanupStack::PushL(decoder); + TPtr8 outputPtr(publicDecryptOutput->Des()); + iVerifyResult = decoder->VerifyL(outputPtr); + + CleanupStack::PopAndDestroy(decoder); + CleanupStack::PopAndDestroy(publicDecryptOutput); + CleanupStack::PopAndDestroy(verifier); + CleanupStack::PopAndDestroy(publicKey); + CleanupStack::PopAndDestroy(digestId); + + return iVerifyResult; + } + +// ----------------------------------------------------------------------------- +// GetSignedData +// Get signed data +// Returns: length of signed data +// ----------------------------------------------------------------------------- +// +EXPORT_C const TUint8* CSymbianKeyStore::GetSignedData(TUint *aLen) + { + TInt leaveValue; + + if (iRSASignature) + { + if (iSignature) + { + delete iSignature; + iSignature = NULL; + } + + TRAP(leaveValue, GetRSASignatureL()) ; + if ( leaveValue != KErrNone ) + { + iError = leaveValue; + } + if (iSignature) + { + *aLen = iSignature->Length(); + return (iSignature->Ptr()); + } + } + + // in case of errors + *aLen = 0; + return NULL; + } + +// ----------------------------------------------------------------------------- +// GetVerifyResult +// Returns verification result +// Returns: ETrue The verification is succeeded +// EFalse The verification is failed +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSymbianKeyStore::GetVerifyResult() + { + return iVerifyResult; + } + +// ----------------------------------------------------------------------------- +// GetError +// Get the error flag +// Returns: error code +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSymbianKeyStore::GetError() + { + return iError; + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/bwinscw/xmlseccrypto.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/bwinscw/xmlseccrypto.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,66 @@ +EXPORTS + xmlSecCheckCertStoreFlag @ 1 NONAME + xmlSecResetCertStoreFlag @ 2 NONAME + xmlSecSetCertStoreFlag @ 3 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey @ 4 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrInit @ 5 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrLoad @ 6 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrSave @ 7 NONAME + xmlSecSymbianCryptoAppGetDefaultPwdCallback @ 8 NONAME + xmlSecSymbianCryptoAppInit @ 9 NONAME + xmlSecSymbianCryptoAppKeyCertLoad @ 10 NONAME + xmlSecSymbianCryptoAppKeyCertLoadBIO @ 11 NONAME + xmlSecSymbianCryptoAppKeyCertLoadMemory @ 12 NONAME + xmlSecSymbianCryptoAppKeyLoadBIO @ 13 NONAME + xmlSecSymbianCryptoAppKeyLoadMemoryWithName @ 14 NONAME + xmlSecSymbianCryptoAppKeyLoadSks @ 15 NONAME + xmlSecSymbianCryptoAppKeyLoadWithName @ 16 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoad @ 17 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadBIO @ 18 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadMemory @ 19 NONAME + xmlSecSymbianCryptoAppPkcs12Load @ 20 NONAME + xmlSecSymbianCryptoAppPkcs12LoadMemory @ 21 NONAME + xmlSecSymbianCryptoAppShutdown @ 22 NONAME + xmlSecSymbianCryptoEvpKeyAdopt @ 23 NONAME + xmlSecSymbianCryptoEvpKeyDataAdoptEvp @ 24 NONAME + xmlSecSymbianCryptoEvpKeyDataGetEvp @ 25 NONAME + xmlSecSymbianCryptoEvpKeyDup @ 26 NONAME + xmlSecSymbianCryptoGenerateRandom @ 27 NONAME + xmlSecSymbianCryptoInit @ 28 NONAME + xmlSecSymbianCryptoKeyDataAesGetKlass @ 29 NONAME + xmlSecSymbianCryptoKeyDataAesSet @ 30 NONAME + xmlSecSymbianCryptoKeyDataDesGetKlass @ 31 NONAME + xmlSecSymbianCryptoKeyDataDesSet @ 32 NONAME + xmlSecSymbianCryptoKeyDataHmacGetKlass @ 33 NONAME + xmlSecSymbianCryptoKeyDataHmacSet @ 34 NONAME + xmlSecSymbianCryptoKeyDataRawX509CertGetKlass @ 35 NONAME + xmlSecSymbianCryptoKeyDataRsaGetKlass @ 36 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCert @ 37 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCrl @ 38 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptKeyCert @ 39 NONAME + xmlSecSymbianCryptoKeyDataX509GetCert @ 40 NONAME + xmlSecSymbianCryptoKeyDataX509GetCertsSize @ 41 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrl @ 42 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrlsSize @ 43 NONAME + xmlSecSymbianCryptoKeyDataX509GetKeyCert @ 44 NONAME + xmlSecSymbianCryptoKeyDataX509GetKlass @ 45 NONAME + xmlSecSymbianCryptoKeysMngrInit @ 46 NONAME + xmlSecSymbianCryptoShutdown @ 47 NONAME + xmlSecSymbianCryptoTransformAes128CbcGetKlass @ 48 NONAME + xmlSecSymbianCryptoTransformAes192CbcGetKlass @ 49 NONAME + xmlSecSymbianCryptoTransformAes256CbcGetKlass @ 50 NONAME + xmlSecSymbianCryptoTransformDes3CbcGetKlass @ 51 NONAME + xmlSecSymbianCryptoTransformHmacMd5GetKlass @ 52 NONAME + xmlSecSymbianCryptoTransformHmacRipemd160GetKlass @ 53 NONAME + xmlSecSymbianCryptoTransformHmacSha1GetKlass @ 54 NONAME + xmlSecSymbianCryptoTransformRsaSha1GetKlass @ 55 NONAME + xmlSecSymbianCryptoTransformSha1GetKlass @ 56 NONAME + xmlSecSymbianCryptoX509CertGetKey @ 57 NONAME + xmlSecSymbianCryptoX509StoreAddCertsPath @ 58 NONAME + xmlSecSymbianCryptoX509StoreAdoptCert @ 59 NONAME + xmlSecSymbianCryptoX509StoreFindCert @ 60 NONAME + xmlSecSymbianCryptoX509StoreGetKlass @ 61 NONAME + xmlSecSymbianCryptoX509StoreKeyCertVerify @ 62 NONAME + xmlSecSymbianCryptoX509StoreVerify @ 63 NONAME + xmlSecSymbianKeysStoreGetKlass @ 64 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/eabi/wsstarxmlseccrypto.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/eabi/wsstarxmlseccrypto.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +EXPORTS + _ZTI14CXmlSecPadding @ 1 NONAME ; ## + _ZTV14CXmlSecPadding @ 2 NONAME ; ## + xmlSecCheckCertStoreFlag @ 3 NONAME + xmlSecResetCertStoreFlag @ 4 NONAME + xmlSecSetCertStoreFlag @ 5 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey @ 6 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrInit @ 7 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrLoad @ 8 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrSave @ 9 NONAME + xmlSecSymbianCryptoAppGetDefaultPwdCallback @ 10 NONAME + xmlSecSymbianCryptoAppInit @ 11 NONAME + xmlSecSymbianCryptoAppKeyCertLoad @ 12 NONAME + xmlSecSymbianCryptoAppKeyCertLoadBIO @ 13 NONAME + xmlSecSymbianCryptoAppKeyCertLoadMemory @ 14 NONAME + xmlSecSymbianCryptoAppKeyLoadBIO @ 15 NONAME + xmlSecSymbianCryptoAppKeyLoadMemoryWithName @ 16 NONAME + xmlSecSymbianCryptoAppKeyLoadSks @ 17 NONAME + xmlSecSymbianCryptoAppKeyLoadWithName @ 18 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoad @ 19 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadBIO @ 20 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadMemory @ 21 NONAME + xmlSecSymbianCryptoAppPkcs12Load @ 22 NONAME + xmlSecSymbianCryptoAppPkcs12LoadMemory @ 23 NONAME + xmlSecSymbianCryptoAppShutdown @ 24 NONAME + xmlSecSymbianCryptoEvpKeyAdopt @ 25 NONAME + xmlSecSymbianCryptoEvpKeyDataAdoptEvp @ 26 NONAME + xmlSecSymbianCryptoEvpKeyDataGetEvp @ 27 NONAME + xmlSecSymbianCryptoEvpKeyDup @ 28 NONAME + xmlSecSymbianCryptoGenerateRandom @ 29 NONAME + xmlSecSymbianCryptoInit @ 30 NONAME + xmlSecSymbianCryptoKeyDataAesGetKlass @ 31 NONAME + xmlSecSymbianCryptoKeyDataAesSet @ 32 NONAME + xmlSecSymbianCryptoKeyDataDesGetKlass @ 33 NONAME + xmlSecSymbianCryptoKeyDataDesSet @ 34 NONAME + xmlSecSymbianCryptoKeyDataHmacGetKlass @ 35 NONAME + xmlSecSymbianCryptoKeyDataHmacSet @ 36 NONAME + xmlSecSymbianCryptoKeyDataRawX509CertGetKlass @ 37 NONAME + xmlSecSymbianCryptoKeyDataRsaGetKlass @ 38 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCert @ 39 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCrl @ 40 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptKeyCert @ 41 NONAME + xmlSecSymbianCryptoKeyDataX509GetCert @ 42 NONAME + xmlSecSymbianCryptoKeyDataX509GetCertsSize @ 43 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrl @ 44 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrlsSize @ 45 NONAME + xmlSecSymbianCryptoKeyDataX509GetKeyCert @ 46 NONAME + xmlSecSymbianCryptoKeyDataX509GetKlass @ 47 NONAME + xmlSecSymbianCryptoKeysMngrInit @ 48 NONAME + xmlSecSymbianCryptoShutdown @ 49 NONAME + xmlSecSymbianCryptoTransformAes128CbcGetKlass @ 50 NONAME + xmlSecSymbianCryptoTransformAes192CbcGetKlass @ 51 NONAME + xmlSecSymbianCryptoTransformAes256CbcGetKlass @ 52 NONAME + xmlSecSymbianCryptoTransformDes3CbcGetKlass @ 53 NONAME + xmlSecSymbianCryptoTransformHmacMd5GetKlass @ 54 NONAME + xmlSecSymbianCryptoTransformHmacRipemd160GetKlass @ 55 NONAME + xmlSecSymbianCryptoTransformHmacSha1GetKlass @ 56 NONAME + xmlSecSymbianCryptoTransformRsaSha1GetKlass @ 57 NONAME + xmlSecSymbianCryptoTransformSha1GetKlass @ 58 NONAME + xmlSecSymbianCryptoX509CertGetKey @ 59 NONAME + xmlSecSymbianCryptoX509StoreAddCertsPath @ 60 NONAME + xmlSecSymbianCryptoX509StoreAdoptCert @ 61 NONAME + xmlSecSymbianCryptoX509StoreFindCert @ 62 NONAME + xmlSecSymbianCryptoX509StoreGetKlass @ 63 NONAME + xmlSecSymbianCryptoX509StoreKeyCertVerify @ 64 NONAME + xmlSecSymbianCryptoX509StoreVerify @ 65 NONAME + xmlSecSymbianKeysStoreGetKlass @ 66 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/eabi/xmlseccrypto.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/eabi/xmlseccrypto.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +EXPORTS + _ZTI14CXmlSecPadding @ 1 NONAME DATA 12 ; ## + _ZTV14CXmlSecPadding @ 2 NONAME DATA 40 ; ## + xmlSecCheckCertStoreFlag @ 3 NONAME + xmlSecResetCertStoreFlag @ 4 NONAME + xmlSecSetCertStoreFlag @ 5 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey @ 6 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrInit @ 7 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrLoad @ 8 NONAME + xmlSecSymbianCryptoAppDefaultKeysMngrSave @ 9 NONAME + xmlSecSymbianCryptoAppGetDefaultPwdCallback @ 10 NONAME + xmlSecSymbianCryptoAppInit @ 11 NONAME + xmlSecSymbianCryptoAppKeyCertLoad @ 12 NONAME + xmlSecSymbianCryptoAppKeyCertLoadBIO @ 13 NONAME + xmlSecSymbianCryptoAppKeyCertLoadMemory @ 14 NONAME + xmlSecSymbianCryptoAppKeyLoadBIO @ 15 NONAME + xmlSecSymbianCryptoAppKeyLoadMemoryWithName @ 16 NONAME + xmlSecSymbianCryptoAppKeyLoadSks @ 17 NONAME + xmlSecSymbianCryptoAppKeyLoadWithName @ 18 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoad @ 19 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadBIO @ 20 NONAME + xmlSecSymbianCryptoAppKeysMngrCertLoadMemory @ 21 NONAME + xmlSecSymbianCryptoAppPkcs12Load @ 22 NONAME + xmlSecSymbianCryptoAppPkcs12LoadMemory @ 23 NONAME + xmlSecSymbianCryptoAppShutdown @ 24 NONAME + xmlSecSymbianCryptoEvpKeyAdopt @ 25 NONAME + xmlSecSymbianCryptoEvpKeyDataAdoptEvp @ 26 NONAME + xmlSecSymbianCryptoEvpKeyDataGetEvp @ 27 NONAME + xmlSecSymbianCryptoEvpKeyDup @ 28 NONAME + xmlSecSymbianCryptoGenerateRandom @ 29 NONAME + xmlSecSymbianCryptoInit @ 30 NONAME + xmlSecSymbianCryptoKeyDataAesGetKlass @ 31 NONAME + xmlSecSymbianCryptoKeyDataAesSet @ 32 NONAME + xmlSecSymbianCryptoKeyDataDesGetKlass @ 33 NONAME + xmlSecSymbianCryptoKeyDataDesSet @ 34 NONAME + xmlSecSymbianCryptoKeyDataHmacGetKlass @ 35 NONAME + xmlSecSymbianCryptoKeyDataHmacSet @ 36 NONAME + xmlSecSymbianCryptoKeyDataRawX509CertGetKlass @ 37 NONAME + xmlSecSymbianCryptoKeyDataRsaGetKlass @ 38 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCert @ 39 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptCrl @ 40 NONAME + xmlSecSymbianCryptoKeyDataX509AdoptKeyCert @ 41 NONAME + xmlSecSymbianCryptoKeyDataX509GetCert @ 42 NONAME + xmlSecSymbianCryptoKeyDataX509GetCertsSize @ 43 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrl @ 44 NONAME + xmlSecSymbianCryptoKeyDataX509GetCrlsSize @ 45 NONAME + xmlSecSymbianCryptoKeyDataX509GetKeyCert @ 46 NONAME + xmlSecSymbianCryptoKeyDataX509GetKlass @ 47 NONAME + xmlSecSymbianCryptoKeysMngrInit @ 48 NONAME + xmlSecSymbianCryptoShutdown @ 49 NONAME + xmlSecSymbianCryptoTransformAes128CbcGetKlass @ 50 NONAME + xmlSecSymbianCryptoTransformAes192CbcGetKlass @ 51 NONAME + xmlSecSymbianCryptoTransformAes256CbcGetKlass @ 52 NONAME + xmlSecSymbianCryptoTransformDes3CbcGetKlass @ 53 NONAME + xmlSecSymbianCryptoTransformHmacMd5GetKlass @ 54 NONAME + xmlSecSymbianCryptoTransformHmacRipemd160GetKlass @ 55 NONAME + xmlSecSymbianCryptoTransformHmacSha1GetKlass @ 56 NONAME + xmlSecSymbianCryptoTransformRsaSha1GetKlass @ 57 NONAME + xmlSecSymbianCryptoTransformSha1GetKlass @ 58 NONAME + xmlSecSymbianCryptoX509CertGetKey @ 59 NONAME + xmlSecSymbianCryptoX509StoreAddCertsPath @ 60 NONAME + xmlSecSymbianCryptoX509StoreAdoptCert @ 61 NONAME + xmlSecSymbianCryptoX509StoreFindCert @ 62 NONAME + xmlSecSymbianCryptoX509StoreGetKlass @ 63 NONAME + xmlSecSymbianCryptoX509StoreKeyCertVerify @ 64 NONAME + xmlSecSymbianCryptoX509StoreVerify @ 65 NONAME + xmlSecSymbianKeysStoreGetKlass @ 66 NONAME + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for XmlSec Crypto componet. +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +PRJ_EXPORTS +../inc/xmlsecc_app.h |../../inc/xmlsecc_app.h +../inc/xmlsecc_bio.h |../../inc/xmlsecc_bio.h +../inc/xmlsecc_config.h |../../inc/xmlsecc_config.h +../inc/xmlsecc_crypto.h |../../inc/xmlsecc_crypto.h +../inc/xmlsecc_evpwrapper.h |../../inc/xmlsecc_evpwrapper.h +../inc/xmlsecc_symbols.h |../../inc/xmlsecc_symbols.h +../inc/xmlsecc_x509.h |../../inc/xmlsecc_x509.h +../inc/xmlsecc_x509wrapper.h |../../inc/xmlsecc_x509wrapper.h +../rom/xmlseccrypto.iby CORE_OS_LAYER_IBY_EXPORT_PATH(xmlseccrypto.iby) + + +PRJ_MMPFILES +xmlseccrypto.mmp + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/group/xmlseccrypto.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/group/xmlseccrypto.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for XmlSec Crypto component. +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +TARGET xmlseccrypto.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9792 + +SOURCEPATH ../src +SOURCE xmlsecc_app.cpp +SOURCE xmlsecc_crypto.cpp +SOURCE xmlsecc_symkeys.cpp +SOURCE xmlsecc_ciphers.cpp +SOURCE xmlsecc_cryptowrapper.cpp +SOURCE xmlsecc_digests.cpp +SOURCE xmlsecc_md.cpp +SOURCE xmlsecc_x509.cpp +SOURCE xmlsecc_x509vfy.cpp +SOURCE xmlsecc_hmac.cpp +SOURCE xmlsecc_signatures.cpp +SOURCE xmlsecc_evp.cpp +SOURCE xmlsecc_evpwrapper.cpp +SOURCE xmlsecc_x509wrapper.cpp +SOURCE xmlsecc_bio.cpp +SOURCE xmlsecc_padding.cpp + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc + +SYSTEMINCLUDE /epoc32/include/libc +USERINCLUDE ../inc + +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY cryptography.lib +LIBRARY random.lib +LIBRARY hash.lib +LIBRARY x509.lib +LIBRARY crypto.lib +#if !defined(__RD_XMLSEC_SRCINC_CHANGE_REVERSE__) +LIBRARY xmlengine.lib +#else +LIBRARY wsstarxmlengine.lib +#endif +LIBRARY xmlseccertman.lib +LIBRARY xmlsec.lib + +nostrictdef +EPOCALLOWDLLDATA + +#if defined(ARMCC) +#if !defined(__RD_XMLSEC_MEMCOPY_PROBLEM_FIX__) + DEFFILE ../eabi/xmlseccrypto.def +#else + DEFFILE ../eabi/wsstarxmlseccrypto.def +#endif +#elif defined(WINSCW) || defined(WINS) + DEFFILE ../bwinscw/xmlseccrypto.def +#endif + +#ifdef CAP_GENERAL_DLL + CAPABILITY CAP_GENERAL_DLL +#else + CAPABILITY ALL -TCB +#endif + + VENDORID VID_DEFAULT + +SMPSAFE diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/Copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/Copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,59 @@ +xmlsec, xmlsec-openssl, xmlsec-gnutls libraries +------------------------------------------------------------------------------ + +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + + +xmlsec-nss library +------------------------------------------------------------------------------ +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. +Copyright (c) 2003 America Online, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Portions of the Software were created using source code and/or APIs +governed by the Mozilla Public License (MPL). The MPL is available +at http://www.mozilla.org/MPL/MPL-1.1.html. The MPL permits such +portions to be distributed with code not governed by MPL, as long +as the requirements of MPL are fulfilled for such portions. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_app.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,108 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_APP_H__ +#define __XMLSEC_SYMBIANCRYPTO_APP_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_transforms.h" + +#include "xmlsecc_bio.h" + +/** + * Init/shutdown + */ +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppInit (const char* config); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppShutdown (void); + +/** + * Keys Manager + */ +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr, + xmlSecKeyPtr key); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr, + const char* uri); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr, + const char* filename, + xmlSecKeyDataType type); +#ifndef XMLSEC_NO_X509 +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr, + const char *filename, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeysMngrCertLoadBIO (xmlSecKeysMngrPtr mngr, + BIO* bio, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +#endif /* XMLSEC_NO_X509 */ + + +/** + * Keys + */ +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppKeyLoadWithName (const char *filename, + xmlSecKeyDataFormat format, + const char *keyname, + const char *pwd, + void *pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppKeyLoadMemoryWithName ( + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + const char *keyname, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppKeyLoadBIO (BIO* bio, + xmlSecKeyDataFormat format, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +#ifndef XMLSEC_NO_X509 +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppPkcs12Load (const char *filename, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppPkcs12LoadMemory (const xmlSecByte* data, + xmlSecSize dataSize, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeyCertLoad (xmlSecKeyPtr key, + const char* filename, + xmlSecKeyDataFormat format); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeyCertLoadMemory (xmlSecKeyPtr key, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoAppKeyCertLoadBIO (xmlSecKeyPtr key, + BIO* bio, + xmlSecKeyDataFormat format); +#endif /* XMLSEC_NO_X509 */ +XMLSEC_CRYPTO_EXPORT void* xmlSecSymbianCryptoAppGetDefaultPwdCallback (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_SYMBIANCRYPTO_APP_H__ */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_bio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_bio.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A wrapper for bio.h in openssl for Symbian. +* +*/ + + +/* A wrapper for bio.h in openssl */ + +#ifndef __SYMBIANCRYPTO_BIO_H__ +#define __SYMBIANCRYPTO_BIO_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsecc_config.h" + +typedef struct ScBIOSt +{ + char* mem; + unsigned int len; + char* name; +} BIO; + + +BIO* BIO_new_file(const char *filename, const char *mode, const char *name); + +BIO* BIO_new_buffer(const char *aData, unsigned int aSize, const char *aName); + +void BIO_free(BIO *bio); + +BIO* BIO_new(); + +int BIO_write(BIO *bio, const unsigned char *buf, unsigned int size); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __SYMBIANCRYPTO_BIO_H__ */ + +#define __SYMBIANCRYPTO_BIO_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_config.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Configuration file for XMLSec Crypto component +* +*/ + + +#ifndef __XMLSECC_CONFIG_H__ +#define __XMLSECC_CONFIG_H__ + +#include "xmlsec_config.h" + +#define XMLSEC_NO_RIPEMD160 +#define XMLSEC_NO_DSA + +#define XMLSEC_NO_MD5 +#define XMLSEC_NO_SHA224 +#define XMLSEC_NO_SHA256 +#define XMLSEC_NO_SHA384 +#define XMLSEC_NO_SHA512 + +//#define XMLSEC_NO_DES +//#define XMLSEC_NO_X509 +//#define XMLSEC_NO_SHA1 +//#define XMLSEC_NO_RSA +//#define XMLSEC_NO_AES +//#define XMLSEC_NO_HMAC + +#endif /* __XMLSECC_CONFIG_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_crypto.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_crypto.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,229 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ +#define __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_dl.h" + +XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_gnutls(void); + +/** + * Init shutdown + */ +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoInit (void); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoShutdown (void); + +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoGenerateRandom (xmlSecBufferPtr buffer, + xmlSecSize size); + +/******************************************************************** + * + * AES transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_AES +/** + * xmlSecSymbianCryptoKeyDataAesId: + * + * The AES key data klass. + */ +#define xmlSecSymbianCryptoKeyDataAesId \ + xmlSecSymbianCryptoKeyDataAesGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataAesGetKlass (void); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataAesSet (xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize); +/** + * xmlSecSymbianCryptoTransformAes128CbcId: + * + * The AES128 CBC cipher transform klass. + */ +#define xmlSecSymbianCryptoTransformAes128CbcId \ + xmlSecSymbianCryptoTransformAes128CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformAes128CbcGetKlass(void); + +/** + * xmlSecSymbianCryptoTransformAes192CbcId: + * + * The AES192 CBC cipher transform klass. + */ +#define xmlSecSymbianCryptoTransformAes192CbcId \ + xmlSecSymbianCryptoTransformAes192CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformAes192CbcGetKlass(void); + +/** + * xmlSecSymbianCryptoTransformAes256CbcId: + * + * The AES256 CBC cipher transform klass. + */ +#define xmlSecSymbianCryptoTransformAes256CbcId \ + xmlSecSymbianCryptoTransformAes256CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformAes256CbcGetKlass(void); + +#endif /* XMLSEC_NO_AES */ + +/******************************************************************** + * + * DES transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_DES +/** + * xmlSecSymbianCryptoKeyDataDesId: + * + * The DES key data klass. + */ +#define xmlSecSymbianCryptoKeyDataDesId \ + xmlSecSymbianCryptoKeyDataDesGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataDesGetKlass (void); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataDesSet (xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize); + +/** + * xmlSecSymbianCryptoTransformDes3CbcId: + * + * The DES3 CBC cipher transform klass. + */ +#define xmlSecSymbianCryptoTransformDes3CbcId \ + xmlSecSymbianCryptoTransformDes3CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformDes3CbcGetKlass(void); + +#endif /* XMLSEC_NO_DES */ + + +/******************************************************************** + * + * HMAC transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_HMAC +/** + * xmlSecSymbianCryptoKeyDataHmacId: + * + * The HMAC key klass. + */ +#define xmlSecSymbianCryptoKeyDataHmacId \ + xmlSecSymbianCryptoKeyDataHmacGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataHmacGetKlass (void); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataHmacSet (xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize); +/** + * xmlSecSymbianCryptoTransformHmacMd5Id: + * + * The HMAC with MD5 signature transform klass. + */ +#define xmlSecSymbianCryptoTransformHmacMd5Id \ + xmlSecSymbianCryptoTransformHmacMd5GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformHmacMd5GetKlass(void); +#endif /* XMLSEC_NO_HMAC */ + +/** + * xmlSecSymbianCryptoTransformHmacRipemd160Id: + * + * The HMAC with RipeMD160 signature transform klass. + */ +#define xmlSecSymbianCryptoTransformHmacRipemd160Id \ + xmlSecSymbianCryptoTransformHmacRipemd160GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformHmacRipemd160GetKlass(void); + +/** + * xmlSecSymbianCryptoTransformHmacSha1Id: + * + * The HMAC with SHA1 signature transform klass. + */ +#define xmlSecSymbianCryptoTransformHmacSha1Id \ + xmlSecSymbianCryptoTransformHmacSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformHmacSha1GetKlass(void); + + + +/******************************************************************** + * + * SHA1 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecSymbianCryptoTransformSha1Id: + * + * The SHA1 digest transform klass. + */ +#define xmlSecSymbianCryptoTransformSha1Id \ + xmlSecSymbianCryptoTransformSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + + +/******************************************************************** + * + * RSA transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_RSA + +/** + * xmlSecSymbianCryptoKeyDataRsaId: + * + * The RSA key klass. + */ +#define xmlSecSymbianCryptoKeyDataRsaId \ + xmlSecSymbianCryptoKeyDataRsaGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataRsaGetKlass(void); + + +/** + * xmlSecSymbianCryptoTransformRsaSha1Id: + * + * The RSA-SHA1 signature transform klass. + */ + +#define xmlSecSymbianCryptoTransformRsaSha1Id \ + xmlSecSymbianCryptoTransformRsaSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformRsaSha1GetKlass(void); + +/** + * xmlSecSymbianCryptoTransformRsaPkcs1Id: + * + * The RSA PKCS1 key transport transform klass. + */ +#define xmlSecSymbianCryptoTransformRsaPkcs1Id \ + xmlSecSymbianCryptoTransformRsaPkcs1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformRsaPkcs1GetKlass(void); + +/** + * xmlSecSymbianCryptoTransformRsaOaepId: + * + * The RSA PKCS1 key transport transform klass. + */ +/* +#define xmlSecSymbianCryptoTransformRsaOaepId \ + xmlSecSymbianCryptoTransformRsaOaepGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecSymbianCryptoTransformRsaOaepGetKlass(void); +*/ +#endif /* XMLSEC_NO_RSA */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ */ + +#define __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_cryptowrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_cryptowrapper.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,308 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to encrypt and decrypt data. +* +*/ + + +/* A wrapper for gcrypt.h */ + +#ifndef __SYMBIANCRYPTO_CRYPTO_WRAPPER_H__ +#define __SYMBIANCRYPTO_CRYPTO_WRAPPER_H__ + +#include +#include "xmlsecc_config.h" + +#include "xmlsecc_evpwrapper.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/************************************ + * + * symmetric cipher functions + * + ************************************/ + +/* Port SC_CIPHER_HD */ + +#ifndef _SC_GCC_ATTR_DEPRECATED +#define _SC_GCC_ATTR_DEPRECATED +#endif + +struct sc_cipher_handle; +typedef struct sc_cipher_handle *sc_cipher_hd_t; +typedef struct sc_cipher_handle *SC_CIPHER_HD _SC_GCC_ATTR_DEPRECATED; +typedef struct sc_cipher_handle *ScCipherHd _SC_GCC_ATTR_DEPRECATED; +typedef sc_cipher_hd_t ScCipherHd; + +#define ISLAST 1 +#define NOTLAST 0 + +/* data type compatibility */ +typedef unsigned char byte; + + +/* Module specification structure for ciphers. */ +typedef struct sc_cipher_spec +{ + const char *name; + const char **aliases; + size_t blocksize; + size_t keylen; + size_t contextsize; +} sc_cipher_spec_t; + +/* All symmetric encryption algorithms are identified by their IDs. + More IDs may be registered at runtime. */ +enum sc_cipher_algos + { + SC_CIPHER_NONE = 0, + SC_CIPHER_IDEA = 1, + SC_CIPHER_3DES = 2, + SC_CIPHER_CAST5 = 3, + SC_CIPHER_BLOWFISH = 4, + SC_CIPHER_SAFER_SK128 = 5, + SC_CIPHER_DES_SK = 6, + SC_CIPHER_AES128 = 7, + SC_CIPHER_AES192 = 8, + SC_CIPHER_AES256 = 9, + SC_CIPHER_TWOFISH = 10, + + /* Other cipher numbers are above 300 for OpenPGP reasons. */ + SC_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */ + SC_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */ + SC_CIPHER_TWOFISH128 = 303, + SC_CIPHER_SERPENT128 = 304, + SC_CIPHER_SERPENT192 = 305, + SC_CIPHER_SERPENT256 = 306, + SC_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */ + SC_CIPHER_RFC2268_128 = 308 /* Ron's Cipher 2 (128 bit). */ + }; + +/* The supported encryption modes. Note that not all of them are + supported for each algorithm. */ +enum sc_cipher_modes + { + SC_CIPHER_MODE_NONE = 0, /* Not yet specified. */ + SC_CIPHER_MODE_ECB = 1, /* Electronic codebook. */ + SC_CIPHER_MODE_CFB = 2, /* Cipher feedback. */ + SC_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */ + SC_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */ + SC_CIPHER_MODE_OFB = 5, /* Outer feedback. */ + SC_CIPHER_MODE_CTR = 6 /* Counter. */ + }; + +/* Flags used with the open function. */ +enum sc_cipher_flags + { + SC_CIPHER_SECURE = 1, /* Allocate in secure memory. */ + SC_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */ + SC_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */ + SC_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */ + }; + +/* To avoid that a compiler optimizes certain memset calls away, these + macros may be used instead. */ +#define wipememory2(_ptr,_set,_len) do { \ + volatile char *_vptr=(volatile char *)(_ptr); \ + size_t _vlen=(_len); \ + while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \ + } while(0) +#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) + + + +/************************************ + * + * random generating functions + * + ************************************/ + +/* The possible values for the random quality. The rule of thumb is + to use STRONG for session keys and VERY_STRONG for key material. + WEAK is currently an alias for STRONG and should not be used + anymore - use sc_create_nonce instead. */ +typedef enum sc_random_level + { + SC_WEAK_RANDOM = 0, + SC_STRONG_RANDOM = 1, + SC_VERY_STRONG_RANDOM = 2 + } +sc_random_level_t; + +/* Fill BUFFER with LENGTH bytes of random, using random numbers of + quality LEVEL. */ +TInt sc_randomize (unsigned char *buffer, size_t length, + enum sc_random_level level); + +/* Retrieve the block length used with algorithm A. */ +size_t sc_cipher_get_algo_blklen (int algo); + +/* Set the IV to be used for the encryption context C to IV with + length IVLEN. The length should match the required length. */ +int sc_cipher_setiv ( sc_cipher_hd_t c, const byte *iv, unsigned int ivlen ); + +/* Encrypt the plaintext of size INLEN in IN using the cipher handle H + into the buffer OUT which has an allocated length of OUTSIZE. For + most algorithms it is possible to pass NULL for in and 0 for INLEN + and do a in-place decryption of the data provided in OUT. */ +int sc_cipher_encrypt (sc_cipher_hd_t h, + void *out, size_t outsize, + const void *in, size_t inlen, int last); + + +/* The counterpart to sc_cipher_encrypt. */ +int sc_cipher_decrypt (sc_cipher_hd_t h, + void *out, size_t outsize, + const void *in, size_t inlen, int *outlen, int last); + +/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may + be given as an bitwise OR of the sc_cipher_flags values. */ +int sc_cipher_open (sc_cipher_hd_t *handle, + int algo, int mode, unsigned int flags); + + +/* Close the cioher handle H and release all resource. */ +void sc_cipher_close (sc_cipher_hd_t h); + +/* Retrieved the key length used with algorithm A. */ +size_t sc_cipher_get_algo_keylen (int algo); + +/* Set the key to be used for the encryption context C to KEY with + length KEYLEN. The length should match the required length. */ +int +sc_cipher_setkey (sc_cipher_hd_t c, byte *key, unsigned int keylen); + +/* Set specification blocksize in context */ +void set_ctx_blocksize(sc_cipher_hd_t c, size_t bklen); + + +/************************************ + * + * cryptograhic hash functions + * + ************************************/ + +#define XMLSEC_SYMBIAN_MAX_DIGEST_SIZE 32 + +/* Algorithm IDs for the hash functions we know about. Not all of them + are implemnted. */ +enum sc_md_algos + { + SC_MD_NONE = 0, + SC_MD_MD5 = 1, + SC_MD_SHA1 = 2, + SC_MD_RMD160 = 3, + SC_MD_MD2 = 5, + SC_MD_TIGER = 6, /* TIGER/192. */ + SC_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */ + SC_MD_SHA256 = 8, + SC_MD_SHA384 = 9, + SC_MD_SHA512 = 10, + SC_MD_MD4 = 301, + SC_MD_CRC32 = 302, + SC_MD_CRC32_RFC1510 = 303, + SC_MD_CRC24_RFC2440 = 304 + }; + +/* Flags used with the open function. */ +enum sc_md_flags + { + SC_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" + memory. */ + SC_MD_FLAG_HMAC = 2 /* Make an HMAC out of this + algorithm. */ + }; + +/* Forward declaration. */ +struct sc_md_handle; +typedef struct sc_md_handle *sc_md_hd_t; + + +/* Compatibility types, do not use them. */ +typedef struct sc_md_handle *SC_MD_HD _SC_GCC_ATTR_DEPRECATED; +typedef struct sc_md_handle *ScMDHd _SC_GCC_ATTR_DEPRECATED; + +/* Create a message digest object for algorithm ALGO. FLAGS may be + given as an bitwise OR of the sc_md_flags values. ALGO may be + given as 0 if the algorithms to be used are later set using + gcry_md_enable. */ +int sc_md_open (sc_md_hd_t *h, int algo, unsigned int flags); + +/* Release the message digest object HD. */ +void sc_md_close (sc_md_hd_t hd); + +/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that + it can update the digest values. This is the actual hash + function. */ +void sc_md_write (sc_md_hd_t hd, unsigned char *buffer, size_t length); + +/* Read out the final digest from HD return the digest value for + algorithm ALGO. */ +const unsigned char *sc_md_read (sc_md_hd_t hd, int algo); + + +/* Retrieve the length in bytes of the digest yielded by algorithm + ALGO. */ +unsigned int sc_md_get_algo_dlen (sc_md_hd_t hd); + +/* Finalize the digest calculation. This is not really needed because + sc_md_read() does this implicitly. */ +void sc_md_final(sc_md_hd_t a); + +/* Set key for HMAC */ +int sc_md_setkey(sc_md_hd_t hd, unsigned char *buffer, size_t length); + +/************************************ + * + * RSA Sign functions + * + ************************************/ + +/* data type compatibility */ + +// OpenSSL + +//typedef ScMDHd EVP_MD_CTX; +#define EVP_MD_CTX ScMDHd + +#define sc_sign_init(a,b) sc_md_open(a,b,SC_MD_FLAG_SECURE) +#define sc_sign_update(a,b,c) sc_md_write(a,b,c) + + +/* Signature final */ +TInt sc_sign_final(sc_md_hd_t hd,unsigned char *outbuf, unsigned int *outlen, EVP_PKEY *pkey); + +/************************************ + * + * RSA Verify functions + * + ************************************/ + +#define sc_verify_init(a,b) sc_md_open(a,b,SC_MD_FLAG_SECURE) +#define sc_verify_update(a,b,c) sc_md_write(a,b,c) + +/* Verify final */ +TInt sc_verify_final(sc_md_hd_t hd, unsigned char *signature, unsigned int len, EVP_PKEY *pkey); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __SYMBIANCRYPTO_CRYPTO_WRAPPER_H__ */ + +#define __SYMBIANCRYPTO_CRYPTO_WRAPPER_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_evp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_evp.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,60 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_EVP_H__ +#define __XMLSEC_SYMBIANCRYPTO_EVP_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_keysmngr.h" + +// replace +#include "xmlsecc_evpwrapper.h" + +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data, + EVP_PKEY* pKey); +XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecSymbianCryptoEvpKeyDataGetEvp (xmlSecKeyDataPtr data); + +/****************************************************************************** + * + * EVP helper functions + * + *****************************************************************************/ +XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecSymbianCryptoEvpKeyDup (EVP_PKEY* pKey); +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecSymbianCryptoEvpKeyAdopt (EVP_PKEY *pKey); + +/**************************************************************************** + * + * Symbian Keys Store + * + ***************************************************************************/ +/** + * xmlSecSymbianKeysStoreId: + * + * A symbian keys store klass id. + */ +#define xmlSecSymbianKeysStoreId xmlSecSymbianKeysStoreGetKlass() + +XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecSymbianKeysStoreGetKlass (void); + +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSymbianCryptoAppKeyLoadSks(char* keyname); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_SYMBIANCRYPTO_EVP_H__ */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_evpwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_evpwrapper.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to sign and verify data. +* +*/ + + +/* A wrapper for evp.h in openssl */ + +#ifndef __SYMBIANCRYPTO_EVP_WRAPPER_H__ +#define __SYMBIANCRYPTO_EVP_WRAPPER_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsecc_config.h" +#include "xmlsecc_bio.h" + + +/************************************ + * + * RSA Sign functions + * + ************************************/ + +/* data type compatibility for OpenSSL*/ + +#define HASKEY 1 +#define NOKEY 0 + +/** + * Key algorithms. + * EVP_PKEY_UNKNOWN unknown algorithm + * EVP_PKEY_RSA RSA algorithm + * EVP_PKEY_DSA DSA algorithm + */ +enum sc_key_algos +{ + EVP_PKEY_UNKNOWN=0, + EVP_PKEY_RSA, + EVP_PKEY_DSA +}; + +struct ScKeyStore; +typedef struct ScKeyStore ScKeyStore, *ScKeyStorePtr; +typedef unsigned char* RSA; + +typedef struct ScPkey +{ + int type; + int load; // HASKEY - 1, NOKEY - 0 + unsigned int bitsize; // Bit size of the key + int duplicate; // Indicate whether this is a duplicate copy + char *name; + ScKeyStorePtr keyStore; +} EVP_PKEY; + + +/** + * Create a new key store structure + * + * @param keytype type of the key + * @param keyname name of the key + * @return EVP_PKEY structure + */ +EVP_PKEY *sc_pkey_new(int keytype, char *keyname); + +/** + * Symbian key store Initialization + * + * @return 0 if correct initialization + * @return error code in the other hand + */ +int sc_pkey_init(); + +/** + * Load an RSA key + * + * @param pkey EVP_PKEY structure + * @return 0 if key is loaded + * @return -1 if key is not loaded + * @return error code in the other hand + */ +int sc_pkey_load(EVP_PKEY *pkey); + +/** + * Generate an RSA key + * + * @param pkey EVP_KEY structure + * @param sizeBits size of the key + * @return 0 if key is loaded + * @return -1 if key is not loaded + * @return error code in the other hand + */ +int sc_pkey_generate(EVP_PKEY *pkey, unsigned int sizeBits); + +/** + * Free the EVP_PKEY structure + */ +void sc_pkey_free(EVP_PKEY *pkey); + +/** + * Duplicate an EVP key + * + * @param pkey EVP_KEY structure + * @return EVP_PKEY duplicated structure + */ +EVP_PKEY *sc_pkey_duplicate(EVP_PKEY *aPKey); + +/** + * Symbian key store shutdown process + */ +void sc_pkey_shutdown(); + +/** + * Get the pkey size + * + * @param pkey EVP_KEY structure + * @return size of the key + */ +unsigned int sc_pkey_size(EVP_PKEY *aPKey); + +/** + * Read the private key from ASN.1 DER encoded PKCS#8 format + * + * @param aBio BIO structure + * @param aPwdCallback callback + * @param aPwdCallbackCtx callback context + * @return EVP_PKEY structure + */ +EVP_PKEY* d2i_PKCS8PrivateKey_bio(BIO *aBio, void *aPwdCallback, void *aPwdCallbackCtx); + +/** + * Read the private key from Unified Key Store + * + * @param keyname name of the key + * @return EVP_PKEY structure + */ +EVP_PKEY* d2i_PKCS8PrivateKey(char *keyname); + +/** + * Read the public key from ASN.1 DER encoded format + * + * @param aBio BIO structure + * @return EVP_PKEY structure + */ +EVP_PKEY* d2i_PUBKEY_bio(BIO *aBio); + +#ifndef XMLSEC_NO_X509 + +/************************************ + * + * X.509 related functions + * + ************************************/ + +typedef struct ScX509St +{ + char* der; // Certificate in ASN.1 DER format + unsigned int derlen; + +} X509; + +/** + * Set the public key info + * + * @param pkey EVP_KEY structure + * @param aCert X509 structure + * @return 0 if operation correct + * @return error code if operation fail + */ +int sc_pkey_setPublic(EVP_PKEY* aPKey, X509 *aCert); + +#endif // XMLSEC_NO_X509 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __SYMBIANCRYPTO_EVP_WRAPPER_H__ */ + +#define __SYMBIANCRYPTO_EVP_WRAPPER_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_globals.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +/* + * XML Security Library + * + * globals.h: internal header only used during the compilation + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_GLOBALS_H__ +#define __XMLSEC_SYMBIANCRYPTO_GLOBALS_H__ + +/** + * Use autoconf defines if present. + */ +#ifdef HAVE_CONFIG_H +#include "xmlsecc_config.h" +#endif /* HAVE_CONFIG_H */ + +#define IN_XMLSEC_CRYPTO +#define XMLSEC_PRIVATE + +#endif /* ! __XMLSEC_GLOBALS_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_padding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_padding.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with implementation of xmlenc padding. +* +*/ + + +#ifndef C_XMLSEC_PADDING_H +#define C_XMLSEC_PADDING_H + +#include + +/** + * This concrete subclass of CPadding implements padding according to + * the "XML Encryption Syntax and Processing" W3C Recomendation + * ( @see http://www.w3.org/TR/xmlenc-core/#sec-Alg-Block). + * + * @lib xmlseccrypto.dll + * @since S60 v3.2 + */ +class CXmlSecPadding : public CPadding + { + public: + /** + * Creates a new CXmlSecPadding object. + * + * @since S60 v3.2 + * @param aBlockBytes The block size in bytes. + * @return A pointer to the new CXmlSecPadding object. + */ + static CXmlSecPadding* NewL(TInt aBlockBytes); + + /** + * Creates a new CXmlSecPadding object and leaves a pointer to it on the cleanup stack. + * + * @since S60 v3.2 + * @param aBlockBytes The block size in bytes. + * @return A pointer to the new CXmlSecPadding object. + */ + static CXmlSecPadding* NewLC(TInt aBlockBytes); + /** + * Pads aInput and places the result in aOutput. + * + * @since S60 v3.2 + * @param aInput Data to be padded. + * @param aOutput On return, the resulting padded. + */ + void DoPadL(const TDesC8& aInput,TDes8& aOutput); + + /** + * Removes padding from aInput and puts result to aOutput. + * + * @since S60 v3.2 + * @param aInput Data to be unpadded. + * @param aOutput The unpadded data. + */ + void UnPadL(const TDesC8& aInput,TDes8& aOutput); + + /** + * The smallest number of bytes that PadL() will add to aInput + * + * @since S60 v3.2 + * @return The smallest number of padding bytes possible. + */ + TInt MinPaddingLength(void) const; + +protected: + /** + * Constructor + * + * @since S60 v3.2 + * @param aBlockBytes The block size in bytes. + */ + CXmlSecPadding(TInt aBlockBytes); + +private: + /** + * Minimum pad lenght + */ + static const TInt KMinPaddingLenght = 1; +}; + +#endif // C_XMLSEC_PADDING_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_symbols.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_symbols.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,100 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_SYMBOLS_H__ +#define __XMLSEC_SYMBIANCRYPTO_SYMBOLS_H__ + +#include "xmlsecc_config.h" + +#if !defined(IN_XMLSEC) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) +#error To disable dynamic loading of xmlsec-crypto libraries undefine XMLSEC_CRYPTO_DYNAMIC_LOADING +#endif /* !defined(IN_XMLSEC) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * Defines for writing simple code + */ +#ifdef XMLSEC_CRYPTO_SYMBIANCRYPTO + +/** + * Crypto Init/shutdown + */ +#define xmlSecCryptoInit xmlSecSymbianCryptoInit +#define xmlSecCryptoShutdown xmlSecSymbianCryptoShutdown + +#define xmlSecCryptoKeysMngrInit xmlSecSymbianCryptoKeysMngrInit + +/** + * Key data ids + */ +#define xmlSecKeyDataAesId xmlSecSymbianCryptoKeyDataAesId +#define xmlSecKeyDataDesId xmlSecSymbianCryptoKeyDataDesId +#define xmlSecKeyDataDsaId xmlSecSymbianCryptoKeyDataDsaId +#define xmlSecKeyDataHmacId xmlSecSymbianCryptoKeyDataHmacId +#define xmlSecKeyDataRsaId xmlSecSymbianCryptoKeyDataRsaId +#define xmlSecKeyDataX509Id xmlSecSymbianCryptoKeyDataX509Id +#define xmlSecKeyDataRawX509CertId xmlSecSymbianCryptoKeyDataRawX509CertId + +/** + * Key data store ids + */ +#define xmlSecX509StoreId xmlSecSymbianCryptoX509StoreId + +/** + * Crypto transforms ids + */ +#define xmlSecTransformAes128CbcId xmlSecSymbianCryptoTransformAes128CbcId +#define xmlSecTransformAes192CbcId xmlSecSymbianCryptoTransformAes192CbcId +#define xmlSecTransformAes256CbcId xmlSecSymbianCryptoTransformAes256CbcId +#define xmlSecTransformKWAes128Id xmlSecSymbianCryptoTransformKWAes128Id +#define xmlSecTransformKWAes192Id xmlSecSymbianCryptoTransformKWAes192Id +#define xmlSecTransformKWAes256Id xmlSecSymbianCryptoTransformKWAes256Id +#define xmlSecTransformDes3CbcId xmlSecSymbianCryptoTransformDes3CbcId +#define xmlSecTransformKWDes3Id xmlSecSymbianCryptoTransformKWDes3Id +#define xmlSecTransformDsaSha1Id xmlSecSymbianCryptoTransformDsaSha1Id +#define xmlSecTransformHmacMd5Id xmlSecSymbianCryptoTransformHmacMd5Id +#define xmlSecTransformHmacRipemd160Id xmlSecSymbianCryptoTransformHmacRipemd160Id +#define xmlSecTransformHmacSha1Id xmlSecSymbianCryptoTransformHmacSha1Id +#define xmlSecTransformRipemd160Id xmlSecSymbianCryptoTransformRipemd160Id +#define xmlSecTransformRsaSha1Id xmlSecSymbianCryptoTransformRsaSha1Id +#define xmlSecTransformRsaPkcs1Id xmlSecSymbianCryptoTransformRsaPkcs1Id +#define xmlSecTransformRsaOaepId xmlSecSymbianCryptoTransformRsaOaepId +#define xmlSecTransformSha1Id xmlSecSymbianCryptoTransformSha1Id + +/** + * High level routines form xmlsec command line utility + */ +#define xmlSecCryptoAppInit xmlSecSymbianCryptoAppInit +#define xmlSecCryptoAppShutdown xmlSecSymbianCryptoAppShutdown +#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecSymbianCryptoAppDefaultKeysMngrInit +#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey +#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecSymbianCryptoAppDefaultKeysMngrLoad +#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecSymbianCryptoAppDefaultKeysMngrSave +#define xmlSecCryptoAppKeysMngrCertLoad xmlSecSymbianCryptoAppKeysMngrCertLoad +#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecSymbianCryptoAppKeysMngrCertLoadMemory +#define xmlSecCryptoAppKeyLoadWithName xmlSecSymbianCryptoAppKeyLoadWithName +#define xmlSecCryptoAppPkcs12Load xmlSecSymbianCryptoAppPkcs12Load +#define xmlSecCryptoAppKeyCertLoad xmlSecSymbianCryptoAppKeyCertLoad +#define xmlSecCryptoAppKeyLoadMemoryWithName xmlSecSymbianCryptoAppKeyLoadMemoryWithName +#define xmlSecCryptoAppPkcs12LoadMemory xmlSecSymbianCryptoAppPkcs12LoadMemory +#define xmlSecCryptoAppKeyCertLoadMemory xmlSecSymbianCryptoAppKeyCertLoadMemory +#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecSymbianCryptoAppGetDefaultPwdCallback + +#endif /* XMLSEC_CRYPTO_SYMBIANCRYPTO */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ */ + +#define __XMLSEC_SYMBIANCRYPTO_CRYPTO_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_x509.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_x509.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,116 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#ifndef __XMLSEC_SYMBIANCRYPTO_X509_H__ +#define __XMLSEC_SYMBIANCRYPTO_X509_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "xmlsecc_config.h" +#ifndef XMLSEC_NO_X509 + +//#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" + +#include "xmlsecc_x509wrapper.h" + +/** + * XMLSEC_STACK_OF_X509: + * + * Macro. To make docbook happy. + */ +#define XMLSEC_STACK_OF_X509 STACK_OF(X509) + +/** + * XMLSEC_STACK_OF_X509_CRL: + * + * Macro. To make docbook happy. + */ +#define XMLSEC_STACK_OF_X509_CRL STACK_OF(X509_CRL) + + +/** + * xmlSecSymbianCryptoKeyDataX509Id: + * + * The SymbianCrypto X509 data klass. + */ +#define xmlSecSymbianCryptoKeyDataX509Id \ + xmlSecSymbianCryptoKeyDataX509GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataX509GetKlass(void); +XMLSEC_CRYPTO_EXPORT X509* xmlSecSymbianCryptoKeyDataX509GetKeyCert(xmlSecKeyDataPtr data); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, + X509* cert); + +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, + X509* cert); +XMLSEC_CRYPTO_EXPORT X509* xmlSecSymbianCryptoKeyDataX509GetCert (xmlSecKeyDataPtr data, + xmlSecSize pos); +XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecSymbianCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data); + +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, + X509_CRL* crl); +XMLSEC_CRYPTO_EXPORT X509_CRL* xmlSecSymbianCryptoKeyDataX509GetCrl (xmlSecKeyDataPtr data, + xmlSecSize pos); +XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecSymbianCryptoKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data); + +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecSymbianCryptoX509CertGetKey (X509* cert); + +/** + * xmlSecSymbianCryptoKeyDataRawX509CertId: + * + * The SymbianCrypto raw X509 certificate klass. + */ +#define xmlSecSymbianCryptoKeyDataRawX509CertId \ + xmlSecSymbianCryptoKeyDataRawX509CertGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecSymbianCryptoKeyDataRawX509CertGetKlass(void); + +/** + * xmlSecSymbianCryptoX509StoreId: + * + * The SymbianCrypto X509 store klass. + */ +#define xmlSecSymbianCryptoX509StoreId \ + xmlSecSymbianCryptoX509StoreGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecSymbianCryptoX509StoreGetKlass(void); +XMLSEC_CRYPTO_EXPORT X509* xmlSecSymbianCryptoX509StoreFindCert (xmlSecKeyDataStorePtr store, + xmlChar *subjectName, + xmlChar *issuerName, + xmlChar *issuerSerial, + xmlChar *ski, + xmlSecKeyInfoCtx* keyInfoCtx); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoX509StoreKeyCertVerify(xmlSecKeyDataStorePtr store, + X509* cert); +XMLSEC_CRYPTO_EXPORT X509* xmlSecSymbianCryptoX509StoreVerify (xmlSecKeyDataStorePtr store, + XMLSEC_STACK_OF_X509* certs, + XMLSEC_STACK_OF_X509_CRL* crls, + xmlSecKeyInfoCtx* keyInfoCtx); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoX509StoreAdoptCert (xmlSecKeyDataStorePtr store, + X509* cert, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT int xmlSecSymbianCryptoX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, + const char* path); + + + +XMLSEC_CRYPTO_EXPORT void xmlSecSetCertStoreFlag(); +XMLSEC_CRYPTO_EXPORT void xmlSecResetCertStoreFlag(); +XMLSEC_CRYPTO_EXPORT int xmlSecCheckCertStoreFlag(); + +#endif /* XMLSEC_NO_X509 */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_XMLSEC_SYMBIANCRYPTO_X509_H__ */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/inc/xmlsecc_x509wrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/inc/xmlsecc_x509wrapper.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to process X509 certificates. +* +*/ + + +/* A wrapper for x509.h in openssl */ + +#ifndef __XMLSEC_SYMBIANCRYPTO_X509_WRAPPER_H__ +#define __XMLSEC_SYMBIANCRYPTO_X509_WRAPPER_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include "xmlsecc_config.h" + +#ifndef XMLSEC_NO_X509 + +#include "xmlsecc_evpwrapper.h" + +/* +struct ScX509PubKeySt; +typedef struct ScX509PubKeySt X509_PUBKEY; +typedef struct ScX509St +{ + char* der; // Certificate in ASN.1 DER format + unsigned int derlen; + X509_PUBKEY *extractedPublicKey; + +} X509; +*/ + +typedef struct ScX509CrlSt +{ + /* actual signature */ + int dummy; +} X509_CRL; /* X509_CRL */ + + +typedef struct ScX509NameSt +{ + char *bytes; + unsigned long hash; /* Keep the hash around for lookups */ +} X509_NAME; /* X509_NAME */ + +/* +typedef struct ScX509Store +{ + int dummy; +} X509_STORE; // X509_STORE +*/ +struct ScX509Store; +typedef struct ScX509Store X509_STORE; + + +#define STACK_OF(type) type +//#define STACK_OF(type) struct stack_st_##type + +/** + * Free the X509 structure + * + * @param aCert X509 structure + */ +void X509_free(X509* aCert); + +/** + * Free the X509_crl structure + * + * @param aCrl X509_CRL structure + */ +void X509_crl_free(X509_CRL* aCrl); + +/** + * Duplicate the X509 structure + * + * @param aCert X509 structure + * @return reference to X509 duplicated structure + */ +X509* X509_dup(X509* aCert); + +/** + * Get the public key + * + * @param aCert X509 structure + * @return EVP_PKEY structure + */ +EVP_PKEY* X509_get_pubkey(X509* aCert); + +/** + * Read the certificate from DER format + * + * @param aBIO BIO structure + * @return reference to X509 structure + */ +X509* d2i_X509_bio(BIO *aBio); + +/** + * Test the validity period from the certificate + * + * @param aCert X509 structure + * @return validation period status + */ +int X509_test_validityPeriod(X509* aCert); + +/************************************ + * + * X509 Store + * + ************************************/ + +/** + * Add a X509 certificate to the X509_STORE + * + * @param aCertStore X509_STORE structure + * @param aCert X509 structure + * @return 0 if correct adding + * @return error in the other hand + */ +int X509_STORE_add_cert(X509_STORE *aCertStore, X509 *aCert); + +/** + * Initialize the X509_STORE structure + * + * @return reference to X509_STORE structure + */ +X509_STORE *X509_STORE_new(void ); + +/** + * Initialize the SymbianCertChain + * + * @param aCertStore X509_STORE structure + * @param aCert STACK_OF(X509) structure + * @return 0 if correct initializing + * @return error in the other hand + */ +int X509_STORE_certchain_init (X509_STORE *aCertStore, STACK_OF(X509) *aCert); + +/** + * Initialize the SymbianCertChain with cert from SymbianCertStore + * + * @param aCertStore X509_STORE structure + * @param aCert STACK_OF(X509) structure + * @return 0 if correct initializing + * @return error in the other hand + */ +int X509_STORE_certchain_init_fromCertStore (X509_STORE *aCertStore, STACK_OF(X509) *aCert); + +/** + * Validate the certificates + * + * @param aCertStore X509_STORE structure + * @return 0 if correct initializing + * @return error in the other hand + */ +int X509_STORE_certchain_validate (X509_STORE *aCertStore); + +/** + * Get the validation result: 1 - success; 0 - failed + * + * @param aCertStore X509_STORE structure + * @return 1 if validation succeed + * @return 0 if validation failed + */ +int X509_STORE_certchain_getValidateResult (X509_STORE *aCertStore); + +/** + * Free the X509_STORE structure + * + * @param aCertStore X509_STORE structure + */ +void X509_STORE_free(X509_STORE *aCertStore); + +#endif /* XMLSEC_NO_X509 */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __SYMBIANCRYPTO_X509_WRAPPER_H__ */ + +#define __SYMBIANCRYPTO_X509_WRAPPER_H__ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/rom/xmlseccrypto.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/rom/xmlseccrypto.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for XMLSec Crypto component +* Description : Image description file for XMLSec Crypto component +* +*/ + + +#ifndef __XMLSECCRYPTO_IBY__ +#define __XMLSECCRYPTO_IBY__ + +file=ABI_DIR\BUILD_DIR\xmlseccrypto.dll SHARED_LIB_DIR\xmlseccrypto.dll + +#endif //__XMLSECCRYPTO_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/Copyright --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/Copyright Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,59 @@ +xmlsec, xmlsec-openssl, xmlsec-gnutls libraries +------------------------------------------------------------------------------ + +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + + +xmlsec-nss library +------------------------------------------------------------------------------ +Copyright (C) 2002-2003 Aleksey Sanin. All Rights Reserved. +Copyright (c) 2003 America Online, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Portions of the Software were created using source code and/or APIs +governed by the Mozilla Public License (MPL). The MPL is available +at http://www.mozilla.org/MPL/MPL-1.1.html. The MPL permits such +portions to be distributed with code not governed by MPL, as long +as the requirements of MPL are fulfilled for such portions. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Aleksey Sanin shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_app.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,909 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include + +#include "xmlsecc_globals.h" + +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" + +#include "xmlsecc_app.h" +#include "xmlsecc_crypto.h" +#include "xmlsecc_evp.h" + +#ifndef XMLSEC_NO_X509 +#include "xmlsecc_x509.h" +#include "xmlsecc_x509wrapper.h" +#include "xmlsecc_bio.h" +#endif /* XMLSEC_NO_X509 */ + +/** + * xmlSecSymbianCryptoAppInit: + * @config: the path to SymbianCrypto configuration (unused). + * + * General crypto engine initialization. This function is used + * by XMLSec command line utility and called before + * @xmlSecInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppInit(const char* config ATTRIBUTE_UNUSED) { + int ret(0); + if( ret ) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "symbiancrypto_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + return(0); +} + +/** + * xmlSecSymbianCryptoAppShutdown: + * + * General crypto engine shutdown. This function is used + * by XMLSec command line utility and called after + * @xmlSecShutdown function. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppShutdown(void) { + return(0); +} + +/** + * xmlSecSymbianCryptoAppKeyLoadWithName: + * @filename: the key filename. + * @format: the key file format. + * @keyname: the assigned name of key + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the a file (not implemented yet). + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppKeyLoadWithName(const char* filename, xmlSecKeyDataFormat format, + const char* keyname, + const char* pwd, + void* pwdCallback, + void* pwdCallbackCtx) { + xmlSecKeyPtr key = NULL; + EVP_PKEY* pKey = NULL; + BIO* bio; + xmlSecKeyDataPtr data; + + xmlSecAssert2(filename, NULL); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL); + + bio = BIO_new_file(filename, (const char*)"rb", keyname); + if(!bio) { + return(NULL); + } + + key = xmlSecSymbianCryptoAppKeyLoadBIO (bio, format, pwd, pwdCallback, pwdCallbackCtx); + BIO_free(bio); + if(!key) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecOpenSSLAppKeyLoadBIO", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + return(NULL); + } + + if(xmlSecKeySetName(key, (const unsigned char*)keyname) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeySetName", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + xmlSecKeyDestroy(key); + return(NULL); + } + + return(key); +} + +/** + * xmlSecSymbianCryptoAppKeyLoadMemory: + * @data: the binary key data. + * @dataSize: the size of binary key. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the memory buffer (not implemented yet). + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppKeyLoadMemoryWithName(const xmlSecByte* data, xmlSecSize dataSize, + xmlSecKeyDataFormat format, const char* keyname, const char* pwd, + void* pwdCallback, void* pwdCallbackCtx) { + + xmlSecKeyPtr key = NULL; + EVP_PKEY* pKey = NULL; + BIO* bio; + + bio = BIO_new_buffer((const char*)data,dataSize,keyname); + if(!bio) { + return(NULL); + } + + key = xmlSecSymbianCryptoAppKeyLoadBIO(bio, format, pwd, pwdCallback, pwdCallbackCtx); + BIO_free(bio); + if(!key) { + return(NULL); + } + + if(xmlSecKeySetName(key, (const unsigned char*)keyname) < 0) { + xmlSecKeyDestroy(key); + return(NULL); + } + return(key); +} + +/** + * xmlSecOpenSSLAppKeyLoadBIO: + * @bio: the key BIO. + * @format: the key file format. + * @pwd: the key file password. + * @pwdCallback: the key password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key from the an OpenSSL BIO object. + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format, + const char* pwd, void* pwdCallback, + void* pwdCallbackCtx) { + + xmlSecKeyPtr key = NULL; + xmlSecKeyDataPtr data; + EVP_PKEY* pKey = NULL; + int ret(-1); + + xmlSecAssert2(bio, NULL); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL); + + switch (format) + { + case xmlSecKeyDataFormatDer: + /* try to read private key first */ + if(!pKey) { + // go to start of the file and try to read public key + pKey = d2i_PUBKEY_bio(bio); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "d2i_PrivateKey_bio and d2i_PUBKEY_bio", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + } + + break; + case xmlSecKeyDataFormatPkcs8Der: + /* try to read private key first */ + pKey = d2i_PKCS8PrivateKey_bio(bio, pwdCallback, pwdCallbackCtx); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "sc_PrivateKey_read", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_FORMAT, + "format=%d", format); + return(NULL); + } + + data = xmlSecSymbianCryptoEvpKeyAdopt(pKey); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoEvpKeyAdopt", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + sc_pkey_free(pKey); + return(NULL); + } + + key = xmlSecKeyCreate(); + if(!key) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "data=%s", + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data))); + xmlSecKeyDestroy(key); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + return(key); +} + + +#ifndef XMLSEC_NO_X509 +static X509* xmlSecSymbianCryptoAppCertLoadBIO (BIO* bio, + xmlSecKeyDataFormat format); + +/** + * xmlSecSymbianCryptoAppKeyCertLoad: + * @key: the pointer to key. + * @filename: the certificate filename. + * @format: the certificate file format. + * + * Reads the certificate from $@filename and adds it to key + * (not implemented yet). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, + xmlSecKeyDataFormat format) { + BIO* bio(NULL); + int ret(-1); + + xmlSecAssert2(key, -1); + xmlSecAssert2(filename, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + + /* Implementation from OpenSSL */ + bio = BIO_new_file(filename, "rb", NULL); + if(!bio) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_new_file", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + return(-1); + } + + ret = xmlSecSymbianCryptoAppKeyCertLoadBIO (key, bio, format); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppKeyCertLoadBIO", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + BIO_free(bio); + return(-1); + } + + BIO_free(bio); + return(0); + +} + +/** + * xmlSecSymbianCryptoAppKeyCertLoadBIO: + * @key: the pointer to key. + * @bio: the certificate bio. + * @format: the certificate file format. + * + * Reads the certificate from memory buffer and adds it to key. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat format) { + + xmlSecKeyDataFormat certFormat; + xmlSecKeyDataPtr data; + X509* cert(NULL); + int ret(-1); + + xmlSecAssert2(key, -1); + xmlSecAssert2(bio, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + + data = xmlSecKeyEnsureData(key, xmlSecSymbianCryptoKeyDataX509Id); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyEnsureData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "transform=%s", + xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecSymbianCryptoKeyDataX509Id))); + return(-1); + } + + /* adjust cert format */ + switch(format) { + case xmlSecKeyDataFormatPkcs8Pem: + certFormat = xmlSecKeyDataFormatPem; + break; + case xmlSecKeyDataFormatPkcs8Der: + certFormat = xmlSecKeyDataFormatDer; + break; + default: + certFormat = format; + } + + cert = xmlSecSymbianCryptoAppCertLoadBIO(bio, certFormat); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppCertLoad", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptKeyCert(data, cert); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "data=%s", + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data))); + X509_free(cert); + return(-1); + } + + return(0); +} + + +/** + * xmlSecSymbianCryptoAppKeyCertLoadMemory: + * @key: the pointer to key. + * @data: the certificate binary data. + * @dataSize: the certificate binary data size. + * @format: the certificate file format. + * + * Reads the certificate from memory buffer and adds it to key (not implemented yet). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format) { + xmlSecAssert2(key, -1); + xmlSecAssert2(data, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + int ret(-1); + BIO* bio(NULL); + + bio = BIO_new_buffer((const char*)data,dataSize,NULL); + if(!bio) { + return(-1); + } + + ret = xmlSecSymbianCryptoAppKeyCertLoadBIO (key, bio, format); + BIO_free(bio); + if(ret < 0) { + return(-1); + } + return(0); +} + +/** + * xmlSecSymbianCryptoAppPEMReadPrivateKey: + * @filename: the PEM key filename. + * @pwd: the PEM file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 file + * (not implemented yet). + * For uniformity, call xmlSecSymbianCryptoAppKeyLoad instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +xmlSecKeyPtr +xmlSecSymbianCryptoAppPEMReadPrivateKey(const char* filename, + const char* pwd ATTRIBUTE_UNUSED, + void* pwdCallback ATTRIBUTE_UNUSED, + void* pwdCallbackCtx ATTRIBUTE_UNUSED) { + xmlSecAssert2(filename, NULL); + + /* Unimplemented - for futher use */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppPEMReadPrivateKey", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); +} + + +/** + * xmlSecSymbianCryptoAppPkcs12Load: + * @filename: the PKCS12 key filename. + * @pwd: the PKCS12 file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 file + * (not implemented yet). + * For uniformity, call xmlSecSymbianCryptoAppKeyLoad instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12. + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppPkcs12Load(const char* filename, + const char* pwd ATTRIBUTE_UNUSED, + void* pwdCallback ATTRIBUTE_UNUSED, + void* pwdCallbackCtx ATTRIBUTE_UNUSED) { + xmlSecAssert2(filename, NULL); + + /* Unimplemented - for futher use */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppPkcs12Load", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); +} + +/** + * xmlSecSymbianCryptoAppPkcs12LoadMemory: + * @data: the PKCS12 binary data. + * @dataSize: the PKCS12 binary data size. + * @pwd: the PKCS12 file password. + * @pwdCallback: the password callback. + * @pwdCallbackCtx: the user context for password callback. + * + * Reads key and all associated certificates from the PKCS12 data in memory buffer. + * For uniformity, call xmlSecSymbianCryptoAppKeyLoadMemory instead of this function. Pass + * in format=xmlSecKeyDataFormatPkcs12 (not implemented yet). + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, + const char* pwd, void* pwdCallback, + void* pwdCallbackCtx) { + xmlSecAssert2(data, NULL); + /* Unimplemented - for futher use */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppPkcs12LoadMemory", + XMLSEC_ERRORS_R_NOT_IMPLEMENTED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); +} + +/** + * xmlSecSymbianCryptoAppKeysMngrCertLoad: + * @mngr: the keys manager. + * @filename: the certificate file. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate in @filename + * trusted or not. + * + * Reads cert from @filename and adds to the list of trusted or known + * untrusted certs in @store (not implemented yet). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type ATTRIBUTE_UNUSED) { + BIO* bio(NULL); + int ret(-1); + + xmlSecAssert2(mngr, -1); + xmlSecAssert2(filename, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + + /* Implementation from OpenSSL */ + bio = BIO_new_file(filename, "rb", NULL); + if(!bio) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_new_file", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + return(-1); + } + + ret = xmlSecSymbianCryptoAppKeysMngrCertLoadBIO(mngr, bio, format, type); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppKeysMngrCertLoadBIO", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + BIO_free(bio); + return(-1); + } + + BIO_free(bio); + return(0); +} + +/** + * xmlSecSymbianCryptoAppKeysMngrCertLoadMemory: + * @mngr: the keys manager. + * @data: the certificate binary data. + * @dataSize: the certificate binary data size. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate trusted or not. + * + * Reads cert from binary buffer @data and adds to the list of trusted or known + * untrusted certs in @store (not implemented yet). + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data, + xmlSecSize dataSize, xmlSecKeyDataFormat format, + xmlSecKeyDataType type) { + xmlSecAssert2(mngr, -1); + xmlSecAssert2(data, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + + BIO* bio(NULL); + int ret(-1); + + bio = BIO_new_buffer((const char*)data,dataSize, NULL); + if(!bio) { + return(-1); + } + + ret = xmlSecSymbianCryptoAppKeysMngrCertLoadBIO(mngr, bio, format, type); + BIO_free(bio); + if(ret < 0) { + return(-1); + } + return(0); +} + +static X509* +xmlSecSymbianCryptoAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) { + X509 *cert; + + xmlSecAssert2(bio, NULL); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL); + + switch(format) { + case xmlSecKeyDataFormatDer: + case xmlSecKeyDataFormatCertDer: + cert = d2i_X509_bio(bio); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "d2i_X509_bio", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_FORMAT, + "format=%d", format); + return(NULL); + } + + return(cert); +} + + +/** + * xmlSecSymbianCryptoAppKeysMngrCertLoadBIO: + * @mngr: the keys manager. + * @bio: the certificate BIO. + * @format: the certificate file format. + * @type: the flag that indicates is the certificate trusted or not. + * + * Reads cert from an SymbianCrypto BIO object and adds to the list of trusted or known + * untrusted certs in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio, + xmlSecKeyDataFormat format, xmlSecKeyDataType type) { + xmlSecKeyDataStorePtr x509Store; + X509* cert(NULL); + int ret(-1); + + xmlSecAssert2(mngr, -1); + xmlSecAssert2(bio, -1); + xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1); + + x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrGetDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecSymbianCryptoX509StoreId"); + return(-1); + } + + cert = xmlSecSymbianCryptoAppCertLoadBIO(bio, format); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoAppCertLoadBIO", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSymbianCryptoX509StoreAdoptCert(x509Store, cert, type); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509StoreAdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_free(cert); + return(-1); + } + + return(0); +} + +#endif /* XMLSEC_NO_X509 */ + +/** + * xmlSecSymbianCryptoAppDefaultKeysMngrInit: + * @mngr: the pointer to keys manager. + * + * Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId + * and a default SymbianCrypto crypto key data stores. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) { + int ret(-1); + + xmlSecAssert2(mngr, -1); + + /* create simple keys store if needed */ + if(!xmlSecKeysMngrGetKeysStore(mngr)) { + xmlSecKeyStorePtr keysStore; + + keysStore = xmlSecKeyStoreCreate(xmlSecSymbianKeysStoreId); + if(!keysStore) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyStoreCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecSimpleKeysStoreId"); + return(-1); + } + + ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrAdoptKeysStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyStoreDestroy(keysStore); + return(-1); + } + } + + ret = xmlSecSymbianCryptoKeysMngrInit(mngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoKeysMngrInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + mngr->getKey = xmlSecKeysMngrGetKey; + return(0); +} + +/** + * xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey: + * @mngr: the pointer to keys manager. + * @key: the pointer to key. + * + * Adds @key to the keys manager @mngr created with #xmlSecSymbianCryptoAppDefaultKeysMngrInit + * function. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) { + xmlSecKeyStorePtr store; + int ret(-1); + + xmlSecAssert2(mngr, -1); + xmlSecAssert2(key, -1); + + store = xmlSecKeysMngrGetKeysStore(mngr); + if(!store) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrGetKeysStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSimpleKeysStoreAdoptKey(store, key); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSimpleKeysStoreAdoptKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecSymbianCryptoAppDefaultKeysMngrLoad: + * @mngr: the pointer to keys manager. + * @uri: the uri. + * + * Loads XML keys file from @uri to the keys manager @mngr created + * with #xmlSecSymbianCryptoAppDefaultKeysMngrInit function. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) { + xmlSecKeyStorePtr store; + int ret(-1); + + xmlSecAssert2(mngr, -1); + xmlSecAssert2(uri, -1); + + store = xmlSecKeysMngrGetKeysStore(mngr); + if(!store) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrGetKeysStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSimpleKeysStoreLoad", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "uri=%s", xmlSecErrorsSafeString(uri)); + return(-1); + } + + return(0); +} + +/** + * xmlSecSymbianCryptoAppDefaultKeysMngrSave: + * @mngr: the pointer to keys manager. + * @filename: the destination filename. + * @type: the type of keys to save (public/private/symmetric). + * + * Saves keys from @mngr to XML keys file. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, + const char* filename, + xmlSecKeyDataType type) { + xmlSecKeyStorePtr store; + int ret(-1); + + xmlSecAssert2(mngr, -1); + xmlSecAssert2(filename, -1); + + store = xmlSecKeysMngrGetKeysStore(mngr); + if(!store) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrGetKeysStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSimpleKeysStoreSave(store, filename, type); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSimpleKeysStoreSave", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "filename=%s", + xmlSecErrorsSafeString(filename)); + return(-1); + } + + return(0); +} + +/** + * xmlSecSymbianCryptoAppGetDefaultPwdCallback: + * + * Gets default password callback. + * + * Returns default password callback. + */ +EXPORT_C +void* +xmlSecSymbianCryptoAppGetDefaultPwdCallback(void) { + return(NULL); +} + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_bio.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_bio.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A wrapper of OpenSSL bio.c functions to Symbian. +* +*/ + + +/** A wrapper of OpenSSL bio.c functions to Symbian **/ + +#include +#include +#include +#include +#include +#include "xmlsec_error_flag.h" +#include "xmlsecc_config.h" +#include "xmlsecc_bio.h" + +BIO* BIO_new_buffer(const char *aData, unsigned int aSize, const char *aName) + { + BIO *bio; + char *tmpname = NULL; + + char* buf = (char *)malloc(aSize + 1); + if(!buf){ + xmlSecSetErrorFlag( KErrNoMemory ); + return(NULL); + } + memcpy(buf, aData, aSize); + + if (aName) + { + tmpname = (char *)malloc(sizeof(char)*(strlen(aName)+1)); + if (!tmpname) + { + xmlSecSetErrorFlag( KErrNoMemory ); + free(buf); + return (NULL); + } + strcpy(tmpname, aName); + } + + bio = (BIO *)malloc(sizeof(BIO)); + if (!bio) + { + xmlSecSetErrorFlag( KErrNoMemory ); + free(buf); + free(tmpname); + return(NULL); + } + + bio->mem = buf; + bio->len = aSize; + bio->name = tmpname; + + return bio; + } + +BIO* BIO_new_file(const char *aFilename, const char *aMode, const char *name) +{ + BIO *bio; + FILE *fp; + char *buf; + long fileLen; + int byteRead; + char *tmpname = NULL; + + //Read file to memory + fp = fopen(aFilename, aMode); + if(!fp) + { + if ( errno == ENOMEM ) + { + xmlSecSetErrorFlag( KErrNoMemory ); + } + return(NULL); + } + fseek(fp, 0, SEEK_END); + fileLen = ftell(fp); + fseek ( fp , 0L , SEEK_SET ); + + buf = (char *)malloc(sizeof(char)*(fileLen+1)); + if(!buf) { + xmlSecSetErrorFlag( KErrNoMemory ); + return(NULL); + } + + byteRead = fread(buf, sizeof(char), fileLen, fp); + if(byteRead != fileLen) { + free(buf); + return(NULL); + } + + if (name) + { + tmpname = (char *)malloc(sizeof(char)*(strlen(name)+1)); + if (!tmpname) + { + xmlSecSetErrorFlag( KErrNoMemory ); + free(buf); + return (NULL); + } + strcpy(tmpname, name); + } + + bio = (BIO *)malloc(sizeof(BIO)); + if (!bio) + { + xmlSecSetErrorFlag( KErrNoMemory ); + if (tmpname) + { + free(tmpname); + } + free(buf); + return(NULL); + } + + bio->mem = buf; + bio->len = fileLen; + bio->name = tmpname; + + return bio; + +} + +void BIO_free(BIO *bio) +{ + if (bio) + { + if (bio->mem) + { + memset(bio->mem, 0, bio->len); + free(bio->mem); + } + if (bio->name) + { + free(bio->name); + } + free(bio); + } +} + +BIO* BIO_new() +{ + BIO *bio = (BIO *)malloc(sizeof(BIO)); + if ( !bio ) + { + xmlSecSetErrorFlag( KErrNoMemory ); + return NULL; + } + bio->mem = NULL; + bio->len = 0; + bio->name = NULL; + return bio; +} + +int BIO_write(BIO *bio, const unsigned char *buf, unsigned int size) +{ + bio->mem = (char *)malloc(size *sizeof(char)); + if (!bio->mem) + { + xmlSecSetErrorFlag( KErrNoMemory ); + return -1; + } + + memcpy((unsigned char*)bio->mem, buf, size); + bio->len = size; + + return 0; +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_ciphers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_ciphers.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,865 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_globals.h" + +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" + +#include "xmlsecc_crypto.h" +#include "xmlsecc_cryptowrapper.h" // replace gnutils/gnutls.h + +/************************************************************************** + * + * Internal SymbianCrypto Block cipher CTX + * + *****************************************************************************/ +xmlSecTransformGetDataTypeMethod const xmlSecCrpytoGetDataTypeMethod = xmlSecTransformDefaultGetDataType; +xmlSecTransformPushBinMethod const xmlSecCryptoPushBinMethod = xmlSecTransformDefaultPushBin; +xmlSecTransformPopBinMethod const xmlSecCryptoPopBinMethod = xmlSecTransformDefaultPopBin; + +typedef struct _xmlSecSymbianCryptoBlockCipherCtx xmlSecSymbianCryptoBlockCipherCtx, + *xmlSecSymbianCryptoBlockCipherCtxPtr; +struct _xmlSecSymbianCryptoBlockCipherCtx { + int cipher; + int mode; + ScCipherHd cipherCtx; + //sc_cipher_hd_t cipherCtx; + xmlSecKeyDataId keyId; + int keyInitialized; + int ctxInitialized; +}; + +static int xmlSecSymbianCryptoBlockCipherCtxInit (xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, + xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoBlockCipherCtxUpdate (xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, + xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoBlockCipherCtxFinal (xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, + xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx); +static int +xmlSecSymbianCryptoBlockCipherCtxInit(xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx) { + int blockLen; + int ret; + + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->cipher != 0, -1); + xmlSecAssert2(ctx->cipherCtx, -1); + xmlSecAssert2(ctx->keyInitialized != 0, -1); + xmlSecAssert2(ctx->ctxInitialized == 0, -1); + xmlSecAssert2(in, -1); + xmlSecAssert2(out, -1); + xmlSecAssert2(transformCtx, -1); + + /* iv len == block len */ + blockLen = sc_cipher_get_algo_blklen(ctx->cipher); + xmlSecAssert2(blockLen > 0, -1); + set_ctx_blocksize(ctx->cipherCtx, blockLen); //set blocksize + + if(encrypt) { + xmlSecByte* iv; + xmlSecSize outSize; + + /* allocate space for IV */ + outSize = xmlSecBufferGetSize(out); + ret = xmlSecBufferSetSize(out, outSize + blockLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + blockLen); + return(-1); + } + iv = xmlSecBufferGetData(out) + outSize; + + /* generate and use random iv */ + ret = sc_randomize(iv, blockLen, SC_STRONG_RANDOM); + if( ret != 0 ) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_randomize", + XMLSEC_ERRORS_R_MALLOC_FAILED, + "ret=%d", ret); + return( -1 ); + } + ret = sc_cipher_setiv(ctx->cipherCtx, iv, blockLen); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_setiv", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + } else { + /* if we don't have enough data, exit and hope that + * we'll have iv next time */ + if(xmlSecBufferGetSize(in) < (xmlSecSize)blockLen) { + return(0); + } + xmlSecAssert2(xmlSecBufferGetData(in), -1); + + /* set iv */ + ret = sc_cipher_setiv(ctx->cipherCtx, xmlSecBufferGetData(in), blockLen); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_setiv", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + + /* and remove from input */ + ret = xmlSecBufferRemoveHead(in, blockLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", blockLen); + return(-1); + } + } + + ctx->ctxInitialized = 1; + return(0); +} + +static int +xmlSecSymbianCryptoBlockCipherCtxUpdate(xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSize inSize, inBlocks, outSize; + int blockLen; + xmlSecByte* outBuf; + int ret; + + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->cipher != 0, -1); + xmlSecAssert2(ctx->cipherCtx, -1); + xmlSecAssert2(ctx->ctxInitialized != 0, -1); + xmlSecAssert2(in, -1); + xmlSecAssert2(out, -1); + xmlSecAssert2(transformCtx, -1); + + blockLen = sc_cipher_get_algo_blklen(ctx->cipher); + xmlSecAssert2(blockLen > 0, -1); + + inSize = xmlSecBufferGetSize(in); + outSize = xmlSecBufferGetSize(out); + + if(inSize < (xmlSecSize)blockLen) { + return(0); + } + + if(encrypt) { + inBlocks = inSize / ((xmlSecSize)blockLen); + } else { + /* we want to have the last block in the input buffer + * for padding check */ + inBlocks = (inSize - 1) / ((xmlSecSize)blockLen); + } + inSize = inBlocks * ((xmlSecSize)blockLen); + + /* we write out the input size plus may be one block */ + ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + inSize + blockLen); + return(-1); + } + outBuf = xmlSecBufferGetData(out) + outSize; + + if(encrypt) { + ret = sc_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen, + xmlSecBufferGetData(in), inSize, NOTLAST); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_encrypt", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + } else { + ret = sc_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen, + xmlSecBufferGetData(in), inSize, NULL, NOTLAST); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_decrypt", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + } + + /* set correct output buffer size */ + ret = xmlSecBufferSetSize(out, outSize + inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + inSize); + return(-1); + } + + /* remove the processed block from input */ + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + return(0); +} + +static int +xmlSecSymbianCryptoBlockCipherCtxFinal(xmlSecSymbianCryptoBlockCipherCtxPtr ctx, + xmlSecBufferPtr in, + xmlSecBufferPtr out, + int encrypt, + const xmlChar* cipherName, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSize inSize, outSize; + int blockLen, outLen = 0; + xmlSecByte* inBuf; + xmlSecByte* outBuf; + int ret; + + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->cipher != 0, -1); + xmlSecAssert2(ctx->cipherCtx, -1); + xmlSecAssert2(ctx->ctxInitialized != 0, -1); + xmlSecAssert2(in, -1); + xmlSecAssert2(out, -1); + xmlSecAssert2(transformCtx, -1); + + blockLen = sc_cipher_get_algo_blklen(ctx->cipher); + xmlSecAssert2(blockLen > 0, -1); + + inSize = xmlSecBufferGetSize(in); + outSize = xmlSecBufferGetSize(out); + + if(encrypt != 0) { + xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1); + + /* create padding */ + ret = xmlSecBufferSetMaxSize(in, blockLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", blockLen); + return(-1); + } + inBuf = xmlSecBufferGetData(in); + + } else { + if(inSize != (xmlSecSize)blockLen) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "data=%d;block=%d", inSize, blockLen); + return(-1); + } + } + + /* process last block */ + ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + 2 * blockLen); + return(-1); + } + outBuf = xmlSecBufferGetData(out) + outSize; + + if(encrypt) { + ret = sc_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen, + xmlSecBufferGetData(in), inSize, ISLAST); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_encrypt", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + + if((xmlSecSize)blockLen >= (inSize + 1)) + { + // Symbian should have done the padding, + //we should re-align inSize so that higher layer won't break + inSize = blockLen; + } + + } else { + ret = sc_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen, + xmlSecBufferGetData(in), inSize, &outLen, ISLAST); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "sc_cipher_decrypt", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + } + + if(encrypt == 0) { + /* check padding */ + if(inSize < outBuf[blockLen - 1]) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "padding=%d;buffer=%d", + outBuf[blockLen - 1], inSize); + return(-1); + } + // outLen is explicitely written and returned from sc_cipher_decrypt() + // outLen = inSize - outBuf[blockLen - 1]; + } else { + outLen = inSize; + } + + /* set correct output buffer size */ + ret = xmlSecBufferSetSize(out, outSize + outLen); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize + outLen); + return(-1); + } + + /* remove the processed block from input */ + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(cipherName), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + + + return(0); +} + + +/****************************************************************************** + * + * Block Cipher transforms + * + * xmlSecSymbianCryptoBlockCipherCtx block is located after xmlSecTransform structure + * + *****************************************************************************/ +#define xmlSecSymbianCryptoBlockCipherSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecSymbianCryptoBlockCipherCtx)) +#define xmlSecSymbianCryptoBlockCipherGetCtx(transform) \ + ((xmlSecSymbianCryptoBlockCipherCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) + +static int xmlSecSymbianCryptoBlockCipherInitialize (xmlSecTransformPtr transform); +static void xmlSecSymbianCryptoBlockCipherFinalize (xmlSecTransformPtr transform); +static int xmlSecSymbianCryptoBlockCipherSetKeyReq (xmlSecTransformPtr transform, + xmlSecKeyReqPtr keyReq); +static int xmlSecSymbianCryptoBlockCipherSetKey (xmlSecTransformPtr transform, + xmlSecKeyPtr key); +static int xmlSecSymbianCryptoBlockCipherExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoBlockCipherCheckId (xmlSecTransformPtr transform); + + + +static int +xmlSecSymbianCryptoBlockCipherCheckId(xmlSecTransformPtr transform) { +#ifndef XMLSEC_NO_DES + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformDes3CbcId)) { + return(1); + } +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_AES + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformAes128CbcId) || + xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformAes192CbcId) || + xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformAes256CbcId)) { + + return(1); + } +#endif /* XMLSEC_NO_AES */ + + return(0); +} + +static int +xmlSecSymbianCryptoBlockCipherInitialize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoBlockCipherCtxPtr ctx; +#ifndef XMLSEC_GNUTLS_OLD + //gpg_err_code_t ret; + //sc_error_t ret; + int ret; +#endif /* XMLSEC_GNUTLS_OLD */ + + xmlSecAssert2(xmlSecSymbianCryptoBlockCipherCheckId(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoBlockCipherSize), -1); + + ctx = xmlSecSymbianCryptoBlockCipherGetCtx(transform); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoBlockCipherCtx)); + +#ifndef XMLSEC_NO_DES + if(transform->id == xmlSecSymbianCryptoTransformDes3CbcId) { + ctx->cipher = SC_CIPHER_3DES; + ctx->mode = SC_CIPHER_MODE_CBC; + ctx->keyId = xmlSecSymbianCryptoKeyDataDesId; + } else +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_AES + if(transform->id == xmlSecSymbianCryptoTransformAes128CbcId) { + ctx->cipher = SC_CIPHER_AES128; + ctx->mode = SC_CIPHER_MODE_CBC; + ctx->keyId = xmlSecSymbianCryptoKeyDataAesId; + } else if(transform->id == xmlSecSymbianCryptoTransformAes192CbcId) { + ctx->cipher = SC_CIPHER_AES192; + ctx->mode = SC_CIPHER_MODE_CBC; + ctx->keyId = xmlSecSymbianCryptoKeyDataAesId; + } else if(transform->id == xmlSecSymbianCryptoTransformAes256CbcId) { + ctx->cipher = SC_CIPHER_AES256; + ctx->mode = SC_CIPHER_MODE_CBC; + ctx->keyId = xmlSecSymbianCryptoKeyDataAesId; + } else +#endif /* XMLSEC_NO_AES */ + + if(1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#ifndef XMLSEC_GNUTLS_OLD + ret = sc_cipher_open(&ctx->cipherCtx, ctx->cipher, ctx->mode, SC_CIPHER_SECURE); /* we are paranoid */ + if(ret != 0/*GPG_ERR_NO_ERROR*/) { +#else /* XMLSEC_GNUTLS_OLD */ + ctx->cipherCtx = sc_cipher_open(ctx->cipher, ctx->mode, SC_CIPHER_SECURE); /* we are paranoid */ + if(!ctx->cipherCtx) { +#endif /* XMLSEC_GNUTLS_OLD */ + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "sc_cipher_open", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static void +xmlSecSymbianCryptoBlockCipherFinalize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoBlockCipherCtxPtr ctx; + + xmlSecAssert(xmlSecSymbianCryptoBlockCipherCheckId(transform)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoBlockCipherSize)); + + ctx = xmlSecSymbianCryptoBlockCipherGetCtx(transform); + xmlSecAssert(ctx); + + if(ctx->cipherCtx) { + sc_cipher_close(ctx->cipherCtx); + } + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoBlockCipherCtx)); +} + +static int +xmlSecSymbianCryptoBlockCipherSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) { + xmlSecSymbianCryptoBlockCipherCtxPtr ctx; + + xmlSecAssert2(xmlSecSymbianCryptoBlockCipherCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) + || (transform->operation == xmlSecTransformOperationDecrypt), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoBlockCipherSize), -1); + xmlSecAssert2(keyReq, -1); + + ctx = xmlSecSymbianCryptoBlockCipherGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->cipher != 0, -1); + xmlSecAssert2(ctx->keyId, -1); + + keyReq->keyId = ctx->keyId; + keyReq->keyType = xmlSecKeyDataTypeSymmetric; + if(transform->operation == xmlSecTransformOperationEncrypt) { + keyReq->keyUsage = xmlSecKeyUsageEncrypt; + } else { + keyReq->keyUsage = xmlSecKeyUsageDecrypt; + } + + keyReq->keyBitsSize = 8 * sc_cipher_get_algo_keylen(ctx->cipher); + return(0); +} + +static int +xmlSecSymbianCryptoBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) { + xmlSecSymbianCryptoBlockCipherCtxPtr ctx; + xmlSecBufferPtr buffer; + xmlSecSize keySize; + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoBlockCipherCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) + || (transform->operation == xmlSecTransformOperationDecrypt), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoBlockCipherSize), -1); + xmlSecAssert2(key, -1); + + ctx = xmlSecSymbianCryptoBlockCipherGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->cipherCtx, -1); + xmlSecAssert2(ctx->cipher != 0, -1); + xmlSecAssert2(ctx->keyInitialized == 0, -1); + xmlSecAssert2(ctx->keyId, -1); + xmlSecAssert2(xmlSecKeyCheckId(key, ctx->keyId), -1); + + keySize = sc_cipher_get_algo_keylen(ctx->cipher); + xmlSecAssert2(keySize > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyGetValue(key)); + xmlSecAssert2(buffer, -1); + + if(xmlSecBufferGetSize(buffer) < keySize) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, + "keySize=%d;expected=%d", + xmlSecBufferGetSize(buffer), keySize); + return(-1); + } + + xmlSecAssert2(xmlSecBufferGetData(buffer), -1); + ret = sc_cipher_setkey(ctx->cipherCtx, xmlSecBufferGetData(buffer), keySize); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "sc_cipher_setkey", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + + ctx->keyInitialized = 1; + return(0); +} + +static int +xmlSecSymbianCryptoBlockCipherExecute(xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoBlockCipherCtxPtr ctx; + xmlSecBufferPtr in, out; + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoBlockCipherCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) + || (transform->operation == xmlSecTransformOperationDecrypt), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoBlockCipherSize), -1); + xmlSecAssert2(transformCtx, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + + ctx = xmlSecSymbianCryptoBlockCipherGetCtx(transform); + xmlSecAssert2(ctx, -1); + + if(transform->status == xmlSecTransformStatusNone) { + transform->status = xmlSecTransformStatusWorking; + } + + if(transform->status == xmlSecTransformStatusWorking) { + if(ctx->ctxInitialized == 0) { + ret = xmlSecSymbianCryptoBlockCipherCtxInit(ctx, in, out, + (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0, + xmlSecTransformGetName(transform), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecSymbianCryptoBlockCipherCtxInit", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + if((ctx->ctxInitialized == 0) && (last != 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "not enough data to initialize transform"); + return(-1); + } + if(ctx->ctxInitialized != 0) { + ret = xmlSecSymbianCryptoBlockCipherCtxUpdate(ctx, in, out, + (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0, + xmlSecTransformGetName(transform), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecSymbianCryptoBlockCipherCtxUpdate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + if(last) { + ret = xmlSecSymbianCryptoBlockCipherCtxFinal(ctx, in, out, + (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0, + xmlSecTransformGetName(transform), transformCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecSymbianCryptoBlockCipherCtxFinal", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + transform->status = xmlSecTransformStatusFinished; + } + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1); + } else if(transform->status == xmlSecTransformStatusNone) { + /* the only way we can get here is if there is no enough data in the input */ + xmlSecAssert2(last == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + + return(0); +} + + +#ifndef XMLSEC_NO_AES +/********************************************************************* + * + * AES CBC cipher transforms + * + ********************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoAes128CbcKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoBlockCipherSize, /* xmlSecSize objSize */ + + xmlSecNameAes128Cbc, /* const xmlChar* name; */ + xmlSecHrefAes128Cbc, /* const xmlChar* href; */ + xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */ + + xmlSecSymbianCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */ + xmlSecSymbianCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformAes128CbcGetKlass: + * + * AES 128 CBC encryption transform klass. + * + * Returns pointer to AES 128 CBC encryption transform. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformAes128CbcGetKlass(void) { + return(&xmlSecSymbianCryptoAes128CbcKlass); +} + +static xmlSecTransformKlass xmlSecSymbianCryptoAes192CbcKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoBlockCipherSize, /* xmlSecSize objSize */ + + xmlSecNameAes192Cbc, /* const xmlChar* name; */ + xmlSecHrefAes192Cbc, /* const xmlChar* href; */ + xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */ + + xmlSecSymbianCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */ + xmlSecSymbianCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformAes192CbcGetKlass: + * + * AES 192 CBC encryption transform klass. + * + * Returns pointer to AES 192 CBC encryption transform. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformAes192CbcGetKlass(void) { + return(&xmlSecSymbianCryptoAes192CbcKlass); +} + +static xmlSecTransformKlass xmlSecSymbianCryptoAes256CbcKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoBlockCipherSize, /* xmlSecSize objSize */ + + xmlSecNameAes256Cbc, /* const xmlChar* name; */ + xmlSecHrefAes256Cbc, /* const xmlChar* href; */ + xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */ + + xmlSecSymbianCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */ + xmlSecSymbianCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformAes256CbcGetKlass: + * + * AES 256 CBC encryption transform klass. + * + * Returns pointer to AES 256 CBC encryption transform. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformAes256CbcGetKlass(void) { + return(&xmlSecSymbianCryptoAes256CbcKlass); +} + +#endif /* XMLSEC_NO_AES */ + +#ifndef XMLSEC_NO_DES +static xmlSecTransformKlass xmlSecSymbianCryptoDes3CbcKlass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoBlockCipherSize, /* xmlSecSize objSize */ + + xmlSecNameDes3Cbc, /* const xmlChar* name; */ + xmlSecHrefDes3Cbc, /* const xmlChar* href; */ + xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */ + + xmlSecSymbianCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */ + xmlSecSymbianCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + NULL, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformDes3CbcGetKlass: + * + * Triple DES CBC encryption transform klass. + * + * Returns pointer to Triple DES encryption transform. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformDes3CbcGetKlass(void) { + return(&xmlSecSymbianCryptoDes3CbcKlass); +} +#endif /* XMLSEC_NO_DES */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_crypto.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_crypto.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,302 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_globals.h" + +#include +#include +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" +#include "xmlsec_dl.h" +#include "xmlsec_private.h" + +#include "xmlsecc_app.h" +#include "xmlsecc_crypto.h" +#include "xmlsecc_cryptowrapper.h" +#include "xmlsecc_evpwrapper.h" +#include "xmlsecc_x509.h" + +static xmlSecCryptoDLFunctionsPtr gXmlSecSymbianCryptoFunctions = NULL; + +/** + * xmlSecCryptoGetFunctions_symbiancrypto: + * + * Gets the pointer to xmlsec-symbiancrypto functions table. + * + * Returns the xmlsec-symbiancrypto functions table or NULL if an error occurs. + */ +xmlSecCryptoDLFunctionsPtr +xmlSecCryptoGetFunctions_symbiancrypto(void) { + static xmlSecCryptoDLFunctions functions; + + if(gXmlSecSymbianCryptoFunctions) { + return(gXmlSecSymbianCryptoFunctions); + } + + memset(&functions, 0, sizeof(functions)); + gXmlSecSymbianCryptoFunctions = &functions; + + /** + * Crypto Init/shutdown + */ + gXmlSecSymbianCryptoFunctions->cryptoInit = xmlSecSymbianCryptoInit; + gXmlSecSymbianCryptoFunctions->cryptoShutdown = xmlSecSymbianCryptoShutdown; + gXmlSecSymbianCryptoFunctions->cryptoKeysMngrInit = xmlSecSymbianCryptoKeysMngrInit; + + /** + * Key data ids + */ +#ifndef XMLSEC_NO_AES + gXmlSecSymbianCryptoFunctions->keyDataAesGetKlass = xmlSecSymbianCryptoKeyDataAesGetKlass; +#endif /* XMLSEC_NO_AES */ + +#ifndef XMLSEC_NO_DES + gXmlSecSymbianCryptoFunctions->keyDataDesGetKlass = xmlSecSymbianCryptoKeyDataDesGetKlass; +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_HMAC + gXmlSecSymbianCryptoFunctions->keyDataHmacGetKlass = xmlSecSymbianCryptoKeyDataHmacGetKlass; +#endif /* XMLSEC_NO_HMAC */ + +#ifndef XMLSEC_NO_RSA + gXmlSecSymbianCryptoFunctions->keyDataRsaGetKlass = xmlSecSymbianCryptoKeyDataRsaGetKlass; +#endif /* XMLSEC_NO_RSA */ + +#ifndef XMLSEC_NO_X509 + gXmlSecSymbianCryptoFunctions->keyDataX509GetKlass = xmlSecSymbianCryptoKeyDataX509GetKlass; + gXmlSecSymbianCryptoFunctions->keyDataRawX509CertGetKlass + = xmlSecSymbianCryptoKeyDataRawX509CertGetKlass; +#endif /* XMLSEC_NO_X509 */ + + /** + * Key data store ids + */ +#ifndef XMLSEC_NO_X509 + gXmlSecSymbianCryptoFunctions->x509StoreGetKlass = xmlSecSymbianCryptoX509StoreGetKlass; +#endif /* XMLSEC_NO_X509 */ + + /** + * Crypto transforms ids + */ +#ifndef XMLSEC_NO_AES + gXmlSecSymbianCryptoFunctions->transformAes128CbcGetKlass + = xmlSecSymbianCryptoTransformAes128CbcGetKlass; + gXmlSecSymbianCryptoFunctions->transformAes192CbcGetKlass + = xmlSecSymbianCryptoTransformAes192CbcGetKlass; + gXmlSecSymbianCryptoFunctions->transformAes256CbcGetKlass + = xmlSecSymbianCryptoTransformAes256CbcGetKlass; +#endif /* XMLSEC_NO_AES */ + +#ifndef XMLSEC_NO_DES + gXmlSecSymbianCryptoFunctions->transformDes3CbcGetKlass + = xmlSecSymbianCryptoTransformDes3CbcGetKlass; +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_HMAC + gXmlSecSymbianCryptoFunctions->transformHmacSha1GetKlass + = xmlSecSymbianCryptoTransformHmacSha1GetKlass; + gXmlSecSymbianCryptoFunctions->transformHmacRipemd160GetKlass + = xmlSecSymbianCryptoTransformHmacRipemd160GetKlass; + gXmlSecSymbianCryptoFunctions->transformHmacMd5GetKlass + = xmlSecSymbianCryptoTransformHmacMd5GetKlass; +#endif /* XMLSEC_NO_HMAC */ + +#ifndef XMLSEC_NO_SHA1 + gXmlSecSymbianCryptoFunctions->transformSha1GetKlass + = xmlSecSymbianCryptoTransformSha1GetKlass; +#endif /* XMLSEC_NO_SHA1 */ + + +#ifndef XMLSEC_NO_RSA + gXmlSecSymbianCryptoFunctions->transformRsaSha1GetKlass + = xmlSecSymbianCryptoTransformRsaSha1GetKlass; +#endif /* XMLSEC_NO_RSA */ + + + + + /** + * High level routines form xmlsec command line utility + */ + gXmlSecSymbianCryptoFunctions->cryptoAppInit + = xmlSecSymbianCryptoAppInit; + gXmlSecSymbianCryptoFunctions->cryptoAppShutdown + = xmlSecSymbianCryptoAppShutdown; + gXmlSecSymbianCryptoFunctions->cryptoAppDefaultKeysMngrInit + = xmlSecSymbianCryptoAppDefaultKeysMngrInit; + gXmlSecSymbianCryptoFunctions->cryptoAppDefaultKeysMngrAdoptKey + = xmlSecSymbianCryptoAppDefaultKeysMngrAdoptKey; + gXmlSecSymbianCryptoFunctions->cryptoAppDefaultKeysMngrLoad + = xmlSecSymbianCryptoAppDefaultKeysMngrLoad; + gXmlSecSymbianCryptoFunctions->cryptoAppDefaultKeysMngrSave + = xmlSecSymbianCryptoAppDefaultKeysMngrSave; +#ifndef XMLSEC_NO_X509 + gXmlSecSymbianCryptoFunctions->cryptoAppKeysMngrCertLoad + = xmlSecSymbianCryptoAppKeysMngrCertLoad; + gXmlSecSymbianCryptoFunctions->cryptoAppPkcs12Load + = xmlSecSymbianCryptoAppPkcs12Load; + gXmlSecSymbianCryptoFunctions->cryptoAppKeyCertLoad + = xmlSecSymbianCryptoAppKeyCertLoad; +#endif /* XMLSEC_NO_X509 */ + gXmlSecSymbianCryptoFunctions->cryptoAppKeyLoadWithName + = xmlSecSymbianCryptoAppKeyLoadWithName; + gXmlSecSymbianCryptoFunctions->cryptoAppDefaultPwdCallback + = (void*)xmlSecSymbianCryptoAppGetDefaultPwdCallback(); + + return(gXmlSecSymbianCryptoFunctions); +} + + +/** + * xmlSecSymbianCryptoInit: + * + * XMLSec library specific crypto engine initialization. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoInit (void) { + /* Check loaded xmlsec library version */ + if(xmlSecCheckVersionExact() != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCheckVersionExact", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if (sc_pkey_init() != 0) + { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "sc_pkey_init", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + + } + + /* register our klasses */ + if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms( + xmlSecCryptoGetFunctions_symbiancrypto()) < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +/** + * xmlSecSymbianCryptoShutdown: + * + * XMLSec library specific crypto engine shutdown. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoShutdown(void) { + sc_pkey_shutdown(); + return(0); +} + +/** + * xmlSecSymbianCryptoKeysMngrInit: + * @mngr: the pointer to keys manager. + * + * Adds SymbianCrypto specific key data stores in keys manager. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) { + int ret; + + xmlSecAssert2(mngr, -1); + + /* Implementation from OpenSSL */ +#ifndef XMLSEC_NO_X509 + /* create x509 store if needed */ + if(!xmlSecKeysMngrGetDataStore(mngr, xmlSecSymbianCryptoX509StoreId)) { + xmlSecKeyDataStorePtr x509Store; + + x509Store = xmlSecKeyDataStoreCreate(xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataStoreCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecOpenSSLX509StoreId"); + return(-1); + } + + ret = xmlSecKeysMngrAdoptDataStore(mngr, x509Store); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeysMngrAdoptDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataStoreDestroy(x509Store); + return(-1); + } + } +#endif /* XMLSEC_NO_X509 */ + return(0); +} + +/** + * xmlSecSymbianCryptoGenerateRandom: + * @buffer: the destination buffer. + * @size: the numer of bytes to generate. + * + * Generates @size random bytes and puts result in @buffer. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) { + int ret; + + xmlSecAssert2(buffer, -1); + xmlSecAssert2(size > 0, -1); + + ret = xmlSecBufferSetSize(buffer, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", size); + return(-1); + } + + /* get random data */ + sc_randomize(xmlSecBufferGetData(buffer), size, SC_STRONG_RANDOM); + /* + CSystemRandom* rand=CSystemRandom::NewLC(); + unsigned char* bytes=xmlSecBufferGetData(buffer); + TPtr8 ptr(bytes, xmlSecBufferGetMaxSize(buffer)); + rand->GenerateBytesL(ptr); + CleanupStack::PopAndDestroy(); + */ + return(0); +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_cryptowrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_cryptowrapper.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,831 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to encrypt and decrypt data. +* +*/ + +#include +#include +#include +#include + +// reading different cipher algorithm +#include <3des.h> +#include +#include +#include +#include +#include +#include +#include +#include + +/** A port of gnu useful functions to Symbian **/ +#include "xmlsecc_config.h" +#include "xmlsecc_globals.h" + +#include "xmlsec_error_flag.h" +#include "xmlsecc_padding.h" + +#include "xmlsecc_cryptowrapper.h" + +// set block size according to "Symmetric ciphers - How To" +//#define MAX_BLOCKSIZE 16 +const TInt KBlockSize( 8 ); +const TInt KAESBlockSize( 16 ); + +#define CTX_MAGIC_NORMAL 0x24091964 +#define CTX_MAGIC_SECURE 0x46919042 + +const TInt KDESKeySize( 8 ); +const TInt K3DESKeySize( 24 ); +const TInt KAESKeySize128( 16 ); +const TInt KAESKeySize192( 24 ); +const TInt KAESKeySize256( 32 ); + + +/* The handle structure. */ +struct sc_cipher_handle +{ + int magic; + size_t actual_handle_size; /* Allocated size of this handle. */ + CSymmetricCipher* iEncryptor; // CBlockTransformation + CSymmetricCipher* iDecryptor; + HBufC8* iKey; + TInt algo; + size_t blocksize; + int mode; + unsigned int flags; + HBufC8* iv; + int unused; /* in IV */ + +}; + + +// Call Symbian random generator +void doRandomizeL(unsigned char* buffer, size_t length) + { + HBufC8* hbuf = HBufC8::NewLC(length); + TPtr8 ptr = hbuf->Des(); + ptr.FillZ(ptr.MaxLength()); + + CSystemRandom* rand=CSystemRandom::NewLC(); + rand->GenerateBytesL(ptr); + memcpy(buffer, hbuf->Ptr(), length); + CleanupStack::PopAndDestroy(rand); + CleanupStack::PopAndDestroy(hbuf); + } + + +/** + - Function: void sc_randomize (unsigned char *BUFFER, size_t LENGTH, + enum sc_random_level LEVEL) + **/ +TInt sc_randomize(unsigned char* buffer, size_t length, enum sc_random_level level) + { + TInt leaveValue( KErrNone ); + TRAP(leaveValue, doRandomizeL (buffer, length)); + + if ( leaveValue != KErrNone ) + { + xmlSecSetErrorFlag( leaveValue ); + } + return leaveValue; + } + +/* Retrieve the block length used with algorithm A. */ +size_t sc_cipher_get_algo_blklen (int algo) +{ + switch (algo) { + // set block size according to "Symmetric ciphers - How To" + case SC_CIPHER_AES128: + case SC_CIPHER_AES192: + case SC_CIPHER_AES256: + return KAESBlockSize; + case SC_CIPHER_NONE: + case SC_CIPHER_3DES: + case SC_CIPHER_DES: + default: + return KBlockSize; // 8 bytes + + } + +} + +/* Set the IV to be used for the encryption context C to IV with + length IVLEN. The length should match the required length. */ +TInt +sc_cipher_setiv( sc_cipher_hd_t c, const byte *iv, unsigned int ivlen ) + { + TInt error( KErrNone ); + + if( iv ) { + + if (c->iv) + { + delete c->iv; + c->iv = NULL; + } + + + if( ivlen != c->blocksize ) + { + /* + log_info("WARNING: cipher_setiv: ivlen=%u blklen=%u\n", + ivlen, (unsigned) c->blocksize ); + */ + } + if (ivlen > c->blocksize) + ivlen = c->blocksize; + + TInt len = ivlen; + TRAP( error, c->iv = HBufC8::NewL(ivlen) ); + if ( error ) //!= KErrNone + { + xmlSecSetErrorFlag( error ); + } + else + { + TPtrC8 ptr(iv, ivlen); + *(c->iv) = ptr; + } + + } + c->unused = 0; + + return error; + } + +/* Set the proper Symbian data structures */ +void +cipher_encrypt_prerequisiteL (sc_cipher_hd_t c) +{ + + if (c->iEncryptor) + return; + + // Generate key and encryptor/decryptor + CBlockTransformation* bT_encrypt = NULL; + CBlockTransformation* encryptor = NULL; + + switch(c->algo) + { + + case SC_CIPHER_AES128: + case SC_CIPHER_AES192: + case SC_CIPHER_AES256: + bT_encrypt = CAESEncryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_encrypt); + break; + case SC_CIPHER_3DES: + bT_encrypt = C3DESEncryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_encrypt); + break; + case SC_CIPHER_DES: + bT_encrypt = CDESEncryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_encrypt); + break; + case SC_CIPHER_NONE: + c->iEncryptor = CNullCipher::NewL(); + break; + default: + User::Leave(KErrNotSupported); + break; + } + + switch (c->mode) + { + case SC_CIPHER_MODE_ECB: + break; + case SC_CIPHER_MODE_CBC: + + CleanupStack::PushL(bT_encrypt); + encryptor = CModeCBCEncryptor::NewLC(bT_encrypt, c->iv->Des()); + CleanupStack::Pop(encryptor); + CleanupStack::Pop(bT_encrypt); + + break; + default: + break; + } + + CleanupStack::PushL(encryptor); + + if (!c->iEncryptor) + { + if (!encryptor) + { + User::Leave(KErrGeneral); + } + CPadding* ePadding = CXmlSecPadding::NewLC(encryptor->BlockSize()); + c->iEncryptor = CBufferedEncryptor::NewL(encryptor, ePadding); + CleanupStack::Pop(ePadding); + + } + + CleanupStack::Pop(encryptor); +} + + +static TInt +cipher_encrypt_doProcessL (sc_cipher_hd_t c, byte *outbuf, const byte *inbuf, + unsigned int nbytes, int last) + { + TInt rc(KErrNone); + + switch( c->mode ) { + + case SC_CIPHER_MODE_ECB: + case SC_CIPHER_MODE_CBC: + { + TUint blockSize = c->iEncryptor->BlockSize(); + + if ((c->mode == SC_CIPHER_MODE_CBC) + && (nbytes%blockSize && !last) + && !(nbytes > blockSize + && (c->flags & SC_CIPHER_CBC_CTS))) + { + rc = KErrArgument; + } + else if ((c->mode == SC_CIPHER_MODE_ECB) + && (nbytes%blockSize && !last)) + { + rc = KErrArgument; + } + else + { + TInt outlen; + if (last) + outlen = c->iEncryptor->MaxFinalOutputLength(nbytes); + else + outlen = c->iEncryptor->MaxOutputLength(nbytes); + HBufC8 *result = HBufC8::NewLC(outlen); + TPtr8 resultActual= result->Des(); + resultActual.FillZ(resultActual.MaxLength()); + resultActual.SetLength(0); + + // could improve memory usage later by allocating a smaller buffer + HBufC8 *input = HBufC8::NewLC(nbytes); + TPtrC8 inbufPtr(inbuf, nbytes); + *input = inbufPtr; + + TInt j(0); + for(; j+blockSizeiEncryptor->Process(input->Mid(j,blockSize), resultActual); + } + + if (last) + { + c->iEncryptor->ProcessFinalL(input->Mid(j), resultActual); + // we delete iEncryptor once the decryption finishes + // so that the next decryption can use a different key or iv + delete c->iEncryptor; + c->iEncryptor = NULL; + } + else + c->iEncryptor->Process(input->Mid(j,blockSize), resultActual); + + memcpy(outbuf, result->Ptr(), result->Size()); + CleanupStack::PopAndDestroy(input); + CleanupStack::PopAndDestroy(result); + } + } + break; + /* + case SC_CIPHER_MODE_CFB: + do_cfb_encrypt(c, outbuf, inbuf, nbytes ); + break; + case SC_CIPHER_MODE_CTR: + do_ctr_encrypt(c, outbuf, inbuf, nbytes ); + break; + case SC_CIPHER_MODE_STREAM: + c->cipher->stencrypt ( &c->context.c, + outbuf, (byte*)inbuf, nbytes ); + break; + case SC_CIPHER_MODE_NONE: + if( inbuf != outbuf ) + memmove( outbuf, inbuf, nbytes ); + break; + */ + default: + rc = KErrNotSupported; + break; + + } + + return rc; + } + +/**************** + * Encrypt INBUF to OUTBUF with the mode selected at open. + * inbuf and outbuf may overlap or be the same. + * Depending on the mode some contraints apply to NBYTES. + */ +static TInt +cipher_encrypt (sc_cipher_hd_t c, byte *outbuf, + const byte *inbuf, unsigned int nbytes, int last) +{ + TInt leaveValue; + TInt ret(KErrNone); + + // Perform Symbian prerequisite data structure initialization + TRAP(leaveValue, cipher_encrypt_prerequisiteL (c)); + if (leaveValue) //!= KErrNone; + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + + // Symbian encryption + TRAP(leaveValue, ret=cipher_encrypt_doProcessL (c, outbuf, inbuf, nbytes, last)); + if (leaveValue) //!= KErrNone + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + return ret; +} + +/**************** + * Encrypt IN and write it to OUT. If IN is NULL, in-place encryption has + * been requested. + */ +int +sc_cipher_encrypt (sc_cipher_hd_t h, void *out, size_t outsize, + const void *in, size_t inlen, int last) +{ + int err; + + if (!in) + /* Caller requested in-place encryption. */ + /* Actullay cipher_encrypt() does not need to know about it, but + * we may change this to get better performance. */ + + err = cipher_encrypt (h, (byte *)out, (byte *)out, outsize, last); + else if (outsize < ((h->flags & SC_CIPHER_CBC_MAC) ? + h->blocksize : inlen)) + err = KErrArgument; + else if ((h->mode == SC_CIPHER_MODE_ECB + || (h->mode == SC_CIPHER_MODE_CBC + && (! ((h->flags & SC_CIPHER_CBC_CTS) + && (inlen > h->blocksize))))) + && ((inlen % h->blocksize) && !last)) // let Symbian do the padding + err = KErrArgument; + else + err = cipher_encrypt (h, (byte *)out, (byte *)in, inlen, last); + + if (err && out) + memset (out, 0x42, outsize); /* Failsafe: Make sure that the + plaintext will never make it into + OUT. */ + + return err; +} + +/* Set the proper Symbian data structures */ +void +cipher_decrypt_prerequisiteL (sc_cipher_hd_t c) +{ + + if (c->iDecryptor) + return; + + // Generate key and encryptor/decryptor + CBlockTransformation* bT_decrypt = NULL; + CBlockTransformation* decryptor = NULL; + + switch(c->algo) + { + + case SC_CIPHER_AES128: + case SC_CIPHER_AES192: + case SC_CIPHER_AES256: + bT_decrypt = CAESDecryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_decrypt); + break; + case SC_CIPHER_3DES: + bT_decrypt = C3DESDecryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_decrypt); + break; + case SC_CIPHER_DES: + bT_decrypt = CDESDecryptor::NewLC(c->iKey->Des()); + CleanupStack::Pop(bT_decrypt); + break; + case SC_CIPHER_NONE: + c->iDecryptor = CNullCipher::NewL(); + break; + default: + User::Leave(KErrNotSupported); + break; + } + + switch (c->mode) + { + case SC_CIPHER_MODE_ECB: + break; + case SC_CIPHER_MODE_CBC: + CleanupStack::PushL(bT_decrypt); + decryptor = CModeCBCDecryptor::NewLC(bT_decrypt, c->iv->Des()); + CleanupStack::Pop(decryptor); + CleanupStack::Pop(bT_decrypt); + + break; + default: + break; + } + + CleanupStack::PushL(decryptor); + + if (!c->iDecryptor) + { + if (!decryptor) + { + User::Leave(KErrGeneral); + } + CPadding* dPadding = CXmlSecPadding::NewLC(decryptor->BlockSize()); + c->iDecryptor = CBufferedDecryptor::NewL(decryptor, dPadding); + CleanupStack::Pop(dPadding); + + } + + CleanupStack::Pop(decryptor); +} + +static TInt +cipher_decrypt_doProcessL (sc_cipher_hd_t c, byte *outbuf, const byte *inbuf, + unsigned int nbytes, int* outputLen, int last) + { + TInt rc(KErrNone); + + switch( c->mode ) { + case SC_CIPHER_MODE_ECB: + case SC_CIPHER_MODE_CBC: + { + TUint blockSize = c->iDecryptor->BlockSize(); + + if ((c->mode == SC_CIPHER_MODE_CBC) + && nbytes%blockSize + && !(nbytes > blockSize + && (c->flags & SC_CIPHER_CBC_CTS))) + { + rc = KErrArgument; + } + else if ((c->mode == SC_CIPHER_MODE_ECB) + && nbytes%blockSize) + { + rc = KErrArgument; + } + else + { + TInt outlen; + if (last) + outlen = c->iDecryptor->MaxFinalOutputLength(nbytes); + else + outlen = c->iDecryptor->MaxOutputLength(nbytes); + HBufC8 *result = HBufC8::NewLC(outlen); + TPtr8 resultActual= result->Des(); + resultActual.FillZ(resultActual.MaxLength()); + resultActual.SetLength(0); + + // could improve memory usage later by allocating a smaller buffer + HBufC8* input = HBufC8::NewLC(nbytes); + TPtrC8 inbufPtr(inbuf, nbytes); + *input = inbufPtr; + + TInt j=0; + + for(; j+blockSizeiDecryptor->Process(input->Mid(j,blockSize), resultActual); + } + + if (last) + { + c->iDecryptor->ProcessFinalL(input->Mid(j), resultActual); + *outputLen = result->Size(); + + // we delete iDecryptor once the decryption finishes + // so that the next decryption can use a different key or iv + delete c->iDecryptor; + c->iDecryptor = NULL; + } + else + c->iDecryptor->Process(input->Mid(j,blockSize), resultActual); + + memcpy(outbuf, result->Ptr(), result->Size()); + + CleanupStack::PopAndDestroy(input); + CleanupStack::PopAndDestroy(result); + + } + } + break; + /* + case SC_CIPHER_MODE_CFB: + do_cfb_decrypt(c, outbuf, inbuf, nbytes ); + break; + case SC_CIPHER_MODE_CTR: + do_ctr_decrypt(c, outbuf, inbuf, nbytes ); + break; + case SC_CIPHER_MODE_STREAM: + c->cipher->stdecrypt ( &c->context.c, + outbuf, (byte*) inbuf, nbytes ); + break; + case SC_CIPHER_MODE_NONE: + if( inbuf != outbuf ) + memmove( outbuf, inbuf, nbytes ); + break; + */ + default: + rc = KErrNotSupported; + break; + + } + + return rc; + } + +/**************** + * Decrypt INBUF to OUTBUF with the mode selected at open. + * inbuf and outbuf may overlap or be the same. + * Depending on the mode some some contraints apply to NBYTES. + */ +static TInt +cipher_decrypt (sc_cipher_hd_t c, byte *outbuf, const byte *inbuf, + unsigned int nbytes, int *outlen, int last) +{ + TInt rc( KErrNone ); + TInt leaveValue; + + // Perform Symbian prerequisite data structure initialization + TRAP(leaveValue, cipher_decrypt_prerequisiteL (c)); + if (leaveValue != KErrNone) + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + + // Symbian decryption + TRAP(leaveValue, rc=cipher_decrypt_doProcessL (c, outbuf, inbuf, nbytes, outlen, last)); + if (leaveValue != KErrNone) + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + return rc; +} + + + +int +sc_cipher_decrypt (sc_cipher_hd_t h, void *out, size_t outsize, + const void *in, size_t inlen, int* outlen, int last) +{ + TInt err( KErrNone ); + + if (last && !outlen) + err = KErrArgument; + else if (! in) + /* Caller requested in-place encryption. */ + /* Actullay cipher_encrypt() does not need to know about it, but + * we may chnage this to get better performance. */ + err = cipher_decrypt (h, (byte*)out, (byte*)out, outsize, outlen, last); + else if (inlen == 0) + return err; + else if (outsize < inlen) + err = KErrArgument; + else if (((h->mode == SC_CIPHER_MODE_ECB) + || ((h->mode == SC_CIPHER_MODE_CBC) + && (! ((h->flags & SC_CIPHER_CBC_CTS) + && (inlen > h->blocksize))))) + && (inlen % h->blocksize)) + err = KErrArgument; + else + err = cipher_decrypt (h, (byte*)out, (byte*)in, inlen, outlen, last); + + return err; +} + +/* + Open a cipher handle for use with cipher algorithm ALGORITHM, using + the cipher mode MODE (one of the SC_CIPHER_MODE_*) and return a + handle in HANDLE. Put NULL into HANDLE and return an error code if + something goes wrong. FLAGS may be used to modify the + operation. The defined flags are: + + SC_CIPHER_SECURE: allocate all internal buffers in secure memory. + SC_CIPHER_ENABLE_SYNC: Enable the sync operation as used in OpenPGP. + SC_CIPHER_CBC_CTS: Enable CTS mode. + SC_CIPHER_CBC_MAC: Enable MAC mode. + + Values for these flags may be combined using OR. + */ +TInt +sc_cipher_open (sc_cipher_hd_t *handle, + int algo, int mode, unsigned int flags) +{ + int secure = (flags & SC_CIPHER_SECURE); + CSymmetricCipher* encryptor = NULL; //CBlockTransformation + CSymmetricCipher* decryptor = NULL; + sc_cipher_hd_t h = NULL; + TInt err( KErrNone ); + + /* If the application missed to call the random poll function, we do + it here to ensure that it is used once in a while. */ + + /* check flags */ + if ((! err) + && ((flags & ~(0 + | SC_CIPHER_SECURE + | SC_CIPHER_ENABLE_SYNC + | SC_CIPHER_CBC_CTS + | SC_CIPHER_CBC_MAC)) + || (flags & SC_CIPHER_CBC_CTS & SC_CIPHER_CBC_MAC))) + err = KErrArgument; + + /* check that a valid mode has been requested */ + if (! err) + switch (mode) + {// + case SC_CIPHER_MODE_ECB: + case SC_CIPHER_MODE_CBC: + case SC_CIPHER_MODE_CFB: + case SC_CIPHER_MODE_CTR: + case SC_CIPHER_MODE_STREAM: + break; + case SC_CIPHER_MODE_NONE: + break; + + default: + err = KErrNotSupported; + } + + + if (! err) + { + size_t size = sizeof(*h); + h = (sc_cipher_hd_t)malloc(size); + + if ( !h ) + { + err = KErrNoMemory; + xmlSecSetErrorFlag( KErrNoMemory ); + } + else + { + h->magic = secure ? CTX_MAGIC_SECURE : CTX_MAGIC_NORMAL; + h->actual_handle_size = size; + h->iEncryptor = encryptor; + h->iDecryptor = decryptor; + h->iKey = NULL; + h->algo = algo; + h->iv = NULL; + + h->mode = mode; + h->flags = flags; + + if (algo == SC_CIPHER_NONE) + { + TRAPD(leaveValue,h->iEncryptor = CNullCipher::NewL()); + if (leaveValue) //!= KErrNone + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + TRAP(leaveValue,h->iDecryptor = CNullCipher::NewL()); + if (leaveValue) //!= KErrNone + { + xmlSecSetErrorFlag( leaveValue ); + return leaveValue; + } + + } + } + } + + *handle = err ? NULL : h; + + return err; +} + + +/* Release all resources associated with the cipher handle H. H may be + NULL in which case this is a no-operation. */ +void +sc_cipher_close (sc_cipher_hd_t h) +{ + if (! h) + return; + + if ((h->magic != CTX_MAGIC_SECURE) + && (h->magic != CTX_MAGIC_NORMAL)) + { + /* + _sc_fatal_error(GPG_ERR_INTERNAL, + "sc_cipher_close: already closed/invalid handle"); + */ + return; + } + + else + h->magic = 0; + + if (h->iEncryptor) + { + delete h->iEncryptor; + h->iEncryptor = NULL; + } + + if (h->iDecryptor) + { + delete h->iDecryptor; + h->iDecryptor = NULL; + } + + if (h->iv) + { + delete h->iv; + h->iv = NULL; + } + + if (h->iKey) + { + delete h->iKey; + h->iKey = NULL; + } + + + /* We always want to wipe out the memory even when the context has + been allocated in secure memory. The user might have disabled + do the wiping. To accomplish this we need to keep track of the + actual size of this structure because we have no way to known + how large the allocated area was when using a standard malloc. */ + /* + TInt len = h->actual_handle_size; + memset(h, 'a', len); // fill with something + */ + + free (h); +} + +size_t +sc_cipher_get_algo_keylen (int algo) +{ + switch (algo) { + + case SC_CIPHER_AES128: + return KAESKeySize128; + case SC_CIPHER_AES192: + return KAESKeySize192; + case SC_CIPHER_AES256: + return KAESKeySize256; + case SC_CIPHER_3DES: + return K3DESKeySize; + case SC_CIPHER_DES: + return KDESKeySize; + case SC_CIPHER_NONE: + default: + return 0; + + } + +} + + +/* Set the key to be used for the encryption context C to KEY with + length KEYLEN. The length should match the required length. */ +//sc_error_t +TInt sc_cipher_setkey (sc_cipher_hd_t c, byte *key, unsigned int keylen) + { + + // Change key into the right format + TRAPD(error, c->iKey = HBufC8::NewL(keylen)); + if(error == KErrNone) + { + TPtrC8 keyPtr(key, keylen); + *(c->iKey) = keyPtr; + } + else + { + xmlSecSetErrorFlag( error ); + } + return error; + } + +/* Set specification blocksize in context */ +void set_ctx_blocksize(sc_cipher_hd_t c, size_t bklen) +{ + c->blocksize = bklen; +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_digests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_digests.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,337 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_globals.h" + +#include +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" +#include "xmlsec_error_flag.h" + +#include "xmlsecc_app.h" +#include "xmlsecc_crypto.h" +#include "xmlsecc_cryptowrapper.h" // replace gnutils/gnutls.h + +//#define XMLSEC_SYMBIAN_MAX_DIGEST_SIZE 32 + +/************************************************************************** + * + * Internal SymbianCrypto Digest CTX + * + *****************************************************************************/ +typedef struct _xmlSecSymbianCryptoDigestCtx + xmlSecSymbianCryptoDigestCtx, *xmlSecSymbianCryptoDigestCtxPtr; +struct _xmlSecSymbianCryptoDigestCtx { + int digest; + ScMDHd digestCtx; + xmlSecByte dgst[XMLSEC_SYMBIAN_MAX_DIGEST_SIZE]; + xmlSecSize dgstSize; /* dgst size in bytes */ +}; + +xmlSecTransformGetDataTypeMethod const xmlSecCrpytoGetDataTypeMethod = xmlSecTransformDefaultGetDataType; +xmlSecTransformPushBinMethod const xmlSecCryptoPushBinMethod = xmlSecTransformDefaultPushBin; +xmlSecTransformPopBinMethod const xmlSecCryptoPopBinMethod = xmlSecTransformDefaultPopBin; + +/****************************************************************************** + * + * Digest transforms + * + * xmlSecSymbianCryptoDigestCtx is located after xmlSecTransform + * + *****************************************************************************/ +#define xmlSecSymbianCryptoDigestSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecSymbianCryptoDigestCtx)) +#define xmlSecSymbianCryptoDigestGetCtx(transform) \ + ((xmlSecSymbianCryptoDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) + +static int xmlSecSymbianCryptoDigestInitialize (xmlSecTransformPtr transform); +static void xmlSecSymbianCryptoDigestFinalize (xmlSecTransformPtr transform); +static int xmlSecSymbianCryptoDigestVerify (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoDigestExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoDigestCheckId (xmlSecTransformPtr transform); + +static int +xmlSecSymbianCryptoDigestCheckId(xmlSecTransformPtr transform) { + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformSha1Id)) { + return(1); + } +#endif /* XMLSEC_NO_SHA1 */ + + return(0); +} + +static int +xmlSecSymbianCryptoDigestInitialize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoDigestCtxPtr ctx; +#ifndef XMLSEC_GNUTLS_OLD + TInt ret; +#endif /* XMLSEC_GNUTLS_OLD */ + + xmlSecAssert2(xmlSecSymbianCryptoDigestCheckId(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoDigestSize), -1); + + ctx = xmlSecSymbianCryptoDigestGetCtx(transform); + xmlSecAssert2(ctx, -1); + + /* initialize context */ + memset(ctx, 0, sizeof(xmlSecSymbianCryptoDigestCtx)); + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformSha1Id)) { + ctx->digest = SC_MD_SHA1; + } else +#endif /* XMLSEC_NO_SHA1 */ + + if(1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#ifndef XMLSEC_GNUTLS_OLD + ret = sc_md_open(&ctx->digestCtx, ctx->digest, SC_MD_FLAG_SECURE); /* we are paranoid */ + if(ret != KErrNone) { +#else /* XMLSEC_GNUTLS_OLD */ + ctx->digestCtx = sc_md_open(ctx->digest, SC_MD_FLAG_SECURE); /* we are paranoid */ + if(!ctx->digestCtx) { +#endif /* XMLSEC_GNUTLS_OLD */ + if ( ret != KErrNone ) + { + xmlSecSetErrorFlag( ret ); + } + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "sc_md_open", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + +static void +xmlSecSymbianCryptoDigestFinalize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoDigestCtxPtr ctx; + + xmlSecAssert(xmlSecSymbianCryptoDigestCheckId(transform)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoDigestSize)); + + ctx = xmlSecSymbianCryptoDigestGetCtx(transform); + xmlSecAssert(ctx); + + if(ctx->digestCtx) { + sc_md_close(ctx->digestCtx); + } + memset(ctx, 0, sizeof(xmlSecSymbianCryptoDigestCtx)); +} + +static int +xmlSecSymbianCryptoDigestVerify(xmlSecTransformPtr transform, + const xmlSecByte* data, xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoDigestCtxPtr ctx; + + xmlSecAssert2(xmlSecSymbianCryptoDigestCheckId(transform), -1); + xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoDigestSize), -1); + xmlSecAssert2(transform->status == xmlSecTransformStatusFinished, -1); + xmlSecAssert2(data, -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoDigestGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->dgstSize > 0, -1); + + if(dataSize != ctx->dgstSize) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "data and digest sizes are different (data=%d, dgst=%d)", + dataSize, ctx->dgstSize); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + if(memcmp(ctx->dgst, data, dataSize) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "data and digest do not match"); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + transform->status = xmlSecTransformStatusOk; + return(0); +} + +static int +xmlSecSymbianCryptoDigestExecute(xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoDigestCtxPtr ctx; + xmlSecBufferPtr in, out; + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoDigestCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(transformCtx, -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoDigestSize), -1); + + ctx = xmlSecSymbianCryptoDigestGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digest != SC_MD_NONE, -1); + xmlSecAssert2(ctx->digestCtx, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + + if(transform->status == xmlSecTransformStatusNone) { + transform->status = xmlSecTransformStatusWorking; + } + + if(transform->status == xmlSecTransformStatusWorking) { + xmlSecSize inSize; + + inSize = xmlSecBufferGetSize(in); + if(inSize > 0) { + sc_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize); + + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + } + if(last) { + const xmlSecByte* buf; + + /* get the final digest */ + sc_md_final(ctx->digestCtx); + + /* get length before sc_md_read */ + ctx->dgstSize = sc_md_get_algo_dlen(ctx->digestCtx); + xmlSecAssert2(ctx->dgstSize > 0, -1); + xmlSecAssert2(ctx->dgstSize <= sizeof(ctx->dgst), -1); + + buf = sc_md_read(ctx->digestCtx, ctx->digest); + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "sc_md_read", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* copy it to our internal buffer */ + memcpy(ctx->dgst, buf, ctx->dgstSize); + + /* and to the output if needed */ + if(transform->operation == xmlSecTransformOperationSign) { + ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", ctx->dgstSize); + return(-1); + } + } + transform->status = xmlSecTransformStatusFinished; + } + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + + return(0); +} + +#ifndef XMLSEC_NO_SHA1 +/****************************************************************************** + * + * SHA1 Digest transforms + * + *****************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoSha1Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoDigestSize, /* xmlSecSize objSize */ + + /* data */ + xmlSecNameSha1, /* const xmlChar* name; */ + xmlSecHrefSha1, /* const xmlChar* href; */ + xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */ + + /* methods */ + xmlSecSymbianCryptoDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + NULL, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoDigestVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoDigestExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformSha1GetKlass: + * + * SHA-1 digest transform klass. + * + * Returns pointer to SHA-1 digest transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformSha1GetKlass(void) { + return(&xmlSecSymbianCryptoSha1Klass); +} +#endif /* XMLSEC_NO_SHA1 */ + + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_evp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_evp.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1788 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_globals.h" + +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" +#include "xmlsec_error_flag.h" + +#include "xmlsecc_crypto.h" +#include "xmlsecc_cryptowrapper.h" +#include "xmlsecc_evp.h" + +/************************************************************************** + * + * Internal SymbianCrypto EVP key CTX + * + *************************************************************************/ +typedef struct _xmlSecSymbianCryptoEvpKeyDataCtx xmlSecSymbianCryptoEvpKeyDataCtx, + *xmlSecSymbianCryptoEvpKeyDataCtxPtr; +struct _xmlSecSymbianCryptoEvpKeyDataCtx { + EVP_PKEY* pKey; +}; + +/****************************************************************************** + * + * EVP key (dsa/rsa) + * + * xmlSecSymbianCryptoEvpKeyDataCtx is located after xmlSecTransform + * + *****************************************************************************/ +#define xmlSecSymbianCryptoEvpKeyDataSize \ + (sizeof(xmlSecKeyData) + sizeof(xmlSecSymbianCryptoEvpKeyDataCtx)) +#define xmlSecSymbianCryptoEvpKeyDataGetCtx(data) \ + ((xmlSecSymbianCryptoEvpKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData))) + +static int xmlSecSymbianCryptoEvpKeyDataInitialize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoEvpKeyDataDuplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +static void xmlSecSymbianCryptoEvpKeyDataFinalize (xmlSecKeyDataPtr data); + +/** + * xmlSecSymbianCryptoEvpKeyDataAdoptEvp: + * @data: the pointer to SymbianCrypto EVP key data. + * @pKey: the pointer to EVP key. + * + * Sets the value of key data. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoEvpKeyDataAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) { + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecSymbianCryptoEvpKeyDataSize), -1); + xmlSecAssert2(pKey, -1); + + ctx = xmlSecSymbianCryptoEvpKeyDataGetCtx(data); + xmlSecAssert2(ctx, -1); + + if(ctx->pKey) { + sc_pkey_free(ctx->pKey); + } + ctx->pKey = pKey; + return(0); +} + +/** + * xmlSecSymbianCryptoEvpKeyDataGetEvp: + * @data: the pointer to SymbianCrypto EVP data. + * + * Gets the EVP_PKEY from the key data. + * + * Returns pointer to EVP_PKEY or NULL if an error occurs. + */ +EXPORT_C +EVP_PKEY* +xmlSecSymbianCryptoEvpKeyDataGetEvp(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecSymbianCryptoEvpKeyDataSize), NULL); + + ctx = xmlSecSymbianCryptoEvpKeyDataGetCtx(data); + xmlSecAssert2(ctx, NULL); + + return(ctx->pKey); + + return NULL; +} + +static int +xmlSecSymbianCryptoEvpKeyDataInitialize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataIsValid(data), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecSymbianCryptoEvpKeyDataSize), -1); + + ctx = xmlSecSymbianCryptoEvpKeyDataGetCtx(data); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoEvpKeyDataCtx)); + + return(0); +} + +static int +xmlSecSymbianCryptoEvpKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctxDst; + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctxSrc; + + xmlSecAssert2(xmlSecKeyDataIsValid(dst), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(dst, xmlSecSymbianCryptoEvpKeyDataSize), -1); + xmlSecAssert2(xmlSecKeyDataIsValid(src), -1); + xmlSecAssert2(xmlSecKeyDataCheckSize(src, xmlSecSymbianCryptoEvpKeyDataSize), -1); + + ctxDst = xmlSecSymbianCryptoEvpKeyDataGetCtx(dst); + xmlSecAssert2(ctxDst, -1); + xmlSecAssert2(!ctxDst->pKey, -1); + + ctxSrc = xmlSecSymbianCryptoEvpKeyDataGetCtx(src); + xmlSecAssert2(ctxSrc, -1); + + if(ctxSrc->pKey) { + ctxDst->pKey = xmlSecSymbianCryptoEvpKeyDup(ctxSrc->pKey); + ctxDst->pKey->duplicate=0; + ctxSrc->pKey->duplicate=1; + if(!ctxDst->pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "xmlSecSymbianCryptoEvpKeyDup", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + return(0); +} + +static void +xmlSecSymbianCryptoEvpKeyDataFinalize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoEvpKeyDataCtxPtr ctx; + + xmlSecAssert(xmlSecKeyDataIsValid(data)); + xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecSymbianCryptoEvpKeyDataSize)); + + ctx = xmlSecSymbianCryptoEvpKeyDataGetCtx(data); + xmlSecAssert(ctx); + + if(ctx->pKey) { + sc_pkey_free(ctx->pKey); + } + memset(ctx, 0, sizeof(xmlSecSymbianCryptoEvpKeyDataCtx)); + +} +/**************************************************************************** + * + * Symbian Keys Store + * + ***************************************************************************/ +#define xmlSecSymbianKeysStoreSize \ + (sizeof(xmlSecKeyStore)+ sizeof(xmlSecPtrList)) +#define xmlSecSymbianKeysStoreGetList(store) \ + ((xmlSecKeyStoreCheckSize((store), xmlSecSymbianKeysStoreSize)) ? \ + (xmlSecPtrListPtr)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \ + (xmlSecPtrListPtr)NULL) + + +static xmlSecKeyPtr xmlSecSymbianKeysStoreFindKey (xmlSecKeyStorePtr store, + const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +static xmlSecKeyStoreKlass xmlSecSymbianKeysStoreKlass = { + sizeof(xmlSecKeyStoreKlass), + xmlSecSymbianKeysStoreSize, + + /* data */ + BAD_CAST "symbian-keys-store", /* const xmlChar* name; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyStoreInitializeMethod initialize; */ + NULL, /* xmlSecKeyStoreFinalizeMethod finalize; */ + xmlSecSymbianKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianKeysStoreGetKlass: + * + * The Symbian list based keys store klass. + * + * Returns simple list based keys store klass. + */ +EXPORT_C +xmlSecKeyStoreId +xmlSecSymbianKeysStoreGetKlass(void) { + return(&xmlSecSymbianKeysStoreKlass); +} + + +static xmlSecKeyPtr +xmlSecSymbianKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + + xmlSecKeyPtr key=NULL; + + xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSymbianKeysStoreId), NULL); + xmlSecAssert2(keyInfoCtx, NULL); + + if((!name) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataIdUnknown)){ + return(NULL); + } + if(keyInfoCtx->keyReq.keyId== xmlSecSymbianCryptoKeyDataRsaId) { + + key=xmlSecSymbianCryptoAppKeyLoadSks((char*)name); + if(!key) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianKeysStoreFindKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "name=%s", + xmlSecErrorsSafeString(name)); + return(NULL); + } + + } + return(key); +} +/** + * xmlSecSymbianCryptoAppKeyLoadSks: + * @keyname: the key name. + * + * Reads key from the symbian keystore. + * + * Returns pointer to the key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyPtr +xmlSecSymbianCryptoAppKeyLoadSks(char* keyname) { + + xmlSecKeyPtr key = NULL; + xmlSecKeyDataPtr data; + EVP_PKEY* pKey = NULL; + + int ret; + + xmlSecAssert2(keyname, NULL); + + pKey = d2i_PKCS8PrivateKey(keyname); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "sc_PrivateKey_read", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + data = xmlSecSymbianCryptoEvpKeyAdopt(pKey); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoEvpKeyAdopt", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + sc_pkey_free(pKey); + return(NULL); + } + + key = xmlSecKeyCreate(); + if(!key) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "data=%s", + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data))); + xmlSecKeyDestroy(key); + xmlSecKeyDataDestroy(data); + return(NULL); + } + + return(key); +} +/****************************************************************************** + * + * EVP helper functions + * + *****************************************************************************/ +/** + * xmlSecSymbianCryptoEvpKeyDup: + * @pKey: the pointer to EVP_PKEY. + * + * Duplicates @pKey. + * + * Returns pointer to newly created EVP_PKEY object or NULL if an error occurs. + */ +EXPORT_C +EVP_PKEY* +xmlSecSymbianCryptoEvpKeyDup(EVP_PKEY* pKey) { + int ret; + EVP_PKEY* pKeyNew; + + xmlSecAssert2(pKey, NULL); + + pKeyNew = sc_pkey_duplicate(pKey); + if(!pKeyNew) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "sc_pkey_duplicate", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return (pKeyNew); +} + +/** + * xmlSecSymbianCryptoEvpKeyAdopt: + * @pKey: the pointer to EVP_PKEY. + * + * Creates xmlsec key object from SymbianCrypto key object. + * + * Returns pointer to newly created xmlsec key or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecSymbianCryptoEvpKeyAdopt(EVP_PKEY *pKey) { + xmlSecKeyDataPtr data = NULL; + int ret; + + xmlSecAssert2(pKey, NULL); + + switch(pKey->type) { +#ifndef XMLSEC_NO_RSA + case EVP_PKEY_RSA: + data = xmlSecKeyDataCreate(xmlSecSymbianCryptoKeyDataRsaId); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecSymbianCryptoKeyDataRsaId"); + return(NULL); + } + break; +#endif /* XMLSEC_NO_RSA */ +#ifndef XMLSEC_NO_DSA + case EVP_PKEY_DSA: + data = xmlSecKeyDataCreate(xmlSecSymbianCryptoKeyDataDsaId); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "xmlSecSymbianCryptoKeyDataDsaId"); + return(NULL); + } + break; +#endif /* XMLSEC_NO_DSA */ + default: + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_TYPE, + "evp key type %d not supported", pKey->type); + return(NULL); + } + + xmlSecAssert2(data, NULL); + ret = xmlSecSymbianCryptoEvpKeyDataAdoptEvp(data, pKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoEvpKeyDataAdoptEvp", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(NULL); + } + return(data); +} + +#ifndef XMLSEC_NO_DSA +/************************************************************************** + * + * processing + * + * + * The DSAKeyValue Element (http://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue) + * + * DSA keys and the DSA signature algorithm are specified in [DSS]. + * DSA public key values can have the following fields: + * + * * P - a prime modulus meeting the [DSS] requirements + * * Q - an integer in the range 2**159 < Q < 2**160 which is a prime + * divisor of P-1 + * * G - an integer with certain properties with respect to P and Q + * * Y - G**X mod P (where X is part of the private key and not made + * public) + * * J - (P - 1) / Q + * * seed - a DSA prime generation seed + * * pgenCounter - a DSA prime generation counter + * + * Parameter J is available for inclusion solely for efficiency as it is + * calculatable from P and Q. Parameters seed and pgenCounter are used in the + * DSA prime number generation algorithm specified in [DSS]. As such, they are + * optional but must either both be present or both be absent. This prime + * generation algorithm is designed to provide assurance that a weak prime is + * not being used and it yields a P and Q value. Parameters P, Q, and G can be + * public and common to a group of users. They might be known from application + * context. As such, they are optional but P and Q must either both appear or + * both be absent. If all of P, Q, seed, and pgenCounter are present, + * implementations are not required to check if they are consistent and are + * free to use either P and Q or seed and pgenCounter. All parameters are + * encoded as base64 [MIME] values. + * + * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are + * represented in XML as octet strings as defined by the ds:CryptoBinary type. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * DTD Definition: + * + * + * + * + * + * + * + * + * + * + * ============================================================================ + * + * To support reading/writing private keys an X element added (before Y). + * Note: The current implementation does not support Seed and PgenCounter! + * by this the P, Q and G are *required*! + * + *************************************************************************/ +static int xmlSecSymbianCryptoKeyDataDsaInitialize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataDsaDuplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +static void xmlSecSymbianCryptoKeyDataDsaFinalize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataDsaXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataDsaXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataDsaGenerate (xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type); + +static xmlSecKeyDataType xmlSecSymbianCryptoKeyDataDsaGetType (xmlSecKeyDataPtr data); +static xmlSecSize xmlSecSymbianCryptoKeyDataDsaGetSize (xmlSecKeyDataPtr data); +static void xmlSecSymbianCryptoKeyDataDsaDebugDump (xmlSecKeyDataPtr data, + FILE* output); +static void xmlSecSymbianCryptoKeyDataDsaDebugXmlDump (xmlSecKeyDataPtr data, + FILE* output); + +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataDsaKlass = { + sizeof(xmlSecKeyDataKlass), + xmlSecSymbianCryptoEvpKeyDataSize, + + /* data */ + xmlSecNameDSAKeyValue, + xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefDSAKeyValue, /* const xmlChar* href; */ + xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + xmlSecSymbianCryptoKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */ + xmlSecSymbianCryptoKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoKeyDataDsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataDsaGetKlass: + * + * The DSA key data klass. + * + * Returns pointer to DSA key data klass. + */ +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataDsaGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataDsaKlass); +} + +/** + * xmlSecSymbianCryptoKeyDataDsaAdoptDsa: + * @data: the pointer to DSA key data. + * @dsa: the pointer to SymbianCrypto DSA key. + * + * Sets the value of DSA key data. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecSymbianCryptoKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) { + EVP_PKEY* pKey = NULL; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), -1); + + /* construct new EVP_PKEY */ + if(dsa) { + pKey = EVP_PKEY_new(); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "EVP_PKEY_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = EVP_PKEY_assign_DSA(pKey, dsa); + if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "EVP_PKEY_assign_DSA", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + ret = xmlSecSymbianCryptoKeyDataDsaAdoptEvp(data, pKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataDsaAdoptEvp", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if(pKey) { + EVP_PKEY_free(pKey); + } + return(-1); + } + return(0); +} + +/** + * xmlSecSymbianCryptoKeyDataDsaGetDsa: + * @data: the pointer to DSA key data. + * + * Gets the SymbianCrypto DSA key from DSA key data. + * + * Returns pointer to SymbianCrypto DSA key or NULL if an error occurs. + */ +DSA* +xmlSecSymbianCryptoKeyDataDsaGetDsa(xmlSecKeyDataPtr data) { + EVP_PKEY* pKey; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), NULL); + + pKey = xmlSecSymbianCryptoKeyDataDsaGetEvp(data); + xmlSecAssert2((!pKey) || (pKey->type == EVP_PKEY_DSA), NULL); + + return((pKey) ? pKey->pkey.dsa : (DSA*)NULL); +} + +/** + * xmlSecSymbianCryptoKeyDataDsaAdoptEvp: + * @data: the pointer to DSA key data. + * @pKey: the pointer to SymbianCrypto EVP key. + * + * Sets the DSA key data value to SymbianCrypto EVP key. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecSymbianCryptoKeyDataDsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), -1); + xmlSecAssert2(pKey, -1); + xmlSecAssert2(pKey->type == EVP_PKEY_DSA, -1); + + return(xmlSecSymbianCryptoEvpKeyDataAdoptEvp(data, pKey)); +} + +/** + * xmlSecSymbianCryptoKeyDataDsaGetEvp: + * @data: the pointer to DSA key data. + * + * Gets the SymbianCrypto EVP key from DSA key data. + * + * Returns pointer to SymbianCrypto EVP key or NULL if an error occurs. + */ +EVP_PKEY* +xmlSecSymbianCryptoKeyDataDsaGetEvp(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), NULL); + + return(xmlSecSymbianCryptoEvpKeyDataGetEvp(data)); +} + +static int +xmlSecSymbianCryptoKeyDataDsaInitialize(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), -1); + + return(xmlSecSymbianCryptoEvpKeyDataInitialize(data)); +} + +static int +xmlSecSymbianCryptoKeyDataDsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecSymbianCryptoKeyDataDsaId), -1); + xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecSymbianCryptoKeyDataDsaId), -1); + + return(xmlSecSymbianCryptoEvpKeyDataDuplicate(dst, src)); +} + +static void +xmlSecSymbianCryptoKeyDataDsaFinalize(xmlSecKeyDataPtr data) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId)); + + xmlSecSymbianCryptoEvpKeyDataFinalize(data); +} + +static int +xmlSecSymbianCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + xmlNodePtr cur; + DSA *dsa; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataDsaId, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + if(xmlSecKeyGetValue(key)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_INVALID_KEY_DATA, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + dsa = DSA_new(); + if(!dsa) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "DSA_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecGetNextElementNode(node->children); + + /* first is P node. It is REQUIRED because we do not support Seed and PgenCounter*/ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAP, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAP)); + DSA_free(dsa); + return(-1); + } + if(!xmlSecSymbianCryptoNodeGetBNValue(cur, &(dsa->p))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAP)); + DSA_free(dsa); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* next is Q node. It is REQUIRED because we do not support Seed and PgenCounter*/ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAQ, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAQ)); + DSA_free(dsa); + return(-1); + } + if(!xmlSecSymbianCryptoNodeGetBNValue(cur, &(dsa->q))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAQ)); + DSA_free(dsa); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* next is G node. It is REQUIRED because we do not support Seed and PgenCounter*/ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAG, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAG)); + DSA_free(dsa); + return(-1); + } + if(!xmlSecSymbianCryptoNodeGetBNValue(cur, &(dsa->g))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAG)); + DSA_free(dsa); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + if((cur) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAX, xmlSecNs))) { + /* next is X node. It is REQUIRED for private key but + * we are not sure exactly what do we read */ + if(!xmlSecSymbianCryptoNodeGetBNValue(cur, &(dsa->priv_key))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAX)); + DSA_free(dsa); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + /* next is Y node. */ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAY, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAY)); + DSA_free(dsa); + return(-1); + } + if(!xmlSecSymbianCryptoNodeGetBNValue(cur, &(dsa->pub_key))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY)); + DSA_free(dsa); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + if((cur) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) { + cur = xmlSecGetNextElementNode(cur->next); + } + + if((cur) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) { + cur = xmlSecGetNextElementNode(cur->next); + } + + if((cur) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) { + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + DSA_free(dsa); + return(-1); + } + + data = xmlSecKeyDataCreate(id); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + DSA_free(dsa); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataDsaAdoptDsa(data, dsa); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataDsaAdoptDsa", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + DSA_free(dsa); + return(-1); + } + + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(-1); + } + + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlNodePtr cur; + DSA* dsa; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataDsaId, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), + xmlSecSymbianCryptoKeyDataDsaId), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + dsa = xmlSecSymbianCryptoKeyDataDsaGetDsa(xmlSecKeyGetValue(key)); + xmlSecAssert2(dsa, -1); + + if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) { + /* we can have only private key or public key */ + return(0); + } + + /* first is P node */ + xmlSecAssert2(dsa->p, -1); + cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAP)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, dsa->p, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAP)); + return(-1); + } + + /* next is Q node. */ + xmlSecAssert2(dsa->q, -1); + cur = xmlSecAddChild(node, xmlSecNodeDSAQ, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAQ)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, dsa->q, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAQ)); + return(-1); + } + + /* next is G node. */ + xmlSecAssert2(dsa->g, -1); + cur = xmlSecAddChild(node, xmlSecNodeDSAG, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAG)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, dsa->g, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAG)); + return(-1); + } + + /* next is X node: write it ONLY for private keys and ONLY if it is requested */ + if(((keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate) != 0) && (dsa->priv_key)) { + cur = xmlSecAddChild(node, xmlSecNodeDSAX, xmlSecNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAX)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, dsa->priv_key, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAX)); + return(-1); + } + } + + /* next is Y node. */ + xmlSecAssert2(dsa->pub_key, -1); + cur = xmlSecAddChild(node, xmlSecNodeDSAY, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAY)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, dsa->pub_key, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeDSAY)); + return(-1); + } + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type ATTRIBUTE_UNUSED) { + DSA* dsa; + int counter_ret; + unsigned long h_ret; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), -1); + xmlSecAssert2(sizeBits > 0, -1); + + dsa = DSA_generate_parameters(sizeBits, NULL, 0, &counter_ret, &h_ret, NULL, NULL); + if(!dsa) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "DSA_generate_parameters", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "size=%d", sizeBits); + return(-1); + } + + ret = DSA_generate_key(dsa); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "DSA_generate_key", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + DSA_free(dsa); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataDsaAdoptDsa(data, dsa); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataDsaAdoptDsa", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + DSA_free(dsa); + return(-1); + } + + return(0); +} + +static xmlSecKeyDataType +xmlSecSymbianCryptoKeyDataDsaGetType(xmlSecKeyDataPtr data) { + DSA* dsa; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), + xmlSecKeyDataTypeUnknown); + + dsa = xmlSecSymbianCryptoKeyDataDsaGetDsa(data); + if((dsa) && (dsa->p) && (dsa->q) && + (dsa->g) && (dsa->pub_key)) { + + if(dsa->priv_key) { + return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic); + } else if(dsa->engine) { + /** + * + * We assume here that engine *always* has private key. + * This might be incorrect but it seems that there is no + * way to ask engine if given key is private or not. + */ + return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic); + } else { + return(xmlSecKeyDataTypePublic); + } + } + + return(xmlSecKeyDataTypeUnknown); +} + +static xmlSecSize +xmlSecSymbianCryptoKeyDataDsaGetSize(xmlSecKeyDataPtr data) { + DSA* dsa; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId), 0); + + dsa = xmlSecSymbianCryptoKeyDataDsaGetDsa(data); + if((dsa) && (dsa->p)) { + return(BN_num_bits(dsa->p)); + } + return(0); +} + +static void +xmlSecSymbianCryptoKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId)); + xmlSecAssert(output); + + fprintf(output, "=== dsa key: size = %d\n", + xmlSecSymbianCryptoKeyDataDsaGetSize(data)); +} + +static void +xmlSecSymbianCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDsaId)); + xmlSecAssert(output); + + fprintf(output, "\n", + xmlSecSymbianCryptoKeyDataDsaGetSize(data)); +} + +#endif /* XMLSEC_NO_DSA */ + +#ifndef XMLSEC_NO_RSA +/************************************************************************** + * + * processing + * + * http://www.w3.org/TR/xmldsig-core/#sec-RSAKeyValue + * The RSAKeyValue Element + * + * RSA key values have two fields: Modulus and Exponent. + * + * + * xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6W + * jubafOqNEpcwR3RdFsT7bCqnXPBe5ELh5u4VEy19MzxkXRgrMvavzyBpVRgBUwUlV + * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U= + * + * AQAB + * + * + * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are + * represented in XML as octet strings as defined by the ds:CryptoBinary type. + * + * Schema Definition: + * + * + * + * + * + * + * + * + * + * DTD Definition: + * + * + * + * + * + * ============================================================================ + * + * To support reading/writing private keys an PrivateExponent element is added + * to the end + * + *************************************************************************/ + +static int xmlSecSymbianCryptoKeyDataRsaInitialize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataRsaDuplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +static void xmlSecSymbianCryptoKeyDataRsaFinalize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataRsaXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataRsaXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataRsaGenerate (xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type); + +static xmlSecKeyDataType xmlSecSymbianCryptoKeyDataRsaGetType (xmlSecKeyDataPtr data); +static xmlSecSize xmlSecSymbianCryptoKeyDataRsaGetSize (xmlSecKeyDataPtr data); +static void xmlSecSymbianCryptoKeyDataRsaDebugDump (xmlSecKeyDataPtr data, + FILE* output); +static void xmlSecSymbianCryptoKeyDataRsaDebugXmlDump (xmlSecKeyDataPtr data, + FILE* output); +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataRsaKlass = { + sizeof(xmlSecKeyDataKlass), + xmlSecSymbianCryptoEvpKeyDataSize, + + /* data */ + xmlSecNameRSAKeyValue, + xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefRSAKeyValue, /* const xmlChar* href; */ + xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + xmlSecSymbianCryptoKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */ + xmlSecSymbianCryptoKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataRsaGetKlass: + * + * The SymbianCrypto RSA key data klass. + * + * Returns pointer to SymbianCrypto RSA key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataRsaGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataRsaKlass); +} + +/** + * xmlSecSymbianCryptoKeyDataRsaAdoptRsa: + * @data: the pointer to RSA key data. + * @rsa: the pointer to SymbianCrypto RSA key. + * + * Sets the value of RSA key data. + * + * Returns 0 on success or a negative value otherwise. + */ +// not needed for current functionality +#ifdef DEBUG +int +xmlSecSymbianCryptoKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) { + EVP_PKEY* pKey = NULL; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), -1); + + /* construct new EVP_PKEY */ + + /* + ret = EVP_PKEY_assign_RSA(pKey, rsa); + if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "EVP_PKEY_assign_RSA", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + */ + ret = xmlSecSymbianCryptoKeyDataRsaAdoptEvp(data, pKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataRsaAdoptEvp", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if(pKey) { + EVP_PKEY_free(pKey); + } + return(-1); + } + + return(0); +} +#endif + +/** + * xmlSecSymbianCryptoKeyDataRsaGetRsa: + * @data: the pointer to RSA key data. + * + * Gets the SymbianCrypto RSA key from RSA key data. + * + * Returns pointer to SymbianCrypto RSA key or NULL if an error occurs. + */ +RSA* +xmlSecSymbianCryptoKeyDataRsaGetRsa(xmlSecKeyDataPtr data) { + EVP_PKEY* pKey; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), NULL); +/* + pKey = xmlSecSymbianCryptoKeyDataRsaGetEvpTest(data); + xmlSecAssert2((pKey == NULL) || (pKey->type == EVP_PKEY_RSA), NULL); + + return((pKey != NULL) ? pKey->pkey.rsa : (RSA*)NULL); +*/ + return NULL; +} + +/** + * xmlSecSymbianCryptoKeyDataRsaAdoptEvp: + * @data: the pointer to RSA key data. + * @pKey: the pointer to SymbianCrypto EVP key. + * + * Sets the RSA key data value to SymbianCrypto EVP key. + * + * Returns 0 on success or a negative value otherwise. + */ +int +xmlSecSymbianCryptoKeyDataRsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), -1); + xmlSecAssert2(pKey, -1); + xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1); + + return(xmlSecSymbianCryptoEvpKeyDataAdoptEvp(data, pKey)); +} + +/** + * xmlSecSymbianCryptoKeyDataRsaGetEvp: + * @data: the pointer to RSA key data. + * + * Gets the SymbianCrypto EVP key from RSA key data. + * + * Returns pointer to SymbianCrypto EVP key or NULL if an error occurs. + */ +EVP_PKEY* +xmlSecSymbianCryptoKeyDataRsaGetEvpTest(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), NULL); + + return(xmlSecSymbianCryptoEvpKeyDataGetEvp(data)); +} + +static int +xmlSecSymbianCryptoKeyDataRsaInitialize(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), -1); + + return(xmlSecSymbianCryptoEvpKeyDataInitialize(data)); +} + +static int +xmlSecSymbianCryptoKeyDataRsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecSymbianCryptoKeyDataRsaId), -1); + xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecSymbianCryptoKeyDataRsaId), -1); + + return(xmlSecSymbianCryptoEvpKeyDataDuplicate(dst, src)); +} + +static void +xmlSecSymbianCryptoKeyDataRsaFinalize(xmlSecKeyDataPtr data) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId)); + + xmlSecSymbianCryptoEvpKeyDataFinalize(data); +} + +static int +xmlSecSymbianCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + xmlNodePtr cur; + RSA *rsa=NULL; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataRsaId, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + if(xmlSecKeyGetValue(key)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + NULL, + XMLSEC_ERRORS_R_INVALID_KEY_DATA, + "key already has a value"); + return(-1); + } + + if(!rsa) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "RSA_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecGetNextElementNode(node->children); + + /* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAModulus, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAModulus)); + return(-1); + } + /* + if(xmlSecSymbianCryptoNodeGetBNValue(cur, &(rsa->n)) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAModulus)); + RSA_free(rsa); + return(-1); + } + */ + cur = xmlSecGetNextElementNode(cur->next); + + /* next is Exponent node. It is REQUIRED because we do not support Seed and PgenCounter*/ + if((!cur) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAExponent, xmlSecDSigNs))) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAExponent)); + return(-1); + } + /* + if(xmlSecSymbianCryptoNodeGetBNValue(cur, &(rsa->e)) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAExponent)); + RSA_free(rsa); + return(-1); + } + */ + cur = xmlSecGetNextElementNode(cur->next); + + if((cur) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) { + /* next is X node. It is REQUIRED for private key but + * we are not sure exactly what do we read */ + /* + if(xmlSecSymbianCryptoNodeGetBNValue(cur, &(rsa->d)) == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeGetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent)); + RSA_free(rsa); + return(-1); + } + */ + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE, + "no nodes expected"); + return(-1); + } + + data = xmlSecKeyDataCreate(id); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyDataCreate", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } +/* + ret = xmlSecSymbianCryptoKeyDataRsaAdoptRsa(data, rsa); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataRsaAdoptRsa", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + //RSA_free(rsa); + return(-1); + } +*/ + ret = xmlSecKeySetValue(key, data); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(data); + return(-1); + } + + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlNodePtr cur; + RSA* rsa; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataRsaId, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), + xmlSecSymbianCryptoKeyDataRsaId), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + rsa = xmlSecSymbianCryptoKeyDataRsaGetRsa(xmlSecKeyGetValue(key)); + xmlSecAssert2(rsa, -1); + + if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) { + /* we can have only private key or public key */ + return(0); + } + + /* first is Modulus node */ + cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAModulus)); + return(-1); + } + /* + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, rsa->n, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAModulus)); + return(-1); + } + */ + + /* next is Exponent node. */ + cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAExponent)); + return(-1); + } + /* + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, rsa->e, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAExponent)); + return(-1); + } + */ + /* next is PrivateExponent node: write it ONLY for private keys and ONLY if it is requested */ + /* + if(((keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate) != 0) && (rsa->d != NULL)) { + cur = xmlSecAddChild(node, xmlSecNodeRSAPrivateExponent, xmlSecNs); + if(cur == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent)); + return(-1); + } + ret = xmlSecSymbianCryptoNodeSetBNValue(cur, rsa->d, 1); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoNodeSetBNValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent)); + return(-1); + } + } + */ + return(0); +} + +// this routine is modified to fit the interface of evpwrapper.cpp +static int +xmlSecSymbianCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type ATTRIBUTE_UNUSED) { + RSA* rsa; + int ret; + EVP_PKEY *pKey; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), -1); + xmlSecAssert2(sizeBits > 0, -1); + + // Construct new EVP_PKEY + pKey = sc_pkey_new(EVP_PKEY_RSA, NULL); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sc_pkey_key", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "sizeBits=%d", sizeBits); + return(-1); + } + + // Check if there is existing key first + ret = sc_pkey_load(pKey); + if (ret < -1) { //KErrNotFound = -1 + xmlSecSetErrorFlag( ret ); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sc_load_key", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "sizeBits=%d", sizeBits); + return(-1); + } + + // Generate key if key is not found + if (ret == -1) // KErrNotFound + { + TInt ret2=sc_pkey_generate(pKey, sizeBits); + if ( ret2 < -1 ) + { + xmlSecSetErrorFlag( ret2 ); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sc_generate_key", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "sizeBits=%d", sizeBits); + return(-1); + } + } + if (!pKey->load) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sc_generate_key", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "sizeBits=%d", sizeBits); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataRsaAdoptEvp(data, pKey); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataRsaAdoptEvp", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + if(pKey) { + sc_pkey_free(pKey); + } + return(-1); + } + + +/* + ret = xmlSecSymbianCryptoKeyDataRsaAdoptRsa(data, rsa); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataRsaAdoptRsa", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + RSA_free(rsa); + return(-1); + } +*/ + return(0); +} + +static xmlSecKeyDataType +xmlSecSymbianCryptoKeyDataRsaGetType(xmlSecKeyDataPtr data) { + EVP_PKEY* pkey; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), + xmlSecKeyDataTypeUnknown); + + pkey = xmlSecSymbianCryptoEvpKeyDataGetEvp(data); + + if (pkey->load) + { + return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic); + } + /* + if((rsa != NULL) && (rsa->n != NULL) && (rsa->e != NULL)) { + if(rsa->d != NULL) { + return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic); + } else if(rsa->engine != NULL) { + */ + /** + * + * We assume here that engine *always* has private key. + * This might be incorrect but it seems that there is no + * way to ask engine if given key is private or not. + */ +/* + return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic); + } else { + return(xmlSecKeyDataTypePublic); + } + } + */ + return(xmlSecKeyDataTypeUnknown); +} + +static xmlSecSize +xmlSecSymbianCryptoKeyDataRsaGetSize(xmlSecKeyDataPtr data) { + EVP_PKEY* pkey; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId), 0); + + pkey = xmlSecSymbianCryptoEvpKeyDataGetEvp(data); + if (pkey) + { + return pkey->bitsize; + } + /* + if((rsa != NULL) && (rsa->n != NULL)) { + return(BN_num_bits(rsa->n)); + } + */ + return(0); +} + +static void +xmlSecSymbianCryptoKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId)); + xmlSecAssert(output); + + fprintf(output, "=== rsa key: size = %d\n", + xmlSecSymbianCryptoKeyDataRsaGetSize(data)); +} + +static void +xmlSecSymbianCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataRsaId)); + xmlSecAssert(output); + + fprintf(output, "\n", + xmlSecSymbianCryptoKeyDataRsaGetSize(data)); +} + +#endif /* XMLSEC_NO_RSA */ + + + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_evpwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_evpwrapper.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,761 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to sign and verify data. +* +*/ + + +/** A wrapper of OpenSSL evp.c functions to Symbian **/ + +#include +#include +#include +#include "xmlsecc_config.h" +#ifndef XMLSEC_NO_X509 +#include +#endif //XMLSEC_NO_X509 + +#include "xmlsecc_evpwrapper.h" +#include "xmlsecc_cryptowrapper.h" + +#include "xmlsecmsymbiankeystore.h" + +#include "xmlsec_error_flag.h" + +_LIT8(KRsaKeyName, "xmlSecRsaKey"); + +const TInt KAssertionLeave = -32380; + +// MK: Flag - is active scheduler created by xml sec or not. +static TBool desActiv = FALSE; + +struct ScKeyStore +{ + // A handle to Symbian key store + CSymbianKeyStore *iKeyStore; + // A handle to the public key read from the certificate + CSubjectPublicKeyInfo *iSubjectPublicKeyInfo; +}; + +// ----------------------------------------------------------------------------- +// doInstallActiveSchedulerL Install ActiveScheduler +// ----------------------------------------------------------------------------- +void doInstallActiveSchedulerL() +{ + // Construct active scheduler + CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL(activeScheduler) ; + + // Install active scheduler + // We don't need to check whether an active scheduler is already installed + // as this is a new thread, so there won't be one + CActiveScheduler::Install(activeScheduler); + + CleanupStack::Pop(activeScheduler); + +} + +// ----------------------------------------------------------------------------- +// sc_initialize Symbian key initialization +// ----------------------------------------------------------------------------- +int sc_pkey_init() +{ + TInt leaveValue = KErrNone; + // Check if there is an active scheduler in current thread + if(!CActiveScheduler::Current()) + { + TRAP(leaveValue, doInstallActiveSchedulerL()); + desActiv = TRUE; + } + return leaveValue; +} + +// ----------------------------------------------------------------------------- +// sc_pkey_shutdown Shutdown ActiveScheduler +// ----------------------------------------------------------------------------- +void sc_pkey_shutdown() +{ + if(desActiv) + { + CActiveScheduler* activeScheduler = CActiveScheduler::Current(); + CActiveScheduler::Install(NULL); + if (activeScheduler) + delete activeScheduler; + } +} + +// ----------------------------------------------------------------------------- +// doKeyStoreCreateL Create a new key store +// Arguments: aKeyStore ScKeyStorePtr structure +// ----------------------------------------------------------------------------- +void doKeyStoreCreateL(ScKeyStorePtr aKeyStore) +{ + + aKeyStore->iKeyStore = CSymbianKeyStore::NewL(); + aKeyStore->iKeyStore->CreateUnifiedKeyStoreL(); + CActiveScheduler::Start(); + + User::LeaveIfError( aKeyStore->iKeyStore->GetError() ); +} + +// ----------------------------------------------------------------------------- +// sc_pkey_new Create a new key store structure +// Arguments: aKeyType the type of key to be generated, enum sc_key_algos +// Returns: the pointer of the EVP_PKEY generated +// ----------------------------------------------------------------------------- +EVP_PKEY *sc_pkey_new(int aKeyType, char *keyname) +{ + ScKeyStorePtr keyStore; + TInt err=KErrNone; + + EVP_PKEY *pkey = (EVP_PKEY*) malloc(sizeof(EVP_PKEY)); + + if (pkey) + { + if (keyname) + { + pkey->name = (char *)malloc(sizeof(char)*(strlen(keyname)+1)); + if (!pkey->name) + { + free(pkey); + xmlSecSetErrorFlag( KErrNoMemory ); + return NULL; + } + strcpy(pkey->name, keyname); + } + else + { + pkey->name = NULL; + } + + keyStore = (ScKeyStorePtr) malloc(sizeof(ScKeyStore)); + if (keyStore) + { + keyStore->iSubjectPublicKeyInfo = NULL; + keyStore->iKeyStore = NULL; + + // Initialize the ScKeyStore - iKeyStore + TRAP(err, doKeyStoreCreateL(keyStore)); + + if (err) + { + delete keyStore->iKeyStore; + free(keyStore); + free(pkey->name); + free (pkey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + pkey->keyStore = keyStore; + + } + else + { + free(pkey->name); + free(pkey); + xmlSecSetErrorFlag( KErrNoMemory ); + return NULL; + } + + pkey->type = aKeyType; + pkey->load = NOKEY; + pkey->bitsize = 0; + pkey->duplicate = 0; + } + else + { + xmlSecSetErrorFlag( KErrNoMemory ); + } + + return pkey; +} + +// ----------------------------------------------------------------------------- +// sc_load_key Try to load usable key from the SymbianKeyStore +// Arguments: aPKey a EVP_PKEY key structure +// Returns: KErrNone if no error +// KErrArgument if the arguments have error +// KErrNotSupported if the key type is not supported +// KErrNotFound if no key is found +// ----------------------------------------------------------------------------- +int sc_pkey_load(EVP_PKEY *aPKey) +{ + TInt err=KErrNone; + + // Check arguments + if (!aPKey || !aPKey->name) + { + return KErrArgument; + } + + // Load key + TPtrC8 keyNamePtr((const unsigned char*)aPKey->name, strlen(aPKey->name)); + switch (aPKey->type) + { + case EVP_PKEY_RSA: + aPKey->keyStore->iKeyStore->FindKey(keyNamePtr, CCTKeyInfo::ERSA); + break; + case EVP_PKEY_UNKNOWN: + aPKey->keyStore->iKeyStore->FindKey(keyNamePtr, CCTKeyInfo::EInvalidAlgorithm); + break; + default: + return KErrNotSupported; + } + err = aPKey->keyStore->iKeyStore->GetError(); + if ( err != KErrNone ) + { + return err; + } + + // Run asynchronous key load until done + CActiveScheduler::Start(); + err = aPKey->keyStore->iKeyStore->GetError(); + if ( err == KErrNone ) + { + err = aPKey->keyStore->iKeyStore->hasKey(); + } + if (!err) + { + aPKey->load = HASKEY; + aPKey->bitsize = aPKey->keyStore->iKeyStore->GetKeySize(); + if (aPKey->type == EVP_PKEY_UNKNOWN) + { + switch (aPKey->keyStore->iKeyStore->GetKeyAlgorithm()) + { + case CCTKeyInfo::ERSA: + aPKey->type = EVP_PKEY_RSA; + break; + case CCTKeyInfo::EDSA: + aPKey->type = EVP_PKEY_DSA; + break; + default: + aPKey->type = EVP_PKEY_UNKNOWN; + break; + } + } + } + else + { + aPKey->load = NOKEY; + aPKey->bitsize = 0; + } + + return err; + +} + +// ----------------------------------------------------------------------------- +// sc_generate_key Try to generate key from the SymbianKeyStore +// Arguments: aPKey a EVP_PKEY key structure +// aSizeBits bit size of the key generated +// Returns: KErrNone if no error +// KErrArgument if the arguments have error +// ----------------------------------------------------------------------------- +int sc_pkey_generate(EVP_PKEY *aPKey, unsigned int aSizeBits) +{ + TInt err=KErrNone; + + // Check arguments + if (!aPKey || (aSizeBits <= 0)) + { + err = KErrArgument; + return err; + } + + // Use SymbianKeyStore to create RSA key + aPKey->keyStore->iKeyStore->CreateRSAKey(aSizeBits, KRsaKeyName); + err = aPKey->keyStore->iKeyStore->GetError(); + if ( err != KErrNone) + { + return err; + } + + // Run asynchronous key creation until done + CActiveScheduler::Start(); + err = aPKey->keyStore->iKeyStore->GetError(); + if ( err == KErrNone ) + err = aPKey->keyStore->iKeyStore->hasKey(); + if (!err) + { + aPKey->load = HASKEY; + aPKey->bitsize = aSizeBits; + } + else + { + aPKey->load = NOKEY; + aPKey->bitsize = 0; + } + + return err; +} + +// ----------------------------------------------------------------------------- +// sc_pkey_free Free the EVP_PKEY structure +// Arguments: aPKey a EVP_PKEY structure +// Returns: None +// ----------------------------------------------------------------------------- +void sc_pkey_free(EVP_PKEY *aPKey) +{ + if (!aPKey) + return; + + if (aPKey->keyStore && !aPKey->duplicate) + { + if (aPKey->name) + { + free(aPKey->name); + aPKey->name = NULL; + } + + if (aPKey->keyStore->iKeyStore) + { + delete aPKey->keyStore->iKeyStore; + aPKey->keyStore->iKeyStore = NULL; + } + + if (aPKey->keyStore->iSubjectPublicKeyInfo) + { + delete aPKey->keyStore->iSubjectPublicKeyInfo; + aPKey->keyStore->iSubjectPublicKeyInfo = NULL; + } + + free(aPKey->keyStore); + aPKey->keyStore = NULL; + } + + + free(aPKey); +} + +// ----------------------------------------------------------------------------- +// sc_pkey_duplicate Duplicate the EVP_PKEY structure +// Arguments: aPKey a EVP_PKEY structure to be copied +// Returns: EVP_PKEY* the new EVP_PKEY structure pointer, NULL if failed +// ----------------------------------------------------------------------------- +EVP_PKEY *sc_pkey_duplicate(EVP_PKEY *aPKey) +{ + + EVP_PKEY *pKeyNew = (EVP_PKEY*) malloc(sizeof(EVP_PKEY)); + + if (pKeyNew) + { + pKeyNew->type = aPKey->type; + pKeyNew->bitsize = aPKey->bitsize; + pKeyNew->load = aPKey->load; + pKeyNew->duplicate = 1; + pKeyNew->keyStore = aPKey->keyStore; + pKeyNew->name = aPKey->name; + + } + else + { + xmlSecSetErrorFlag( KErrNoMemory ); + } + + return pKeyNew; +} + +unsigned int sc_pkey_size(EVP_PKEY */*aPKey*/) +{ + // temporary fix (max 16358 bits = 2048 bytes) + return 2048; +} + +// ----------------------------------------------------------------------------- +// sc_sign_final Finalize signing +// Arguments: aCtx EVP_MD_CTX structure, aOutbuf buffer, +// aOutlen size of buffer,aPKey a EVP_PKEY structure, +// Returns: NULL if correct operation, or error code +// ----------------------------------------------------------------------------- +TInt sc_sign_final(EVP_MD_CTX aCtx, unsigned char *aOutbuf, unsigned int *aOutlen, EVP_PKEY *aPkey) +{ + const byte *hash; + unsigned int hashLen; + const unsigned char *outbuf = NULL; + TInt err; + + hashLen = sc_md_get_algo_dlen(aCtx); + hash = sc_md_read(aCtx, 0); // the algo is not used currently + if (!hash) + { + return KErrNoMemory; + } + + switch(aPkey->type) + { + case EVP_PKEY_RSA: + TRAP(err, aPkey->keyStore->iKeyStore->RSASignL(hash, hashLen)); + if (err!=KErrNone) + { + xmlSecSetErrorFlag( err ); + return err; + } + // Run asynchronous RSA signing until done + CActiveScheduler::Start(); + outbuf = aPkey->keyStore->iKeyStore->GetSignedData(aOutlen); + break; + default: + return KErrNotSupported; + } + + if (outbuf) + { + memcpy(aOutbuf, outbuf, *aOutlen); + return KErrNone; + } + else + { + TInt error = aPkey->keyStore->iKeyStore->GetError(); + xmlSecSetErrorFlag( error ); + return error; + } + +} + +// ----------------------------------------------------------------------------- +// doVerifyFinalL Finalize verification +// Arguments: aHash buffer with hash, aHashLen size of hash, aSignature buffer, +// aLen size of buffer,aPKey a EVP_PKEY structure, +// Returns: NULL if correct operation, or error code +// ----------------------------------------------------------------------------- +TInt doVerifyFinalL(const byte *aHash, + unsigned int aHashLen, + unsigned char *aSignature, + unsigned int aLen, + EVP_PKEY *aPKey) +{ + TInt res = 0; + switch(aPKey->type) + { + case EVP_PKEY_RSA: + if (aPKey->keyStore->iSubjectPublicKeyInfo) + { + res = (TInt)aPKey->keyStore->iKeyStore->RSAVerifyWithPublicKeyL(aHash, + aHashLen, + aSignature, + aLen, + aPKey->keyStore->iSubjectPublicKeyInfo); + } + else + { + aPKey->keyStore->iKeyStore->RSAVerifyL(aHash, aHashLen, aSignature, aLen); + // Run asynchronous RSA signing until done + CActiveScheduler::Start(); + User::LeaveIfError( aPKey->keyStore->iKeyStore->GetError() ); + res = (TInt)aPKey->keyStore->iKeyStore->GetVerifyResult(); + }; + break; + default: + res = KErrNotSupported; + } + return res; +} + +// ----------------------------------------------------------------------------- +// sc_verify_final Finalize verification +// Arguments: aCtx EVP_MD_CTX structure, aSignature buffer, +// aLen size of buffer,aPKey a EVP_PKEY structure, +// Returns: NULL if correct operation, or error code +// ----------------------------------------------------------------------------- +TInt sc_verify_final(EVP_MD_CTX aCtx, + unsigned char *aSignature, + unsigned int aLen, + EVP_PKEY *aPKey) +{ + const byte *hash; + unsigned int hashLen; + TInt err; + TInt ret=0; + + hashLen = sc_md_get_algo_dlen(aCtx); + hash = sc_md_read(aCtx, 0); // the algo is not used currently + if (!hash) + { + return KErrNoMemory; + } + + TRAP(err, ret = doVerifyFinalL(hash, hashLen, aSignature, aLen, aPKey)); + + if (err != KErrNone) + { + xmlSecSetErrorFlag( err ); + return err; + } + else + { + return ret; + } + +} + +// ----------------------------------------------------------------------------- +// d2i_PUBKEY_bio Read the public key from ASN.1 DER encoded format +// Arguments: aBio BIO structure +// Returns: EVP_PKEY structure +// ----------------------------------------------------------------------------- +EVP_PKEY* d2i_PUBKEY_bio(BIO *aBio) +{ + // Import key to keystore + TInt err; + EVP_PKEY *pKey; + + // Remember to get the key type later + pKey = sc_pkey_new(EVP_PKEY_UNKNOWN, aBio->name); + if (!pKey) + { + return NULL; + } + + // Import key if key is not found + TPtrC8 keyPtr((const unsigned char*)aBio->mem, aBio->len); + TRAP(err, pKey->keyStore->iSubjectPublicKeyInfo = CX509SubjectPublicKeyInfo::NewL(keyPtr)); + if (err!=KErrNone) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + pKey->load = HASKEY; + switch (pKey->keyStore->iSubjectPublicKeyInfo->AlgorithmId()) + { + case ERSA: + pKey->type = EVP_PKEY_RSA; + break; + case EDSA: + pKey->type = EVP_PKEY_DSA; + break; + default: + pKey->type = EVP_PKEY_UNKNOWN; + break; + } + + return pKey; +} + +// ----------------------------------------------------------------------------- +// doKeyImportL Imports key +// Arguments: EVP_PKEY structure, aBio BIO structure +// ----------------------------------------------------------------------------- +void doKeyImportL(EVP_PKEY *aPKey, BIO *aBio) +{ + __ASSERT_ALWAYS(aPKey, User::Leave(KAssertionLeave)); + __ASSERT_ALWAYS(aPKey->name, User::Leave(KAssertionLeave)); + + TPtrC8 keyPtr((const unsigned char*)aBio->mem, aBio->len); + TPtrC8 keyNamePtr((const unsigned char*)aPKey->name, strlen(aPKey->name)); + + aPKey->keyStore->iKeyStore->ImportKey(keyPtr, keyNamePtr); + User::LeaveIfError( aPKey->keyStore->iKeyStore->GetError() ); + + // Run asynchronous key creation until done + CActiveScheduler::Start(); + User::LeaveIfError( aPKey->keyStore->iKeyStore->GetError() ); +} + +// ----------------------------------------------------------------------------- +// d2i_PKCS8PrivateKey_bio Read the private key from ASN.1 DER encoded PKCS#8 format +// Arguments: aBio BIO structure, aPwdCallback callback, aPwdCallbackCtx callback context +// Returns: EVP_PKEY structure +// ----------------------------------------------------------------------------- +EVP_PKEY* d2i_PKCS8PrivateKey_bio(BIO *aBio, void *aPwdCallback, void *aPwdCallbackCtx) +{ + // Import key to keystore + TInt err; + EVP_PKEY *pKey; + + // Remember to get the key type later + pKey = sc_pkey_new(EVP_PKEY_UNKNOWN, aBio->name); + if (!pKey) + { + return NULL; + } + + // Check if there is existing key first + err = sc_pkey_load(pKey); + if (err == 0 && pKey->load) + { + // Return key if it is found + return pKey; + } + else if ( err != KErrNotFound ) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + // Import key if key is not found + TRAP(err, doKeyImportL(pKey, aBio)); + if (err!=KErrNone) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + + // Check to see if the import key is successful + err = pKey->keyStore->iKeyStore->hasKey(); + if (err) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + pKey->load = HASKEY; + pKey->bitsize = pKey->keyStore->iKeyStore->GetKeySize(); + switch (pKey->keyStore->iKeyStore->GetKeyAlgorithm()) + { + case CCTKeyInfo::ERSA: + pKey->type = EVP_PKEY_RSA; + break; + case CCTKeyInfo::EDSA: + pKey->type = EVP_PKEY_DSA; + break; + default: + pKey->type = EVP_PKEY_UNKNOWN; + break; + } + + + return pKey; + +} + +// ----------------------------------------------------------------------------- +// d2i_PKCS8PrivateKey Read the private key from Unified Key Store +// Arguments: keyname name of the key +// Returns: EVP_PKEY structure +// ----------------------------------------------------------------------------- +EVP_PKEY* d2i_PKCS8PrivateKey(char *keyname) +{ + TInt err; + EVP_PKEY *pKey; + + // Remember to get the key type later + pKey = sc_pkey_new(EVP_PKEY_UNKNOWN, keyname); + if (!pKey) + { + return NULL; + } + + // Check if there is existing key first + err = sc_pkey_load(pKey); + if (err == 0 && pKey->load) + { + // Return key if it is found + return pKey; + } + else if ( err != KErrNotFound ) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + // Check to see if the find key is successful + err = pKey->keyStore->iKeyStore->hasKey(); + if (err) + { + sc_pkey_free(pKey); + xmlSecSetErrorFlag( err ); + return NULL; + } + + pKey->load = HASKEY; + pKey->bitsize = pKey->keyStore->iKeyStore->GetKeySize(); + switch (pKey->keyStore->iKeyStore->GetKeyAlgorithm()) + { + case CCTKeyInfo::ERSA: + pKey->type = EVP_PKEY_RSA; + break; + case CCTKeyInfo::EDSA: + pKey->type = EVP_PKEY_DSA; + break; + default: + pKey->type = EVP_PKEY_UNKNOWN; + break; + } + + + return pKey; + +} + +#ifndef XMLSEC_NO_X509 + +// ----------------------------------------------------------------------------- +// doGetPubKeyL Set the public key info +// Arguments: EVP_PKEY structure, aCert X509 structure +// ----------------------------------------------------------------------------- +void doGetPubKeyL(EVP_PKEY *aPKey, X509 *aCert) +{ + // Convert X509 to CX509Certificate + TPtrC8 certPtr((const unsigned char*)aCert->der, aCert->derlen); + CX509Certificate *cert = CX509Certificate::NewLC(certPtr); + + // Retrieve the public key + aPKey->keyStore->iSubjectPublicKeyInfo = CSubjectPublicKeyInfo::NewL(cert->PublicKey()); + + // Cleanup + CleanupStack::PopAndDestroy(cert); + +} + +// ----------------------------------------------------------------------------- +// sc_pkey_setPublic Set the public key info +// Arguments: EVP_PKEY structure, aCert X509 structure +// Returns: 0 if operation correct, or error code +// ----------------------------------------------------------------------------- +TInt sc_pkey_setPublic(EVP_PKEY* aPKey, X509 *aCert) +{ + TInt err; + + if (aPKey->keyStore->iSubjectPublicKeyInfo) + { + delete aPKey->keyStore->iSubjectPublicKeyInfo; + aPKey->keyStore->iSubjectPublicKeyInfo = NULL; + } + + TRAP(err, doGetPubKeyL(aPKey, aCert)); + + if (err == KErrNone) + { + aPKey->load = HASKEY; + switch (aPKey->keyStore->iSubjectPublicKeyInfo->AlgorithmId()) + { + case ERSA: + aPKey->type = EVP_PKEY_RSA; + break; + case EDSA: + aPKey->type = EVP_PKEY_DSA; + break; + default: + aPKey->type = EVP_PKEY_UNKNOWN; + break; + } + + } + else + { + xmlSecSetErrorFlag( err ); + } + + return err; +} + +#endif // XMLSEC_NO_X509 diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_hmac.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_hmac.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,573 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_config.h" +#ifndef XMLSEC_NO_HMAC +#include "xmlsecc_globals.h" + +#include + +#include +#include //definition of KErrNoMemory + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" +#include "xmlsec_error_flag.h" + +#include "xmlsecc_app.h" +#include "xmlsecc_crypto.h" +#include "xmlsecc_cryptowrapper.h" + +#define XMLSEC_SYMBIANCRYPTO_MAX_HMAC_SIZE 128 + +/************************************************************************** + * + * Internal SYMBIANCRYPTO HMAC CTX + * + *****************************************************************************/ +typedef struct _xmlSecSymbianCryptoHmacCtx + xmlSecSymbianCryptoHmacCtx, *xmlSecSymbianCryptoHmacCtxPtr; +struct _xmlSecSymbianCryptoHmacCtx { + int digest; + ScMDHd digestCtx; + xmlSecByte dgst[XMLSEC_SYMBIANCRYPTO_MAX_HMAC_SIZE]; + xmlSecSize dgstSize; /* dgst size in bits */ +}; + +xmlSecTransformGetDataTypeMethod const xmlSecCrpytoGetDataTypeMethod = xmlSecTransformDefaultGetDataType; +xmlSecTransformPushBinMethod const xmlSecCryptoPushBinMethod = xmlSecTransformDefaultPushBin; +xmlSecTransformPopBinMethod const xmlSecCryptoPopBinMethod = xmlSecTransformDefaultPopBin; + +/****************************************************************************** + * + * HMAC transforms + * + * xmlSecSymbianCryptoHmacCtx is located after xmlSecTransform + * + *****************************************************************************/ +#define xmlSecSymbianCryptoHmacGetCtx(transform) \ + ((xmlSecSymbianCryptoHmacCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) +#define xmlSecSymbianCryptoHmacSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecSymbianCryptoHmacCtx)) +#define xmlSecSymbianCryptoHmacCheckId(transform) \ + (xmlSecTransformCheckId((transform), xmlSecSymbianCryptoTransformHmacSha1Id) || \ + xmlSecTransformCheckId((transform), xmlSecSymbianCryptoTransformHmacMd5Id) || \ + xmlSecTransformCheckId((transform), xmlSecSymbianCryptoTransformHmacRipemd160Id)) + +static int xmlSecSymbianCryptoHmacInitialize (xmlSecTransformPtr transform); +static void xmlSecSymbianCryptoHmacFinalize (xmlSecTransformPtr transform); +static int xmlSecSymbianCryptoHmacNodeRead (xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoHmacSetKeyReq (xmlSecTransformPtr transform, + xmlSecKeyReqPtr keyReq); +static int xmlSecSymbianCryptoHmacSetKey (xmlSecTransformPtr transform, + xmlSecKeyPtr key); +static int xmlSecSymbianCryptoHmacVerify (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoHmacExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +static int +xmlSecSymbianCryptoHmacInitialize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoHmacCtxPtr ctx; +#ifndef XMLSEC_GNUTLS_OLD + //gpg_err_code_t ret; +#endif /* XMLSEC_GNUTLS_OLD */ + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoHmacCheckId(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoHmacCtx)); + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformHmacSha1Id)) { + ctx->digest = SC_MD_SHA1; + } else if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformHmacMd5Id)) { + ctx->digest = SC_MD_MD5; + } else if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformHmacRipemd160Id)) { + ctx->digest = SC_MD_RMD160; + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = sc_md_open(&ctx->digestCtx, ctx->digest, SC_MD_FLAG_HMAC | SC_MD_FLAG_SECURE); /* we are paranoid */ + if(ret != 0 /*GPG_ERR_NO_ERROR*/) { + if ( ret != KErrNone ) + { + xmlSecSetErrorFlag( ret ); + } + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "gcry_md_open", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static void +xmlSecSymbianCryptoHmacFinalize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoHmacCtxPtr ctx; + + xmlSecAssert(xmlSecSymbianCryptoHmacCheckId(transform)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize)); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert(ctx); + + if(ctx->digestCtx) { + sc_md_close(ctx->digestCtx); + } + memset(ctx, 0, sizeof(xmlSecSymbianCryptoHmacCtx)); +} + +/** + * xmlSecSymbianCryptoHmacNodeRead: + * + * HMAC (http://www.w3.org/TR/xmldsig-core/#sec-HMAC): + * + * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits + * as a parameter; if the parameter is not specified then all the bits of the + * hash are output. An example of an HMAC SignatureMethod element: + * + * 128 + * + * + * Schema Definition: + * + * + * + * + * + * DTD: + * + * + */ +static int +xmlSecSymbianCryptoHmacNodeRead(xmlSecTransformPtr transform, + xmlNodePtr node, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoHmacCtxPtr ctx; + xmlNodePtr cur; + + xmlSecAssert2(xmlSecSymbianCryptoHmacCheckId(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + + cur = xmlSecGetNextElementNode(node->children); + if((cur) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) { + xmlChar *content; + + content = xmlNodeGetContent(cur); + if(content) { + ctx->dgstSize = atoi((char*)content); + xmlFree(content); + } + cur = xmlSecGetNextElementNode(cur->next); + } + + if(cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + xmlSecNodeGetName(cur), + XMLSEC_ERRORS_R_INVALID_NODE, + "no nodes expected"); + return(-1); + } + return(0); +} + + +static int +xmlSecSymbianCryptoHmacSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) { + xmlSecSymbianCryptoHmacCtxPtr ctx; + + xmlSecAssert2(xmlSecSymbianCryptoHmacCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(keyReq, -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + + keyReq->keyId = xmlSecSymbianCryptoKeyDataHmacId; + keyReq->keyType= xmlSecKeyDataTypeSymmetric; + if(transform->operation == xmlSecTransformOperationSign) { + keyReq->keyUsage = xmlSecKeyUsageSign; + } else { + keyReq->keyUsage = xmlSecKeyUsageVerify; + } + + return(0); +} + +static int +xmlSecSymbianCryptoHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) { + xmlSecSymbianCryptoHmacCtxPtr ctx; + xmlSecKeyDataPtr value; + xmlSecBufferPtr buffer; + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoHmacCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + xmlSecAssert2(key, -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digestCtx, -1); + + value = xmlSecKeyGetValue(key); + xmlSecAssert2(xmlSecKeyDataCheckId(value, xmlSecSymbianCryptoKeyDataHmacId), -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(value); + xmlSecAssert2(buffer, -1); + + if(xmlSecBufferGetSize(buffer) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, + "key is empty"); + return(-1); + } + ret = sc_md_setkey(ctx->digestCtx, xmlSecBufferGetData(buffer), + xmlSecBufferGetSize(buffer)); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "gcry_md_setkey", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "ret=%d", ret); + return(-1); + } + return(0); +} + +static int +xmlSecSymbianCryptoHmacVerify(xmlSecTransformPtr transform, + const xmlSecByte* data, xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx) { + static xmlSecByte last_byte_masks[] = + { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE }; + + xmlSecSymbianCryptoHmacCtxPtr ctx; + xmlSecByte mask; + + xmlSecAssert2(xmlSecTransformIsValid(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1); + xmlSecAssert2(transform->status == xmlSecTransformStatusFinished, -1); + xmlSecAssert2(data, -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digestCtx, -1); + xmlSecAssert2(ctx->dgstSize > 0, -1); + + /* compare the digest size in bytes */ + if(dataSize != ((ctx->dgstSize + 7) / 8)){ + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "data=%d;dgst=%d", + dataSize, ((ctx->dgstSize + 7) / 8)); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + /* we check the last byte separatelly */ + xmlSecAssert2(dataSize > 0, -1); + mask = last_byte_masks[ctx->dgstSize % 8]; + if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1] & mask)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_DATA_NOT_MATCH, + "data and digest do not match (last byte)"); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + /* now check the rest of the digest */ + if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_DATA_NOT_MATCH, + "data and digest do not match"); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + transform->status = xmlSecTransformStatusOk; + return(0); +} + +static int +xmlSecSymbianCryptoHmacExecute(xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoHmacCtxPtr ctx; + xmlSecBufferPtr in, out; + const xmlSecByte* dgst; + xmlSecSize dgstSize; + int ret; + + xmlSecAssert2(xmlSecSymbianCryptoHmacCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoHmacSize), -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoHmacGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digestCtx, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + + if(transform->status == xmlSecTransformStatusNone) { + transform->status = xmlSecTransformStatusWorking; + } + + if(transform->status == xmlSecTransformStatusWorking) { + xmlSecSize inSize; + + inSize = xmlSecBufferGetSize(in); + if(inSize > 0) { + sc_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize); + + ret = xmlSecBufferRemoveHead(in, inSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", inSize); + return(-1); + } + } + if(last) { + /* get the final digest */ + dgstSize = sc_md_get_algo_dlen(ctx->digestCtx); + sc_md_final(ctx->digestCtx); + dgst = sc_md_read(ctx->digestCtx, ctx->digest); + if(!dgst) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "gcry_md_read", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* copy it to our internal buffer */ + //dgstSize = sc_md_get_algo_dlen(ctx->digest); + xmlSecAssert2(dgstSize > 0, -1); + xmlSecAssert2(dgstSize <= sizeof(ctx->dgst), -1); + memcpy(ctx->dgst, dgst, dgstSize); + + /* check/set the result digest size */ + if(ctx->dgstSize == 0) { + ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */ + } else if(ctx->dgstSize <= 8 * dgstSize) { + dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */ + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "result-bits=%d;required-bits=%d", + 8 * dgstSize, ctx->dgstSize); + return(-1); + } + + if(transform->operation == xmlSecTransformOperationSign) { + ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferAppend", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", dgstSize); + return(-1); + } + } + transform->status = xmlSecTransformStatusFinished; + } + } else if(transform->status == xmlSecTransformStatusFinished) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "size=%d", transform->status); + return(-1); + } + + return(0); +} + +/** + * HMAC SHA1 + */ +static xmlSecTransformKlass xmlSecSymbianCryptoHmacSha1Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoHmacSize, /* xmlSecSize objSize */ + + xmlSecNameHmacSha1, /* const xmlChar* name; */ + xmlSecHrefHmacSha1, /* const xmlChar *href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecSymbianCryptoHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoHmacVerify, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoHmacExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformHmacSha1GetKlass: + * + * The HMAC-SHA1 transform klass. + * + * Returns the HMAC-SHA1 transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformHmacSha1GetKlass(void) { + return(&xmlSecSymbianCryptoHmacSha1Klass); +} + +/** + * HMAC Ripemd160 + */ +static xmlSecTransformKlass xmlSecSymbianCryptoHmacRipemd160Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoHmacSize, /* xmlSecSize objSize */ + + xmlSecNameHmacRipemd160, /* const xmlChar* name; */ + xmlSecHrefHmacRipemd160, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecSymbianCryptoHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoHmacVerify, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoHmacExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformHmacRipemd160GetKlass: + * + * The HMAC-RIPEMD160 transform klass. + * + * Returns the HMAC-RIPEMD160 transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformHmacRipemd160GetKlass(void) { + return(&xmlSecSymbianCryptoHmacRipemd160Klass); +} + +/** + * HMAC Md5 + */ +static xmlSecTransformKlass xmlSecSymbianCryptoHmacMd5Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoHmacSize, /* xmlSecSize objSize */ + + xmlSecNameHmacMd5, /* const xmlChar* name; */ + xmlSecHrefHmacMd5, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + xmlSecSymbianCryptoHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoHmacVerify, /* xmlSecTransformValidateMethod validate; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoHmacExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformHmacMd5GetKlass: + * + * The HMAC-MD5 transform klass. + * + * Returns the HMAC-MD5 transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformHmacMd5GetKlass(void) { + return(&xmlSecSymbianCryptoHmacMd5Klass); +} + +#endif /* XMLSEC_NO_HMAC */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_md.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_md.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A port of gnu md.c useful functions to Symbian. +* +*/ + + +/** A port of gnu md.c useful functions to Symbian **/ + +#include +#include +#include "xmlsecc_config.h" +#include "xmlsecc_cryptowrapper.h" +#include "xmlsec_error_flag.h" + + +/* This object is used to hold a handle to a message digest object. + This structure is private - only to be used by the public sc_md_* + macros. */ +typedef struct sc_md_handle +{ + /* Actual context. */ + CMessageDigest *digest; + + /* Buffer management. */ + HBufC8 *hash; + + /* Indicate support for HMAC */ + int hmac; + +} *sc_md_hd_t; + +/**************** + * Open a message digest handle for use with algorithm ALGO. + * More algorithms may be added by md_enable(). The initial algorithm + * may be 0. + */ + +static TInt +md_open (sc_md_hd_t *h, int algo, int secure, int hmac) +{ + TInt err = KErrNone; + int bufsize = secure ? 512 : 1024; + sc_md_hd_t hd; + hd = (sc_md_hd_t)malloc (sizeof (struct sc_md_handle)); + if (! hd) + err = KErrNoMemory; + if (! err) + { + /* Setup the globally visible data (bctl in the diagram).*/ + switch(algo) + { + case SC_MD_SHA1: + TRAP(err, hd->digest = CSHA1::NewL()); + hd->hash = NULL; + break; + default: + free(hd); + return KErrNotSupported; + } + //HMAC + hd->hmac = hmac; + } + if (! err) + { + *h = hd; + } + else + { + free(hd); + } + return err; +} + +/* Create a message digest object for algorithm ALGO. FLAGS may be + given as an bitwise OR of the sc_md_flags values. ALGO may be + given as 0 if the algorithms to be used are later set using + sc_md_enable. H is guaranteed to be a valid handle or NULL on + error. */ +TInt +sc_md_open (sc_md_hd_t *h, int algo, unsigned int flags) +{ + TInt err = KErrNone; + sc_md_hd_t hd=NULL; + + if ((flags & ~(SC_MD_FLAG_SECURE | SC_MD_FLAG_HMAC))) + err = KErrArgument; + else + { + + err = md_open (&hd, algo, (flags & SC_MD_FLAG_SECURE), + (flags & SC_MD_FLAG_HMAC)); + + } + + *h = err? NULL : hd; + return err; +} + +/**************** + * Return the length of the digest in bytes. + * This function will return 0 in case of errors. + */ +unsigned int +sc_md_get_algo_dlen (sc_md_hd_t hd) +{ + + TInt len = hd->digest->HashSize(); + + return len; +} + +const byte * +md_read(sc_md_hd_t hd) +{ + TRAPD(leaveValue,hd->hash = HBufC8::NewL(hd->digest->HashSize())); + if (leaveValue != KErrNone) + { + xmlSecSetErrorFlag( leaveValue ); + return NULL; + } + *(hd->hash)=hd->digest->Final(); + return hd->hash->Ptr(); +} + +/* + * Read out the complete digest, this function implictly finalizes + * the hash. + */ +const byte * +sc_md_read (sc_md_hd_t hd, int /*algo*/) +{ + const byte *ret; + + if (hd->hash) + { + delete hd->hash; + hd->hash = NULL; + } + ret = md_read (hd); + return ret; +} + +void +sc_md_write (sc_md_hd_t hd, unsigned char *inbuf, size_t inlen) +{ + + TPtrC8 inbufPtr(inbuf, inlen); + hd->digest->Update(inbufPtr); + +} + +void +sc_md_close (sc_md_hd_t hd) +{ + + if (hd->digest) + { + delete hd->digest; + hd->digest = NULL; + } + + if (hd->hash) + { + delete hd->hash; + hd->hash = NULL; + } + + free (hd); +} + +void +sc_md_final (sc_md_hd_t /*a*/) +{ + // Do nothing, sc_md_read will call final() +} + + +/* Set key for HMAC */ +int sc_md_setkey(sc_md_hd_t hd, unsigned char *buffer, size_t length) +{ + TInt err; + + if (!hd || !buffer || length <=0) + return KErrArgument; + + TPtrC8 keyPtr(buffer, length); + + if (hd->hmac) + { + // Initialize HMAC + TRAP(err, hd->digest = CHMAC::NewL(keyPtr, hd->digest)); + if ( err != KErrNone ) + { + xmlSecSetErrorFlag( err ); + } + } + + return err; +} diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_padding.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_padding.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with implementation of xmlenc padding. +* +*/ + + +#include "xmlsecc_padding.h" + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +CXmlSecPadding* CXmlSecPadding::NewLC(TInt aBlockBytes) + { + CXmlSecPadding* self = new (ELeave) CXmlSecPadding(aBlockBytes); + CleanupStack::PushL(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +CXmlSecPadding* CXmlSecPadding::NewL(TInt aBlockBytes) + { + CXmlSecPadding* self = CXmlSecPadding::NewLC(aBlockBytes); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CXmlSecPadding::CXmlSecPadding(TInt aBlockBytes) : CPadding(aBlockBytes) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +void CXmlSecPadding::DoPadL(const TDesC8& aInput,TDes8& aOutput) + { + TInt padLength = BlockSize() - aInput.Length(); + aOutput.Append(aInput); + aOutput.AppendFill( (TChar)padLength, padLength ); + } + +// --------------------------------------------------------------------------- +// Add pad to buffer +// --------------------------------------------------------------------------- +// +void CXmlSecPadding::UnPadL(const TDesC8& aInput,TDes8& aOutput) + { + TInt padLength = (TInt) aInput[ BlockSize()-1 ]; + aOutput.Copy( aInput.Left( BlockSize() - padLength ) ); + } + +// --------------------------------------------------------------------------- +// Remove pad +// --------------------------------------------------------------------------- +// +TInt CXmlSecPadding::MinPaddingLength(void) const + { + return KMinPaddingLenght; + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_signatures.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_signatures.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1044 @@ +/** + * XMLSec library + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +//#include "globals.h" +#include "xmlsecc_globals.h" + +#include +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_keys.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" +#include "xmlsec_error_flag.h" + +#include "xmlsecc_crypto.h" +#include "xmlsecc_evp.h" +#include "xmlsecc_cryptowrapper.h" + +#ifndef XMLSEC_NO_DSA +static const TInt KXmlSecSymbianCryptoDsaSignatureSize(40); +static const EVP_MD *xmlSecSymbianCryptoDsaSha1Evp (void); +#endif /* XMLSEC_NO_DSA */ + + +/************************************************************************** + * + * Internal SymbianCrypto evp signatures ctx + * + *****************************************************************************/ +typedef struct _xmlSecSymbianCryptoEvpSignatureCtx xmlSecSymbianCryptoEvpSignatureCtx, + *xmlSecSymbianCryptoEvpSignatureCtxPtr; +struct _xmlSecSymbianCryptoEvpSignatureCtx { + int digest; + EVP_MD_CTX digestCtx; + xmlSecKeyDataId keyId; + EVP_PKEY* pKey; +}; + +xmlSecTransformGetDataTypeMethod const xmlSecCrpytoGetDataTypeMethod = xmlSecTransformDefaultGetDataType; +xmlSecTransformPushBinMethod const xmlSecCryptoPushBinMethod = xmlSecTransformDefaultPushBin; +xmlSecTransformPopBinMethod const xmlSecCryptoPopBinMethod = xmlSecTransformDefaultPopBin; + +/****************************************************************************** + * + * EVP Signature transforms + * + * xmlSecSymbianCryptoEvpSignatureCtx is located after xmlSecTransform + * + *****************************************************************************/ +#define xmlSecSymbianCryptoEvpSignatureSize \ + (sizeof(xmlSecTransform) + sizeof(xmlSecSymbianCryptoEvpSignatureCtx)) +#define xmlSecSymbianCryptoEvpSignatureGetCtx(transform) \ + ((xmlSecSymbianCryptoEvpSignatureCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) + +static int xmlSecSymbianCryptoEvpSignatureCheckId (xmlSecTransformPtr transform); +static int xmlSecSymbianCryptoEvpSignatureInitialize (xmlSecTransformPtr transform); +static void xmlSecSymbianCryptoEvpSignatureFinalize (xmlSecTransformPtr transform); +static int xmlSecSymbianCryptoEvpSignatureSetKeyReq (xmlSecTransformPtr transform, + xmlSecKeyReqPtr keyReq); +static int xmlSecSymbianCryptoEvpSignatureSetKey (xmlSecTransformPtr transform, + xmlSecKeyPtr key); +static int xmlSecSymbianCryptoEvpSignatureVerify (xmlSecTransformPtr transform, + const xmlSecByte* data, + xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx); +static int xmlSecSymbianCryptoEvpSignatureExecute (xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx); + +static int +xmlSecSymbianCryptoEvpSignatureCheckId(xmlSecTransformPtr transform) { +#ifndef XMLSEC_NO_DSA + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformDsaSha1Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA1 */ + +#endif /* XMLSEC_NO_DSA */ + +#ifndef XMLSEC_NO_RSA + +#ifndef XMLSEC_NO_MD5 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaMd5Id)) { + return(1); + } else +#endif /* XMLSEC_NO_MD5 */ + +#ifndef XMLSEC_NO_RIPEMD160 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaRipemd160Id)) { + return(1); + } else +#endif /* XMLSEC_NO_RIPEMD160 */ + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha1Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA224 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha224Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA224 */ + +#ifndef XMLSEC_NO_SHA256 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha256Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha384Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha512Id)) { + return(1); + } else +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_RSA */ + + { + return(0); + } + + return(0); +} + +static int +xmlSecSymbianCryptoEvpSignatureInitialize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + xmlSecAssert2(xmlSecSymbianCryptoEvpSignatureCheckId(transform), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize), -1); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoEvpSignatureCtx)); + +#ifndef XMLSEC_NO_DSA + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformDsaSha1Id)) { + ctx->digest = xmlSecSymbianCryptoDsaSha1Evp(); + ctx->keyId = xmlSecSymbianCryptoKeyDataDsaId; + } else +#endif /* XMLSEC_NO_SHA1 */ + +#endif /* XMLSEC_NO_DSA */ + +#ifndef XMLSEC_NO_RSA + +#ifndef XMLSEC_NO_MD5 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaMd5Id)) { + ctx->digest = EVP_md5(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_MD5 */ + +#ifndef XMLSEC_NO_RIPEMD160 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaRipemd160Id)) { + ctx->digest = EVP_ripemd160(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_RIPEMD160 */ + +#ifndef XMLSEC_NO_SHA1 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha1Id)) { +// ctx->digest = EVP_sha1(); + ctx->digest = SC_MD_SHA1; + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA224 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha224Id)) { + ctx->digest = EVP_sha224(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_SHA224 */ + +#ifndef XMLSEC_NO_SHA256 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha256Id)) { + ctx->digest = EVP_sha256(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha384Id)) { + ctx->digest = EVP_sha384(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 + if(xmlSecTransformCheckId(transform, xmlSecSymbianCryptoTransformRsaSha512Id)) { + ctx->digest = EVP_sha512(); + ctx->keyId = xmlSecSymbianCryptoKeyDataRsaId; + } else +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_RSA */ + + if(1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_TRANSFORM, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static void +xmlSecSymbianCryptoEvpSignatureFinalize(xmlSecTransformPtr transform) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + + xmlSecAssert(xmlSecSymbianCryptoEvpSignatureCheckId(transform)); + xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize)); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert(ctx); + + + if (ctx->pKey) { + sc_pkey_free(ctx->pKey); + } + + if (ctx->digestCtx) + { + sc_md_close(ctx->digestCtx); + } + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoEvpSignatureCtx)); +} + +static int +xmlSecSymbianCryptoEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + xmlSecKeyDataPtr value; + EVP_PKEY* pKey; + + xmlSecAssert2(xmlSecSymbianCryptoEvpSignatureCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize), -1); + xmlSecAssert2(key, -1); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digest, -1); + xmlSecAssert2(ctx->keyId, -1); + xmlSecAssert2(xmlSecKeyCheckId(key, ctx->keyId), -1); + + value = xmlSecKeyGetValue(key); + xmlSecAssert2(value, -1); + + pKey = xmlSecSymbianCryptoEvpKeyDataGetEvp(value); + if (!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecSymbianCryptoEvpKeyDataGetEvp", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if (ctx->pKey) { + sc_pkey_free(ctx->pKey); + } + + ctx->pKey = xmlSecSymbianCryptoEvpKeyDup(pKey); + if (!ctx->pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecSymbianCryptoEvpKeyDup", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + return(0); +} + +static int +xmlSecSymbianCryptoEvpSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + + xmlSecAssert2(xmlSecSymbianCryptoEvpSignatureCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize), -1); + xmlSecAssert2(keyReq, -1); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->keyId, -1); + + keyReq->keyId = ctx->keyId; + if (transform->operation == xmlSecTransformOperationSign) { + keyReq->keyType = xmlSecKeyDataTypePrivate; + keyReq->keyUsage = xmlSecKeyUsageSign; + } else { + keyReq->keyType = xmlSecKeyDataTypePublic; + keyReq->keyUsage = xmlSecKeyUsageVerify; + } + return(0); +} + + +static int +xmlSecSymbianCryptoEvpSignatureVerify(xmlSecTransformPtr transform, + const xmlSecByte* data, xmlSecSize dataSize, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + int ret = -1; + + xmlSecAssert2(xmlSecSymbianCryptoEvpSignatureCheckId(transform), -1); + xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize), -1); + xmlSecAssert2(transform->status == xmlSecTransformStatusFinished, -1); + xmlSecAssert2(data, -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + + ret = sc_verify_final(ctx->digestCtx, (xmlSecByte*)data, dataSize, ctx->pKey); + if (ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "EVP_VerifyFinal", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } else if (ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "EVP_VerifyFinal", + XMLSEC_ERRORS_R_DATA_NOT_MATCH, + "signature do not match"); + transform->status = xmlSecTransformStatusFail; + return(0); + } + + transform->status = xmlSecTransformStatusOk; + return(0); +} + +static int +xmlSecSymbianCryptoEvpSignatureExecute(xmlSecTransformPtr transform, + int last, + xmlSecTransformCtxPtr transformCtx) { + xmlSecSymbianCryptoEvpSignatureCtxPtr ctx; + xmlSecBufferPtr in, out; + xmlSecSize inSize, outSize; + int ret = -1; + + xmlSecAssert2(xmlSecSymbianCryptoEvpSignatureCheckId(transform), -1); + xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) + || (transform->operation == xmlSecTransformOperationVerify), -1); + xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecSymbianCryptoEvpSignatureSize), -1); + xmlSecAssert2(transformCtx, -1); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + + in = &(transform->inBuf); + out = &(transform->outBuf); + inSize = xmlSecBufferGetSize(in); + outSize = xmlSecBufferGetSize(out); + + ctx = xmlSecSymbianCryptoEvpSignatureGetCtx(transform); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->digest, -1); + xmlSecAssert2(ctx->pKey, -1); + + if (transform->status == xmlSecTransformStatusNone) { + xmlSecAssert2(outSize == 0, -1); + + if (transform->operation == xmlSecTransformOperationSign) { + // Initialization + ret = sc_sign_init(&(ctx->digestCtx), ctx->digest); + if(ret != 0) { + xmlSecSetErrorFlag( ret ); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "EVP_SignInit", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + } else { + ret = sc_verify_init(&(ctx->digestCtx), ctx->digest); + if (ret != 0) { + xmlSecSetErrorFlag( ret ); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "EVP_SignInit", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + transform->status = xmlSecTransformStatusWorking; + } + + if ((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) { + xmlSecAssert2(outSize == 0, -1); + + if (transform->operation == xmlSecTransformOperationSign) { + + sc_sign_update(ctx->digestCtx, xmlSecBufferGetData(in), inSize); + + } else { + + sc_verify_update(ctx->digestCtx, xmlSecBufferGetData(in), inSize); + + } + + ret = xmlSecBufferRemoveHead(in, inSize); + if (ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferRemoveHead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + if ((transform->status == xmlSecTransformStatusWorking) && (last != 0)) { + xmlSecAssert2(outSize == 0, -1); + if (transform->operation == xmlSecTransformOperationSign) { + outSize = sc_pkey_size(ctx->pKey); +#ifndef XMLSEC_NO_DSA + if (outSize < XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE) { + outSize = XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE; + } +#endif /* XMLSEC_NO_DSA */ + + ret = xmlSecBufferSetMaxSize(out, outSize); + if (ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetMaxSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize); + return(-1); + } + + ret = sc_sign_final(ctx->digestCtx, xmlSecBufferGetData(out), &outSize, ctx->pKey); + if (ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "EVP_SignFinal", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecBufferSetSize(out, outSize); + if (ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + "xmlSecBufferSetSize", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "size=%d", outSize); + return(-1); + } + } + transform->status = xmlSecTransformStatusFinished; + } + + if ((transform->status == xmlSecTransformStatusWorking) + || (transform->status == xmlSecTransformStatusFinished)) { + /* the only way we can get here is if there is no input */ + xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), + NULL, + XMLSEC_ERRORS_R_INVALID_STATUS, + "status=%d", transform->status); + return(-1); + } + + return(0); +} + +#ifndef XMLSEC_NO_DSA + +#ifndef XMLSEC_NO_SHA1 +/**************************************************************************** + * + * DSA-SHA1 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoDsaSha1Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameDsaSha1, /* const xmlChar* name; */ + xmlSecHrefDsaSha1, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformDsaSha1GetKlass: + * + * The DSA-SHA1 signature transform klass. + * + * Returns DSA-SHA1 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformDsaSha1GetKlass(void) { + return(&xmlSecSymbianCryptoDsaSha1Klass); +} + +/**************************************************************************** + * + * DSA-SHA1 EVP + * + * XMLDSig specifies dsa signature packing not supported by SymbianCrypto so + * we created our own EVP_MD. + * + * http://www.w3.org/TR/xmldsig-core/#sec-SignatureAlg: + * + * The output of the DSA algorithm consists of a pair of integers + * usually referred by the pair (r, s). The signature value consists of + * the base64 encoding of the concatenation of two octet-streams that + * respectively result from the octet-encoding of the values r and s in + * that order. Integer to octet-stream conversion must be done according + * to the I2OSP operation defined in the RFC 2437 [PKCS1] specification + * with a l parameter equal to 20. For example, the SignatureValue element + * for a DSA signature (r, s) with values specified in hexadecimal: + * + * r = 8BAC1AB6 6410435C B7181F95 B16AB97C 92B341C0 + * s = 41E2345F 1F56DF24 58F426D1 55B4BA2D B6DCD8C8 + * + * from the example in Appendix 5 of the DSS standard would be + * + * i6watmQQQ1y3GB+VsWq5fJKzQcBB4jRfH1bfJFj0JtFVtLotttzYyA== + * + ***************************************************************************/ +#ifndef XMLSEC_OPENSSL_096 +static int +xmlSecSymbianCryptoDsaSha1EvpInit(EVP_MD_CTX *ctx) +{ + return SHA1_Init(ctx->md_data); +} + +static int +xmlSecSymbianCryptoDsaSha1EvpUpdate(EVP_MD_CTX *ctx,const void *data,unsigned long count) +{ + return SHA1_Update(ctx->md_data,data,count); +} + +static int +xmlSecSymbianCryptoDsaSha1EvpFinal(EVP_MD_CTX *ctx,xmlSecByte *md) +{ + return SHA1_Final(md,ctx->md_data); +} +#endif /* XMLSEC_OPENSSL_096 */ + +static int +xmlSecSymbianCryptoDsaSha1EvpSign(int type ATTRIBUTE_UNUSED, + const xmlSecByte *dgst, int dlen, + xmlSecByte *sig, unsigned int *siglen, DSA *dsa) { + DSA_SIG *s; + int rSize, sSize; + + s = DSA_do_sign(dgst, dlen, dsa); + if(!s) { + *siglen=0; + return(0); + } + + rSize = BN_num_bytes(s->r); + sSize = BN_num_bytes(s->s); + if((rSize > (KXmlSecSymbianCryptoDsaSignatureSize / 2)) || + (sSize > (KXmlSecSymbianCryptoDsaSignatureSize / 2))) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "size(r)=%d or size(s)=%d > %d", + rSize, sSize, KXmlSecSymbianCryptoDsaSignatureSize / 2); + DSA_SIG_free(s); + return(0); + } + + memset(sig, 0, KXmlSecSymbianCryptoDsaSignatureSize); + BN_bn2bin(s->r, sig + (KXmlSecSymbianCryptoDsaSignatureSize / 2) - rSize); + BN_bn2bin(s->s, sig + KXmlSecSymbianCryptoDsaSignatureSize - sSize); + *siglen = KXmlSecSymbianCryptoDsaSignatureSize; + + DSA_SIG_free(s); + return(1); +} + +static int +xmlSecSymbianCryptoDsaSha1EvpVerify(int type ATTRIBUTE_UNUSED, + const xmlSecByte *dgst, int dgst_len, + const xmlSecByte *sigbuf, int siglen, DSA *dsa) { + DSA_SIG *s; + int ret = -1; + + s = DSA_SIG_new(); + if (!s) { + return(ret); + } + + if(siglen != KXmlSecSymbianCryptoDsaSignatureSize) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "invalid length %d (%d expected)", + siglen, KXmlSecSymbianCryptoDsaSignatureSize); + goto err; + } + + s->r = BN_bin2bn(sigbuf, KXmlSecSymbianCryptoDsaSignatureSize / 2, NULL); + s->s = BN_bin2bn(sigbuf + (KXmlSecSymbianCryptoDsaSignatureSize / 2), + KXmlSecSymbianCryptoDsaSignatureSize / 2, NULL); + if((!s->r) || (!s->s)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BN_bin2bn", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto err; + } + + ret = DSA_do_verify(dgst, dgst_len, s, dsa); + +err: + DSA_SIG_free(s); + return(ret); +} + +static const EVP_MD xmlSecSymbianCryptoDsaMdEvp = { + NID_dsaWithSHA, + NID_dsaWithSHA, + SHA_DIGEST_LENGTH, +#ifndef XMLSEC_OPENSSL_096 + 0, + xmlSecSymbianCryptoDsaSha1EvpInit, + xmlSecSymbianCryptoDsaSha1EvpUpdate, + xmlSecSymbianCryptoDsaSha1EvpFinal, + NULL, + NULL, +#else /* XMLSEC_OPENSSL_096 */ + SHA1_Init, + SHA1_Update, + SHA1_Final, +#endif /* XMLSEC_OPENSSL_096 */ + xmlSecSymbianCryptoDsaSha1EvpSign, + xmlSecSymbianCryptoDsaSha1EvpVerify, + {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3,EVP_PKEY_DSA4,0}, + SHA_CBLOCK, + sizeof(EVP_MD *)+sizeof(SHA_CTX), +}; + +static const EVP_MD *xmlSecSymbianCryptoDsaSha1Evp(void) +{ + return(&xmlSecSymbianCryptoDsaMdEvp); +} +#endif /* XMLSEC_NO_SHA1 */ + +#endif /* XMLSEC_NO_DSA */ + +#ifndef XMLSEC_NO_RSA + +#ifndef XMLSEC_NO_MD5 +/**************************************************************************** + * + * RSA-MD5 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaMd5Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaMd5, /* const xmlChar* name; */ + xmlSecHrefRsaMd5, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaMd5GetKlass: + * + * The RSA-MD5 signature transform klass. + * + * Returns RSA-MD5 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaMd5GetKlass(void) { + return(&xmlSecSymbianCryptoRsaMd5Klass); +} + +#endif /* XMLSEC_NO_MD5 */ + +#ifndef XMLSEC_NO_RIPEMD160 +/**************************************************************************** + * + * RSA-RIPEMD160 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaRipemd160Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaRipemd160, /* const xmlChar* name; */ + xmlSecHrefRsaRipemd160, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaRipemd160GetKlass: + * + * The RSA-RIPEMD160 signature transform klass. + * + * Returns RSA-RIPEMD160 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaRipemd160GetKlass(void) { + return(&xmlSecSymbianCryptoRsaRipemd160Klass); +} + +#endif /* XMLSEC_NO_RIPEMD160 */ + +#ifndef XMLSEC_NO_SHA1 +/**************************************************************************** + * + * RSA-SHA1 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaSha1Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaSha1, /* const xmlChar* name; */ + xmlSecHrefRsaSha1, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaSha1GetKlass: + * + * The RSA-SHA1 signature transform klass. + * + * Returns RSA-SHA1 signature transform klass. + */ +EXPORT_C +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaSha1GetKlass(void) { + return(&xmlSecSymbianCryptoRsaSha1Klass); +} + +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA224 +/**************************************************************************** + * + * RSA-SHA224 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaSha224Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaSha224, /* const xmlChar* name; */ + xmlSecHrefRsaSha224, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaSha224GetKlass: + * + * The RSA-SHA224 signature transform klass. + * + * Returns RSA-SHA224 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaSha224GetKlass(void) { + return(&xmlSecSymbianCryptoRsaSha224Klass); +} + +#endif /* XMLSEC_NO_SHA224 */ + +#ifndef XMLSEC_NO_SHA256 +/**************************************************************************** + * + * RSA-SHA256 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaSha256Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaSha256, /* const xmlChar* name; */ + xmlSecHrefRsaSha256, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaSha256GetKlass: + * + * The RSA-SHA256 signature transform klass. + * + * Returns RSA-SHA256 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaSha256GetKlass(void) { + return(&xmlSecSymbianCryptoRsaSha256Klass); +} + +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 +/**************************************************************************** + * + * RSA-SHA384 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaSha384Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaSha384, /* const xmlChar* name; */ + xmlSecHrefRsaSha384, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaSha384GetKlass: + * + * The RSA-SHA384 signature transform klass. + * + * Returns RSA-SHA384 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaSha384GetKlass(void) { + return(&xmlSecSymbianCryptoRsaSha384Klass); +} + +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 +/**************************************************************************** + * + * RSA-SHA512 signature transform + * + ***************************************************************************/ +static xmlSecTransformKlass xmlSecSymbianCryptoRsaSha512Klass = { + /* klass/object sizes */ + sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */ + xmlSecSymbianCryptoEvpSignatureSize, /* xmlSecSize objSize */ + + xmlSecNameRsaSha512, /* const xmlChar* name; */ + xmlSecHrefRsaSha512, /* const xmlChar* href; */ + xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */ + + xmlSecSymbianCryptoEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */ + xmlSecSymbianCryptoEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */ + NULL, /* xmlSecTransformNodeReadMethod readNode; */ + NULL, /* xmlSecTransformNodeWriteMethod writeNode; */ + xmlSecSymbianCryptoEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */ + xmlSecSymbianCryptoEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */ + xmlSecSymbianCryptoEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */ + xmlSecCrpytoGetDataTypeMethod, /* xmlSecTransformGetDataTypeMethod getDataType; */ + xmlSecCryptoPushBinMethod, /* xmlSecTransformPushBinMethod pushBin; */ + xmlSecCryptoPopBinMethod, /* xmlSecTransformPopBinMethod popBin; */ + NULL, /* xmlSecTransformPushXmlMethod pushXml; */ + NULL, /* xmlSecTransformPopXmlMethod popXml; */ + xmlSecSymbianCryptoEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */ + + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoTransformRsaSha512GetKlass: + * + * The RSA-SHA512 signature transform klass. + * + * Returns RSA-SHA512 signature transform klass. + */ +xmlSecTransformId +xmlSecSymbianCryptoTransformRsaSha512GetKlass(void) { + return(&xmlSecSymbianCryptoRsaSha512Klass); +} + +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_RSA */ + + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_symkeys.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_symkeys.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,454 @@ +/** + * + * XMLSec library + * + * DES Algorithm support + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_globals.h" + +#include +#include +#include +#include "xmlsecc_config.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_transforms.h" +#include "xmlsec_errors.h" + +#include "xmlsecc_crypto.h" + +/***************************************************************************** + * + * Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary + * + ****************************************************************************/ +static int xmlSecSymbianCryptoSymKeyDataInitialize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoSymKeyDataDuplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +static void xmlSecSymbianCryptoSymKeyDataFinalize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoSymKeyDataXmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoSymKeyDataXmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoSymKeyDataBinRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + const xmlSecByte* buf, + xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoSymKeyDataBinWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlSecByte** buf, + xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoSymKeyDataGenerate (xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type); + +static xmlSecKeyDataType xmlSecSymbianCryptoSymKeyDataGetType (xmlSecKeyDataPtr data); +static xmlSecSize xmlSecSymbianCryptoSymKeyDataGetSize (xmlSecKeyDataPtr data); +static void xmlSecSymbianCryptoSymKeyDataDebugDump (xmlSecKeyDataPtr data, + FILE* output); +static void xmlSecSymbianCryptoSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data, + FILE* output); +static int xmlSecSymbianCryptoSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass); + +#define xmlSecSymbianCryptoSymKeyDataCheckId(data) \ + (xmlSecKeyDataIsValid((data)) && \ + xmlSecSymbianCryptoSymKeyDataKlassCheck((data)->id)) + +static int +xmlSecSymbianCryptoSymKeyDataInitialize(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(data), -1); + + return(xmlSecKeyDataBinaryValueInitialize(data)); +} + +static int +xmlSecSymbianCryptoSymKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(dst), -1); + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(src), -1); + xmlSecAssert2(dst->id == src->id, -1); + + return(xmlSecKeyDataBinaryValueDuplicate(dst, src)); +} + +static void +xmlSecSymbianCryptoSymKeyDataFinalize(xmlSecKeyDataPtr data) { + xmlSecAssert(xmlSecSymbianCryptoSymKeyDataCheckId(data)); + + xmlSecKeyDataBinaryValueFinalize(data); +} + +static int +xmlSecSymbianCryptoSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataKlassCheck(id), -1); + + return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx)); +} + +static int +xmlSecSymbianCryptoSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataKlassCheck(id), -1); + + return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx)); +} + +static int +xmlSecSymbianCryptoSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + const xmlSecByte* buf, xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataKlassCheck(id), -1); + + return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx)); +} + +static int +xmlSecSymbianCryptoSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlSecByte** buf, xmlSecSize* bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataKlassCheck(id), -1); + + return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx)); +} + +static int +xmlSecSymbianCryptoSymKeyDataGenerate(xmlSecKeyDataPtr data, + xmlSecSize sizeBits, + xmlSecKeyDataType type ATTRIBUTE_UNUSED) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(data), -1); + xmlSecAssert2(sizeBits > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer, -1); + + return(xmlSecSymbianCryptoGenerateRandom(buffer, (sizeBits + 7) / 8)); +} + +static xmlSecKeyDataType +xmlSecSymbianCryptoSymKeyDataGetType(xmlSecKeyDataPtr data) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(data), xmlSecKeyDataTypeUnknown); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer, xmlSecKeyDataTypeUnknown); + + return((xmlSecBufferGetSize(buffer) > 0) ? + xmlSecKeyDataTypeSymmetric : xmlSecKeyDataTypeUnknown); +} + +static xmlSecSize +xmlSecSymbianCryptoSymKeyDataGetSize(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecSymbianCryptoSymKeyDataCheckId(data), 0); + + return(xmlSecKeyDataBinaryValueGetSize(data)); +} + +static void +xmlSecSymbianCryptoSymKeyDataDebugDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecSymbianCryptoSymKeyDataCheckId(data)); + + xmlSecKeyDataBinaryValueDebugDump(data, output); +} + +static void +xmlSecSymbianCryptoSymKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) { + xmlSecAssert(xmlSecSymbianCryptoSymKeyDataCheckId(data)); + + xmlSecKeyDataBinaryValueDebugXmlDump(data, output); +} + +static int +xmlSecSymbianCryptoSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) { +#ifndef XMLSEC_NO_DES + if(klass == xmlSecSymbianCryptoKeyDataDesId) { + return(1); + } +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_AES + if(klass == xmlSecSymbianCryptoKeyDataAesId) { + return(1); + } +#endif /* XMLSEC_NO_AES */ + +#ifndef XMLSEC_NO_HMAC + if(klass == xmlSecSymbianCryptoKeyDataHmacId) { + return(1); + } +#endif /* XMLSEC_NO_HMAC */ + + return(0); +} + +#ifndef XMLSEC_NO_AES +/************************************************************************** + * + * processing + * + *************************************************************************/ +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataAesKlass = { + sizeof(xmlSecKeyDataKlass), + xmlSecKeyDataBinarySize, + + /* data */ + xmlSecNameAESKeyValue, + xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefAESKeyValue, /* const xmlChar* href; */ + xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + xmlSecSymbianCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */ + xmlSecSymbianCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + xmlSecSymbianCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */ + xmlSecSymbianCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataAesGetKlass: + * + * The AES key data klass. + * + * Returns AES key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataAesGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataAesKlass); +} + +/** + * xmlSecSymbianCryptoKeyDataAesSet: + * @data: the pointer to AES key data. + * @buf: the pointer to key value. + * @bufSize: the key value size (in bytes). + * + * Sets the value of AES key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataAesSet(xmlSecKeyDataPtr data, + const xmlSecByte* buf, xmlSecSize bufSize) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataAesId), -1); + xmlSecAssert2(buf, -1); + xmlSecAssert2(bufSize > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer, -1); + + return(xmlSecBufferSetData(buffer, buf, bufSize)); +} +#endif /* XMLSEC_NO_AES */ + +#ifndef XMLSEC_NO_DES +/************************************************************************** + * + * processing + * + *************************************************************************/ +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataDesKlass = { + sizeof(xmlSecKeyDataKlass), + xmlSecKeyDataBinarySize, + + /* data */ + xmlSecNameDESKeyValue, + xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefDESKeyValue, /* const xmlChar* href; */ + xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + xmlSecSymbianCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */ + xmlSecSymbianCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + xmlSecSymbianCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */ + xmlSecSymbianCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataDesGetKlass: + * + * The DES key data klass. + * + * Returns DES key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataDesGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataDesKlass); +} + +/** + * xmlSecSymbianCryptoKeyDataDesSet: + * @data: the pointer to DES key data. + * @buf: the pointer to key value. + * @bufSize: the key value size (in bytes). + * + * Sets the value of DES key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataDesSet(xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataDesId), -1); + xmlSecAssert2(buf, -1); + xmlSecAssert2(bufSize > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer, -1); + + return(xmlSecBufferSetData(buffer, buf, bufSize)); +} + +#endif /* XMLSEC_NO_DES */ + +#ifndef XMLSEC_NO_HMAC +/************************************************************************** + * + * processing + * + *************************************************************************/ +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataHmacKlass = { + sizeof(xmlSecKeyDataKlass), + xmlSecKeyDataBinarySize, + + /* data */ + xmlSecNameHMACKeyValue, + xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefHMACKeyValue, /* const xmlChar* href; */ + xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */ + xmlSecNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + xmlSecSymbianCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */ + xmlSecSymbianCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + xmlSecSymbianCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */ + xmlSecSymbianCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataHmacGetKlass: + * + * The HMAC key data klass. + * + * Returns HMAC key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataHmacGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataHmacKlass); +} + +/** + * xmlSecSymbianCryptoKeyDataHmacSet: + * @data: the pointer to HMAC key data. + * @buf: the pointer to key value. + * @bufSize: the key value size (in bytes). + * + * Sets the value of HMAC key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataHmacSet(xmlSecKeyDataPtr data, + const xmlSecByte* buf, + xmlSecSize bufSize) { + xmlSecBufferPtr buffer; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataHmacId), -1); + xmlSecAssert2(buf, -1); + xmlSecAssert2(bufSize > 0, -1); + + buffer = xmlSecKeyDataBinaryValueGetBuffer(data); + xmlSecAssert2(buffer, -1); + + return(xmlSecBufferSetData(buffer, buf, bufSize)); +} + +#endif /* XMLSEC_NO_HMAC */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2448 @@ +/** + * XMLSec library + * + * X509 support + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +//#include "globals.h" +#include "xmlsecc_config.h" +#ifndef XMLSEC_NO_X509 +#include "xmlsecc_globals.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_x509.h" +#include "xmlsec_base64.h" +#include "xmlsec_errors.h" + +#include "xmlsecc_crypto.h" +#include "xmlsecc_evp.h" +#include "xmlsecc_x509.h" + +/************************************************************************* + * + * X509 utility functions + * + ************************************************************************/ +static int xmlSecSymbianCryptoX509DataNodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509CertificateNodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509CertificateNodeWrite (X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509SubjectNameNodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509SubjectNameNodeWrite (X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509IssuerSerialNodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509IssuerSerialNodeWrite (X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509SKINodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509SKINodeWrite (X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509CRLNodeRead (xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoX509CRLNodeWrite (X509_CRL* crl, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, + xmlSecKeyPtr key, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static X509* xmlSecSymbianCryptoX509CertDerRead (const xmlSecByte* buf, + xmlSecSize size); +static X509* xmlSecSymbianCryptoX509CertBase64DerRead (xmlChar* buf); +static xmlChar* xmlSecSymbianCryptoX509CertBase64DerWrite (X509* cert, + int base64LineWrap); +static X509_CRL* xmlSecSymbianCryptoX509CrlDerRead (xmlSecByte* buf, + xmlSecSize size); +static X509_CRL* xmlSecSymbianCryptoX509CrlBase64DerRead (xmlChar* buf); +static xmlChar* xmlSecSymbianCryptoX509CrlBase64DerWrite (X509_CRL* crl, + int base64LineWrap); +static xmlChar* xmlSecSymbianCryptoX509NameWrite (X509_NAME* nm); +#ifdef XMLSEC_FUTURE_SUPPORT +static xmlChar* xmlSecSymbianCryptoASN1IntegerWrite (ASN1_INTEGER *asni); +#endif //XMLSEC_FUTURE_SUPPORT +static xmlChar* xmlSecSymbianCryptoX509SKIWrite (X509* cert); +static void xmlSecSymbianCryptoX509CertDebugDump (X509* cert, + FILE* output); +static void xmlSecSymbianCryptoX509CertDebugXmlDump (X509* cert, + FILE* output); +#ifdef XMLSEC_FUTURE_SUPPORT +static int xmlSecSymbianCryptoX509CertGetTime (ASN1_TIME* t, + time_t* res); +#endif //XMLSEC_FUTURE_SUPPORT +/************************************************************************* +* +* Support for SymbianCertStore +* +*************************************************************************/ +static int XmlSecCertStoreFlag = 0; + +// --------------------------------------------------------------------------- +// Set SymbianCertStore flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +void xmlSecSetCertStoreFlag() + { + XmlSecCertStoreFlag = 1; + } + +// --------------------------------------------------------------------------- +// Reset SymbianCertStore flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +void xmlSecResetCertStoreFlag() + { + XmlSecCertStoreFlag = 0; + } +// --------------------------------------------------------------------------- +// Check SymbianCertStore flag. +// --------------------------------------------------------------------------- +// +EXPORT_C +int xmlSecCheckCertStoreFlag() + { + return XmlSecCertStoreFlag; + } +/************************************************************************* + * + * Internal SymbianCrypto X509 data CTX + * + ************************************************************************/ +typedef struct _xmlSecSymbianCryptoX509DataCtx xmlSecSymbianCryptoX509DataCtx, + *xmlSecSymbianCryptoX509DataCtxPtr; +struct _xmlSecSymbianCryptoX509DataCtx { + X509* keyCert; + STACK_OF(X509)* certsList; + STACK_OF(X509_CRL)* crlsList; +}; +/************************************************************************** + * + * processing + * + * + * The X509Data Element (http://www.w3.org/TR/xmldsig-core/#sec-X509Data) + * + * An X509Data element within KeyInfo contains one or more identifiers of keys + * or X509 certificates (or certificates' identifiers or a revocation list). + * The content of X509Data is: + * + * 1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate: + * 2. + * * The X509IssuerSerial element, which contains an X.509 issuer + * distinguished name/serial number pair that SHOULD be compliant + * with RFC2253 [LDAP-DN], + * * The X509SubjectName element, which contains an X.509 subject + * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN], + * * The X509SKI element, which contains the base64 encoded plain (i.e. + * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension. + * * The X509Certificate element, which contains a base64-encoded [X509v3] + * certificate, and + * * Elements from an external namespace which accompanies/complements any + * of the elements above. + * * The X509CRL element, which contains a base64-encoded certificate + * revocation list (CRL) [X509v3]. + * + * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear + * MUST refer to the certificate or certificates containing the validation key. + * All such elements that refer to a particular individual certificate MUST be + * grouped inside a single X509Data element and if the certificate to which + * they refer appears, it MUST also be in that X509Data element. + * + * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to + * the same key but different certificates MUST be grouped within a single + * KeyInfo but MAY occur in multiple X509Data elements. + * + * All certificates appearing in an X509Data element MUST relate to the + * validation key by either containing it or being part of a certification + * chain that terminates in a certificate containing the validation key. + * + * No ordering is implied by the above constraints. + * + * Note, there is no direct provision for a PKCS#7 encoded "bag" of + * certificates or CRLs. However, a set of certificates and CRLs can occur + * within an X509Data element and multiple X509Data elements can occur in a + * KeyInfo. Whenever multiple certificates occur in an X509Data element, at + * least one such certificate must contain the public key which verifies the + * signature. + * + * Schema Definition + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * DTD + * + * + * + * + * + * + * + * + * + * + * ----------------------------------------------------------------------- + * + * xmlSecSymbianCryptoX509DataCtx is located after xmlSecTransform + * + *************************************************************************/ +#define xmlSecSymbianCryptoX509DataSize \ + (sizeof(xmlSecKeyData) + sizeof(xmlSecSymbianCryptoX509DataCtx)) +#define xmlSecSymbianCryptoX509DataGetCtx(data) \ + ((xmlSecSymbianCryptoX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData))) + +static int xmlSecSymbianCryptoKeyDataX509Initialize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataX509Duplicate (xmlSecKeyDataPtr dst, + xmlSecKeyDataPtr src); +static void xmlSecSymbianCryptoKeyDataX509Finalize (xmlSecKeyDataPtr data); +static int xmlSecSymbianCryptoKeyDataX509XmlRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static int xmlSecSymbianCryptoKeyDataX509XmlWrite (xmlSecKeyDataId id, + xmlSecKeyPtr key, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx); +static xmlSecKeyDataType xmlSecSymbianCryptoKeyDataX509GetType (xmlSecKeyDataPtr data); +static const xmlChar* xmlSecSymbianCryptoKeyDataX509GetIdentifier (xmlSecKeyDataPtr data); + +static void xmlSecSymbianCryptoKeyDataX509DebugDump (xmlSecKeyDataPtr data, + FILE* output); +static void xmlSecSymbianCryptoKeyDataX509DebugXmlDump (xmlSecKeyDataPtr data, + FILE* output); + + + +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataX509Klass = { + sizeof(xmlSecKeyDataKlass), + xmlSecSymbianCryptoX509DataSize, + + /* data */ + xmlSecNameX509Data, + xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefX509Data, /* const xmlChar* href; */ + xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */ + xmlSecSymbianCryptoKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */ + xmlSecSymbianCryptoKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + xmlSecSymbianCryptoKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + xmlSecSymbianCryptoKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + xmlSecSymbianCryptoKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + xmlSecSymbianCryptoKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + NULL, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + xmlSecSymbianCryptoKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + xmlSecSymbianCryptoKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataX509GetKlass: + * + * The SymbianCrypto X509 key data klass (http://www.w3.org/TR/xmldsig-core/#sec-X509Data). + * + * Returns the X509 data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataX509GetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataX509Klass); +} + +/** + * xmlSecSymbianCryptoKeyDataX509GetKeyCert: + * @data: the pointer to X509 key data. + * + * Gets the certificate from which the key was extracted. + * + * Returns the key's certificate or NULL if key data was not used for key + * extraction or an error occurs. + */ +EXPORT_C +X509* +xmlSecSymbianCryptoKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), NULL); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, NULL); + + return(ctx->keyCert); +} + +/** + * xmlSecSymbianCryptoKeyDataX509AdoptKeyCert: + * @data: the pointer to X509 key data. + * @cert: the pointer to SymbianCrypto X509 certificate. + * + * Sets the key's certificate in @data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, X509* cert) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(cert, -1); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, -1); + + if(ctx->keyCert) { + X509_free(ctx->keyCert); + } + ctx->keyCert = cert; + return(0); +} + +/** + * xmlSecSymbianCryptoKeyDataX509AdoptCert: + * @data: the pointer to X509 key data. + * @cert: the pointer to SymbianCrypto X509 certificate. + * + * Adds certificate to the X509 key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(cert, -1); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, -1); + /* + if(ctx->certsList == NULL) { + ctx->certsList = sk_X509_new_null(); + if(ctx->certsList == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sk_X509_new_null", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + ret = sk_X509_push(ctx->certsList, cert); + if(ret < 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sk_X509_push", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + */ + return(0); +} + +/** + * xmlSecSymbianCryptoKeyDataX509GetCert: + * @data: the pointer to X509 key data. + * @pos: the desired certificate position. + * + * Gets a certificate from X509 key data. + * + * Returns the pointer to certificate or NULL if @pos is larger than the + * number of certificates in @data or an error occurs. + */ +EXPORT_C +X509* +xmlSecSymbianCryptoKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), NULL); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, NULL); + xmlSecAssert2(ctx->certsList, NULL); + + return NULL; +} + +/** + * xmlSecSymbianCryptoKeyDataX509GetCertsSize: + * @data: the pointer to X509 key data. + * + * Gets the number of certificates in @data. + * + * Returns te number of certificates in @data. + */ +EXPORT_C +xmlSecSize +xmlSecSymbianCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), 0); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, 0); + + return 0; +} + +/** + * xmlSecSymbianCryptoKeyDataX509AdoptCrl: + * @data: the pointer to X509 key data. + * @crl: the pointer to SymbianCrypto X509 CRL. + * + * Adds CRL to the X509 key data. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(crl, -1); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, -1); + /* + if(ctx->crlsList == NULL) { + ctx->crlsList = sk_X509_CRL_new_null(); + if(ctx->crlsList == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sk_X509_CRL_new_null", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + ret = sk_X509_CRL_push(ctx->crlsList, crl); + if(ret < 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "sk_X509_CRL_push", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + */ + return(0); +} + +/** + * xmlSecSymbianCryptoKeyDataX509GetCrl: + * @data: the pointer to X509 key data. + * @pos: the desired CRL position. + * + * Gets a CRL from X509 key data. + * + * Returns the pointer to CRL or NULL if @pos is larger than the + * number of CRLs in @data or an error occurs. + */ +EXPORT_C +X509_CRL* +xmlSecSymbianCryptoKeyDataX509GetCrl(xmlSecKeyDataPtr data, xmlSecSize pos) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), NULL); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, NULL); + + xmlSecAssert2(ctx->crlsList, NULL); + + return NULL; +} + +/** + * xmlSecSymbianCryptoKeyDataX509GetCrlsSize: + * @data: the pointer to X509 key data. + * + * Gets the number of CRLs in @data. + * + * Returns te number of CRLs in @data. + */ +EXPORT_C +xmlSecSize +xmlSecSymbianCryptoKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), 0); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, 0); + + return 0; +} + +static int +xmlSecSymbianCryptoKeyDataX509Initialize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoX509DataCtx)); + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) { + X509* certSrc; + X509* certDst = NULL; + X509_CRL* crlSrc; + X509_CRL* crlDst = NULL; + xmlSecSize size, pos; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecSymbianCryptoKeyDataX509Id), -1); + + /* copy certsList */ + size = xmlSecSymbianCryptoKeyDataX509GetCertsSize(src); + for(pos = 0; pos < size; ++pos) { + certSrc = xmlSecSymbianCryptoKeyDataX509GetCert(src, pos); + if(!certSrc) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), + "xmlSecSymbianCryptoKeyDataX509GetCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + + if(!certDst) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(dst, certDst); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* copy crls */ + size = xmlSecSymbianCryptoKeyDataX509GetCrlsSize(src); + for(pos = 0; pos < size; ++pos) { + crlSrc = xmlSecSymbianCryptoKeyDataX509GetCrl(src, pos); + if(!crlSrc) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), + "xmlSecSymbianCryptoKeyDataX509GetCrl", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + + if(!crlDst) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "X509_CRL_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCrl(dst, crlDst); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "xmlSecSymbianCryptoKeyDataX509AdoptCrl", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + + /* copy key cert if exist */ + certSrc = xmlSecSymbianCryptoKeyDataX509GetKeyCert(src); + if(certSrc) { + if(!certDst) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ret = xmlSecSymbianCryptoKeyDataX509AdoptKeyCert(dst, certDst); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), + "xmlSecSymbianCryptoKeyDataX509AdoptKeyCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +static void +xmlSecSymbianCryptoKeyDataX509Finalize(xmlSecKeyDataPtr data) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id)); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert(ctx); + + if(ctx->certsList) { + + } + if(ctx->crlsList) { + + } + if(ctx->keyCert) { + X509_free(ctx->keyCert); + } + memset(ctx, 0, sizeof(xmlSecSymbianCryptoX509DataCtx)); +} + +static int +xmlSecSymbianCryptoKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataX509Id, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + data = xmlSecKeyEnsureData(key, id); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyEnsureData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ret = xmlSecSymbianCryptoX509DataNodeRead(data, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509DataNodeRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS) == 0) { + ret = xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, + xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + X509* cert; + X509_CRL* crl; + xmlSecSize size, pos = 0; + int content; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataX509Id, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + content = xmlSecX509DataGetNodeContent (node, 1, keyInfoCtx); + if (content < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecX509DataGetNodeContent", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "content=%d", content); + return(-1); + } else if(content == 0) { + /* by default we are writing certificates and crls */ + content = XMLSEC_X509DATA_DEFAULT; + } + + /* get x509 data */ + data = xmlSecKeyGetData(key, id); + if(!data) { + /* no x509 data in the key */ + return(0); + } + + /* write certs */ + +// for(pos = 0; pos < size; ++pos) { + cert = xmlSecSymbianCryptoKeyDataX509GetKeyCert(data); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataX509GetCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + + if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) { + ret = xmlSecSymbianCryptoX509CertificateNodeWrite(cert, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509CertificateNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + } + + if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) { + ret = xmlSecSymbianCryptoX509SubjectNameNodeWrite(cert, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509SubjectNameNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + } + + if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) { + ret = xmlSecSymbianCryptoX509IssuerSerialNodeWrite(cert, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509IssuerSerialNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + } + + if((content & XMLSEC_X509DATA_SKI_NODE) != 0) { + ret = xmlSecSymbianCryptoX509SKINodeWrite(cert, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509SKINodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + } + +// } // for(pos = 0; pos < size; ++pos) + + /* write crls if needed */ + if((content & XMLSEC_X509DATA_CRL_NODE) != 0) { + size = xmlSecSymbianCryptoKeyDataX509GetCrlsSize(data); + for(pos = 0; pos < size; ++pos) { + crl = xmlSecSymbianCryptoKeyDataX509GetCrl(data, pos); + if(!crl) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataX509GetCrl", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + + ret = xmlSecSymbianCryptoX509CRLNodeWrite(crl, node, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoX509CRLNodeWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return(-1); + } + } + } + + return(0); +} + + +static xmlSecKeyDataType +xmlSecSymbianCryptoKeyDataX509GetType(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), + xmlSecKeyDataTypeUnknown); + + return(xmlSecKeyDataTypeUnknown); +} + +static const xmlChar* +xmlSecSymbianCryptoKeyDataX509GetIdentifier(xmlSecKeyDataPtr data) { + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), NULL); + + return(NULL); +} + +static void +xmlSecSymbianCryptoKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) { + X509* cert; + xmlSecSize size, pos; + + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id)); + xmlSecAssert(output); + + fprintf(output, "=== X509 Data:\n"); + cert = xmlSecSymbianCryptoKeyDataX509GetKeyCert(data); + if(cert) { + fprintf(output, "==== Key Certificate:\n"); + xmlSecSymbianCryptoX509CertDebugDump(cert, output); + } + + size = xmlSecSymbianCryptoKeyDataX509GetCertsSize(data); + for(pos = 0; pos < size; ++pos) { + cert = xmlSecSymbianCryptoKeyDataX509GetCert(data, pos); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509GetCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return; + } + fprintf(output, "==== Certificate:\n"); + xmlSecSymbianCryptoX509CertDebugDump(cert, output); + } + + /* we don't print out crls */ +} + +static void +xmlSecSymbianCryptoKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) { + X509* cert; + xmlSecSize size, pos; + + xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id)); + xmlSecAssert(output); + + fprintf(output, "\n"); + cert = xmlSecSymbianCryptoKeyDataX509GetKeyCert(data); + if(cert) { + fprintf(output, "\n"); + xmlSecSymbianCryptoX509CertDebugXmlDump(cert, output); + fprintf(output, "\n"); + } + + size = xmlSecSymbianCryptoKeyDataX509GetCertsSize(data); + for(pos = 0; pos < size; ++pos) { + cert = xmlSecSymbianCryptoKeyDataX509GetCert(data, pos); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509GetCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "pos=%d", pos); + return; + } + fprintf(output, "\n"); + xmlSecSymbianCryptoX509CertDebugXmlDump(cert, output); + fprintf(output, "\n"); + } + + /* we don't print out crls */ + fprintf(output, "\n"); +} + +static int +xmlSecSymbianCryptoX509DataNodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlNodePtr cur; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + for(cur = xmlSecGetNextElementNode(node->children); + cur; + cur = xmlSecGetNextElementNode(cur->next)) { + + ret = 0; + if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) { + ret = xmlSecSymbianCryptoX509CertificateNodeRead(data, cur, keyInfoCtx); + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) { + ret = xmlSecSymbianCryptoX509SubjectNameNodeRead(data, cur, keyInfoCtx); + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) { + ret = xmlSecSymbianCryptoX509IssuerSerialNodeRead(data, cur, keyInfoCtx); + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) { + ret = xmlSecSymbianCryptoX509SKINodeRead(data, cur, keyInfoCtx); + } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) { + ret = xmlSecSymbianCryptoX509CRLNodeRead(data, cur, keyInfoCtx); + } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) { + /* laxi schema validation: ignore unknown nodes */ + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "read node failed"); + return(-1); + } + } + return(0); +} + +static int +xmlSecSymbianCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlChar *content; + X509* cert; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + content = xmlNodeGetContent(node); + if((!content) || (xmlSecIsEmptyString(content) == 1)) { + if(content) { + xmlFree(content); + } + if ( OOM_FLAG ) + return(-1); + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); + } + + cert = xmlSecSymbianCryptoX509CertBase64DerRead(content); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CertBase64DerRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptKeyCert(data, cert); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509AdoptKeyCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_free(cert); + xmlFree(content); + return(-1); + } + + xmlFree(content); + return(0); +} + +static int +xmlSecSymbianCryptoX509CertificateNodeWrite(X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlChar* buf; + xmlNodePtr cur; + + xmlSecAssert2(cert, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + /* set base64 lines size from context */ + buf = xmlSecSymbianCryptoX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize); + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509CertBase64DerWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509Certificate)); + xmlFree(buf); + return(-1); + } + + xmlNodeSetContent(cur, xmlSecStringCR); + if ( OOM_FLAG ) + { + xmlUnlinkNode(cur); + xmlFreeNode(cur); + xmlFree(buf); + return(-1); + } + xmlNodeSetContent(cur, buf); + if ( OOM_FLAG ) + { + xmlUnlinkNode(cur); + xmlFreeNode(cur); + xmlFree(buf); + return(-1); + } + xmlFree(buf); + return(0); +} + +static int +xmlSecSymbianCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataStorePtr x509Store; + xmlChar* subject; + X509* cert; + X509* cert2 = NULL; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + xmlSecAssert2(keyInfoCtx->keysMngr, -1); + + x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeysMngrGetDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + subject = xmlNodeGetContent(node); + if((!subject) || (xmlSecIsEmptyString(subject) == 1)) { + if(subject) { + xmlFree(subject); + } + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); + } + + cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx); + if(!cert){ + xmlFree(subject); + + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_FOUND, + "subject=%s", + xmlSecErrorsSafeString(subject)); + return(-1); + } + return(0); + } + + if(!cert2) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(subject); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert2); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(subject); + return(-1); + } + + xmlFree(subject); + return(0); +} + +static int +xmlSecSymbianCryptoX509SubjectNameNodeWrite(X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) { + xmlChar* buf = NULL; + xmlNodePtr cur = NULL; + + xmlSecAssert2(cert, -1); + xmlSecAssert2(node, -1); + + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameWrite(X509_get_subject_name)", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(node, xmlSecNodeX509SubjectName, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SubjectName)); + xmlFree(buf); + return(-1); + } + xmlNodeSetContent(cur, buf); + xmlFree(buf); + return(0); +} + +static int +xmlSecSymbianCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataStorePtr x509Store; + xmlNodePtr cur; + xmlChar *issuerName; + xmlChar *issuerSerial; + X509* cert; + X509* cert2 = NULL; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + xmlSecAssert2(keyInfoCtx->keysMngr, -1); + + x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeysMngrGetDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecGetNextElementNode(node->children); + if(!cur) { + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeX509IssuerName), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + return(0); + } + + /* the first is required node X509IssuerName */ + if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeX509IssuerName), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + return(-1); + } + issuerName = xmlNodeGetContent(cur); + if(!issuerName) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509IssuerName)); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + /* next is required node X509SerialNumber */ + if((!cur) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_NODE_NOT_FOUND, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber)); + xmlFree(issuerName); + return(-1); + } + issuerSerial = xmlNodeGetContent(cur); + if(!issuerSerial) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeGetName(cur))); + xmlFree(issuerName); + return(-1); + } + cur = xmlSecGetNextElementNode(cur->next); + + if(cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(cur)), + XMLSEC_ERRORS_R_UNEXPECTED_NODE, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(issuerSerial); + xmlFree(issuerName); + return(-1); + } + + cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, + NULL, + issuerName, + issuerSerial, + NULL, + keyInfoCtx); + if(!cert){ + xmlFree(issuerSerial); + xmlFree(issuerName); + + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_FOUND, + "issuerName=%s;issuerSerial=%s", + xmlSecErrorsSafeString(issuerName), + xmlSecErrorsSafeString(issuerSerial)); + return(-1); + } + return(0); + } + + if(!cert2) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(issuerSerial); + xmlFree(issuerName); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert2); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(issuerSerial); + xmlFree(issuerName); + return(-1); + } + + xmlFree(issuerSerial); + xmlFree(issuerName); + return(0); +} + +static int +xmlSecSymbianCryptoX509IssuerSerialNodeWrite(X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) { + xmlNodePtr cur; + xmlNodePtr issuerNameNode; + xmlNodePtr issuerNumberNode; + xmlChar* buf = NULL; + + xmlSecAssert2(cert, -1); + xmlSecAssert2(node, -1); + + /* create xml nodes */ + cur = xmlSecAddChild(node, xmlSecNodeX509IssuerSerial, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial)); + return(-1); + } + + issuerNameNode = xmlSecAddChild(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs); + if(!issuerNameNode) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509IssuerName)); + return(-1); + } + + issuerNumberNode = xmlSecAddChild(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs); + if(!issuerNumberNode) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber)); + return(-1); + } + + /* write data */ + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameWrite(X509_get_issuer_name)", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlNodeSetContent(issuerNameNode, buf); + xmlFree(buf); + + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoASN1IntegerWrite(X509_get_serialNumber)", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + xmlNodeSetContent(issuerNumberNode, buf); + xmlFree(buf); + + return(0); +} + + +static int +xmlSecSymbianCryptoX509SKINodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataStorePtr x509Store; + xmlChar* ski; + X509* cert; + X509* cert2 = NULL; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + xmlSecAssert2(keyInfoCtx->keysMngr, -1); + + x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeysMngrGetDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ski = xmlNodeGetContent(node); + if((!ski) || (xmlSecIsEmptyString(ski) == 1)) { + if(ski) { + xmlFree(ski); + } + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + "node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SKI)); + return(-1); + } + return(0); + } + + cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx); + if(!cert){ + xmlFree(ski); + + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_FOUND, + "ski=%s", + xmlSecErrorsSafeString(ski)); + return(-1); + } + return(0); + } + + if(!cert2) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(ski); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert2); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(ski); + return(-1); + } + + xmlFree(ski); + return(0); +} + +static int +xmlSecSymbianCryptoX509SKINodeWrite(X509* cert, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) { + xmlChar *buf = NULL; + xmlNodePtr cur = NULL; + + xmlSecAssert2(cert, -1); + xmlSecAssert2(node, -1); + + buf = xmlSecSymbianCryptoX509SKIWrite(cert); + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509SKIWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(node, xmlSecNodeX509SKI, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "new_node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509SKI)); + xmlFree(buf); + return(-1); + } + xmlNodeSetContent(cur, buf); + xmlFree(buf); + + return(0); +} + +static int +xmlSecSymbianCryptoX509CRLNodeRead(xmlSecKeyDataPtr data, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlChar *content; + X509_CRL* crl; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + content = xmlNodeGetContent(node); + if((!content) || (xmlSecIsEmptyString(content) == 1)) { + if(content) { + xmlFree(content); + } + if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + xmlSecErrorsSafeString(xmlSecNodeGetName(node)), + XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); + } + + crl = xmlSecSymbianCryptoX509CrlBase64DerRead(content); + if(!crl) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CrlBase64DerRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlFree(content); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCrl(data, crl); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoKeyDataX509AdoptCrl", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_crl_free(crl); + xmlFree(content); + return(-1); + } + + xmlFree(content); + return(0); +} + +static int +xmlSecSymbianCryptoX509CRLNodeWrite(X509_CRL* crl, + xmlNodePtr node, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlChar* buf = NULL; + xmlNodePtr cur = NULL; + + xmlSecAssert2(crl, -1); + xmlSecAssert2(node, -1); + xmlSecAssert2(keyInfoCtx, -1); + + /* set base64 lines size from context */ + buf = xmlSecSymbianCryptoX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize); + if(!buf) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509CrlBase64DerWrite", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + cur = xmlSecAddChild(node, xmlSecNodeX509CRL, xmlSecDSigNs); + if(!cur) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecAddChild", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "new_node=%s", + xmlSecErrorsSafeString(xmlSecNodeX509CRL)); + xmlFree(buf); + return(-1); + } + xmlNodeSetContent(cur, xmlSecStringCR); + xmlNodeSetContent(cur, buf); + xmlFree(buf); + + return(0); +} + +static int +xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecSymbianCryptoX509DataCtxPtr ctx; + xmlSecKeyDataStorePtr x509Store; + int ret; + + xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(keyInfoCtx, -1); + xmlSecAssert2(keyInfoCtx->keysMngr, -1); + + ctx = xmlSecSymbianCryptoX509DataGetCtx(data); + xmlSecAssert2(ctx, -1); + + x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecSymbianCryptoX509StoreId); + if(!x509Store) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeysMngrGetDataStore", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + // do not use list first + //if((ctx->keyCert == NULL) && (ctx->certsList != NULL) && (xmlSecKeyGetValue(key) == NULL)) { + if((ctx->keyCert) && (!xmlSecKeyGetValue(key)) ) { + X509* cert; + + ret = xmlSecSymbianCryptoX509StoreKeyCertVerify(x509Store, ctx->keyCert); + if(ret == 0) { + xmlSecKeyDataPtr keyValue; + /* + ctx->keyCert = X509_dup(cert); + if(ctx->keyCert == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + */ + keyValue = xmlSecSymbianCryptoX509CertGetKey(ctx->keyCert); + if(!keyValue) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CertGetKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + /* verify that the key matches our expectations */ + if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeyReqMatchKeyValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(keyValue); + return(-1); + } + + ret = xmlSecKeySetValue(key, keyValue); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecKeySetValue", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecKeyDataDestroy(keyValue); + return(-1); + } + /* + if((X509_get_notBefore(ctx->keyCert) != NULL) && (X509_get_notAfter(ctx->keyCert) != NULL)) { + ret = xmlSecSymbianCryptoX509CertGetTime(X509_get_notBefore(ctx->keyCert), &(key->notValidBefore)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CertGetTime", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "notValidBefore"); + return(-1); + } + + ret = xmlSecSymbianCryptoX509CertGetTime(X509_get_notAfter(ctx->keyCert), &(key->notValidAfter)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CertGetTime", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "notValidAfter"); + return(-1); + } + } else { + key->notValidBefore = key->notValidAfter = 0; + } + */ + ret = X509_test_validityPeriod(ctx->keyCert); + if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + "xmlSecSymbianCryptoX509CertGetTime", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "x509_test_validityPeriod"); + return(-1); + } + else + { + key->notValidBefore = key->notValidAfter = 0; + } + + + } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + else if (ret != 0) + { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_FOUND, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +#ifdef HAVE_TIMEGM +extern time_t timegm (struct tm *tm); +#else /* HAVE_TIMEGM */ +#ifdef WIN32 +#define timegm(tm) (mktime(tm) - _timezone) +#else /* WIN32 */ +/* Absolutely not the best way but it's the only ANSI compatible way I know. + * If you system has a native struct tm --> GMT time_t conversion function + * (like timegm) use it instead. + */ +static time_t +my_timegm(struct tm *t) { + time_t tl, tb; + struct tm *tg; + + tl = mktime (t); + if(tl == -1) { + t->tm_hour--; + tl = mktime (t); + if (tl == -1) { + return -1; + } + tl += 3600; + } + tg = gmtime (&tl); + tg->tm_isdst = 0; + tb = mktime (tg); + if (tb == -1) { + tg->tm_hour--; + tb = mktime (tg); + if (tb == -1) { + return -1; + } + tb += 3600; + } + return (tl - (tb - tl)); +} + +#define timegm(tm) my_timegm(tm) +#endif /* WIN32 */ +#endif /* HAVE_TIMEGM */ + +#ifdef XMLSEC_FUTURE_SUPPORT +static int +xmlSecSymbianCryptoX509CertGetTime(ASN1_TIME* t, time_t* res) { + struct tm tm; + int offset; + + xmlSecAssert2(t, -1); + xmlSecAssert2(res, -1); + + (*res) = 0; +#ifndef XMLSEC_OPENSSL_096 + if(!ASN1_TIME_check(t)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "ASN1_TIME_check", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } +#endif /* XMLSEC_OPENSSL_096 */ + + memset(&tm, 0, sizeof(tm)); + +#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') + if(t->type == V_ASN1_UTCTIME) { + xmlSecAssert2(t->length > 12, -1); + + + /* this code is copied from OpenSSL asn1/a_utctm.c file */ + tm.tm_year = g2(t->data); + if(tm.tm_year < 50) { + tm.tm_year += 100; + } + tm.tm_mon = g2(t->data + 2) - 1; + tm.tm_mday = g2(t->data + 4); + tm.tm_hour = g2(t->data + 6); + tm.tm_min = g2(t->data + 8); + tm.tm_sec = g2(t->data + 10); + if(t->data[12] == 'Z') { + offset = 0; + } else { + xmlSecAssert2(t->length > 16, -1); + + offset = g2(t->data + 13) * 60 + g2(t->data + 15); + if(t->data[12] == '-') { + offset = -offset; + } + } + tm.tm_isdst = -1; + } else { + xmlSecAssert2(t->length > 14, -1); + + tm.tm_year = g2(t->data) * 100 + g2(t->data + 2); + tm.tm_mon = g2(t->data + 4) - 1; + tm.tm_mday = g2(t->data + 6); + tm.tm_hour = g2(t->data + 8); + tm.tm_min = g2(t->data + 10); + tm.tm_sec = g2(t->data + 12); + if(t->data[14] == 'Z') { + offset = 0; + } else { + xmlSecAssert2(t->length > 18, -1); + + offset = g2(t->data + 15) * 60 + g2(t->data + 17); + if(t->data[14] == '-') { + offset = -offset; + } + } + tm.tm_isdst = -1; + } +#undef g2 + (*res) = timegm(&tm) - offset * 60; + return(0); +} + +#endif //XMLSEC_FUTURE_SUPPORT +/** + * xmlSecSymbianCryptoX509CertGetKey: + * @cert: the certificate. + * + * Extracts public key from the @cert. + * + * Returns public key value or NULL if an error occurs. + */ +EXPORT_C +xmlSecKeyDataPtr +xmlSecSymbianCryptoX509CertGetKey(X509* cert) { + xmlSecKeyDataPtr data; + EVP_PKEY *pKey = NULL; + + xmlSecAssert2(cert, NULL); + + pKey = X509_get_pubkey(cert); + if(!pKey) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_get_pubkey", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + data = xmlSecSymbianCryptoEvpKeyAdopt(pKey); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoEvpKeyAdopt", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + sc_pkey_free(pKey); + return(NULL); + } + + return(data); +} + +static X509* +xmlSecSymbianCryptoX509CertBase64DerRead(xmlChar* buf) { + int ret; + + xmlSecAssert2(buf, NULL); + + /* usual trick with base64 decoding "in-place" */ + ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Decode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecSymbianCryptoX509CertDerRead((xmlSecByte*)buf, ret)); +} + +static X509* +xmlSecSymbianCryptoX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) { + X509 *cert = NULL; + BIO *mem = NULL; + int ret; + + xmlSecAssert2(buf, NULL); + xmlSecAssert2(size > 0, NULL); + + mem = BIO_new(); + if(!mem) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "BIO_s_mem"); + return(NULL); + } + + ret = BIO_write(mem, buf, size); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_write", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "size=%d", size); + BIO_free(mem); + return(NULL); + } + + cert = d2i_X509_bio(mem); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "d2i_X509_bio", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BIO_free(mem); + return(NULL); + } + + BIO_free(mem); + + return(cert); +} + +static xmlChar* +xmlSecSymbianCryptoX509CertBase64DerWrite(X509* cert, int base64LineWrap) { + xmlChar *res = NULL; + xmlSecByte *p = NULL; + long size; + + xmlSecAssert2(cert, NULL); + + res = xmlSecBase64Encode((const xmlSecByte*)cert->der, cert->derlen, base64LineWrap); + if(!res) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(res); +} + +static X509_CRL* +xmlSecSymbianCryptoX509CrlBase64DerRead(xmlChar* buf) { + int ret; + + xmlSecAssert2(buf, NULL); + + /* usual trick with base64 decoding "in-place" */ + ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Decode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + return(xmlSecSymbianCryptoX509CrlDerRead((xmlSecByte*)buf, ret)); +} + +static X509_CRL* +xmlSecSymbianCryptoX509CrlDerRead(xmlSecByte* buf, xmlSecSize size) { + X509_CRL *crl = NULL; + + xmlSecAssert2(buf, NULL); + xmlSecAssert2(size > 0, NULL); + + return(crl); +} + +static xmlChar* +xmlSecSymbianCryptoX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) { + xmlChar *res = NULL; + xmlSecByte *p = NULL; + long size; + + xmlSecAssert2(crl, NULL); +#ifdef XMLSEC_FUTURE_SUPPORT + mem = BIO_new(BIO_s_mem()); + if(!mem) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "BIO_s_mem"); + return(NULL); + } + + i2d_X509_CRL_bio(mem, crl); + BIO_flush(mem); + + size = BIO_get_mem_data(mem, &p); + if((size <= 0) || (!p)){ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_get_mem_data", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BIO_free_all(mem); + return(NULL); + } + + res = xmlSecBase64Encode(p, size, base64LineWrap); + if(!res) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BIO_free_all(mem); + return(NULL); + } + + BIO_free_all(mem); + +#endif + return(res); +} + +static xmlChar* +xmlSecSymbianCryptoX509NameWrite(X509_NAME* nm) { + xmlChar *res = NULL; + long size; + + xmlSecAssert2(nm, NULL); +#ifdef XMLSEC_FUTURE_SUPPORT + mem = BIO_new(BIO_s_mem()); + if(!mem) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BIO_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "BIO_s_mem"); + return(NULL); + } + + if (X509_NAME_print_ex(mem, nm, 0, XN_FLAG_RFC2253) <=0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_NAME_print_ex", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BIO_free_all(mem); + return(NULL); + } + + BIO_flush(mem); + + size = BIO_pending(mem); + res = xmlMalloc(size + 1); + if(!res) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlMalloc", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BIO_free_all(mem); + return(NULL); + } + + size = BIO_read(mem, res, size); + res[size] = '\0'; + + BIO_free_all(mem); +#endif + return(res); +} + +#ifdef XMLSEC_FUTURE_SUPPORT +static xmlChar* +xmlSecSymbianCryptoASN1IntegerWrite(ASN1_INTEGER *asni) { + xmlChar *res = NULL; + BIGNUM *bn; + char *p; + + xmlSecAssert2(asni, NULL); + bn = ASN1_INTEGER_to_BN(asni, NULL); + if(!bn) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "ASN1_INTEGER_to_BN", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + p = BN_bn2dec(bn); + if (!p) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BN_bn2dec", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BN_free(bn); + return(NULL); + } + BN_free(bn); + bn = NULL; + + /* SymbianCrypto and LibXML2 can have different memory callbacks, i.e. + when data is allocated in SymbianCrypto should be freed with SymbianCrypto + method, not with LibXML2 method. + */ + res = xmlCharStrdup(p); + if(!res) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlCharStrdup", + XMLSEC_ERRORS_R_MALLOC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + OPENSSL_free(p); + return(NULL); + } + OPENSSL_free(p); + p = NULL; + return(res); +} +#endif //XMLSEC_FUTURE_SUPPORT + +static xmlChar* +xmlSecSymbianCryptoX509SKIWrite(X509* cert) { + xmlChar *res = NULL; + int index; +#ifdef XMLSEC_FUTURE_SUPPORT + X509_EXTENSION *ext; + ASN1_OCTET_STRING *keyId; + + xmlSecAssert2(cert, NULL); + + index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1); + if (index < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "Certificate without SubjectKeyIdentifier extension", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + ext = X509_get_ext(cert, index); + if (!ext) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_get_ext", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + keyId = X509V3_EXT_d2i(ext); + if (!keyId) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509V3_EXT_d2i", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + M_ASN1_OCTET_STRING_free(keyId); + return(NULL); + } + + res = xmlSecBase64Encode(M_ASN1_STRING_data(keyId), M_ASN1_STRING_length(keyId), 0); + if(!res) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Encode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + M_ASN1_OCTET_STRING_free(keyId); + return(NULL); + } + M_ASN1_OCTET_STRING_free(keyId); +#endif //XMLSEC_FUTURE_SUPPORT + return(res); +} + +static void +xmlSecSymbianCryptoX509CertDebugDump(X509* cert, FILE* output) { + char buf[1024]; +#ifdef XMLSEC_FUTURE_SUPPORT + BIGNUM *bn = NULL; + + xmlSecAssert(cert); + xmlSecAssert(output); + + fprintf(output, "==== Subject Name: %s\n", + X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))); + fprintf(output, "==== Issuer Name: %s\n", + X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf))); + fprintf(output, "==== Issuer Serial: "); + bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert),NULL); + if(bn) { + BN_print_fp(output, bn); + BN_free(bn); + fprintf(output, "\n"); + } else { + fprintf(output, "unknown\n"); + } +#endif //XMLSEC_FUTURE_SUPPORT +} + + +static void +xmlSecSymbianCryptoX509CertDebugXmlDump(X509* cert, FILE* output) { + char buf[1024]; +#ifdef XMLSEC_FUTURE_SUPPORT + BIGNUM *bn = NULL; + + xmlSecAssert(cert); + xmlSecAssert(output); + + fprintf(output, "=== X509 Certificate\n"); + fprintf(output, "==== Subject Name: %s\n", + X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))); + fprintf(output, "==== Issuer Name: %s\n", + X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf))); + fprintf(output, "==== Issuer Serial: "); + bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert),NULL); + if(bn) { + BN_print_fp(output, bn); + BN_free(bn); + fprintf(output, "\n"); + } else { + fprintf(output, "unknown\n"); + } +#endif //XMLSEC_FUTURE_SUPPORT +} + + +/************************************************************************** + * + * Raw X509 Certificate processing + * + * + *************************************************************************/ +static int xmlSecSymbianCryptoKeyDataRawX509CertBinRead (xmlSecKeyDataId id, + xmlSecKeyPtr key, + const xmlSecByte* buf, + xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx); + +static xmlSecKeyDataKlass xmlSecSymbianCryptoKeyDataRawX509CertKlass = { + sizeof(xmlSecKeyDataKlass), + sizeof(xmlSecKeyData), + + /* data */ + xmlSecNameRawX509Cert, + xmlSecKeyDataUsageRetrievalMethodNodeBin, + /* xmlSecKeyDataUsage usage; */ + xmlSecHrefRawX509Cert, /* const xmlChar* href; */ + NULL, /* const xmlChar* dataNodeName; */ + xmlSecDSigNs, /* const xmlChar* dataNodeNs; */ + + /* constructors/destructor */ + NULL, /* xmlSecKeyDataInitializeMethod initialize; */ + NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */ + NULL, /* xmlSecKeyDataFinalizeMethod finalize; */ + NULL, /* xmlSecKeyDataGenerateMethod generate; */ + + /* get info */ + NULL, /* xmlSecKeyDataGetTypeMethod getType; */ + NULL, /* xmlSecKeyDataGetSizeMethod getSize; */ + NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */ + + /* read/write */ + NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */ + NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */ + xmlSecSymbianCryptoKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */ + NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */ + + /* debug */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */ + NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +/** + * xmlSecSymbianCryptoKeyDataRawX509CertGetKlass: + * + * The raw X509 certificates key data klass. + * + * Returns raw X509 certificates key data klass. + */ +EXPORT_C +xmlSecKeyDataId +xmlSecSymbianCryptoKeyDataRawX509CertGetKlass(void) { + return(&xmlSecSymbianCryptoKeyDataRawX509CertKlass); +} + +static int +xmlSecSymbianCryptoKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, + const xmlSecByte* buf, xmlSecSize bufSize, + xmlSecKeyInfoCtxPtr keyInfoCtx) { + xmlSecKeyDataPtr data; + X509* cert; + int ret; + + xmlSecAssert2(id == xmlSecSymbianCryptoKeyDataRawX509CertId, -1); + xmlSecAssert2(key, -1); + xmlSecAssert2(buf, -1); + xmlSecAssert2(bufSize > 0, -1); + xmlSecAssert2(keyInfoCtx, -1); + + cert = xmlSecSymbianCryptoX509CertDerRead(buf, bufSize); + if(!cert) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509CertDerRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + data = xmlSecKeyEnsureData(key, xmlSecSymbianCryptoKeyDataX509Id); + if(!data) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecKeyEnsureData", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_free(cert); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataX509AdoptCert", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_free(cert); + return(-1); + } + + ret = xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx); + if(ret < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), + "xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + return(0); +} + + +#endif /* XMLSEC_NO_X509 */ + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509vfy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509vfy.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1326 @@ +/** + * XMLSec library + * + * X509 support + * + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2002-2003 Aleksey Sanin + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + */ +#include "xmlsecc_config.h" +#ifndef XMLSEC_NO_X509 +#include "xmlsecc_globals.h" + +#include +#include +#include +#include +#include + +#include + +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_keys.h" +#include "xmlsec_keyinfo.h" +#include "xmlsec_keysmngr.h" +#include "xmlsec_base64.h" +#include "xmlsec_errors.h" + +#include "xmlsecc_crypto.h" +#include "xmlsecc_x509wrapper.h" +#include "xmlsecc_x509.h" +#include "xmlsec_error_flag.h" + +#define XMLSEC_OPENSSL_097 + +/************************************************************************** + * + * Internal SymbianCrypto X509 store CTX + * + *************************************************************************/ +typedef struct _xmlSecSymbianCryptoX509StoreCtx xmlSecSymbianCryptoX509StoreCtx, + *xmlSecSymbianCryptoX509StoreCtxPtr; +struct _xmlSecSymbianCryptoX509StoreCtx { + X509_STORE* xst; + STACK_OF(X509)* untrusted; + STACK_OF(X509_CRL)* crls; + +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + X509_VERIFY_PARAM * vpm; +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ +}; + +/**************************************************************************** + * + * xmlSecSymbianCryptoKeyDataStoreX509Id: + * + * xmlSecSymbianCryptoX509StoreCtx is located after xmlSecTransform + * + ***************************************************************************/ +#define xmlSecSymbianCryptoX509StoreGetCtx(store) \ + ((xmlSecSymbianCryptoX509StoreCtxPtr)(((xmlSecByte*)(store)) + \ + sizeof(xmlSecKeyDataStoreKlass))) +#define xmlSecSymbianCryptoX509StoreSize \ + (sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecSymbianCryptoX509StoreCtx)) + +static int xmlSecSymbianCryptoX509StoreInitialize (xmlSecKeyDataStorePtr store); +static void xmlSecSymbianCryptoX509StoreFinalize (xmlSecKeyDataStorePtr store); + +static xmlSecKeyDataStoreKlass xmlSecSymbianCryptoX509StoreKlass = { + sizeof(xmlSecKeyDataStoreKlass), + xmlSecSymbianCryptoX509StoreSize, + + /* data */ + xmlSecNameX509Store, /* const xmlChar* name; */ + + /* constructors/destructor */ + xmlSecSymbianCryptoX509StoreInitialize, /* xmlSecKeyDataStoreInitializeMethod initialize; */ + xmlSecSymbianCryptoX509StoreFinalize, /* xmlSecKeyDataStoreFinalizeMethod finalize; */ + + /* reserved for the future */ + NULL, /* void* reserved0; */ + NULL, /* void* reserved1; */ +}; + +static int xmlSecSymbianCryptoX509VerifyCrl (X509_STORE* xst, + X509_CRL *crl ); +static X509* xmlSecSymbianCryptoX509FindCert (STACK_OF(X509) *certs, + xmlChar *subjectName, + xmlChar *issuerName, + xmlChar *issuerSerial, + xmlChar *ski); +static X509* xmlSecSymbianCryptoX509FindNextChainCert (STACK_OF(X509) *chain, + X509 *cert); +static int xmlSecSymbianCryptoX509VerifyCertAgainstCrls (STACK_OF(X509_CRL) *crls, + X509* cert); +static X509_NAME* xmlSecSymbianCryptoX509NameRead (xmlSecByte *str, + int len); +static int xmlSecSymbianCryptoX509NameStringRead (xmlSecByte **str, + int *strLen, + xmlSecByte *res, + int resLen, + xmlSecByte delim, + int ingoreTrailingSpaces); +static int xmlSecSymbianCryptoX509NamesCompare (X509_NAME *a, + X509_NAME *b); +static int xmlSecSymbianCryptoX509_NAME_cmp (const X509_NAME *a, + const X509_NAME *b); +/* +static int xmlSecSymbianCryptoX509_NAME_ENTRY_cmp (const X509_NAME_ENTRY **a, + const X509_NAME_ENTRY **b); +*/ +/** + * xmlSecSymbianCryptoX509StoreGetKlass: + * + * The SymbianCrypto X509 certificates key data store klass. + * + * Returns pointer to SymbianCrypto X509 certificates key data store klass. + */ +EXPORT_C +xmlSecKeyDataStoreId +xmlSecSymbianCryptoX509StoreGetKlass(void) { + return(&xmlSecSymbianCryptoX509StoreKlass); +} + +/** + * xmlSecSymbianCryptoX509StoreFindCert: + * @store: the pointer to X509 key data store klass. + * @subjectName: the desired certificate name. + * @issuerName: the desired certificate issuer name. + * @issuerSerial: the desired certificate issuer serial number. + * @ski: the desired certificate SKI. + * @keyInfoCtx: the pointer to element processing context. + * + * Searches @store for a certificate that matches given criteria. + * + * Returns pointer to found certificate or NULL if certificate is not found + * or an error occurs. + */ +EXPORT_C +X509* +xmlSecSymbianCryptoX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName, + xmlChar *issuerName, xmlChar *issuerSerial, + xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + X509* res = NULL; + + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), NULL); + xmlSecAssert2(keyInfoCtx, NULL); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, NULL); + + if((!res) && (ctx->untrusted)) { + res = xmlSecSymbianCryptoX509FindCert(ctx->untrusted, + subjectName, + issuerName, + issuerSerial, + ski); + } + return(res); +} + + +/** + * xmlSecSymbianCryptoX509StoreVerify: + * @store: the pointer to X509 key data store klass. + * @cert: the untrusted key cert. + * + * Verifies @certs list. + * + * Returns Result of the verification + */ +EXPORT_C +int +xmlSecSymbianCryptoX509StoreKeyCertVerify(xmlSecKeyDataStorePtr store, X509* cert) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + X509* res = NULL; + X509 *err_cert = NULL; + char buf[256]; + int err = 0, depth; + int i; + int ret; + + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), NULL); + xmlSecAssert2(cert, NULL); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, NULL); + xmlSecAssert2(ctx->xst, NULL); + + if(!xmlSecCheckCertStoreFlag()) //SymbianCertStore Flag == FALSE + { + err = X509_STORE_certchain_init (ctx->xst, cert); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + //goto done; + return -1; + } + err = X509_STORE_certchain_validate(ctx->xst); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + //goto done; + return -1; + } + + return X509_STORE_certchain_getValidateResult(ctx->xst); + } +else //SymbianCertStore Flag ==TRUE + { + err = X509_STORE_certchain_init_fromCertStore(ctx->xst, cert); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + //goto done; + return -1; + } + err = X509_STORE_certchain_validate(ctx->xst); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + //goto done; + return -1; + } + return X509_STORE_certchain_getValidateResult(ctx->xst); + } //else +} + +/** + * xmlSecSymbianCryptoX509StoreVerify: + * @store: the pointer to X509 key data store klass. + * @certs: the untrusted certificates stack. + * @crls: the crls stack. + * @keyInfoCtx: the pointer to element processing context. + * + * Verifies @certs list. + * + * Returns pointer to the first verified certificate from @certs. + */ +EXPORT_C +X509* +xmlSecSymbianCryptoX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509* certs, + XMLSEC_STACK_OF_X509_CRL* crls, xmlSecKeyInfoCtx* keyInfoCtx) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + STACK_OF(X509)* certs2 = NULL; + X509* res = NULL; + X509* cert = NULL; + X509 *err_cert = NULL; + char buf[256]; + int err = 0, depth; + int i; + int ret; + + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), NULL); + xmlSecAssert2(certs, NULL); + xmlSecAssert2(keyInfoCtx, NULL); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, NULL); + xmlSecAssert2(ctx->xst, NULL); + + err = X509_STORE_certchain_init (ctx->xst, certs); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + } + + + err = X509_STORE_certchain_validate(ctx->xst); + if(err != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_certchain_init", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + } + + ret = X509_STORE_certchain_getValidateResult(ctx->xst); + if(ret == 1) { + res = cert; + } + +#ifdef XMLSEC_FUTURE_SUPPORT + /* dup certs */ + /* + certs2 = sk_X509_dup(certs); + if(certs2 == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + */ + /* add untrusted certs from the store */ +#ifndef XMLSEC_NO_X509_UNTRUST + if(ctx->untrusted) { + for(i = 0; i < sk_X509_num(ctx->untrusted); ++i) { + ret = sk_X509_push(certs2, sk_X509_value(ctx->untrusted, i)); + if(ret < 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_push", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + } +#endif //XMLSEC_NO_X509_UNTRUST + +#ifndef XMLSEC_NO_X509_CRL + /* dup crls but remove all non-verified */ + if(crls) { + crls2 = sk_X509_CRL_dup(crls); + if(!crls2) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_CRL_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + + for(i = 0; i < sk_X509_CRL_num(crls2); ) { + ret = xmlSecSymbianCryptoX509VerifyCrl(ctx->xst, sk_X509_CRL_value(crls2, i)); + if(ret == 1) { + ++i; + } else if(ret == 0) { + sk_X509_CRL_delete(crls2, i); + } else { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "xmlSecSymbianCryptoX509VerifyCrl", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + } + + /* remove all revoked certs */ + for(i = 0; i < sk_X509_num(certs2);) { + cert = sk_X509_value(certs2, i); + + if(crls2) { + ret = xmlSecSymbianCryptoX509VerifyCertAgainstCrls(crls2, cert); + if(ret == 0) { + sk_X509_delete(certs2, i); + continue; + } else if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "xmlSecSymbianCryptoX509VerifyCertAgainstCrls", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + + if(ctx->crls) { + ret = xmlSecSymbianCryptoX509VerifyCertAgainstCrls(ctx->crls, cert); + if(ret == 0) { + sk_X509_delete(certs2, i); + continue; + } else if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "xmlSecSymbianCryptoX509VerifyCertAgainstCrls", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + } + ++i; + } + +#endif //XMLSEC_NO_X509_CRL + + /* get one cert after another and try to verify */ + for(i = 0; i < sk_X509_num(certs2); ++i) { + cert = sk_X509_value(certs2, i); + if(!xmlSecSymbianCryptoX509FindNextChainCert(certs2, cert)) { + X509_STORE_CTX xsc; + +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + X509_VERIFY_PARAM * vpm = NULL; + unsigned long vpm_flags = 0; + + vpm = X509_VERIFY_PARAM_new(); + if(!vpm) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_VERIFY_PARAM_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + goto done; + } + vpm_flags = vpm->flags; +/* + vpm_flags &= (~X509_V_FLAG_X509_STRICT); +*/ + vpm_flags &= (~X509_V_FLAG_CRL_CHECK); + + X509_VERIFY_PARAM_set_depth(vpm, 9); + X509_VERIFY_PARAM_set_flags(vpm, vpm_flags); +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + + + X509_STORE_CTX_init (&xsc, ctx->xst, cert, certs2); + + if(keyInfoCtx->certsVerificationTime > 0) { +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + vpm_flags |= X509_V_FLAG_USE_CHECK_TIME; + X509_VERIFY_PARAM_set_time(vpm, keyInfoCtx->certsVerificationTime); +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + X509_STORE_CTX_set_time(&xsc, 0, keyInfoCtx->certsVerificationTime); + } + +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + X509_STORE_CTX_set0_param(&xsc, vpm); +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + + + ret = X509_verify_cert(&xsc); + err_cert = X509_STORE_CTX_get_current_cert(&xsc); + err = X509_STORE_CTX_get_error(&xsc); + depth = X509_STORE_CTX_get_error_depth(&xsc); + + X509_STORE_CTX_cleanup (&xsc); + + if(ret == 1) { + res = cert; + goto done; + } else if(ret < 0) { + const char* err_msg; + + buf[0] = '\0'; + X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf); + err_msg = X509_verify_cert_error_string(err); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_verify_cert", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "subj=%s;err=%d;msg=%s", + xmlSecErrorsSafeString(buf), + err, + xmlSecErrorsSafeString(err_msg)); + goto done; + } else if(ret == 0) { + const char* err_msg; + + buf[0] = '\0'; + X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf); + err_msg = X509_verify_cert_error_string(err); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_verify_cert", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + "subj=%s;err=%d;msg=%s", + xmlSecErrorsSafeString(buf), + err, + xmlSecErrorsSafeString(err_msg)); + } + } + } + + /* if we came here then we found nothing. do we have any error? */ + if((err != 0) && (err_cert)) { + const char* err_msg; + + err_msg = X509_verify_cert_error_string(err); + switch (err) { + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: + X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, sizeof buf); + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + NULL, + XMLSEC_ERRORS_R_CERT_ISSUER_FAILED, + "err=%d;msg=%s;issuer=%s", + err, + xmlSecErrorsSafeString(err_msg), + xmlSecErrorsSafeString(buf)); + break; + case X509_V_ERR_CERT_NOT_YET_VALID: + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + NULL, + XMLSEC_ERRORS_R_CERT_NOT_YET_VALID, + "err=%d;msg=%s", err, + xmlSecErrorsSafeString(err_msg)); + break; + case X509_V_ERR_CERT_HAS_EXPIRED: + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + NULL, + XMLSEC_ERRORS_R_CERT_HAS_EXPIRED, + "err=%d;msg=%s", err, + xmlSecErrorsSafeString(err_msg)); + break; + default: + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + NULL, + XMLSEC_ERRORS_R_CERT_VERIFY_FAILED, + "err=%d;msg=%s", err, + xmlSecErrorsSafeString(err_msg)); + } + } + +done: + + if(certs2) { + X509_free(certs2); + } + if(crls2) { + sk_X509_CRL_free(crls2); + } + +#endif //XMLSEC_FUTURE_SUPPORT + return(res); +} + +/** + * xmlSecSymbianCryptoX509StoreAdoptCert: + * @store: the pointer to X509 key data store klass. + * @cert: the pointer to SymbianCrypto X509 certificate. + * @type: the certificate type (trusted/untrusted). + * + * Adds trusted (root) or untrusted certificate to the store. + * + * Returns 0 on success or a negative value if an error occurs. + */ +EXPORT_C +int +xmlSecSymbianCryptoX509StoreAdoptCert(xmlSecKeyDataStorePtr store, + X509* cert, + xmlSecKeyDataType type) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + int ret = -1; + + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), -1); + xmlSecAssert2(cert, -1); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, -1); + + if((type & xmlSecKeyDataTypeTrusted) != 0) { + xmlSecAssert2(ctx->xst, -1); + + ret = X509_STORE_add_cert(ctx->xst, cert); + if(ret != 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_add_cert", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + xmlSecSetErrorFlag( ret ); + return(-1); + } + /* add cert increments the reference */ + X509_free(cert); + } else { + xmlSecAssert2(ctx->untrusted, -1); + + if(ret < 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_push", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + } + return(0); +} + +/** + * xmlSecSymbianCryptoX509StoreAddCertsPath: + * @store: the pointer to SymbianCrypto x509 store. + * @path: the path to the certs dir. + * + * Adds all certs in the @path to the list of trusted certs + * in @store. + * + * Returns 0 on success or a negative value otherwise. + */ +EXPORT_C +int +xmlSecSymbianCryptoX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char *path) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), -1); + xmlSecAssert2(path, -1); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, -1); + xmlSecAssert2(ctx->xst, -1); + /* + lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir()); + if(lookup == NULL) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_add_lookup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + X509_LOOKUP_add_dir(lookup, path, X509_FILETYPE_DEFAULT); + */ + return(0); +} + +static int +xmlSecSymbianCryptoX509StoreInitialize(xmlSecKeyDataStorePtr store) { + const xmlChar* path; + + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId), -1); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert2(ctx, -1); + + memset(ctx, 0, sizeof(xmlSecSymbianCryptoX509StoreCtx)); + + ctx->xst = X509_STORE_new(); + if(!ctx->xst) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } +#ifdef XMLSEC_FUTURE_SUPPORT + if(!X509_STORE_set_default_paths(ctx->xst)) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_set_default_paths", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + path = xmlSecSymbianCryptoGetDefaultTrustedCertsFolder(); + if(path) { + X509_LOOKUP *lookup = NULL; + + lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir()); + if(!lookup) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_STORE_add_lookup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + X509_LOOKUP_add_dir(lookup, (char*)path, X509_FILETYPE_DEFAULT); + } + + ctx->untrusted = sk_X509_new_null(); + if(!ctx->untrusted) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_new_null", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + + ctx->crls = sk_X509_CRL_new_null(); + if(!ctx->crls) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "sk_X509_CRL_new_null", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + ctx->vpm = X509_VERIFY_PARAM_new(); + if(!ctx->vpm) { + xmlSecError(XMLSEC_ERRORS_HERE, + xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)), + "X509_VERIFY_PARAM_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + X509_VERIFY_PARAM_set_depth(ctx->vpm, 9); /* the default cert verification path in openssl */ + X509_STORE_set1_param(ctx->xst, ctx->vpm); + +#else /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + ctx->xst->depth = 9; /* the default cert verification path in openssl */ +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + +#endif //XMLSEC_FUTURE_SUPPORT + return(0); +} + +static void +xmlSecSymbianCryptoX509StoreFinalize(xmlSecKeyDataStorePtr store) { + xmlSecSymbianCryptoX509StoreCtxPtr ctx; + xmlSecAssert(xmlSecKeyDataStoreCheckId(store, xmlSecSymbianCryptoX509StoreId)); + + ctx = xmlSecSymbianCryptoX509StoreGetCtx(store); + xmlSecAssert(ctx); + + if(ctx->xst) { + X509_STORE_free(ctx->xst); + } + if(ctx->untrusted) { + } + if(ctx->crls) { + } +#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) + if(ctx->vpm) { + X509_VERIFY_PARAM_free(ctx->vpm); + } +#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */ + memset(ctx, 0, sizeof(xmlSecSymbianCryptoX509StoreCtx)); +} + + +/***************************************************************************** + * + * Low-level x509 functions + * + *****************************************************************************/ +static int +xmlSecSymbianCryptoX509VerifyCrl(X509_STORE* xst, X509_CRL *crl ) { + + EVP_PKEY *pkey; + int ret = 0; +#ifdef XMLSEC_FUTURE_SUPPORT + xmlSecAssert2(xst, -1); + xmlSecAssert2(crl, -1); + + X509_STORE_CTX_init(&xsc, xst, NULL, NULL); + ret = X509_STORE_get_by_subject(&xsc, X509_LU_X509, + X509_CRL_get_issuer(crl), &xobj); + if(ret <= 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_STORE_get_by_subject", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + pkey = X509_get_pubkey(xobj.data.x509); + X509_OBJECT_free_contents(&xobj); + if(!pkey) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_get_pubkey", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + ret = X509_CRL_verify(crl, pkey); + EVP_PKEY_free(pkey); + if(ret != 1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_CRL_verify", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + } + X509_STORE_CTX_cleanup (&xsc); +#endif //XMLSEC_FUTURE_SUPPORT + return((ret == 1) ? 1 : 0); +} + +/** + * xmlSecSymbianCryptoX509FindCert: + */ +static X509* +xmlSecSymbianCryptoX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName, + xmlChar *issuerName, xmlChar *issuerSerial, + xmlChar *ski) { + X509 *cert = NULL; + int i; + + xmlSecAssert2(certs, NULL); +#ifdef XMLSEC_FUTURE_SUPPORT + /* may be this is not the fastest way to search certs */ + if(subjectName) { + X509_NAME *nm; + X509_NAME *subj; + + nm = xmlSecSymbianCryptoX509NameRead(subjectName, xmlStrlen(subjectName)); + if(!nm) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "subject=%s", + xmlSecErrorsSafeString(subjectName)); + return(NULL); + } + + for(i = 0; i < certs->num; ++i) { + cert = ((X509**)(certs->data))[i]; + subj = X509_get_subject_name(cert); + if(xmlSecSymbianCryptoX509NamesCompare(nm, subj) == 0) { + X509_NAME_free(nm); + return(cert); + } + } + X509_NAME_free(nm); + } else if((issuerName) && (issuerSerial)) { + X509_NAME *nm; + X509_NAME *issuer; + BIGNUM *bn; + ASN1_INTEGER *serial; + + nm = xmlSecSymbianCryptoX509NameRead(issuerName, xmlStrlen(issuerName)); + if(!nm) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "issuer=%s", + xmlSecErrorsSafeString(issuerName)); + return(NULL); + } + + bn = BN_new(); + if(!bn) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BN_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_NAME_free(nm); + return(NULL); + } + if(BN_dec2bn(&bn, (char*)issuerSerial) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BN_dec2bn", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BN_free(bn); + X509_NAME_free(nm); + return(NULL); + } + + serial = BN_to_ASN1_INTEGER(bn, NULL); + if(!serial) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "BN_to_ASN1_INTEGER", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + BN_free(bn); + X509_NAME_free(nm); + return(NULL); + } + BN_free(bn); + + + for(i = 0; i < certs->num; ++i) { + cert = ((X509**)(certs->data))[i]; + if(ASN1_INTEGER_cmp(X509_get_serialNumber(cert), serial) != 0) { + continue; + } + issuer = X509_get_issuer_name(cert); + if(xmlSecSymbianCryptoX509NamesCompare(nm, issuer) == 0) { + ASN1_INTEGER_free(serial); + X509_NAME_free(nm); + return(cert); + } + } + + X509_NAME_free(nm); + ASN1_INTEGER_free(serial); + } else if(ski) { + int len; + int index; + X509_EXTENSION *ext; + ASN1_OCTET_STRING *keyId; + + /* our usual trick with base64 decode */ + len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski)); + if(len < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecBase64Decode", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + "ski=%s", + xmlSecErrorsSafeString(ski)); + return(NULL); + } + for(i = 0; i < certs->num; ++i) { + cert = ((X509**)(certs->data))[i]; + index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1); + if(index >= 0) { + ext = X509_get_ext(cert, index); + if(ext){ + keyId = X509V3_EXT_d2i(ext); + if((keyId) && (keyId->length == len) && + (memcmp(keyId->data, ski, len) == 0)) { + M_ASN1_OCTET_STRING_free(keyId); + return(cert); + } + M_ASN1_OCTET_STRING_free(keyId); + } + } + } + } +#endif //XMLSEC_FUTURE_SUPPORT + return(NULL); +} + +/** + * xmlSecSymbianCryptoX509FindNextChainCert: + */ +static X509* +xmlSecSymbianCryptoX509FindNextChainCert(STACK_OF(X509) *chain, X509 *cert) { + unsigned long certSubjHash; + int i; + + xmlSecAssert2(chain, NULL); + xmlSecAssert2(cert, NULL); +/* + certSubjHash = X509_subject_name_hash(cert); + for(i = 0; i < sk_X509_num(chain); ++i) { + if((sk_X509_value(chain, i) != cert) && + (X509_issuer_name_hash(sk_X509_value(chain, i)) == certSubjHash)) { + + return(sk_X509_value(chain, i)); + } + } +*/ + return(NULL); +} + +/** + * xmlSecSymbianCryptoX509VerifyCertAgainstCrls: + */ +static int +xmlSecSymbianCryptoX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) { + X509_NAME *issuer; + X509_CRL *crl = NULL; +#ifdef XMLSEC_FUTURE_SUPPORT + X509_REVOKED *revoked; + int i, n; + int ret; + + xmlSecAssert2(crls, -1); + xmlSecAssert2(cert, -1); + + /* + * Try to retrieve a CRL corresponding to the issuer of + * the current certificate + */ + n = sk_X509_CRL_num(crls); + for(i = 0; i < n; i++) { + crl = sk_X509_CRL_value(crls, i); + issuer = X509_CRL_get_issuer(crl); + if(xmlSecSymbianCryptoX509NamesCompare(X509_CRL_get_issuer(crl), issuer) == 0) { + break; + } + } + if((i >= n) || (!crl)){ + /* no crls for this issuer */ + return(1); + } + + /* + * Check date of CRL to make sure it's not expired + */ + ret = X509_cmp_current_time(X509_CRL_get_nextUpdate(crl)); + if (ret == 0) { + /* crl expired */ + return(1); + } + + /* + * Check if the current certificate is revoked by this CRL + */ + n = sk_num(X509_CRL_get_REVOKED(crl)); + for (i = 0; i < n; i++) { + revoked = (X509_REVOKED *)sk_value(X509_CRL_get_REVOKED(crl), i); + if (ASN1_INTEGER_cmp(revoked->serialNumber, X509_get_serialNumber(cert)) == 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_CERT_REVOKED, + XMLSEC_ERRORS_NO_MESSAGE); + return(0); + } + } +#endif //XMLSEC_FUTURE_SUPPORT + return(1); +} + + +/** + * xmlSecSymbianCryptoX509NameRead: + */ +static X509_NAME * +xmlSecSymbianCryptoX509NameRead(xmlSecByte *str, int len) { + xmlSecByte name[256]; + xmlSecByte value[256]; + int nameLen, valueLen; + X509_NAME *nm = NULL; + + xmlSecAssert2(str, NULL); + +#ifdef XMLSEC_FUTURE_SUPPORT + nm = X509_NAME_new(); + if(!nm) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_NAME_new", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(NULL); + } + + while(len > 0) { + /* skip spaces after comma or semicolon */ + while((len > 0) && isspace(*str)) { + ++str; --len; + } + + nameLen = xmlSecSymbianCryptoX509NameStringRead(&str, &len, name, sizeof(name), '=', 0); + if(nameLen < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameStringRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_NAME_free(nm); + return(NULL); + } + name[nameLen] = '\0'; + if(len > 0) { + ++str; --len; + if((*str) == '\"') { + ++str; --len; + valueLen = xmlSecSymbianCryptoX509NameStringRead(&str, &len, + value, sizeof(value), '"', 1); + if(valueLen < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameStringRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_NAME_free(nm); + return(NULL); + } + + /* skip quote */ + if((len <= 0) || ((*str) != '\"')) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "quote is expected:%s", + xmlSecErrorsSafeString(str)); + X509_NAME_free(nm); + return(NULL); + } + ++str; --len; + + /* skip spaces before comma or semicolon */ + while((len > 0) && isspace(*str)) { + ++str; --len; + } + if((len > 0) && ((*str) != ',')) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "comma is expected:%s", + xmlSecErrorsSafeString(str)); + X509_NAME_free(nm); + return(NULL); + } + if(len > 0) { + ++str; --len; + } + type = MBSTRING_ASC; + } else if((*str) == '#') { + /* Not implemented currently */ + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "reading octect values is not implemented yet"); + X509_NAME_free(nm); + return(NULL); + } else { + valueLen = xmlSecSymbianCryptoX509NameStringRead(&str, &len, + value, sizeof(value), ',', 1); + if(valueLen < 0) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "xmlSecSymbianCryptoX509NameStringRead", + XMLSEC_ERRORS_R_XMLSEC_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + X509_NAME_free(nm); + return(NULL); + } + type = MBSTRING_ASC; + } + } else { + valueLen = 0; + } + value[valueLen] = '\0'; + if(len > 0) { + ++str; --len; + } + X509_NAME_add_entry_by_txt(nm, (char*)name, type, value, valueLen, -1, 0); + } +#endif //XMLSEC_FUTURE_SUPPORT + return(nm); +} + + + +/** + * xmlSecSymbianCryptoX509NameStringRead: + */ +static int +xmlSecSymbianCryptoX509NameStringRead(xmlSecByte **str, int *strLen, + xmlSecByte *res, int resLen, + xmlSecByte delim, int ingoreTrailingSpaces) { + xmlSecByte *p, *q, *nonSpace; + + xmlSecAssert2(str, -1); + xmlSecAssert2(strLen, -1); + xmlSecAssert2(res, -1); + + p = (*str); + nonSpace = q = res; + while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) { + if((*p) != '\\') { + if(ingoreTrailingSpaces && !isspace(*p)) nonSpace = q; + *(q++) = *(p++); + } else { + ++p; + nonSpace = q; + if(xmlSecIsHex((*p))) { + if((p - (*str) + 1) >= (*strLen)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "two hex digits expected"); + return(-1); + } + *(q++) = xmlSecGetHex(p[0]) * 16 + xmlSecGetHex(p[1]); + p += 2; + } else { + if(((++p) - (*str)) >= (*strLen)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_DATA, + "escaped symbol missed"); + return(-1); + } + *(q++) = *(p++); + } + } + } + if(((p - (*str)) < (*strLen)) && ((*p) != delim)) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + NULL, + XMLSEC_ERRORS_R_INVALID_SIZE, + "buffer is too small"); + return(-1); + } + (*strLen) -= (p - (*str)); + (*str) = p; + return((ingoreTrailingSpaces) ? nonSpace - res + 1 : q - res); +} + +static +int xmlSecSymbianCryptoX509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) { + int i,ret; +/* + const X509_NAME_ENTRY *na,*nb; + + xmlSecAssert2(a != NULL, -1); + xmlSecAssert2(b != NULL, 1); + + if (sk_X509_NAME_ENTRY_num(a->entries) != sk_X509_NAME_ENTRY_num(b->entries)) { + return sk_X509_NAME_ENTRY_num(a->entries) - sk_X509_NAME_ENTRY_num(b->entries); + } + + for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) { + na=sk_X509_NAME_ENTRY_value(a->entries,i); + nb=sk_X509_NAME_ENTRY_value(b->entries,i); + + ret = xmlSecSymbianCryptoX509_NAME_ENTRY_cmp(&na, &nb); + if(ret != 0) { + return(ret); + } + } +*/ + return(0); +} + + +/** + * xmlSecSymbianCryptoX509NamesCompare: + * + * we have to sort X509_NAME entries to get correct results. + * This is ugly but SymbianCrypto does not support it + */ +static int +xmlSecSymbianCryptoX509NamesCompare(X509_NAME *a, X509_NAME *b) { + X509_NAME *a1 = NULL; + X509_NAME *b1 = NULL; + int ret = -1; + + xmlSecAssert2(a, -1); + xmlSecAssert2(b, 1); +#ifdef XMLSEC_FUTURE_SUPPORT + a1 = X509_NAME_dup(a); + if(!a1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_NAME_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(-1); + } + b1 = X509_NAME_dup(b); + if(!b1) { + xmlSecError(XMLSEC_ERRORS_HERE, + NULL, + "X509_NAME_dup", + XMLSEC_ERRORS_R_CRYPTO_FAILED, + XMLSEC_ERRORS_NO_MESSAGE); + return(1); + } + + /* sort both */ + sk_X509_NAME_ENTRY_set_cmp_func(a1->entries, xmlSecSymbianCryptoX509_NAME_ENTRY_cmp); + sk_X509_NAME_ENTRY_sort(a1->entries); + sk_X509_NAME_ENTRY_set_cmp_func(b1->entries, xmlSecSymbianCryptoX509_NAME_ENTRY_cmp); + sk_X509_NAME_ENTRY_sort(b1->entries); + + /* actually compare */ + ret = xmlSecSymbianCryptoX509_NAME_cmp(a1, b1); + + /* cleanup */ + X509_NAME_free(a1); + X509_NAME_free(b1); +#endif //XMLSEC_FUTURE_SUPPORT + return(ret); +} + + +/** + * xmlSecSymbianCryptoX509_NAME_ENTRY_cmp: + */ +#ifdef XMLSEC_FUTURE_SUPPORT +static int +xmlSecSymbianCryptoX509_NAME_ENTRY_cmp(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b) { + int ret; + + xmlSecAssert2(a, -1); + xmlSecAssert2(b, 1); + xmlSecAssert2((*a), -1); + xmlSecAssert2((*b), 1); + + /* first compare values */ + if((!((*a)->value)) && ((*b)->value)) { + return(-1); + } else if(((*a)->value) && (!((*b)->value))) { + return(1); + } else if((!((*a)->value)) && (!((*b)->value))) { + return(0); + } + + ret = (*a)->value->length - (*b)->value->length; + if(ret != 0) { + return(ret); + } + + ret = memcmp((*a)->value->data, (*b)->value->data, (*a)->value->length); + if(ret != 0) { + return(ret); + } + + /* next compare names */ + return(OBJ_cmp((*a)->object, (*b)->object)); +} +#endif //XMLSEC_FUTURE_SUPPORT + + +#endif /* XMLSEC_NO_X509 */ + + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509wrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlseccrypto/src/xmlsecc_x509wrapper.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods that allows to process X509 certificates. +* +*/ + + + +/** A wrapper of OpenSSL x509.c functions to Symbian **/ + +#ifndef XMLSEC_NO_X509 +#include +#include +#include +#include + +#include "xmlsecc_config.h" +#include "xmlsecc_x509wrapper.h" +#include "xmlsecc_evpwrapper.h" + +#include "xmlsecmsymbiancertchain.h" +#include "xmlsecmsymbiancertstore.h" +#include "xmlsec_error_flag.h" + +struct ScX509Store +{ + RPointerArray< CX509Certificate> iRootCerts; + CSymbianCertChain *iCertChain; + CSymbianCertStore *iSymbianCertStore; + RPointerArray< CX509Certificate> iRootCertsSCS; +}; + +void X509_free(X509* aCert) +{ + if (aCert) + { + if (aCert->der) + { + memset(aCert->der, 0, aCert->derlen); + free (aCert->der); + } + + free(aCert); + } +} + +void X509_crl_free(X509_CRL* aCrl) +{ +} + + +X509* X509_dup(X509* aCert) +{ + return aCert; +} + + +/* Get the public key */ +EVP_PKEY* X509_get_pubkey(X509* aCert) +{ + EVP_PKEY *pKey = NULL; + TInt err; + + // Create the pKey structure + pKey = sc_pkey_new(EVP_PKEY_UNKNOWN, NULL); + if (!pKey) + { + return NULL; + } + + //Assign the public key + err = sc_pkey_setPublic(pKey, aCert); + if (err != KErrNone) + { + sc_pkey_free(pKey); + return NULL; + } + + return pKey; +} + +TInt testValidityPeriodL(X509 *aCert) +{ + // convert aCert to TDesC8 + TPtrC8 certPtr((const unsigned char*)aCert->der, aCert->derlen); + + CX509Certificate *cert = CX509Certificate::NewLC(certPtr); + CValidityPeriod validPeriod = cert->ValidityPeriod(); + + TTime currentTime; + currentTime.HomeTime(); + + TBool res = validPeriod.Valid(currentTime); + CleanupStack::PopAndDestroy(cert); + + return (TInt)res; + +} + + +/* Test the validity period from the certificate */ +TInt X509_test_validityPeriod(X509* aCert) +{ + TInt err; + TBool res=FALSE; + + TRAP(err, res = testValidityPeriodL(aCert)); + + if (err) + { + xmlSecSetErrorFlag( err ); + return err; + } + else + return res; +} + +/* Read the certificate from DER format */ +X509* d2i_X509_bio(BIO *aBio) +{ + X509 *cert = (X509 *)malloc(sizeof(X509)); + if (!cert) + { + xmlSecSetErrorFlag( KErrNoMemory ); + return NULL; + } + + // Duplicate the certificate + cert->der = (char *)malloc(aBio->len * sizeof(char)); + if (!cert->der) + { + free( cert ); + xmlSecSetErrorFlag( KErrNoMemory ); + return NULL; + } + memcpy(cert->der, aBio->mem, aBio->len); + + // Set length + cert->derlen = aBio->len; + + return cert; + +} + + +X509_STORE *X509_STORE_new( void ) +{ + X509_STORE *certStore = (X509_STORE *)malloc(sizeof(X509_STORE)); + + if (certStore) + { + certStore->iRootCerts = RPointerArray (2); + certStore->iRootCertsSCS = RPointerArray (2); + certStore->iCertChain = NULL; + certStore->iSymbianCertStore = NULL; + } + else + { + xmlSecSetErrorFlag( KErrNoMemory ); + } + + + return certStore; +} + +void X509_STORE_free(X509_STORE *aCertStore) +{ + if (aCertStore) + { + if (aCertStore->iCertChain) + { + delete aCertStore->iCertChain; + aCertStore->iCertChain = NULL; + } + if (aCertStore->iSymbianCertStore) + { + delete aCertStore->iSymbianCertStore; + aCertStore->iSymbianCertStore = NULL; + } + aCertStore->iRootCertsSCS.ResetAndDestroy(); + aCertStore->iRootCerts.ResetAndDestroy(); + free(aCertStore); + } +} + +void doAddCertL(X509_STORE *aCertStore, X509 *aCert) +{ + // convert aCert to TDesC8 + TPtrC8 certPtr((const unsigned char*)aCert->der, aCert->derlen); + CX509Certificate *cert = CX509Certificate::NewLC(certPtr); + aCertStore->iRootCerts.AppendL((CX509Certificate *)cert); + CleanupStack::Pop(cert); +} + +/* Add certificate to the cert store */ +int X509_STORE_add_cert(X509_STORE *aCertStore, X509 *aCert) +{ + TInt err; + + TRAP(err, doAddCertL(aCertStore, aCert)); + + return err; + +} + +void doCertChainInitL(X509_STORE *aCertStore, STACK_OF(X509) *aCert) +{ + if (aCertStore->iCertChain) + { + delete aCertStore->iCertChain; + aCertStore->iCertChain = NULL; + } + aCertStore->iCertChain = CSymbianCertChain::NewL(); + aCertStore->iCertChain->InitializeL((unsigned char*)aCert->der, + (unsigned int)aCert->derlen, + aCertStore->iRootCerts); +} + +/* Init certchain using certs from iRootCerts */ +int X509_STORE_certchain_init (X509_STORE *aCertStore, STACK_OF(X509) *aCert) +{ + TInt err; + + TRAP(err, doCertChainInitL(aCertStore, aCert)); + if ( err != KErrNone ) + { + xmlSecSetErrorFlag( err ); + } + return err; +} + +void doCertChainInitfromCertStoreL(X509_STORE *aCertStore, STACK_OF(X509) *aCert) +{ + TInt numCert ; + RMPointerArray listCerts; + HBufC8* certdata; + CX509Certificate* certX509; + + if (aCertStore->iCertChain) + { + delete aCertStore->iCertChain; + aCertStore->iCertChain = NULL; + } + if(!aCertStore->iSymbianCertStore) + { + aCertStore->iSymbianCertStore = CSymbianCertStore::NewL(); + aCertStore->iSymbianCertStore->CreateUnifiedCertStoreL(); + CActiveScheduler::Start(); + User::LeaveIfError( aCertStore->iSymbianCertStore->GetError() ); + } + if (aCertStore->iRootCertsSCS.Count()) + { + aCertStore->iRootCertsSCS.ResetAndDestroy(); + } + aCertStore->iSymbianCertStore->ListCertL(); + CActiveScheduler::Start(); + User::LeaveIfError( aCertStore->iSymbianCertStore->GetError() ); + listCerts=aCertStore->iSymbianCertStore->GetCertList(); + numCert = listCerts.Count(); + + for (int i=0;iiSymbianCertStore->SetCert(cert); + aCertStore->iSymbianCertStore->RetrieveCertDataL(); + CActiveScheduler::Start(); + User::LeaveIfError( aCertStore->iSymbianCertStore->GetError() ); + certdata=aCertStore->iSymbianCertStore->GetRetrieveCertData(); + certX509 = CX509Certificate::NewLC(*certdata); + aCertStore->iRootCertsSCS.Append((CX509Certificate *)certX509); + CleanupStack::Pop(certX509); + } + aCertStore->iCertChain = CSymbianCertChain::NewL(); + aCertStore->iCertChain->InitializeL((unsigned char*)aCert->der, + (unsigned int)aCert->derlen, + aCertStore->iRootCertsSCS); +} + +/*Init certchain using root certs from SymbianCertStore stored in iRootCertsSCS */ +int X509_STORE_certchain_init_fromCertStore (X509_STORE *aCertStore, STACK_OF(X509) *aCert) +{ + TInt err; + TRAP(err, doCertChainInitfromCertStoreL(aCertStore, aCert)); + if ( err != KErrNone ) + { + xmlSecSetErrorFlag( err ); + } + return err; +} + +int X509_STORE_certchain_validate (X509_STORE *aCertStore) +{ + TInt err; + + TRAP(err, aCertStore->iCertChain->ValidateL()); + + if (err==KErrNone) + { + CActiveScheduler::Start(); + err = aCertStore->iCertChain->GetError(); + if ( err != KErrNone ) + { + xmlSecSetErrorFlag( err ); + } + } + else + { + xmlSecSetErrorFlag( err ); + } + + return err; + +} + + +int X509_STORE_certchain_getValidateResult (X509_STORE *aCertStore) +{ + TInt ret; + + ret = aCertStore->iCertChain->GetValidateResult(); + + return ret; + +} + +#endif /* XMLSEC_NO_X509 */ diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/bwinscw/xmlsecwrapper.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/bwinscw/xmlsecwrapper.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + ?AddTrustedCertFromBufferL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 1 NONAME ; void CXmlSecSign::AddTrustedCertFromBufferL(class TDesC8 const &) + ?AddTrustedCertFromFileL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 2 NONAME ; void CXmlSecSign::AddTrustedCertFromFileL(class TDesC8 const &) + ?CreateTemplateL@CXmlSecEncrypt@@QAEABVRXmlEngDocument@@W4TXmlSecKeyType@1@W4TXmlSecDataType@1@@Z @ 3 NONAME ; class RXmlEngDocument const & CXmlSecEncrypt::CreateTemplateL(enum CXmlSecEncrypt::TXmlSecKeyType, enum CXmlSecEncrypt::TXmlSecDataType) + ?CreateTemplateL@CXmlSecSign@@QAEABVRXmlEngDocument@@W4TXmlSecKeyType@1@AAV?$RArray@VTXmlEngElement@@@@ABVTDesC8@@HI2H@Z @ 4 NONAME ; class RXmlEngDocument const & CXmlSecSign::CreateTemplateL(enum CXmlSecSign::TXmlSecKeyType, class RArray &, class TDesC8 const &, int, unsigned int, class TDesC8 const &, int) + ?CreateTemplateL@CXmlSecSign@@QAEABVRXmlEngDocument@@W4TXmlSecKeyType@1@HIABVTDesC8@@H@Z @ 5 NONAME ; class RXmlEngDocument const & CXmlSecSign::CreateTemplateL(enum CXmlSecSign::TXmlSecKeyType, int, unsigned int, class TDesC8 const &, int) + ?CurrentTemplate@CXmlSecEncrypt@@QBEABVRXmlEngDocument@@XZ @ 6 NONAME ; class RXmlEngDocument const & CXmlSecEncrypt::CurrentTemplate(void) const + ?CurrentTemplate@CXmlSecSign@@QBEABVRXmlEngDocument@@XZ @ 7 NONAME ; class RXmlEngDocument const & CXmlSecSign::CurrentTemplate(void) const + ?DecryptXmlDocumentKeyFromBufferL@CXmlSecEncrypt@@QAEPAVHBufC8@@AAVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 8 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlDocumentKeyFromBufferL(class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?DecryptXmlDocumentKeyFromFileL@CXmlSecEncrypt@@QAEPAVHBufC8@@AAVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 9 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlDocumentKeyFromFileL(class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?DecryptXmlDocumentL@CXmlSecEncrypt@@QAEPAVHBufC8@@AAVRXmlEngDocument@@@Z @ 10 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlDocumentL(class RXmlEngDocument &) + ?DecryptXmlNodeKeyFromBufferL@CXmlSecEncrypt@@QAEPAVHBufC8@@VTXmlEngElement@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 11 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlNodeKeyFromBufferL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?DecryptXmlNodeKeyFromFileL@CXmlSecEncrypt@@QAEPAVHBufC8@@VTXmlEngElement@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 12 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlNodeKeyFromFileL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?DecryptXmlNodeL@CXmlSecEncrypt@@QAEPAVHBufC8@@VTXmlEngElement@@@Z @ 13 NONAME ; class HBufC8 * CXmlSecEncrypt::DecryptXmlNodeL(class TXmlEngElement) + ?DestroyCurrentTemplate@CXmlSecEncrypt@@QAEXXZ @ 14 NONAME ; void CXmlSecEncrypt::DestroyCurrentTemplate(void) + ?DestroyCurrentTemplate@CXmlSecSign@@QAEXXZ @ 15 NONAME ; void CXmlSecSign::DestroyCurrentTemplate(void) + ?EncryptDataL@CXmlSecEncrypt@@QAE?AVRXmlEngDocument@@ABVTDesC8@@@Z @ 16 NONAME ; class RXmlEngDocument CXmlSecEncrypt::EncryptDataL(class TDesC8 const &) + ?EncryptXmlDocumentKeyFromBufferL@CXmlSecEncrypt@@QAEXAAVRXmlEngDocument@@0ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 17 NONAME ; void CXmlSecEncrypt::EncryptXmlDocumentKeyFromBufferL(class RXmlEngDocument &, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?EncryptXmlDocumentKeyFromFileL@CXmlSecEncrypt@@QAEXAAVRXmlEngDocument@@0ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 18 NONAME ; void CXmlSecEncrypt::EncryptXmlDocumentKeyFromFileL(class RXmlEngDocument &, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?EncryptXmlDocumentL@CXmlSecEncrypt@@QAEXAAVRXmlEngDocument@@@Z @ 19 NONAME ; void CXmlSecEncrypt::EncryptXmlDocumentL(class RXmlEngDocument &) + ?EncryptXmlNodeKeyFromBufferL@CXmlSecEncrypt@@QAEXVTXmlEngElement@@AAVRXmlEngDocument@@ABVTDesC8@@2W4TXmlSecKeyType@1@@Z @ 20 NONAME ; void CXmlSecEncrypt::EncryptXmlNodeKeyFromBufferL(class TXmlEngElement, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?EncryptXmlNodeKeyFromFileL@CXmlSecEncrypt@@QAEXVTXmlEngElement@@AAVRXmlEngDocument@@ABVTDesC8@@2W4TXmlSecKeyType@1@@Z @ 21 NONAME ; void CXmlSecEncrypt::EncryptXmlNodeKeyFromFileL(class TXmlEngElement, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?EncryptXmlNodeL@CXmlSecEncrypt@@QAEXVTXmlEngElement@@@Z @ 22 NONAME ; void CXmlSecEncrypt::EncryptXmlNodeL(class TXmlEngElement) + ?NewL@CXmlSecEncrypt@@SAPAV1@XZ @ 23 NONAME ; class CXmlSecEncrypt * CXmlSecEncrypt::NewL(void) + ?NewL@CXmlSecSign@@SAPAV1@XZ @ 24 NONAME ; class CXmlSecSign * CXmlSecSign::NewL(void) + ?NewLC@CXmlSecEncrypt@@SAPAV1@XZ @ 25 NONAME ; class CXmlSecEncrypt * CXmlSecEncrypt::NewLC(void) + ?NewLC@CXmlSecSign@@SAPAV1@XZ @ 26 NONAME ; class CXmlSecSign * CXmlSecSign::NewLC(void) + ?SetCertFromBufferL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 27 NONAME ; void CXmlSecSign::SetCertFromBufferL(class TDesC8 const &) + ?SetCertFromFileL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 28 NONAME ; void CXmlSecSign::SetCertFromFileL(class TDesC8 const &) + ?SetKeyFromBufferL@CXmlSecEncrypt@@QAEXABVTDesC8@@0W4TXmlSecKeyType@1@@Z @ 29 NONAME ; void CXmlSecEncrypt::SetKeyFromBufferL(class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?SetKeyFromBufferL@CXmlSecSign@@QAEXABVTDesC8@@0W4TXmlSecKeyType@1@@Z @ 30 NONAME ; void CXmlSecSign::SetKeyFromBufferL(class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SetKeyFromFileL@CXmlSecEncrypt@@QAEXABVTDesC8@@0W4TXmlSecKeyType@1@@Z @ 31 NONAME ; void CXmlSecEncrypt::SetKeyFromFileL(class TDesC8 const &, class TDesC8 const &, enum CXmlSecEncrypt::TXmlSecKeyType) + ?SetKeyFromFileL@CXmlSecSign@@QAEXABVTDesC8@@0W4TXmlSecKeyType@1@@Z @ 32 NONAME ; void CXmlSecSign::SetKeyFromFileL(class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SetKeyInfoL@CXmlSecEncrypt@@QAEXABVTDesC8@@@Z @ 33 NONAME ; void CXmlSecEncrypt::SetKeyInfoL(class TDesC8 const &) + ?SetKeyInfoL@CXmlSecEncrypt@@QAEXVTXmlEngElement@@@Z @ 34 NONAME ; void CXmlSecEncrypt::SetKeyInfoL(class TXmlEngElement) + ?SetKeyInfoL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 35 NONAME ; void CXmlSecSign::SetKeyInfoL(class TDesC8 const &) + ?SetKeyInfoL@CXmlSecSign@@QAEXVTXmlEngElement@@@Z @ 36 NONAME ; void CXmlSecSign::SetKeyInfoL(class TXmlEngElement) + ?SetTemplateFromBufferL@CXmlSecEncrypt@@QAEXABVTDesC8@@@Z @ 37 NONAME ; void CXmlSecEncrypt::SetTemplateFromBufferL(class TDesC8 const &) + ?SetTemplateFromBufferL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 38 NONAME ; void CXmlSecSign::SetTemplateFromBufferL(class TDesC8 const &) + ?SetTemplateFromFileL@CXmlSecEncrypt@@QAEXAAVRFs@@ABVTDesC8@@@Z @ 39 NONAME ; void CXmlSecEncrypt::SetTemplateFromFileL(class RFs &, class TDesC8 const &) + ?SetTemplateFromFileL@CXmlSecEncrypt@@QAEXABVTDesC8@@@Z @ 40 NONAME ; void CXmlSecEncrypt::SetTemplateFromFileL(class TDesC8 const &) + ?SetTemplateFromFileL@CXmlSecSign@@QAEXAAVRFs@@ABVTDesC8@@@Z @ 41 NONAME ; void CXmlSecSign::SetTemplateFromFileL(class RFs &, class TDesC8 const &) + ?SetTemplateFromFileL@CXmlSecSign@@QAEXABVTDesC8@@@Z @ 42 NONAME ; void CXmlSecSign::SetTemplateFromFileL(class TDesC8 const &) + ?SetTemplateL@CXmlSecEncrypt@@QAEXABVRXmlEngDocument@@@Z @ 43 NONAME ; void CXmlSecEncrypt::SetTemplateL(class RXmlEngDocument const &) + ?SetTemplateL@CXmlSecSign@@QAEXABVRXmlEngDocument@@@Z @ 44 NONAME ; void CXmlSecSign::SetTemplateL(class RXmlEngDocument const &) + ?SignXmlDocumentKeyFromBufferL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAVRXmlEngDocument@@0ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 45 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromBufferL(class RXmlEngDocument &, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SignXmlDocumentKeyFromBufferL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 46 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromBufferL(class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SignXmlDocumentKeyFromFileL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAVRXmlEngDocument@@0ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 47 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromFileL(class RXmlEngDocument &, class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SignXmlDocumentKeyFromFileL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 48 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromFileL(class RXmlEngDocument &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?SignXmlDocumentL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAVRXmlEngDocument@@H@Z @ 49 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlDocumentL(class RXmlEngDocument &, int) + ?SignXmlNodesL@CXmlSecSign@@QAE?AVTXmlEngElement@@AAV?$RArray@VTXmlEngElement@@@@H@Z @ 50 NONAME ; class TXmlEngElement CXmlSecSign::SignXmlNodesL(class RArray &, int) + ?VerifyXmlDocumentKeyFromBufferL@CXmlSecSign@@QAEHABVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 51 NONAME ; int CXmlSecSign::VerifyXmlDocumentKeyFromBufferL(class RXmlEngDocument const &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?VerifyXmlDocumentKeyFromFileL@CXmlSecSign@@QAEHABVRXmlEngDocument@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 52 NONAME ; int CXmlSecSign::VerifyXmlDocumentKeyFromFileL(class RXmlEngDocument const &, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?VerifyXmlDocumentL@CXmlSecSign@@QAEHABVRXmlEngDocument@@W4TXmlSecVerificationKeyRepository@1@@Z @ 53 NONAME ; int CXmlSecSign::VerifyXmlDocumentL(class RXmlEngDocument const &, enum CXmlSecSign::TXmlSecVerificationKeyRepository) + ?VerifyXmlNodeKeyFromBufferL@CXmlSecSign@@QAEHVTXmlEngElement@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 54 NONAME ; int CXmlSecSign::VerifyXmlNodeKeyFromBufferL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?VerifyXmlNodeKeyFromFileL@CXmlSecSign@@QAEHVTXmlEngElement@@ABVTDesC8@@1W4TXmlSecKeyType@1@@Z @ 55 NONAME ; int CXmlSecSign::VerifyXmlNodeKeyFromFileL(class TXmlEngElement, class TDesC8 const &, class TDesC8 const &, enum CXmlSecSign::TXmlSecKeyType) + ?VerifyXmlNodeL@CXmlSecSign@@QAEHVTXmlEngElement@@W4TXmlSecVerificationKeyRepository@1@@Z @ 56 NONAME ; int CXmlSecSign::VerifyXmlNodeL(class TXmlEngElement, enum CXmlSecSign::TXmlSecVerificationKeyRepository) + ?XmlSecCleanup@@YAXPAX@Z @ 57 NONAME ; void XmlSecCleanup(void *) + ?XmlSecInitializeL@@YAXXZ @ 58 NONAME ; void XmlSecInitializeL(void) + ?XmlSecPopAndDestroy@@YAXXZ @ 59 NONAME ; void XmlSecPopAndDestroy(void) + ?XmlSecPushL@@YAXXZ @ 60 NONAME ; void XmlSecPushL(void) + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/eabi/wsstarxmlsecwrapper.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/eabi/wsstarxmlsecwrapper.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +EXPORTS + _Z11XmlSecPushLv @ 1 NONAME + _Z13XmlSecCleanupPv @ 2 NONAME + _Z17XmlSecInitializeLv @ 3 NONAME + _Z19XmlSecPopAndDestroyv @ 4 NONAME + _ZN11CXmlSecSign11SetKeyInfoLE14TXmlEngElement @ 5 NONAME + _ZN11CXmlSecSign11SetKeyInfoLERK6TDesC8 @ 6 NONAME + _ZN11CXmlSecSign12SetTemplateLERK15RXmlEngDocument @ 7 NONAME + _ZN11CXmlSecSign13SignXmlNodesLER6RArrayI14TXmlEngElementEi @ 8 NONAME + _ZN11CXmlSecSign14VerifyXmlNodeLE14TXmlEngElementNS_32TXmlSecVerificationKeyRepositoryE @ 9 NONAME + _ZN11CXmlSecSign15CreateTemplateLENS_14TXmlSecKeyTypeER6RArrayI14TXmlEngElementERK6TDesC8ijS7_i @ 10 NONAME + _ZN11CXmlSecSign15CreateTemplateLENS_14TXmlSecKeyTypeEijRK6TDesC8i @ 11 NONAME + _ZN11CXmlSecSign15SetKeyFromFileLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 12 NONAME + _ZN11CXmlSecSign16SetCertFromFileLERK6TDesC8 @ 13 NONAME + _ZN11CXmlSecSign16SignXmlDocumentLER15RXmlEngDocumenti @ 14 NONAME + _ZN11CXmlSecSign17SetKeyFromBufferLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 15 NONAME + _ZN11CXmlSecSign18SetCertFromBufferLERK6TDesC8 @ 16 NONAME + _ZN11CXmlSecSign18VerifyXmlDocumentLERK15RXmlEngDocumentNS_32TXmlSecVerificationKeyRepositoryE @ 17 NONAME + _ZN11CXmlSecSign20SetTemplateFromFileLER3RFsRK6TDesC8 @ 18 NONAME + _ZN11CXmlSecSign20SetTemplateFromFileLERK6TDesC8 @ 19 NONAME + _ZN11CXmlSecSign22DestroyCurrentTemplateEv @ 20 NONAME + _ZN11CXmlSecSign22SetTemplateFromBufferLERK6TDesC8 @ 21 NONAME + _ZN11CXmlSecSign23AddTrustedCertFromFileLERK6TDesC8 @ 22 NONAME + _ZN11CXmlSecSign25AddTrustedCertFromBufferLERK6TDesC8 @ 23 NONAME + _ZN11CXmlSecSign25VerifyXmlNodeKeyFromFileLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 24 NONAME + _ZN11CXmlSecSign27SignXmlDocumentKeyFromFileLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 25 NONAME + _ZN11CXmlSecSign27SignXmlDocumentKeyFromFileLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 26 NONAME + _ZN11CXmlSecSign27VerifyXmlNodeKeyFromBufferLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 27 NONAME + _ZN11CXmlSecSign29SignXmlDocumentKeyFromBufferLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 28 NONAME + _ZN11CXmlSecSign29SignXmlDocumentKeyFromBufferLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 29 NONAME + _ZN11CXmlSecSign29VerifyXmlDocumentKeyFromFileLERK15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 30 NONAME + _ZN11CXmlSecSign31VerifyXmlDocumentKeyFromBufferLERK15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 31 NONAME + _ZN11CXmlSecSign4NewLEv @ 32 NONAME + _ZN11CXmlSecSign5NewLCEv @ 33 NONAME + _ZN14CXmlSecEncrypt11SetKeyInfoLE14TXmlEngElement @ 34 NONAME + _ZN14CXmlSecEncrypt11SetKeyInfoLERK6TDesC8 @ 35 NONAME + _ZN14CXmlSecEncrypt12EncryptDataLERK6TDesC8 @ 36 NONAME + _ZN14CXmlSecEncrypt12SetTemplateLERK15RXmlEngDocument @ 37 NONAME + _ZN14CXmlSecEncrypt15CreateTemplateLENS_14TXmlSecKeyTypeENS_15TXmlSecDataTypeE @ 38 NONAME + _ZN14CXmlSecEncrypt15DecryptXmlNodeLE14TXmlEngElement @ 39 NONAME + _ZN14CXmlSecEncrypt15EncryptXmlNodeLE14TXmlEngElement @ 40 NONAME + _ZN14CXmlSecEncrypt15SetKeyFromFileLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 41 NONAME + _ZN14CXmlSecEncrypt17SetKeyFromBufferLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 42 NONAME + _ZN14CXmlSecEncrypt19DecryptXmlDocumentLER15RXmlEngDocument @ 43 NONAME + _ZN14CXmlSecEncrypt19EncryptXmlDocumentLER15RXmlEngDocument @ 44 NONAME + _ZN14CXmlSecEncrypt20SetTemplateFromFileLER3RFsRK6TDesC8 @ 45 NONAME + _ZN14CXmlSecEncrypt20SetTemplateFromFileLERK6TDesC8 @ 46 NONAME + _ZN14CXmlSecEncrypt22DestroyCurrentTemplateEv @ 47 NONAME + _ZN14CXmlSecEncrypt22SetTemplateFromBufferLERK6TDesC8 @ 48 NONAME + _ZN14CXmlSecEncrypt26DecryptXmlNodeKeyFromFileLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 49 NONAME + _ZN14CXmlSecEncrypt26EncryptXmlNodeKeyFromFileLE14TXmlEngElementR15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 50 NONAME + _ZN14CXmlSecEncrypt28DecryptXmlNodeKeyFromBufferLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 51 NONAME + _ZN14CXmlSecEncrypt28EncryptXmlNodeKeyFromBufferLE14TXmlEngElementR15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 52 NONAME + _ZN14CXmlSecEncrypt30DecryptXmlDocumentKeyFromFileLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 53 NONAME + _ZN14CXmlSecEncrypt30EncryptXmlDocumentKeyFromFileLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 54 NONAME + _ZN14CXmlSecEncrypt32DecryptXmlDocumentKeyFromBufferLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 55 NONAME + _ZN14CXmlSecEncrypt32EncryptXmlDocumentKeyFromBufferLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 56 NONAME + _ZN14CXmlSecEncrypt4NewLEv @ 57 NONAME + _ZN14CXmlSecEncrypt5NewLCEv @ 58 NONAME + _ZNK11CXmlSecSign15CurrentTemplateEv @ 59 NONAME + _ZNK14CXmlSecEncrypt15CurrentTemplateEv @ 60 NONAME + _ZTI11CXmlSecSign @ 61 NONAME ; ## + _ZTI14CXmlSecEncrypt @ 62 NONAME ; ## + _ZTI17CXmlSecKeyManager @ 63 NONAME ; ## + _ZTV11CXmlSecSign @ 64 NONAME ; ## + _ZTV14CXmlSecEncrypt @ 65 NONAME ; ## + _ZTV17CXmlSecKeyManager @ 66 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/eabi/xmlsecwrapper.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/eabi/xmlsecwrapper.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,68 @@ +EXPORTS + _Z11XmlSecPushLv @ 1 NONAME + _Z13XmlSecCleanupPv @ 2 NONAME + _Z17XmlSecInitializeLv @ 3 NONAME + _Z19XmlSecPopAndDestroyv @ 4 NONAME + _ZN11CXmlSecSign11SetKeyInfoLE14TXmlEngElement @ 5 NONAME + _ZN11CXmlSecSign11SetKeyInfoLERK6TDesC8 @ 6 NONAME + _ZN11CXmlSecSign12SetTemplateLERK15RXmlEngDocument @ 7 NONAME + _ZN11CXmlSecSign13SignXmlNodesLER6RArrayI14TXmlEngElementEi @ 8 NONAME + _ZN11CXmlSecSign14VerifyXmlNodeLE14TXmlEngElementNS_32TXmlSecVerificationKeyRepositoryE @ 9 NONAME + _ZN11CXmlSecSign15CreateTemplateLENS_14TXmlSecKeyTypeER6RArrayI14TXmlEngElementERK6TDesC8ijS7_i @ 10 NONAME + _ZN11CXmlSecSign15CreateTemplateLENS_14TXmlSecKeyTypeEijRK6TDesC8i @ 11 NONAME + _ZN11CXmlSecSign15SetKeyFromFileLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 12 NONAME + _ZN11CXmlSecSign16SetCertFromFileLERK6TDesC8 @ 13 NONAME + _ZN11CXmlSecSign16SignXmlDocumentLER15RXmlEngDocumenti @ 14 NONAME + _ZN11CXmlSecSign17SetKeyFromBufferLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 15 NONAME + _ZN11CXmlSecSign18SetCertFromBufferLERK6TDesC8 @ 16 NONAME + _ZN11CXmlSecSign18VerifyXmlDocumentLERK15RXmlEngDocumentNS_32TXmlSecVerificationKeyRepositoryE @ 17 NONAME + _ZN11CXmlSecSign20SetTemplateFromFileLER3RFsRK6TDesC8 @ 18 NONAME + _ZN11CXmlSecSign20SetTemplateFromFileLERK6TDesC8 @ 19 NONAME + _ZN11CXmlSecSign22DestroyCurrentTemplateEv @ 20 NONAME + _ZN11CXmlSecSign22SetTemplateFromBufferLERK6TDesC8 @ 21 NONAME + _ZN11CXmlSecSign23AddTrustedCertFromFileLERK6TDesC8 @ 22 NONAME + _ZN11CXmlSecSign25AddTrustedCertFromBufferLERK6TDesC8 @ 23 NONAME + _ZN11CXmlSecSign25VerifyXmlNodeKeyFromFileLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 24 NONAME + _ZN11CXmlSecSign27SignXmlDocumentKeyFromFileLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 25 NONAME + _ZN11CXmlSecSign27SignXmlDocumentKeyFromFileLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 26 NONAME + _ZN11CXmlSecSign27VerifyXmlNodeKeyFromBufferLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 27 NONAME + _ZN11CXmlSecSign29SignXmlDocumentKeyFromBufferLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 28 NONAME + _ZN11CXmlSecSign29SignXmlDocumentKeyFromBufferLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 29 NONAME + _ZN11CXmlSecSign29VerifyXmlDocumentKeyFromFileLERK15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 30 NONAME + _ZN11CXmlSecSign31VerifyXmlDocumentKeyFromBufferLERK15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 31 NONAME + _ZN11CXmlSecSign4NewLEv @ 32 NONAME + _ZN11CXmlSecSign5NewLCEv @ 33 NONAME + _ZN14CXmlSecEncrypt11SetKeyInfoLE14TXmlEngElement @ 34 NONAME + _ZN14CXmlSecEncrypt11SetKeyInfoLERK6TDesC8 @ 35 NONAME + _ZN14CXmlSecEncrypt12EncryptDataLERK6TDesC8 @ 36 NONAME + _ZN14CXmlSecEncrypt12SetTemplateLERK15RXmlEngDocument @ 37 NONAME + _ZN14CXmlSecEncrypt15CreateTemplateLENS_14TXmlSecKeyTypeENS_15TXmlSecDataTypeE @ 38 NONAME + _ZN14CXmlSecEncrypt15DecryptXmlNodeLE14TXmlEngElement @ 39 NONAME + _ZN14CXmlSecEncrypt15EncryptXmlNodeLE14TXmlEngElement @ 40 NONAME + _ZN14CXmlSecEncrypt15SetKeyFromFileLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 41 NONAME + _ZN14CXmlSecEncrypt17SetKeyFromBufferLERK6TDesC8S2_NS_14TXmlSecKeyTypeE @ 42 NONAME + _ZN14CXmlSecEncrypt19DecryptXmlDocumentLER15RXmlEngDocument @ 43 NONAME + _ZN14CXmlSecEncrypt19EncryptXmlDocumentLER15RXmlEngDocument @ 44 NONAME + _ZN14CXmlSecEncrypt20SetTemplateFromFileLER3RFsRK6TDesC8 @ 45 NONAME + _ZN14CXmlSecEncrypt20SetTemplateFromFileLERK6TDesC8 @ 46 NONAME + _ZN14CXmlSecEncrypt22DestroyCurrentTemplateEv @ 47 NONAME + _ZN14CXmlSecEncrypt22SetTemplateFromBufferLERK6TDesC8 @ 48 NONAME + _ZN14CXmlSecEncrypt26DecryptXmlNodeKeyFromFileLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 49 NONAME + _ZN14CXmlSecEncrypt26EncryptXmlNodeKeyFromFileLE14TXmlEngElementR15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 50 NONAME + _ZN14CXmlSecEncrypt28DecryptXmlNodeKeyFromBufferLE14TXmlEngElementRK6TDesC8S3_NS_14TXmlSecKeyTypeE @ 51 NONAME + _ZN14CXmlSecEncrypt28EncryptXmlNodeKeyFromBufferLE14TXmlEngElementR15RXmlEngDocumentRK6TDesC8S5_NS_14TXmlSecKeyTypeE @ 52 NONAME + _ZN14CXmlSecEncrypt30DecryptXmlDocumentKeyFromFileLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 53 NONAME + _ZN14CXmlSecEncrypt30EncryptXmlDocumentKeyFromFileLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 54 NONAME + _ZN14CXmlSecEncrypt32DecryptXmlDocumentKeyFromBufferLER15RXmlEngDocumentRK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 55 NONAME + _ZN14CXmlSecEncrypt32EncryptXmlDocumentKeyFromBufferLER15RXmlEngDocumentS1_RK6TDesC8S4_NS_14TXmlSecKeyTypeE @ 56 NONAME + _ZN14CXmlSecEncrypt4NewLEv @ 57 NONAME + _ZN14CXmlSecEncrypt5NewLCEv @ 58 NONAME + _ZNK11CXmlSecSign15CurrentTemplateEv @ 59 NONAME + _ZNK14CXmlSecEncrypt15CurrentTemplateEv @ 60 NONAME + _ZTI11CXmlSecSign @ 61 NONAME ; ## + _ZTI14CXmlSecEncrypt @ 62 NONAME ; ## + _ZTI17CXmlSecKeyManager @ 63 NONAME ; ## + _ZTV11CXmlSecSign @ 64 NONAME ; ## + _ZTV14CXmlSecEncrypt @ 65 NONAME ; ## + _ZTV17CXmlSecKeyManager @ 66 NONAME ; ## + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for XmlSec Wrapper component. +* +*/ +#include "../../inc/xmlsecvariant.hrh" + +PRJ_EXPORTS +../rom/xmlsecwrapper.iby CORE_OS_LAYER_IBY_EXPORT_PATH(xmlsecwrapper.iby) + +PRJ_MMPFILES +xmlsecwrapper.mmp diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/group/xmlsecwrapper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/group/xmlsecwrapper.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for XmlSec Wrapper component +* +*/ + +#include "../../inc/xmlsecvariant.hrh" + +TARGET xmlsecwrapper.dll +TARGETTYPE dll +UID 0x1000008D 0x101F9793 + +#ifdef CAP_GENERAL_DLL + CAPABILITY CAP_GENERAL_DLL +#else + CAPABILITY ALL -TCB +#endif + + VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE xmlsecwencrypt.cpp +SOURCE xmlsecwsign.cpp +SOURCE xmlsecwkeymanager.cpp +SOURCE xmlsecwinit.cpp +SOURCE xmlsecwtemplate.cpp +SOURCE xmlsecwinternalutils.cpp + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc + +SYSTEMINCLUDE /epoc32/include/libc +USERINCLUDE ../inc + +LIBRARY euser.lib + +#ifdef __RD_XMLSEC_MEMCOPY_PROBLEM_FIX__ +LIBRARY estlib.lib +#endif + +LIBRARY charconv.lib +LIBRARY efsrv.lib +#if !defined(__RD_XMLSEC_SRCINC_CHANGE_REVERSE__) +//libxml2parser +LIBRARY xmlengine.lib +LIBRARY xmlengineutils.lib +LIBRARY xmlenginedom.lib +#else +LIBRARY wsstarxmlengine.lib +LIBRARY wsstarxmlengineutils.lib +LIBRARY wsstarxmlenginedom.lib +#endif +//xmlsecurity +LIBRARY xmlsec.lib +LIBRARY xmlseccrypto.lib + +#if defined(ARMCC) +#if !defined(__RD_XMLSEC_MEMCOPY_PROBLEM_FIX__) + DEFFILE ../eabi/xmlsecwrapper.def +#else + DEFFILE ../eabi/wsstarxmlsecwrapper.def +#endif +#elif defined(WINSCW) || defined(WINS) + DEFFILE ../bwinscw/xmlsecwrapper.def +#endif + +nostrictdef + +SMPSAFE diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/inc/xmlsecwdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/inc/xmlsecwdefs.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Macro definitions used in XmlSec code. +* +*/ + +#ifndef _DEFS_H +#define _DEFS_H + +#define TEMPLATE (static_cast(iTemplate)) + +#define INTERNAL_NODEPTR(aNodeObject) (*reinterpret_cast(&(aNodeObject))) +#define INTERNAL_DOCPTR(aDocObject) (*reinterpret_cast(&(aDocObject))) + +#define ENC_CTX (static_cast(iEncCtx)) +#define SIG_CTX (static_cast(iSigCtx)) + +#endif // _DEFS_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/inc/xmlsecwglobalstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/inc/xmlsecwglobalstate.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Structure with global states for component. +* +*/ + +#ifndef C_GLOABALSTATE_H +#define C_GLOABALSTATE_H + +#include + +class CXmlSecKeyManager; +/** + * Strucure with global states for component. + * Holds key manager pointer and user counter. + * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +struct XmlSecGlobalState + { +public: + /** + * Key manager pointer. + */ + CXmlSecKeyManager* iKeyManager; + + /** + * User counter. + */ + TInt iUserCount; + + /** + * DOM implementation. + */ + RXmlEngDOMImplementation* iDOMImpl; + }; + + /** + * Gets global state for dll + */ + XmlSecGlobalState* XmlSecGetTls(); + + /** + * Sets global state for dll + */ + XmlSecGlobalState* XmlSecSetTlsL(); + + +#endif // C_GLOABALSTATE_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/inc/xmlsecwinternalutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/inc/xmlsecwinternalutils.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helper functions for internal use in Wrapper. +* +*/ + +#ifndef C_INTERNALUTILS_H +#define C_INTERNALUTILS_H + +/** + * Checks the error flag, and if the flag is set: leaves and resets it + * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +void XmlSecErrorFlagTestL(); + +/** + * Cleanup node pointer + * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +void LibxmlNodeCleanup(TAny* aNodePtr ); + +#endif // C_INTERNALUTILS_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/inc/xmlsecwkeymanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/inc/xmlsecwkeymanager.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Key manager class. +* +*/ + +#ifndef C_KEYMANAGER_H +#define C_KEYMANAGER_H + +/** + * Class that contains key manager. + * + * Class allows application to have only one key menager. + * Class should be used internal. + * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +class CXmlSecKeyManager : public CBase + { + +public: + /** + * Gets instance of key manager. + * + * @since S60 v3.2 + * @return Key manager instance. + */ + LOCAL_C CXmlSecKeyManager* GetInstanceL(); + + /** + * Gets pointer to XmlSec key manager. + * + * @since S60 v3.2 + * @return Key manager pointer. + */ + xmlSecKeysMngr* GetKeyManagerPtr(); + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~CXmlSecKeyManager(); + +private: + /** + * Constructor. + * + * @since S60 v3.2 + */ + CXmlSecKeyManager(); + + /** + * Second phase constructor. + * + * @since S60 v3.2 + */ + void ConstructL(); + +private: + /** + * XmlSec key manager pointer + */ + xmlSecKeysMngr* iKeyManager; + }; + +#endif // C_KEYMANAGER_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/inc/xmlsecwtemplate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/inc/xmlsecwtemplate.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods used in encryption and decryption process. +* +*/ + +#ifndef C_TEMPLATE_H +#define C_TEMPLATE_H + +#include +#include + +#include +#include +#include +#include +#include + +class XmlSecTemplate + { +public: + /** + * Sets template. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template document + * @param aInput DOM tree with template document + */ + static void SetTemplateL(RXmlEngDocument& aTemplate, const RXmlEngDocument& aInput); + + + /** + * Sets template from file. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template document + * @param aFile name of the file with template inside + * @param aRFs handle to a file server session + */ + static void SetTemplateFromFileL(RXmlEngDocument& aTemplate, const TDesC8& aFile, RFs& aRFs); + + /** + * Sets template from file. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template document + * @param aFile name of the file with template inside + */ + static void SetTemplateFromFileL(RXmlEngDocument& aTemplate, const TDesC8& aFile); + + /** + * Sets template from buffer. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template document + * @param aBuffer template in buffer + */ + static void SetTemplateFromBufferL(RXmlEngDocument& aTemplate,const TDesC8& aBuffer); + + /** + * Destroys current template. + * + * @since S60 v3.2 + * @param aTemplate template to destroy + */ + static void DestroyTemplate(RXmlEngDocument& aTemplate); + + /** + * Adds element to node and sets the value of it. + * The element will be added to aTemplate template. + * + * @since S60 v3.2 + * @param aTemplate template document. + * @param aKeyName Key name that should be set. + */ + static void SetKeyInfoL(RXmlEngDocument& aTemplate, const TDesC8& aKeyName); + + /** + * Adds element to node. + * This method allow to add specific data to element. + * The element will be added to aTemplate template. + * + * @since S60 v3.2 + * @param aTemplate template document + * @param aKeyProp TElement that should be set in template document. + */ + static void SetKeyInfoL(RXmlEngDocument& aTemplate, TXmlEngElement aKeyProp); + }; + +#endif // C_TEMPLATE_H diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/rom/xmlsecwrapper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/rom/xmlsecwrapper.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for XMLSec Wrapper component +* +*/ + +#ifndef __XMLSECWRAPPER_IBY__ +#define __XMLSECWRAPPER_IBY__ + +file=ABI_DIR\BUILD_DIR\xmlsecwrapper.dll SHARED_LIB_DIR\xmlsecwrapper.dll + +#endif //__XMLSECWRAPPER_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwencrypt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwencrypt.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,673 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods needed in encryption and decryption process. +* +*/ + +#include + +// XML Engine +#include +#include +#include + +#include +#include +#include + +#include + +// XML Sec +#include "xmlsec_crypto.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_xmlenc.h" +#include "xmlsec_templates.h" +#include "xmlsecwinternalutils.h" + +#include "xmlsecwerrors.h" +#include "xmlsecwdefs.h" +#include "xmlsecwencrypt.h" +#include "xmlsecwkeymanager.h" +#include "xmlsecwtemplate.h" +#include "xmlsecwglobalstate.h" + +const TInt K3DESKeySize = 24; +const TInt KAESKeySize256 = 32; + +namespace Encrypt + { + +// --------------------------------------------------------------------------- +// Reset encryption ctxt +// --------------------------------------------------------------------------- +// +void ResetCtx(xmlSecEncCtxPtr aCtx, CXmlSecKeyManager* aMngr) + { + xmlSecKeyPtr tmpKey = NULL; + if(!aMngr) + { + tmpKey = aCtx->encKey; + aCtx->encKey = NULL; + } + // reset ctx + xmlSecEncCtxReset(aCtx); + if(aMngr) + { + xmlSecEncCtxInitialize(aCtx,aMngr->GetKeyManagerPtr()); + } + + aCtx->encKey = tmpKey; + } + +// --------------------------------------------------------------------------- +// Read key from buffer +// --------------------------------------------------------------------------- +// +xmlSecKeyPtr ReadKeyFromBufferL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + CXmlSecEncrypt::TXmlSecKeyType aAlgorithm) + { + if(aKeyFile.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + char* name = XmlEngXmlCharFromDes8L(aKeyName); + CleanupStack::PushL(name); + char* tmpName = NULL; + if(aKeyName.Length()) + { + tmpName = name; + } + xmlSecKeyPtr keyPtr = NULL; + // read key and check size + if (aAlgorithm == CXmlSecEncrypt::EAES256) + { + if(aKeyFile.Size() != KAESKeySize256) + { + User::Leave(KErrKey); + } + keyPtr = xmlSecKeyReadMemory(xmlSecKeyDataAesId, aKeyFile.Ptr(), aKeyFile.Size()); + } + else if (aAlgorithm == CXmlSecEncrypt::E3DES) + { + if(aKeyFile.Size() != K3DESKeySize) + { + User::Leave(KErrKey); + } + keyPtr = xmlSecKeyReadMemory(xmlSecKeyDataDesId, aKeyFile.Ptr(), aKeyFile.Size()); + } + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + + if(!keyPtr) + { + User::Leave(KErrKey); + } + // set key name + if(xmlSecKeySetName(keyPtr, (const unsigned char*) tmpName) < 0) + { + xmlSecKeyDestroy(keyPtr); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKey); + } + CleanupStack::PopAndDestroy(name); + return keyPtr; + } + +// --------------------------------------------------------------------------- +// Read key from file +// --------------------------------------------------------------------------- +// +xmlSecKeyPtr ReadKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + CXmlSecEncrypt::TXmlSecKeyType aKeyFormat) + { + if(aKeyFile.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + RFile keyFile; + TInt size; + RBuf keyName; + // read key from file + keyName.CreateL(KMaxFileName); + CleanupClosePushL(keyName); + keyName.Copy(aKeyFile); + User::LeaveIfError(keyFile.Open(fs, keyName, EFileRead | EFileShareReadersOnly)); + CleanupStack::PopAndDestroy(&keyName); + CleanupClosePushL(keyFile); + User::LeaveIfError(keyFile.Size(size)); + HBufC8* key = HBufC8::NewLC(size); + TPtr8 keyPtrD = key->Des(); + User::LeaveIfError(keyFile.Read(keyPtrD, size)); + xmlSecKeyPtr keyPtr = ReadKeyFromBufferL(*key,aKeyName,aKeyFormat); + CleanupStack::PopAndDestroy(key); + CleanupStack::PopAndDestroy(&keyFile); + CleanupStack::PopAndDestroy(&fs); + return keyPtr; + } + + } // namespace Encrypt + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlSecEncrypt* CXmlSecEncrypt::NewLC() + { + CXmlSecEncrypt* self = new (ELeave) CXmlSecEncrypt; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlSecEncrypt* CXmlSecEncrypt::NewL() + { + CXmlSecEncrypt* self = CXmlSecEncrypt::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Encrypt data from buffer +// --------------------------------------------------------------------------- +// +EXPORT_C RXmlEngDocument CXmlSecEncrypt::EncryptDataL(const TDesC8& aData) + { + if(!aData.Length()) + { + User::Leave(KErrWrongParameter); + } + if(iTemplate.IsNull()) + { + User::Leave(KErrTemplate); + } + xmlSecEncCtxPtr tmpCtx = ENC_CTX; + + Encrypt::ResetCtx(tmpCtx,NULL); + + xmlNodePtr node = NULL; + // Copy tmpl file + xmlDocPtr result = xmlCopyDoc(INTERNAL_DOCPTR(iTemplate), 1); + if(!result) + { + User::Leave(KErrNoMemory); + } + // find start node + node = xmlSecFindNode(xmlDocGetRootElement(result), xmlSecNodeEncryptedData, xmlSecEncNs); + if(!node) + { + xmlFreeDoc(result); + User::Leave(KErrTemplate); + } + + // encrypt the data + if(xmlSecEncCtxBinaryEncrypt(tmpCtx, node, aData.Ptr(), aData.Length()) < 0) + { + xmlFreeDoc(result); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrEncrypt); + } + RXmlEngDocument doc; + XmlSecGlobalState* gs = XmlSecGetTls(); + doc.OpenL(*gs->iDOMImpl,result); + return doc; + } + +// --------------------------------------------------------------------------- +// Encrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlDocumentL(RXmlEngDocument& aDocument) + { + if(aDocument.IsNull()) + { + User::Leave(KErrWrongParameter); + } + EncryptXmlNodeL(aDocument.DocumentElement()); + } + +// --------------------------------------------------------------------------- +// Encrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlNodeL(TXmlEngElement aNode) + { + if(aNode.IsNull()) + { + User::Leave(KErrWrongParameter); + } + if(iTemplate.IsNull()) + { + User::Leave(KErrTemplate); + } + xmlSecEncCtxPtr tmpCtx = ENC_CTX; + + Encrypt::ResetCtx(tmpCtx,NULL); + + xmlNodePtr node = NULL; + // find start node + node = xmlSecFindNode(xmlDocGetRootElement(INTERNAL_DOCPTR(iTemplate)), + xmlSecNodeEncryptedData, xmlSecEncNs); + if(!node) + { + User::Leave(KErrTemplate); + } + + xmlNodePtr result = xmlCopyNode(node, 1); + if(!result) + { + XmlEngOOMTestL(); + User::Leave(KErrNoMemory); + } + // encrypt the data + if(xmlSecEncCtxXmlEncrypt(tmpCtx, result, INTERNAL_NODEPTR(aNode)) < 0) + { + xmlFreeNode( result ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrEncrypt); + } + } + +// --------------------------------------------------------------------------- +// Encrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlNodeKeyFromFileL(TXmlEngElement aNode, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + SetTemplateL(aTemplate); + EncryptXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Encrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlDocumentKeyFromFileL(RXmlEngDocument& aDoc, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + SetTemplateL(aTemplate); + EncryptXmlDocumentL(aDoc); + } + +// --------------------------------------------------------------------------- +// Encrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlNodeKeyFromBufferL(TXmlEngElement aNode, + RXmlEngDocument& aTemplate, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + SetTemplateL(aTemplate); + EncryptXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Encrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::EncryptXmlDocumentKeyFromBufferL(RXmlEngDocument& aDoc, + RXmlEngDocument& aTemplate, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + SetTemplateL(aTemplate); + EncryptXmlDocumentL(aDoc); + } + +// --------------------------------------------------------------------------- +// Decrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlNodeKeyFromFileL(TXmlEngElement aNode, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + return DecryptXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Decrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlDocumentKeyFromFileL(RXmlEngDocument& aDoc, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + return DecryptXmlDocumentL(aDoc); + } + +// --------------------------------------------------------------------------- +// Decrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlNodeKeyFromBufferL(TXmlEngElement aNode, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + return DecryptXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Decrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlDocumentKeyFromBufferL(RXmlEngDocument& aDoc, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + return DecryptXmlDocumentL(aDoc); + } + +// --------------------------------------------------------------------------- +// Decrypt xml node +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlNodeL(TXmlEngElement aNode) + { + if(aNode.IsNull()) + { + User::Leave(KErrWrongParameter); + } + + xmlNodePtr node = NULL; + xmlNodePtr root = INTERNAL_NODEPTR(aNode); + // find start node + node = xmlSecFindNode(root,xmlSecNodeEncryptedData, xmlSecEncNs); + if(!node) + { + User::Leave(KErrWrongParameter); + } + + xmlSecEncCtxPtr tmpCtx = ENC_CTX; + + Encrypt::ResetCtx(tmpCtx,NULL); + // decrypt data + if((xmlSecEncCtxDecrypt(tmpCtx, node) < 0) + || (!tmpCtx->result)) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrDecrypt); + } + // if result is data not xml part it is returned as hbufc8* + if(!tmpCtx->resultReplaced) + { + xmlSecByte* result = xmlSecBufferGetData(tmpCtx->result); + if(result) + { + TPtrC8 ptr(result,tmpCtx->result->size); + return ptr.AllocL(); + } + } + return NULL; + } + +// --------------------------------------------------------------------------- +// Decrypt xml document +// --------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CXmlSecEncrypt::DecryptXmlDocumentL(RXmlEngDocument& aDocument) + { + if(aDocument.IsNull()) + { + User::Leave(KErrWrongParameter); + } + return DecryptXmlNodeL(aDocument.DocumentElement()); + } + +// --------------------------------------------------------------------------- +// Set template from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetTemplateFromFileL(const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromFileL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set template from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetTemplateFromFileL(RFs& aRFs, const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromFileL(iTemplate,aTemplate,aRFs); + } + +// --------------------------------------------------------------------------- +// Set template from buffer +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetTemplateFromBufferL(const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromBufferL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set template from DOM tree +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetTemplateL(const RXmlEngDocument& aTemplate) + { + XmlSecTemplate::SetTemplateL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set key info node in template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetKeyInfoL(const TDesC8& aKeyName) + { + XmlSecTemplate::SetKeyInfoL(iTemplate,aKeyName); + } + +// --------------------------------------------------------------------------- +// Set key info node in template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetKeyInfoL(TXmlEngElement aKeyProp) + { + XmlSecTemplate::SetKeyInfoL(iTemplate,aKeyProp); + } + +// --------------------------------------------------------------------------- +// Create encryption template +// --------------------------------------------------------------------------- +// +EXPORT_C const RXmlEngDocument& CXmlSecEncrypt::CreateTemplateL(TXmlSecKeyType aAlgorithm, + TXmlSecDataType aDataType) + { + if(iTemplate.NotNull()) + { + iTemplate.Close(); + } + xmlNodePtr node = NULL; + // create encryption template to encrypt XML file and replace + // its content with encryption result + const xmlChar* mimeType = NULL; + if(aDataType == CXmlSecEncrypt::ENode) + { + mimeType = xmlSecTypeEncElement; + } + else if (aDataType == CXmlSecEncrypt::ENodeContent) + { + mimeType = xmlSecTypeEncContent; + } + + if (aAlgorithm == EAES256) + { + node = xmlSecTmplEncDataCreate(NULL, xmlSecTransformAes256CbcId, + NULL, mimeType, NULL, NULL); + } + else if (aAlgorithm == E3DES) + { + node = xmlSecTmplEncDataCreate(NULL, xmlSecTransformDes3CbcId, + NULL, mimeType, NULL, NULL); + } + if(!node) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + // we want to put encrypted data in the node + if(!xmlSecTmplEncDataEnsureCipherValue(node)) + { + xmlFreeNode( node ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + // add and nodes to put key name in the signed document + xmlNodePtr keyInfo = xmlSecTmplEncDataEnsureKeyInfo(node, NULL); + if(!keyInfo) + { + xmlFreeNode( node ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + XmlSecGlobalState* gs = XmlSecGetTls(); + CleanupStack::PushL(TCleanupItem(LibxmlNodeCleanup,(TAny*)node)); + iTemplate.OpenL(*gs->iDOMImpl,TXmlEngElement(node)); + CleanupStack::Pop(node); + return iTemplate; + } + +// --------------------------------------------------------------------------- +// Return current encryption template +// --------------------------------------------------------------------------- +// +EXPORT_C const RXmlEngDocument& CXmlSecEncrypt::CurrentTemplate() const + { + return iTemplate; + } + +// --------------------------------------------------------------------------- +// Destroy current encryption template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::DestroyCurrentTemplate() + { + XmlSecTemplate::DestroyTemplate(iTemplate); + } + +// --------------------------------------------------------------------------- +// Set key from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aAlgorithm) + { + xmlSecEncCtxPtr tmp = ENC_CTX; + if(tmp->encKey) + { + xmlSecKeyDestroy(tmp->encKey); + tmp->encKey = NULL; + } + tmp->encKey = Encrypt::ReadKeyFromFileL(aKeyFile,aKeyName,aAlgorithm); + } + +// --------------------------------------------------------------------------- +// Set key from buffer +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecEncrypt::SetKeyFromBufferL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aAlgorithm) + { + xmlSecEncCtxPtr tmp = ENC_CTX; + if(tmp->encKey) + { + xmlSecKeyDestroy(tmp->encKey); + tmp->encKey = NULL; + } + tmp->encKey = Encrypt::ReadKeyFromBufferL(aKeyFile,aKeyName,aAlgorithm); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CXmlSecEncrypt::CXmlSecEncrypt() + { + iTemplate = RXmlEngDocument(); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CXmlSecEncrypt::ConstructL() + { + // create encryption context + iEncCtx = xmlSecEncCtxCreate(NULL); + if(!iEncCtx) + { + User::Leave(KErrNoMemory); + } + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CXmlSecEncrypt::~CXmlSecEncrypt() + { + if(iTemplate.NotNull()) + { + iTemplate.Close(); + } + if(iEncCtx) + { + xmlSecEncCtxDestroy(ENC_CTX); + } + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwinit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwinit.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Methods for initializing and closing component. +* +*/ +// XML Engine +#include +#include + +// XML Sec +#include "xmlsec_crypto.h" +#include "xmlsec_error_flag.h" +#include "xmlsecwerrors.h" +#include "xmlsecwinit.h" +#include "xmlsecwglobalstate.h" +#include "xmlsecwkeymanager.h" + +#include "xmlsecwinternalutils.h" + +// --------------------------------------------------------------------------- +// Get global state for dll +// --------------------------------------------------------------------------- +// +XmlSecGlobalState* XmlSecGetTls() + { + return STATIC_CAST(XmlSecGlobalState*, Dll::Tls()); + } + +// --------------------------------------------------------------------------- +// Set global state for dll +// --------------------------------------------------------------------------- +// +XmlSecGlobalState* XmlSecSetTlsL() + { + XmlSecGlobalState* gs = new(ELeave) XmlSecGlobalState; + gs->iKeyManager = NULL; + gs->iUserCount = 0; + TInt error = Dll::SetTls(gs); + if(error) + { + delete gs; + User::Leave(error); + } + return gs; + } + +// --------------------------------------------------------------------------- +// UnSet global state for dll +// --------------------------------------------------------------------------- +// +void XmlSecUnsetTlsD( void* aGlobalState ) + { + delete aGlobalState; + Dll::SetTls( NULL ); + } + +// --------------------------------------------------------------------------- +// Initialize wrapper +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlSecInitializeL() + { + /* Init libxml and libxslt libraries */ + XmlSecGlobalState* gs = XmlSecGetTls(); + if(!gs) + { + gs = XmlSecSetTlsL(); + } + if(gs->iUserCount == 0) + { + CleanupStack::PushL( TCleanupItem( XmlSecUnsetTlsD, gs ) ); + XmlEngineAttachL(); + + RXmlEngDOMImplementation dom; + dom.OpenL(); + gs->iDOMImpl = &dom; + xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + xmlSubstituteEntitiesDefault(1); + + // Init xmlsec library + if(xmlSecInit() < 0) + { + User::Leave(KErrInit); + } + // Check loaded library version + if(xmlSecCheckVersion() != 1) + { + User::Leave(KErrInit); + } + // Init crypto library + if(xmlSecCryptoAppInit(NULL) < 0) + { + User::Leave(KErrInit); + } + // Init xmlsec-crypto library + if(xmlSecCryptoInit() < 0) + { + User::Leave(KErrInit); + } + //initialization completed + CleanupStack::Pop( gs ); //gs will be destroyed during cleanup of xmlsec + } + gs->iUserCount++; + } + +// --------------------------------------------------------------------------- +// Cleanup wrapper +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlSecCleanup(TAny* globalState) + { + XmlSecGlobalState* gs = NULL; + if(globalState) + { + gs = reinterpret_cast(globalState); + } + else + { + gs = XmlSecGetTls(); + } + if(!gs) + { + return; + } + gs->iUserCount--; + if(gs->iUserCount > 0) + { + return; + } + // Shutdown xmlsec-crypto library + xmlSecCryptoShutdown(); + + // Shutdown crypto library + xmlSecCryptoAppShutdown(); + + // Shutdown xmlsec library + xmlSecShutdown(); + +#ifndef XMLSEC_NO_XSLT + xsltCleanupGlobals(); +#endif /* XMLSEC_NO_XSLT */ + gs->iDOMImpl->Close(); + XmlEngineCleanup(); + if(gs->iKeyManager) + { + delete gs->iKeyManager; + } + delete gs; + Dll::SetTls(NULL); + xmlSecResetErrorFlag(); + } + +// --------------------------------------------------------------------------- +// Initialize wrapper +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlSecPushL() + { + XmlSecInitializeL(); + CleanupStack::PushL(TCleanupItem(XmlSecCleanup, NULL)); + } + +// --------------------------------------------------------------------------- +// Cleanup wrapper +// --------------------------------------------------------------------------- +// +EXPORT_C void XmlSecPopAndDestroy() + { + CleanupStack::PopAndDestroy(); + } + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwinternalutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwinternalutils.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helper functions for internal use in Wrapper. +* +*/ + + +#include + +#include + +#include "xmlsec_error_flag.h" + +#include "xmlsecwinternalutils.h" + +// --------------------------------------------------------------------------- +// Checks the error flag, and if the flag is set: leaves and resets it +// --------------------------------------------------------------------------- +// +void XmlSecErrorFlagTestL() + { + TInt error = xmlSecCheckErrorFlag(); + if ( error ) + { + xmlSecResetErrorFlag(); + User::Leave( error ); + } + } + +// --------------------------------------------------------------------------- +// Free node pointer +// --------------------------------------------------------------------------- +// +void LibxmlNodeCleanup( + TAny* aNodePtr ) + { + xmlFreeNode((xmlNodePtr)aNodePtr); + } + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwkeymanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwkeymanager.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Key manager functionality +* +*/ + + +#include + +#include +#include + +#include "xmlsec_crypto.h" +#include "xmlsec_xmlsec.h" + +#include "xmlsecwkeymanager.h" +#include "xmlsecwerrors.h" +#include "xmlsecwglobalstate.h" +#include "xmlsecwinternalutils.h" + +// --------------------------------------------------------------------------- +// Get instance of key manager. +// --------------------------------------------------------------------------- +// +CXmlSecKeyManager* CXmlSecKeyManager::GetInstanceL() + { + XmlSecGlobalState* gs = XmlSecGetTls(); + CXmlSecKeyManager* self = gs->iKeyManager; + if(!self) + { + self = new (ELeave) CXmlSecKeyManager; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + gs->iKeyManager = self; + } + return self; + } + +// --------------------------------------------------------------------------- +// Return pointer to key manager (XMLSEC) +// --------------------------------------------------------------------------- +// +xmlSecKeysMngr* CXmlSecKeyManager::GetKeyManagerPtr() + { + return iKeyManager; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CXmlSecKeyManager::~CXmlSecKeyManager() + { + if(iKeyManager) + { + xmlSecKeysMngrDestroy(iKeyManager); + } + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CXmlSecKeyManager::ConstructL() + { + iKeyManager = xmlSecKeysMngrCreate(); + if(!iKeyManager) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKeyManagerInit); + } + + if(xmlSecCryptoAppDefaultKeysMngrInit(iKeyManager) < 0) + { + xmlSecKeysMngrDestroy(iKeyManager); + iKeyManager = NULL; + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKeyManagerInit); + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CXmlSecKeyManager::CXmlSecKeyManager() + { + } diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwsign.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwsign.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1037 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods used in sign and verification process. +* +*/ + +// XML Engine +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +// XML Sec +#include "xmlsec_crypto.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" +#include "xmlsec_xmldsig.h" +#include "xmlsec_templates.h" +#include "xmlsecc_x509.h" + +#include "xmlsecwsign.h" +#include "xmlsecwkeymanager.h" +#include "xmlsecwerrors.h" +#include "xmlsecwdefs.h" +#include "xmlsecwtemplate.h" +#include "xmlsecwinternalutils.h" +#include "xmlsecwglobalstate.h" + +namespace Sign + { +// --------------------------------------------------------------------------- +// Reset sign ctx +// --------------------------------------------------------------------------- +// +xmlSecDSigCtxPtr ResetCtxL(xmlSecDSigCtxPtr aCtx, CXmlSecKeyManager* aMngr) + { + xmlSecKeyPtr tmpKey = NULL; + if(!aMngr) + { + tmpKey = aCtx->signKey; + aCtx->signKey = NULL; + } + // destroy old ctx + xmlSecDSigCtxDestroy(aCtx); + // create new ctx + if(aMngr) + { + aCtx = xmlSecDSigCtxCreate(aMngr->GetKeyManagerPtr()); + } + else + { + aCtx = xmlSecDSigCtxCreate(NULL); + } + // add key if needed + if ( !aCtx ) + { + if ( tmpKey ) + { + xmlSecKeyDestroy( tmpKey ); + } + User::Leave( KErrNoMemory ); + } + + aCtx->signKey = tmpKey; + tmpKey = NULL; + return aCtx; + } + +// --------------------------------------------------------------------------- +// Read key from file +// --------------------------------------------------------------------------- +// +xmlSecKeyPtr ReadKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + CXmlSecSign::TXmlSecKeyType aKeyFormat) + { + if(aKeyFile.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + + xmlSecKeyPtr keyPtr = NULL; + char* file = XmlEngXmlCharFromDes8L(aKeyFile); + CleanupStack::PushL(file); + char* name = XmlEngXmlCharFromDes8L(aKeyName); + CleanupStack::PushL(name); + // load key - used method depend key type + if (aKeyFormat == CXmlSecSign::ERSAPrivate) + { + if(aKeyName.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + keyPtr = xmlSecCryptoAppKeyLoadWithName(file, xmlSecKeyDataFormatPkcs8Der, + name, NULL, NULL, NULL); + } + else if (aKeyFormat == CXmlSecSign::ERSAPublic) + { + if(aKeyName.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + keyPtr = xmlSecCryptoAppKeyLoadWithName(file, xmlSecKeyDataFormatDer, + name, NULL, NULL, NULL); + } + else if (aKeyFormat == CXmlSecSign::EHMAC) + keyPtr = xmlSecKeyReadBinaryFile(xmlSecKeyDataHmacId,file); + + if(!keyPtr) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKey); + } + const xmlChar* KTmpName = NULL; + if(aKeyName.Length()) + { + KTmpName = (xmlChar*) name; + } + // add key name to key + if((aKeyFormat == CXmlSecSign::EHMAC) && (xmlSecKeySetName(keyPtr,KTmpName) < 0)) + { + xmlSecKeyDestroy(keyPtr); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKey); + } + + CleanupStack::PopAndDestroy(name); + CleanupStack::PopAndDestroy(file); + return keyPtr; + } + +// --------------------------------------------------------------------------- +// Read key from buffer +// --------------------------------------------------------------------------- +// +xmlSecKeyPtr ReadKeyFromBufferL(const TDesC8& aBuffer, + const TDesC8& aKeyName, + CXmlSecSign::TXmlSecKeyType aKeyFormat) + { + if(aBuffer.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + char* name = XmlEngXmlCharFromDes8L(aKeyName); + CleanupStack::PushL(name); + xmlSecKeyPtr keyPtr = NULL; + // load key - used method depend key type + if (aKeyFormat == CXmlSecSign::ERSAPrivate) + { + if(aKeyName.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + keyPtr = xmlSecCryptoAppKeyLoadMemoryWithName(aBuffer.Ptr(), aBuffer.Size(), + xmlSecKeyDataFormatPkcs8Der, name, NULL, NULL, NULL); + } + else if (aKeyFormat == CXmlSecSign::ERSAPublic) + { + if(aKeyName.Length() == 0) + { + User::Leave(KErrWrongParameter); + } + keyPtr = xmlSecCryptoAppKeyLoadMemoryWithName(aBuffer.Ptr(), aBuffer.Size(), + xmlSecKeyDataFormatDer, name, NULL, NULL, NULL); + } + else if (aKeyFormat == CXmlSecSign::EHMAC) + keyPtr = xmlSecKeyReadMemory(xmlSecKeyDataHmacId,aBuffer.Ptr(), aBuffer.Size()); + + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + if(!keyPtr) + { + User::Leave(KErrKey); + } + + const xmlChar* KTmpName = NULL; + if(aKeyName.Length()) + { + KTmpName = (xmlChar*) name; + } + // add key name to key + if((aKeyFormat == CXmlSecSign::EHMAC) && (xmlSecKeySetName(keyPtr,KTmpName) < 0)) + { + xmlSecKeyDestroy(keyPtr); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrKey); + } + CleanupStack::PopAndDestroy(name); + return keyPtr; + } + +// --------------------------------------------------------------------------- +// Reset template settings +// --------------------------------------------------------------------------- +// +void TemplateCleanup(TAny* aPref) + { + if(aPref) + { + delete aPref; + xmlSetPrefix(NULL); + } + xmlSetNewLineFlag(1); + } + + }// namespace Sign + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlSecSign* CXmlSecSign::NewLC() + { + CXmlSecSign* self = new (ELeave) CXmlSecSign; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CXmlSecSign* CXmlSecSign::NewL() + { + CXmlSecSign* self = CXmlSecSign::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Sign the xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlDocumentL(RXmlEngDocument& aDocument, + TBool aUseCurrentKey) + { + if(aDocument.IsNull()) + { + User::Leave(KErrWrongParameter); + } + return SignXmlNodeL(aDocument.DocumentElement(),aUseCurrentKey); + } + +// --------------------------------------------------------------------------- +// Sign the xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromFileL(RXmlEngDocument& aDocument, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + if(EFalse == iTemplate.IsSameNode(aTemplate)) + { + SetTemplateL(aTemplate); + } + iSkipTmplLookUp = ETrue; //Set to TRUE indicating to skip searching for Template in document + return SignXmlDocumentL(aDocument); + } + +// --------------------------------------------------------------------------- +// Sign the xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromFileL(RXmlEngDocument& aDocument, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + return SignXmlDocumentL(aDocument); + } + +// --------------------------------------------------------------------------- +// Sign the xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromBufferL(RXmlEngDocument& aDocument, + RXmlEngDocument& aTemplate, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + if(EFalse == iTemplate.IsSameNode(aTemplate)) + { + SetTemplateL(aTemplate); + } + iSkipTmplLookUp = ETrue; //Set to TRUE indicating to skip searching for Template in document + return SignXmlDocumentL(aDocument); + } + +// --------------------------------------------------------------------------- +// Sign the xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlDocumentKeyFromBufferL(RXmlEngDocument& aDocument, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyFormat); + return SignXmlDocumentL(aDocument); + } + + +// --------------------------------------------------------------------------- +// Sign the xml node +// --------------------------------------------------------------------------- +// +TXmlEngElement CXmlSecSign::SignXmlNodeL(TXmlEngElement aNode, TBool aUseCurrentKey) + { + TXmlEngElement ele; + TBool add = FALSE; + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + // Reset ctxt + if(aUseCurrentKey) + { + iSigCtx = NULL; + tmpCtx = Sign::ResetCtxL(tmpCtx,NULL); + iSigCtx = tmpCtx; + } + else + { + if(!iMngr) + { + iMngr = CXmlSecKeyManager::GetInstanceL(); + } + iSigCtx = NULL; + tmpCtx = Sign::ResetCtxL(tmpCtx,iMngr); + iSigCtx = tmpCtx; + } + + xmlNodePtr node = NULL; + + // skip if there is a template already available which may or may not contain Signature(from document) + if(EFalse == iSkipTmplLookUp) + { + // find in aNode + node = xmlSecFindNode(xmlDocGetRootElement(INTERNAL_NODEPTR(aNode)->doc), + xmlSecNodeSignature, xmlSecDSigNs); + } + TXmlEngElement sign(node); + if(!node) + { + if(iTemplate.NotNull()) + { + // process template + node = xmlSecFindNode(xmlDocGetRootElement(INTERNAL_DOCPTR(iTemplate)), + xmlSecNodeSignature, xmlSecDSigNs); + if(!node) + { + User::Leave(KErrTemplate); + } + node = xmlCopyNode(node, 1); + if(!node) + { + User::Leave(KErrNoMemory); + } + // add template to document that should be signed + sign = TXmlEngElement(node); + aNode.AppendChildL(sign); + add = TRUE; + } + } + + // sign the data + if(xmlSecDSigCtxSign(tmpCtx, node) < 0) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrSign); + } + if(add) + { + sign.Unlink(); + } + iSkipTmplLookUp = EFalse; // Reset the Flag + return sign; + } + +// --------------------------------------------------------------------------- +// Sign the xml nodes +// --------------------------------------------------------------------------- +// +EXPORT_C TXmlEngElement CXmlSecSign::SignXmlNodesL(RArray& aNodes, + TBool aUseCurrentKey) + { + if(!aNodes.Count()) + { + User::Leave(KErrWrongParameter); + } + return SignXmlNodeL(aNodes[0].OwnerDocument().DocumentElement(),aUseCurrentKey); + } + +// --------------------------------------------------------------------------- +// Verify xml node +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlNodeL(TXmlEngElement aNode, + TXmlSecVerificationKeyRepository aKeyRepository) + { + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + + // Reset ctxt + if( aKeyRepository == EThisObject ) + { + iSigCtx = NULL; + tmpCtx = Sign::ResetCtxL(tmpCtx,iMngr); + iSigCtx = tmpCtx; + } + else + { + if(!iMngr) + { + iMngr = CXmlSecKeyManager::GetInstanceL(); + } + iSigCtx = NULL; + tmpCtx = Sign::ResetCtxL(tmpCtx,iMngr); + iSigCtx = tmpCtx; + } + // should cert store be used + if ( aKeyRepository == ECertStore ) + { + xmlSecSetCertStoreFlag(); + } + // verify data + if (xmlSecDSigCtxVerify(tmpCtx, INTERNAL_NODEPTR(aNode)) < 0) + { + if ( aKeyRepository == ECertStore ) + { + xmlSecResetCertStoreFlag(); + } + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrVerify); + } + // check result + if (tmpCtx->status == xmlSecDSigStatusSucceeded) + { + if ( aKeyRepository == ECertStore ) + { + xmlSecResetCertStoreFlag(); + } + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// Verify xml node +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlNodeKeyFromFileL(TXmlEngElement aNode, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyType); + return VerifyXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Verify xml node +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlNodeKeyFromBufferL(TXmlEngElement aNode, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyType); + return VerifyXmlNodeL(aNode); + } + +// --------------------------------------------------------------------------- +// Verify xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlDocumentL(const RXmlEngDocument& aDocument, + TXmlSecVerificationKeyRepository aKeyRepository) + { + xmlNodePtr node = NULL; + TXmlEngNode tmpNode = aDocument.DocumentElement(); + xmlNodePtr root = INTERNAL_NODEPTR(tmpNode); + node = xmlSecFindNode(root,xmlSecNodeSignature, xmlSecDSigNs); + if(!node) + { + User::Leave(KErrVerify); + } + return VerifyXmlNodeL(TXmlEngElement(node),aKeyRepository); + } + +// --------------------------------------------------------------------------- +// Verify xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlDocumentKeyFromFileL(const RXmlEngDocument& aDocument, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType) + { + SetKeyFromFileL(aKeyFile,aKeyName,aKeyType); + return VerifyXmlDocumentL(aDocument); + } + +// --------------------------------------------------------------------------- +// Verify xml document +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CXmlSecSign::VerifyXmlDocumentKeyFromBufferL(const RXmlEngDocument& aDocument, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType) + { + SetKeyFromBufferL(aKey,aKeyName,aKeyType); + return VerifyXmlDocumentL(aDocument); + } + +// --------------------------------------------------------------------------- +// Set template from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetTemplateFromFileL(const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromFileL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set template from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetTemplateFromFileL(RFs& aRFs, const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromFileL(iTemplate,aTemplate,aRFs); + } + +// --------------------------------------------------------------------------- +// Set template from buffer +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetTemplateFromBufferL(const TDesC8& aTemplate) + { + XmlSecTemplate::SetTemplateFromBufferL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set template from DOM tree +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetTemplateL(const RXmlEngDocument& aTemplate) + { + XmlSecTemplate::SetTemplateL(iTemplate,aTemplate); + } + +// --------------------------------------------------------------------------- +// Set key info node in template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetKeyInfoL(const TDesC8& aKeyName) + { + XmlSecTemplate::SetKeyInfoL(iTemplate,aKeyName); + } + +// --------------------------------------------------------------------------- +// Set key info node in template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetKeyInfoL(TXmlEngElement aKeyProp) + { + XmlSecTemplate::SetKeyInfoL(iTemplate,aKeyProp); + } + +// --------------------------------------------------------------------------- +// Create template +// --------------------------------------------------------------------------- +// +EXPORT_C const RXmlEngDocument& CXmlSecSign::CreateTemplateL(TXmlSecKeyType aKeyFormat, + RArray& aNodes, + const TDesC8& aId, + TBool aX509Cert, + TUint aTransform, + const TDesC8& aPref, + TBool aNewLine) + { + _LIT8(KSep,":"); + _LIT8(KPoint,"#"); + if(iTemplate.NotNull()) + { + iTemplate.Close(); + } + + if(!aNewLine) + { + xmlSetNewLineFlag(0); + } + + unsigned char* pref = NULL; + if(aPref.Length()) + { + pref = (unsigned char*) XmlEngXmlCharFromDes8L(aPref); + xmlSetPrefix(pref); + } + CleanupStack::PushL(TCleanupItem(Sign::TemplateCleanup,(TAny*)pref)); + + xmlNodePtr signNode = NULL; + xmlNodePtr refNode = NULL; + xmlNodePtr keyInfoNode = NULL; + + if((aKeyFormat == ERSAPrivate) || (aKeyFormat == ERSAPublic)) + { + // create signature template for RSA-SHA1 enveloped signature + signNode = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId, + xmlSecTransformRsaSha1Id, NULL); + } + else if(aKeyFormat == CXmlSecSign::EHMAC) + { + // create signature template for HMAC-SHA1 enveloped signature + signNode = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId, + xmlSecTransformHmacSha1Id, NULL); + + } + if(!signNode) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + CleanupStack::PushL(TCleanupItem(LibxmlNodeCleanup,(TAny*)signNode)); + + TInt nodeCount = aNodes.Count(); + if(!nodeCount) + { + // add reference + refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id, + NULL, NULL, NULL); + if(!refNode) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + if(KEnvelopedSignature & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + if(KC14N & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformInclC14NId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + else if(KExclusiveC14N & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformExclC14NId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + } + else + { + TPtrC8 nameSpace = KNullDesC8(); + TPtrC8 uriVal = KNullDesC8(); + TXmlEngString str; + TInt pos = aId.Find(KSep); + // check id of element + if(pos > 0) + { + nameSpace.Set(aNodes[0].LookupNamespaceUriL(aId.Left(pos))); + if(!nameSpace.Length()) + { + //xmlFreeNode( signNode ); + if (OOM_FLAG) + { + XmlEngLeaveOOML(); + } + XmlSecErrorFlagTestL(); + User::Leave(KErrIdUndefineNS); + } + } + // for all elements with id add reference + TXmlEngElement elem; + for(TInt i = 0; i < nodeCount; i++) + { + elem = aNodes[i]; + uriVal.Set(elem.AttributeValueL(aId.Right(aId.Length() - (pos + 1)),nameSpace)); + if(uriVal.Length()) + { + str.SetL(KPoint); + CleanupClosePushL(str); + TXmlEngString str2; + str2.SetL(uriVal); + CleanupClosePushL(str2); + str.AppendL(str2); + CleanupStack::PopAndDestroy(&str2); + // add reference + refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id, + NULL, (unsigned char*)str.Cstring(), NULL); + CleanupStack::PopAndDestroy(&str); + if(!refNode) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + + if(KEnvelopedSignature & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + if(KC14N & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformInclC14NId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + else if(KExclusiveC14N & aTransform) + { + // add enveloped transform + if(!xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformExclC14NId)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + } + } + } + + // add and + keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL); + if(!keyInfoNode) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + if(aKeyFormat != CXmlSecSign::EHMAC && aX509Cert) + { + if(!xmlSecTmplKeyInfoAddX509Data(keyInfoNode)) + { + //xmlFreeNode( signNode ); + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrTemplate); + } + } + + xmlDocPtr doc = xmlNewDoc(NULL); + xmlNodePtr tmpNode = xmlAddChild(INTERNAL_NODEPTR(doc), signNode); + if(!tmpNode) + { + xmlFreeDoc(doc); + //xmlFreeNode(signNode); + User::Leave(KErrNoMemory); + } + CleanupStack::Pop(signNode); + // return created template + RXmlEngDocument retDoc; + XmlSecGlobalState* gs = XmlSecGetTls(); + retDoc.OpenL(*gs->iDOMImpl,doc); + iTemplate = retDoc; + CleanupStack::PopAndDestroy(); + return iTemplate; + } + +// --------------------------------------------------------------------------- +// Create template +// --------------------------------------------------------------------------- +// +EXPORT_C const RXmlEngDocument& CXmlSecSign::CreateTemplateL(TXmlSecKeyType aKeyFormat, + TBool aX509Cert, + TUint aTransform, + const TDesC8& aPref, + TBool aNewLine) + { + RArray array; + CleanupClosePushL(array); + CreateTemplateL(aKeyFormat,array,KNullDesC8(),aX509Cert,aTransform,aPref,aNewLine); + CleanupStack::PopAndDestroy(&array); + return iTemplate; + } + +// --------------------------------------------------------------------------- +// Return current encryption template +// --------------------------------------------------------------------------- +// +EXPORT_C const RXmlEngDocument& CXmlSecSign::CurrentTemplate() const + { + return iTemplate; + } + +// --------------------------------------------------------------------------- +// Destroy current encryption template +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::DestroyCurrentTemplate() + { + XmlSecTemplate::DestroyTemplate(iTemplate); + } + +// --------------------------------------------------------------------------- +// Read key from buffer and puts it in SymbianKeyStore +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetKeyFromBufferL(const TDesC8& aBuffer, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + if(tmpCtx->signKey) + { + xmlSecKeyDestroy(tmpCtx->signKey); + tmpCtx->signKey = NULL; + } + tmpCtx->signKey = Sign::ReadKeyFromBufferL(aBuffer,aKeyName,aKeyFormat); + } + +// --------------------------------------------------------------------------- +// Read key from file and puts it in SymbianKeyStore +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyFormat) + { + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + if(tmpCtx->signKey) + { + xmlSecKeyDestroy(tmpCtx->signKey); + tmpCtx->signKey = NULL; + } + tmpCtx->signKey = Sign::ReadKeyFromFileL(aKeyFile,aKeyName,aKeyFormat); + } + +// --------------------------------------------------------------------------- +// Read certificate from file +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetCertFromFileL(const TDesC8& aCertFile) + { + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + + if(!tmpCtx->signKey) + { + User::Leave(KErrKey); + } + const TInt length = aCertFile.Length(); + char* cStringFileName = new char[ length+1 ]; + if (!cStringFileName) + { + User::Leave( KErrNoMemory ); + } + // copy cert data + memcpy(cStringFileName, (char*) aCertFile.Ptr(), length); + cStringFileName[ length ] = NULL; + // read cert data, add cert to key + if(xmlSecCryptoAppKeyCertLoad(tmpCtx->signKey, cStringFileName, xmlSecKeyDataFormatDer) < 0) + { + delete[] cStringFileName; + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrCert); + } + delete[] cStringFileName; + } + +// --------------------------------------------------------------------------- +// Read certificate from buffer +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::SetCertFromBufferL(const TDesC8& aCert) + { + xmlSecDSigCtxPtr tmpCtx = SIG_CTX; + + if(!tmpCtx->signKey) + { + User::Leave(KErrKey); + } + // add cert data to key + if(xmlSecSymbianCryptoAppKeyCertLoadMemory(tmpCtx->signKey,aCert.Ptr(),aCert.Size(), + xmlSecKeyDataFormatDer) < 0) + { + User::Leave(KErrCert); + } + } + +// --------------------------------------------------------------------------- +// Add cert from file to root's cert chain +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::AddTrustedCertFromFileL(const TDesC8& aCertFile) + { + if(!iMngr) + { + iMngr = CXmlSecKeyManager::GetInstanceL(); + } + const TInt length = aCertFile.Length(); + char* cStringFileName = new char[ length+1 ]; + if (!cStringFileName) + { + User::Leave( KErrNoMemory ); + } + memcpy(cStringFileName, (char*) aCertFile.Ptr(), length); + cStringFileName[ length ] = NULL; + // load cert data + if(xmlSecCryptoAppKeysMngrCertLoad(iMngr->GetKeyManagerPtr(), cStringFileName, + xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted) < 0) + { + delete[] cStringFileName; + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrCert); + } + delete[] cStringFileName; + } + +// --------------------------------------------------------------------------- +// Add cert from buffer to root's cert chain +// --------------------------------------------------------------------------- +// +EXPORT_C void CXmlSecSign::AddTrustedCertFromBufferL(const TDesC8& aCert) + { + if(!iMngr) + { + iMngr = CXmlSecKeyManager::GetInstanceL(); + } + if(xmlSecCryptoAppKeysMngrCertLoadMemory(iMngr->GetKeyManagerPtr(), aCert.Ptr(), + aCert.Size(), xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted) < 0) + { + XmlEngOOMTestL(); + XmlSecErrorFlagTestL(); + User::Leave(KErrCert); + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CXmlSecSign::CXmlSecSign() + { + iTemplate = RXmlEngDocument(); + iSigCtx = NULL; + iSkipTmplLookUp = EFalse; //Initialize the flag to FALSE + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CXmlSecSign::ConstructL() + { + // create sign context + iSigCtx = xmlSecDSigCtxCreate(NULL); + if(!iSigCtx) + { + User::Leave(KErrNoMemory); + } + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CXmlSecSign::~CXmlSecSign() + { + if(iTemplate.NotNull()) + { + iTemplate.Close(); + } + if(iSigCtx) + { + xmlSecDSigCtxDestroy(SIG_CTX); + } + } + diff -r 000000000000 -r e35f40988205 xmlsecurityengine/xmlsecwrapper/src/xmlsecwtemplate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsecurityengine/xmlsecwrapper/src/xmlsecwtemplate.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods used in encryption and decryption process. +* +*/ + +#include +#include + +#include "xmlsecwerrors.h" +#include "xmlsecwdefs.h" +#include "xmlsecwtemplate.h" + +#include "xmlsec_templates.h" +#include "xmlsec_xmlsec.h" +#include "xmlsec_xmltree.h" + +#include +#include +#include + +// --------------------------------------------------------------------------- +// Set Template +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetTemplateL(RXmlEngDocument& aTemplate, const RXmlEngDocument& aInput) + { + if(aInput.IsNull()) + { + User::Leave(KErrTemplate); + }; + if(aTemplate.NotNull()) + { + aTemplate.Close(); + } + aTemplate = aInput.CloneDocumentL(); + } + +// --------------------------------------------------------------------------- +// Set Template from file +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetTemplateFromFileL(RXmlEngDocument& aTemplate, + const TDesC8& aFile, + RFs& aRFs) + { + if(aTemplate.NotNull()) + { + aTemplate.Close(); + } + // load template + HBufC16* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aFile); + CleanupStack::PushL(buf); + RXmlEngDOMImplementation dom; + dom.OpenL(); + CleanupClosePushL(dom); + RXmlEngDOMParser parser; + User::LeaveIfError(parser.Open(dom)); + CleanupClosePushL(parser); + aTemplate = parser.ParseFileL(aRFs,buf->Des()); + CleanupStack::PopAndDestroy(&parser); + CleanupStack::PopAndDestroy(&dom); + CleanupStack::PopAndDestroy(buf); + } + +// --------------------------------------------------------------------------- +// Set Template from file +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetTemplateFromFileL(RXmlEngDocument& aTemplate, const TDesC8& aFile) + { + RFs rfs; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + XmlSecTemplate::SetTemplateFromFileL(aTemplate, aFile, rfs); + CleanupStack::PopAndDestroy(&rfs); + } + +// --------------------------------------------------------------------------- +// Set Template from buffer +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetTemplateFromBufferL(RXmlEngDocument& aTemplate,const TDesC8& aBuffer) + { + if(aTemplate.NotNull()) + { + aTemplate.Close(); + } + // load template + RXmlEngDOMImplementation dom; + dom.OpenL(); + CleanupClosePushL(dom); + RXmlEngDOMParser parser; + User::LeaveIfError(parser.Open(dom)); + CleanupClosePushL(parser); + aTemplate = parser.ParseL(aBuffer); + CleanupStack::PopAndDestroy(&parser); + CleanupStack::PopAndDestroy(&dom); + } + +// --------------------------------------------------------------------------- +// Destroy Template +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::DestroyTemplate(RXmlEngDocument& aTemplate) + { + if(aTemplate.NotNull()) + { + aTemplate.Close(); + } + } + +// --------------------------------------------------------------------------- +// Add element to node and set the value of it. +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetKeyInfoL(RXmlEngDocument& aTemplate, const TDesC8& aKeyName) + { + if(!aKeyName.Compare(KNullDesC8)) + { + User::Leave(KErrWrongParameter); + } + if(aTemplate.IsNull()) + { + User::Leave(KErrTemplate); + } + xmlNodePtr keyInfo = NULL; + TXmlEngNode tmpNode = aTemplate.DocumentElement(); + xmlNodePtr root = INTERNAL_NODEPTR(tmpNode); + keyInfo = xmlSecFindNode(root,xmlSecNodeKeyInfo, xmlSecDSigNs); + if(!keyInfo) + { + User::Leave(KErrTemplate); + } + TXmlEngElement(keyInfo).RemoveChildren(); + char* name = XmlEngXmlCharFromDes8L(aKeyName); + root = xmlSecTmplKeyInfoAddKeyName(keyInfo,(unsigned char*)name); + delete name; + if(!root) + { + User::Leave(KErrNoMemory); + } + } + +// --------------------------------------------------------------------------- +// Add element to node. +// --------------------------------------------------------------------------- +// +void XmlSecTemplate::SetKeyInfoL(RXmlEngDocument& aTemplate, TXmlEngElement aKeyProp) + { + if(aKeyProp.IsNull()) + { + User::Leave(KErrWrongParameter); + } + if(aTemplate.IsNull()) + { + User::Leave(KErrTemplate); + } + xmlNodePtr keyInfo = NULL; + TXmlEngNode tmpNode = aTemplate.DocumentElement(); + xmlNodePtr root = INTERNAL_NODEPTR(tmpNode); + keyInfo = xmlSecFindNode(root,xmlSecNodeKeyInfo, xmlSecDSigNs); + if(!keyInfo) + { + User::Leave(KErrTemplate); + } + TXmlEngElement keyIn(keyInfo); + keyIn.RemoveChildren(); + keyIn.AppendChildL(aKeyProp); + } diff -r 000000000000 -r e35f40988205 xmlsrv_info/xmlsrv_metadata/xmlsrv_metadata.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_info/xmlsrv_metadata/xmlsrv_metadata.mrp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,6 @@ +component xmlsrv_metadata +source \sf\os\xmlsrv\xmlsrv_info\xmlsrv_metadata +source \sf\os\xmlsrv\package_definition.xml +source \sf\os\xmlsrv\distribution.policy.s60 +notes_source \component_defs\release.src +ipr T diff -r 000000000000 -r e35f40988205 xmlsrv_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../../inc/xmlsrv.hrh" + +#include "../xml_encryption_api/group/bld.inf" +#include "../xml_signature_api/group/bld.inf" +#include "../xml_security_engine_utils_api/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XML Encryption API +* +*/ + + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/xmlsecwencrypt.h OS_LAYER_PLATFORM_EXPORT_PATH(xmlsecwencrypt.h) diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/inc/xmlsecwencrypt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/inc/xmlsecwencrypt.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods used in encryption and decryption process. +* +*/ + + + + + + + +#ifndef C_ENCRYPT_H +#define C_ENCRYPT_H + +#include +#include + +#include + +class CXmlSecKeyManager; + +/** + * Class used to encrypt/decrypt data. + * + * How to use: + * + * Encryption: + *

+ *  1. Create new object:
+ *          CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC();      
+ *  2. Set the key that should be used during encryption: 
+ *          enc->SetKeyFromFileL(filename, keyname, CXmlSecEncrypt::E3DES);
+ *  3. Set template for encryption: 
+ *          enc->SetTemplateFromFileL(templatefile);
+ *  4. Encrypt data from buffer:
+ *          doc = enc->EncryptDataL(data);
+ *     data will be added to template or encrypt xml node: 
+ *	        enc->EncryptXmlNodeL(doc.DocumentElement()); 
+ *     node will be replaced by template with encrypted data
+ *  
+ * + * Decryption: + *
+ *  1. Create new object:
+ *          CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC();
+ *  2. Set the key that should be used during decryption:  
+ *          enc->SetKeyFromFileL(keyfile,keyname,CXmlSecEncrypt::EAES256);
+ *  3. Decrypt xml node:
+ *          enc->DecryptXmlNodeL(doc.DocumentElement()); 
+ *   Function will replace encryption template with encrypted data. If result of encryption will
+ *   not be a document then result will be returned as HBufC8*.
+ *  
+ * + * @note Key should be set before encryption + * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +class CXmlSecEncrypt : public CBase + { +public: + /** + * Key types. + * Currently symmetric key (AES (256 bit) or 3DES) + */ + enum TXmlSecKeyType + { + EAES256 = 0, + E3DES + }; + + /** + * Encryption data types + */ + enum TXmlSecDataType + { + ENode = 0, + ENodeContent, + EData + }; + +public: + /** + * Creates new object. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CXmlSecEncrypt* NewL(); + + /** + * Creates new object and puts it on cleanup stack. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CXmlSecEncrypt* NewLC(); + + /** + * Destructor. + * + * @since S60 v3.2 + */ + virtual ~CXmlSecEncrypt(); + + /** + * Encrypts data from buffer. + * + * @since S60 v3.2 + * @param aData data that should be encrypted + * @return xml document with encrypted data + */ + IMPORT_C RXmlEngDocument EncryptDataL(const TDesC8& aData); + + /** + * Encrypts xml document. + * + * @since S60 v3.2 + * @param aDocument xml document that should be encrypted. + * + * @note Encrypted content will replace aDocument content. + * aDocument contains the result. + */ + IMPORT_C void EncryptXmlDocumentL(RXmlEngDocument& aDocument); + + /** + * Encrypts xml node. + * + * @since S60 v3.2 + * @param aNode xml node that should be encrypted. + * + * @note Encrypted content will replace aNode. + * aNode contains the result. + */ + IMPORT_C void EncryptXmlNodeL(TXmlEngElement aNode); + + /** + * Encrypts xml node. + * + * @since S60 v3.2 + * @param aNode xml node that should be encrypted. + * @param aTemplate DOM tree with template document + * @param aKeyFile name of the file with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * + * @note Encrypted content will replace aNode. + * aNode contains the result. + */ + IMPORT_C void EncryptXmlNodeKeyFromFileL(TXmlEngElement aNode, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + /** + * Encrypts xml document. + * + * @since S60 v3.2 + * @param aDocument xml document that should be encrypted. + * @param aTemplate DOM tree with template document + * @param aKeyFile name of the file with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * + * @note Encrypted content will replace aNode. + * aNode contains the result. + */ + IMPORT_C void EncryptXmlDocumentKeyFromFileL(RXmlEngDocument& aDoc, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Encrypts xml node. + * + * @since S60 v3.2 + * @param aNode xml node that should be encrypted. + * @param aTemplate DOM tree with template document + * @param aKey buffer with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * + * @note Encrypted content will replace aNode. + * aNode contains the result. + */ + IMPORT_C void EncryptXmlNodeKeyFromBufferL(TXmlEngElement aNode, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + /** + * Encrypts xml document. + * + * @since S60 v3.2 + * @param aDocument xml document that should be encrypted. + * @param aTemplate DOM tree with template document + * @param aKey buffer with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * + * @note Encrypted content will replace aNode. + * aNode contains the result. + */ + IMPORT_C void EncryptXmlDocumentKeyFromBufferL(RXmlEngDocument& aDoc, + RXmlEngDocument& aTemplate, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Decrypts data contained in a node. + * + * @since S60 v3.2 + * @param aNode element (see XML Encryption recommendation) + * @return Decryption result. If xml data will be a result then it will replace aNode content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlNodeL(TXmlEngElement aNode); + + /** + * Decrypts data contained in xml DOM tree. + * + * @since S60 v3.2 + * @param aDocument DOM tree with encrypted data + * @return Decryption result. If xml data will be a result then it will replace aDocument content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlDocumentL(RXmlEngDocument& aDocument); + + /** + * Decrypts xml node. + * + * @since S60 v3.2 + * @param aNode xml node that should be decrypted. + * @param aKeyFile name of the file with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * @return Decryption result. If xml data will be a result then it will replace aDocument content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlNodeKeyFromFileL(TXmlEngElement aNode, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + /** + * Decrypts xml document. + * + * @since S60 v3.2 + * @param aDocument xml document that should be decrypted. + * @param aKeyFile name of the file with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * @return Decryption result. If xml data will be a result then it will replace aDocument content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlDocumentKeyFromFileL(RXmlEngDocument& aDocument, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Decrypts xml node. + * + * @since S60 v3.2 + * @param aNode xml node that should be decrypted. + * @param aKey buffer with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * @return Decryption result. If xml data will be a result then it will replace aDocument content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlNodeKeyFromBufferL(TXmlEngElement aNode, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + /** + * Decrypts xml document. + * + * @since S60 v3.2 + * @param aDocument xml document that should be decrypted. + * @param aKey buffer with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + * @return Decryption result. If xml data will be a result then it will repleace aDocument content + * and null will be returned. If result type will be different then result will be returned + * in HBufC8 pointer. + */ + IMPORT_C HBufC8* DecryptXmlDocumentKeyFromBufferL(RXmlEngDocument& aDocument, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Sets encryption template (parses template file). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template file + */ + IMPORT_C void SetTemplateFromFileL(const TDesC8& aTemplate); + + /** + * Sets encryption template (parses template file). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aRFs handle to a file server session. + * @param aTemplate template file + */ + IMPORT_C void SetTemplateFromFileL(RFs& aRFs, + const TDesC8& aTemplate); + + /** + * Sets encryption template (parses buffer that contains template xml). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template xml in buffer + */ + IMPORT_C void SetTemplateFromBufferL(const TDesC8& aTemplate); + + /** + * Set copy of the argument as a encryption template. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate DOM tree with template document + */ + IMPORT_C void SetTemplateL(const RXmlEngDocument& aTemplate); + + /** + * Adds element to node and sets the value of it. + * The element will be added to current template. + * + * @since S60 v3.2 + * @param aKeyName Key name that should be set. + */ + IMPORT_C void SetKeyInfoL(const TDesC8& aKeyName); + + /** + * Adds element to node. This method allows to add specific data + * to element. + * The element will be added to current template. + * + * @since S60 v3.2 + * @param aKeyProp Element that should be set. + */ + IMPORT_C void SetKeyInfoL(TXmlEngElement aKeyProp); + + /** + * Creates encryption template. Template will be created for specific key algorithm. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aKeyType Key algorithm + * @param aDataType Type of encrypted data. It can be xml node or data. + * @return template document + */ + IMPORT_C const RXmlEngDocument& CreateTemplateL(TXmlSecKeyType aKeyType, + TXmlSecDataType aDataType = CXmlSecEncrypt::ENode); + + /** + * Return current encryption template. + * + * @since S60 v3.2 + * @return template document + */ + IMPORT_C const RXmlEngDocument& CurrentTemplate() const; + + /** + * Destroys current template. + * + * @since S60 v3.2 + */ + IMPORT_C void DestroyCurrentTemplate(); + + /** + * Reads key from file. Key will be used during encrypt/decrypt action until + * new key will be set. + * + * @since S60 v3.2 + * @param aKeyFile name of the file with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyFormat key algorithm (i.e. AES) + */ + IMPORT_C void SetKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Reads key from buffer. Key will be used during encrypt/decrypt action until + * new key will be set. + * + * @since S60 v3.2 + * @param aKey buffer with key inside + * @param aKeyName name of the key. In case of AES and 3DES it can be null. + * @param aKeyType key algorithm (i.e. AES) + */ + IMPORT_C void SetKeyFromBufferL(const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + +private: + /** + * Default constructor. + * + * @since S60 v3.2 + */ + CXmlSecEncrypt(); + + /** + * Second phase constructor. + * + * @since S60 v3.2 + */ + void ConstructL(); + +private: + /** + * DOM tree with template + */ + RXmlEngDocument iTemplate; + + /** + * Encryption context + */ + void* iEncCtx; + + /** + * Key manager + */ + CXmlSecKeyManager* iMngr; + }; + +#endif // C_ENCRYPT_H diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/bwinscw/test_xmlsecencrypt.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/bwinscw/test_xmlsecencrypt.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/conf/XmlSecEncryptTester.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/conf/XmlSecEncryptTester.cfg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,186 @@ +[Define] +DESKEY e:\testing\data\xmlsecurity\encrypt\deskey.bin +AESKEY e:\testing\data\xmlsecurity\encrypt\aeskey.bin +WRNGKEY e:\testing\data\xmlsecurity\encrypt\wrokey.bin +TMPL e:\testing\data\xmlsecurity\encrypt\template.xml +WRNGTMPL e:\testing\data\xmlsecurity\encrypt\wrongtemplate.xml +AESDOC e:\testing\data\xmlsecurity\encrypt\aes_cont.xml +DESDOC e:\testing\data\xmlsecurity\encrypt\3des_doc.xml +AESELM e:\testing\data\xmlsecurity\encrypt\aes_elem.xml +AESDATA e:\testing\data\xmlsecurity\encrypt\aes_data.xml +[Enddefine] + +[Test] +title NewLL +create test_xmlsecencrypt test +test Test-NewLL +delete test +[Endtest] + +[Test] +title NewLC +create test_xmlsecencrypt test +test Test-NewLC +delete test +[Endtest] + +[Test] +title EncryptDataLL +create test_xmlsecencrypt test +test Test-EncryptDataLL DESKEY AESKEY TMPL +delete test +[Endtest] + +[Test] +title EncryptXmlDocumentLL +create test_xmlsecencrypt test +test Test-EncryptXmlDocumentLL DESKEY +delete test +[Endtest] + +[Test] +title EncryptXmlDocumentKeyFromFileLL +create test_xmlsecencrypt test +test Test-EncryptXmlDocumentKeyFromFileLL DESKEY +delete test +[Endtest] + +[Test] +title EncryptXmlDocumentKeyFromBufferLL +create test_xmlsecencrypt test +test Test-EncryptXmlDocumentKeyFromBufferLL +delete test +[Endtest] + +[Test] +title EncryptXmlNodeLL +create test_xmlsecencrypt test +test Test-EncryptXmlNodeLL DESKEY AESKEY +delete test +[Endtest] + +[Test] +title EncryptXmlNodeKeyFromFileLL +create test_xmlsecencrypt test +test Test-EncryptXmlNodeKeyFromFileLL DESKEY +delete test +[Endtest] + +[Test] +title EncryptXmlNodeKeyFromBufferLL +create test_xmlsecencrypt test +test Test-EncryptXmlNodeKeyFromBufferLL +delete test +[Endtest] + +[Test] +title DecryptXmlNodeLL +create test_xmlsecencrypt test +test Test-DecryptXmlNodeLL DESKEY AESKEY AESDOC DESDOC +delete test +[Endtest] + +[Test] +title DecryptXmlNodeKeyFromFileLL +create test_xmlsecencrypt test +test Test-DecryptXmlNodeKeyFromFileLL AESKEY AESDOC +delete test +[Endtest] + +[Test] +title DecryptXmlNodeKeyFromBufferLL +create test_xmlsecencrypt test +test Test-DecryptXmlNodeKeyFromBufferLL AESDOC +delete test +[Endtest] + +[Test] +title DecryptXmlDocumentLL +create test_xmlsecencrypt test +test Test-DecryptXmlDocumentLL AESKEY AESELM AESDATA +delete test +[Endtest] + +[Test] +title DecryptXmlDocumentKeyFromFileLL +create test_xmlsecencrypt test +test Test-DecryptXmlDocumentKeyFromFileLL AESKEY AESELM AESDATA +delete test +[Endtest] + +[Test] +title DecryptXmlDocumentKeyFromBufferLL +create test_xmlsecencrypt test +test Test-DecryptXmlDocumentKeyFromBufferLL AESELM AESDATA +delete test +[Endtest] + +[Test] +title SetTemplateFromFileL_1L +create test_xmlsecencrypt test +test Test-SetTemplateFromFileL_1L TMPL WRNGTMPL +delete test +[Endtest] + +[Test] +title SetTemplateFromFileL_2L +create test_xmlsecencrypt test +test Test-SetTemplateFromFileL_2L TMPL +delete test +[Endtest] + +[Test] +title SetTemplateFromBufferLL +create test_xmlsecencrypt test +test Test-SetTemplateFromBufferLL +delete test +[Endtest] + +[Test] +title SetTemplateLL +create test_xmlsecencrypt test +test Test-SetTemplateLL TMPL +delete test +[Endtest] + +[Test] +title CreateTemplateLL +create test_xmlsecencrypt test +test Test-CreateTemplateLL +delete test +[Endtest] + +[Test] +title GetCurrentTemplateLL +create test_xmlsecencrypt test +test Test-GetCurrentTemplateLL +delete test +[Endtest] + +[Test] +title SetKeyFromFileLL +create test_xmlsecencrypt test +test Test-SetKeyFromFileLL DESKEY AESKEY +delete test +[Endtest] + +[Test] +title SetKeyFromBufferLL +create test_xmlsecencrypt test +test Test-SetKeyFromBufferLL WRNGKEY +delete test +[Endtest] + +[Test] +title SetKeyInfoL_1L +create test_xmlsecencrypt test +test Test-SetKeyInfoL_1L +delete test +[Endtest] + +[Test] +title SetKeyInfoL_2L +create test_xmlsecencrypt test +test Test-SetKeyInfoL_2L +delete test +[Endtest] \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/3des_doc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/3des_doc.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,11 @@ + + + + +name + + +Blz3okZURf1ceFnppqQdAW/WSz7hvQtEzmTxRjwDIlYSPsqcTTkVvlQ5h3Gumvvq +EG4zs5vriXk= + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_cont.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_cont.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,15 @@ + + + + + + +name + + +CWE3XO0QSKuY+v0E3IAWonJvK74oHYYPpBEqwUioowc= + + + + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_data.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_data.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,10 @@ + + + + +name + + +hGLiRO3Oky8k322ee5FGbQNnBka7s7bdbE6nSg7L39Y= + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_elem.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aes_elem.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,13 @@ + + + + + +name + + +tiZ9pO0DL7eR02i2DlzWWRHgEucvG/FT/RzeFfvJt9m5UoB6r/HWifSoaNEExN/0 + + + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aeskey.bin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/aeskey.bin Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +01234567012345670123456701234567 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/deskey.bin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/deskey.bin Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +012345670123456701234567 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/template.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/wrokey.bin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/wrokey.bin Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +wvdeeeee34232-23244:23311135dsg3dsf34dsf \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/wrongtemplate.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/data/mmc/xmlsecurity/encrypt/wrongtemplate.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2 @@ + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/eabi/test_xmlsecencrypt.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/eabi/test_xmlsecencrypt.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for xml_encryption_api test components +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +PRJ_TESTEXPORTS +PRJ_MMPFILES + +PRJ_TESTMMPFILES +test_xmlsecencrypt.mmp + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/group/test_xmlsecencrypt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/group/test_xmlsecencrypt.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file for test_xmlsecencrypt of xml_encryption_api test component +* +*/ +#include + + +TARGET test_xmlsecencrypt.dll +TARGETTYPE dll +//TARGETPATH /z/sys/bin +UID 0x1000af5a 0x01700000 + +#if defined(ARMCC) + DEFFILE ../eabi/test_xmlsecencrypt.def +#elif defined(WINSCW) || defined(WINS) + DEFFILE ../bwinscw/test_xmlsecencrypt.def +#endif + +CAPABILITY CAP_GENERAL_DLL + + +SOURCEPATH ../src +SOURCE xmlsecencrypttester.cpp +SOURCE xmlsecencrypttesterblocks.cpp + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/libc +USERINCLUDE ../inc + +LIBRARY stiftestinterface.lib +LIBRARY charconv.lib +LIBRARY efsrv.lib +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY InetProtUtil.lib +LIBRARY XmlEngineDom.lib +LIBRARY XmlSecWrapper.lib + +nostrictdef +epocallowdlldata \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/group/test_xmlsecencrypt.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/group/test_xmlsecencrypt.pkg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,63 @@ +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + +; Languages +&EN + +; Provide value for uid +#{"XmlSecEncryptTester"},(0x00000000),1,0,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\test_xmlsecencrypt.dll" - "c:\Sys\Bin\test_xmlsecencrypt.dll" + +;Init files +"..\init\TestFramework.ini"-"c:\testframework\TestFramework.ini" + +;Conf Files +"..\conf\XmlSecEncryptTester.cfg"-"c:\testing\conf\XmlSecEncryptTester.cfg" + +;Data files +"..\Data\mmc\xmlsecurity\encrypt\3des_doc.xml" - "c:\testing\data\xmlsecurity\encrypt\3des_doc.xml" +"..\Data\mmc\xmlsecurity\encrypt\aes_cont.xml" - "c:\testing\data\xmlsecurity\encrypt\aes_cont.xml " +"..\Data\mmc\xmlsecurity\encrypt\aes_data.xml" - "c:\testing\data\xmlsecurity\encrypt\aes_data.xml" +"..\Data\mmc\xmlsecurity\encrypt\aes_elem.xml" - "c:\testing\data\xmlsecurity\encrypt\aes_elem.xml" +"..\Data\mmc\xmlsecurity\encrypt\aeskey.bin" - "c:\testing\data\xmlsecurity\encrypt\aeskey.bin" +"..\Data\mmc\xmlsecurity\encrypt\deskey.bin" - "c:\testing\data\xmlsecurity\encrypt\deskey.bin" +"..\Data\mmc\xmlsecurity\encrypt\template.xml" - "c:\testing\data\xmlsecurity\encrypt\template.xml" +"..\Data\mmc\xmlsecurity\encrypt\wrokey.bin" - "c:\testing\data\xmlsecurity\encrypt\wrokey.bin" +"..\Data\mmc\xmlsecurity\encrypt\wrongtemplate.xml" - "c:\testing\data\xmlsecurity\encrypt\wrongtemplate.xml" diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/inc/xmlsecencrypttester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/inc/xmlsecencrypttester.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for XmlSecEncryptTester +* +*/ +#ifndef __XMLSECENCRYPTTESTER_H__ +#define __XMLSECENCRYPTTESTER_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +// Logging path +_LIT( KXmlSecTesterLogPath, "e:\\temp\\xmlsec" ); + +// Log file +_LIT( KXmlSecTesterLogFile, "XmlSecEncryptTester.txt" ); + +// Test name +_LIT( KTEST_NAME, "XmlSecEncryptTester" ); + + +_LIT8(KImplementationID, ""); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CXmlSecEncryptTester; + + +// CLASS DEFINITION +/** +* CXmlSecEncrypt test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CXmlSecEncryptTester) : public CScriptBase + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static CXmlSecEncryptTester* NewL(CTestModuleIf &); + /** + * Destructor + */ + virtual ~CXmlSecEncryptTester(); + + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + + + virtual TInt RunMethodL( CStifItemParser& aItem ); + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //type ?member_function( ?type ?arg1 ); + + + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: // Constructors and destructors + + /** + * C++ default constructor. + */ + CXmlSecEncryptTester( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + public: // From observer interface + + HBufC8* ReadFileL(const TDesC& aFileName); + + private: // New methods + + void CXmlSecEncrypt_NewLL(); + void CXmlSecEncrypt_NewLCL(); + TInt CXmlSecEncrypt_EncryptDataLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_EncryptXmlDocumentLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_EncryptXmlDocumentKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_EncryptXmlDocumentKeyFromBufferLL(); + TInt CXmlSecEncrypt_EncryptXmlNodeLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_EncryptXmlNodeKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_EncryptXmlNodeKeyFromBufferLL(); + TInt CXmlSecEncrypt_DecryptXmlNodeLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_DecryptXmlNodeKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_DecryptXmlNodeKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_DecryptXmlDocumentLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_DecryptXmlDocumentKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_DecryptXmlDocumentKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_SetTemplateFromFileL_1L(CStifItemParser& aItem); + TInt CXmlSecEncrypt_SetTemplateFromFileL_2L(CStifItemParser& aItem); + TInt CXmlSecEncrypt_SetTemplateFromBufferLL(); + TInt CXmlSecEncrypt_SetTemplateLL(); + TInt CXmlSecEncrypt_CreateTemplateLL(); + TInt CXmlSecEncrypt_GetCurrentTemplateLL(); + TInt CXmlSecEncrypt_SetKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_SetKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecEncrypt_SetKeyInfoL_1L(); + TInt CXmlSecEncrypt_SetKeyInfoL_2L(); + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // __XMLSECSIGNTESTER_H__ + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/init/TestFramework.ini Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,218 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= HTML # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testing\conf\XmlSecEncryptTester.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/rom/test_xmlsecencrypt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/rom/test_xmlsecencrypt.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY for xmlsecwrapper module tests +* +*/ + +#ifndef __TEST_XMLSECENCRYPT_IBY__ +#define __TEST_XMLSECENCRYPT_IBY__ + +file=ABI_DIR\BUILD_DIR\test_xmlsecencrypt.dll SHARED_LIB_DIR\test_xmlsecencrypt.dll + +#endif //__TEST_XMLSECENCRYPT_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/src/xmlsecencrypttester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/src/xmlsecencrypttester.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main file +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "xmlsecencrypttester.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecEncryptTester::CXmlSecEncryptTester +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CXmlSecEncryptTester::CXmlSecEncryptTester( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + + + } + +// ----------------------------------------------------------------------------- +// CXmlSecEncryptTester::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CXmlSecEncryptTester::ConstructL() + { + iLog = CStifLogger::NewL( KXmlSecTesterLogPath, + KXmlSecTesterLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + } + +// ----------------------------------------------------------------------------- +// CXmlSecEncryptTester::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXmlSecEncryptTester* CXmlSecEncryptTester::NewL( + CTestModuleIf& aTestModuleIf ) + { + CXmlSecEncryptTester* self = new (ELeave) CXmlSecEncryptTester( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CXmlSecEncryptTester::~CXmlSecEncryptTester() + { + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + CloseSTDLIB(); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CXmlSecEncryptTester::NewL( aTestModuleIf ); + + } +// End of File diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/tsrc/src/xmlsecencrypttesterblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/tsrc/src/xmlsecencrypttesterblocks.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1094 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Xmlsecurity encryption tests +* +*/ +// CLASS HEADER +#include "xmlsecencrypttester.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "xmlsecwinit.h" +#include "xmlsecwencrypt.h" +#include "xmlsecwerrors.h" +#include "XmlEngdom.h" +#include "XmlEngDOMParser.h" + + +// MACROS +//#define ?macro ?macro_def +#define LOCAL_ASSERT(expression) {if(!(expression)){return KErrArgument;}} + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecEncryptTester::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CXmlSecEncryptTester::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CXmlSecEncryptTester::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + + // Test cases for encryption + ENTRY( "Test-NewLL", CXmlSecEncryptTester::CXmlSecEncrypt_NewLL), + ENTRY( "Test-NewLC", CXmlSecEncryptTester::CXmlSecEncrypt_NewLCL), + ENTRY( "Test-EncryptDataLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptDataLL), + ENTRY( "Test-EncryptXmlDocumentLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentLL), + ENTRY( "Test-EncryptXmlDocumentKeyFromFileLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentKeyFromFileLL), + ENTRY( "Test-EncryptXmlDocumentKeyFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentKeyFromBufferLL), + ENTRY( "Test-EncryptXmlNodeLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeLL), + ENTRY( "Test-EncryptXmlNodeKeyFromFileLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeKeyFromFileLL), + ENTRY( "Test-EncryptXmlNodeKeyFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeKeyFromBufferLL), + ENTRY( "Test-DecryptXmlNodeLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeLL), + ENTRY( "Test-DecryptXmlNodeKeyFromFileLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeKeyFromFileLL), + ENTRY( "Test-DecryptXmlNodeKeyFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeKeyFromBufferLL), + ENTRY( "Test-DecryptXmlDocumentLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentLL), + ENTRY( "Test-DecryptXmlDocumentKeyFromFileLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentKeyFromFileLL), + ENTRY( "Test-DecryptXmlDocumentKeyFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentKeyFromBufferLL), + ENTRY( "Test-SetTemplateFromFileL_1L", CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromFileL_1L), + ENTRY( "Test-SetTemplateFromFileL_2L", CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromFileL_2L), + ENTRY( "Test-SetTemplateFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromBufferLL), + ENTRY( "Test-SetTemplateLL", CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateLL), + ENTRY( "Test-CreateTemplateLL", CXmlSecEncryptTester::CXmlSecEncrypt_CreateTemplateLL), + ENTRY( "Test-GetCurrentTemplateLL", CXmlSecEncryptTester::CXmlSecEncrypt_GetCurrentTemplateLL), + ENTRY( "Test-SetKeyFromFileLL", CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyFromFileLL), + ENTRY( "Test-SetKeyFromBufferLL", CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyFromBufferLL), + ENTRY( "Test-SetKeyInfoL_1L", CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyInfoL_1L), + ENTRY( "Test-SetKeyInfoL_2L", CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyInfoL_2L), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +void CXmlSecEncryptTester::CXmlSecEncrypt_NewLL( ) + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewL(); + CleanupStack::PushL(enc); + //LOCAL_ASSERT( enc ); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + } +//-------------------------------------------------------------------------------- +// +void CXmlSecEncryptTester::CXmlSecEncrypt_NewLCL( ) + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + //LOCAL_ASSERT( enc ); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptDataLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + TPtrC8 pt5(KNullDesC8()); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + TPtrC pTem; + aItem.GetNextString(pTem); + HBufC8* p_BufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(pTem); + CleanupStack::PushL( p_BufTem8 ); + TPtrC8 pTem8 = p_BufTem8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + + TRAPD(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrTemplate ); + + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::EData); + TRAP(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrEncrypt ); + + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::EData); + doc = enc->EncryptDataL(pt4); + LOCAL_ASSERT( doc.NotNull() ); + doc.Close(); + + enc->SetKeyFromFileL(p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::EData); + doc = enc->EncryptDataL(pt4); + LOCAL_ASSERT( doc.NotNull() ); + doc.Close(); + + TRAP(err,doc = enc->EncryptDataL(pt5)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::EData); + TRAP(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrEncrypt ); + + TRAP(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrEncrypt ); + + TRAP(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrEncrypt ); + + enc->SetTemplateFromFileL(pTem8); + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + TRAP(err,doc = enc->EncryptDataL(pt4)); + LOCAL_ASSERT( err == KErrTemplate ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufTem8); + CleanupStack::PopAndDestroy(p_BufAesKey8); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentLL( CStifItemParser& aItem ) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + TRAPD(err,enc->EncryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + enc->SetKeyFromFileL(p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode); + enc->EncryptXmlDocumentL(doc); + LOCAL_ASSERT( doc.NotNull() ); + LOCAL_ASSERT( doc.DocumentElement().Name().Compare(_L8("test")) ); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentKeyFromFileLL( CStifItemParser& aItem ) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument temp = enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode).CloneDocumentL(); + enc->DestroyCurrentTemplate(); + enc->EncryptXmlDocumentKeyFromFileL(doc,temp,p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + LOCAL_ASSERT( doc.NotNull() ); + LOCAL_ASSERT( doc.DocumentElement().Name().Compare(_L8("test")) ); + temp.Close(); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlDocumentKeyFromBufferLL( ) + { + _LIT8(t1,"012345670123456701234567"); + TPtrC8 pt1(t1); + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument temp = enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode).CloneDocumentL(); + enc->DestroyCurrentTemplate(); + enc->EncryptXmlDocumentKeyFromBufferL(doc,temp,pt1,pt4,CXmlSecEncrypt::E3DES); + LOCAL_ASSERT( doc.NotNull() ); + LOCAL_ASSERT( doc.DocumentElement().Name().Compare(_L8("test")) ); + temp.Close(); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// + TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + + TRAPD(err,enc->EncryptXmlNodeL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrWrongParameter ); + + TXmlEngElement elem = doc.CreateElementL(_L8("doc")); + TXmlEngComment com = doc.CreateCommentL(_L8("test")); + doc.AppendChildL(com); + doc.SetDocumentElement(elem); + TXmlEngElement elem2 = doc.CreateElementL(_L8("elem1")); + elem2.SetTextL(_L8("testtext")); + elem.AppendChildL(elem2); + elem2 = doc.CreateElementL(_L8("elem2")); + elem.AppendChildL(elem2); + + TRAP(err,enc->EncryptXmlNodeL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrTemplate ); + + enc->SetTemplateL(doc); + TRAP(err,enc->EncryptXmlNodeL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrTemplate ); + + RXmlEngDocument tmp = doc.CloneDocumentL(); + enc->SetKeyFromFileL(p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode); + enc->EncryptXmlNodeL(tmp.DocumentElement()); + LOCAL_ASSERT( tmp.NotNull() ); + LOCAL_ASSERT( tmp.DocumentElement().Name().Compare(_L8("doc")) ); + tmp.Close(); + + tmp = doc.CloneDocumentL(); + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::ENode); + enc->EncryptXmlNodeL(tmp.DocumentElement().FirstChild().AsElement()); + LOCAL_ASSERT( tmp.NotNull() ); + LOCAL_ASSERT( !tmp.DocumentElement().Name().Compare(_L8("doc")) ); + LOCAL_ASSERT( tmp.DocumentElement().FirstChild().Name().Compare(_L8("elem1")) ); + tmp.Close(); + + tmp = doc.CloneDocumentL(); + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::ENodeContent); + enc->EncryptXmlNodeL(tmp.DocumentElement().FirstChild().AsElement()); + LOCAL_ASSERT( tmp.NotNull() ); + LOCAL_ASSERT( !tmp.DocumentElement().Name().Compare(_L8("doc")) ); + LOCAL_ASSERT( !tmp.DocumentElement().FirstChild().Name().Compare(_L8("elem1")) ); + tmp.Close(); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } + +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("doc")); + doc.SetDocumentElement(elem); + RXmlEngDocument temp = enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode).CloneDocumentL(); + enc->DestroyCurrentTemplate(); + enc->EncryptXmlNodeKeyFromFileL(doc.DocumentElement(),temp,p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + LOCAL_ASSERT( doc.NotNull() ); + LOCAL_ASSERT( doc.DocumentElement().Name().Compare(_L8("doc")) ); + temp.Close(); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_EncryptXmlNodeKeyFromBufferLL() + { + _LIT8(t1,"012345670123456701234567"); + TPtrC8 pt1(t1); + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument doc; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("doc")); + doc.SetDocumentElement(elem); + RXmlEngDocument temp = enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::ENode).CloneDocumentL(); + enc->DestroyCurrentTemplate(); + enc->EncryptXmlNodeKeyFromBufferL(doc.DocumentElement(),temp,pt1,pt4,CXmlSecEncrypt::E3DES); + LOCAL_ASSERT( doc.NotNull() ); + LOCAL_ASSERT( doc.DocumentElement().Name().Compare(_L8("doc")) ); + temp.Close(); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } + + +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeLL(CStifItemParser& aItem) + { + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + TPtrC p_AesDoc; + aItem.GetNextString(p_AesDoc); + + TPtrC p_DesDoc; + aItem.GetNextString(p_DesDoc); + + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + + RXmlEngDocument doc ; + HBufC8* buf = NULL; + TRAPD(err,buf=enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + doc=parser.ParseFileL(p_AesDoc); + + TRAP(err,buf = enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrDecrypt ); + + enc->SetKeyFromFileL(p_AesKey8,pt1n,CXmlSecEncrypt::EAES256); + TRAP(err,buf = enc->DecryptXmlNodeL(doc.AsElement())); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1") )); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + + enc->SetKeyFromFileL(p_AesKey8,pt1n,CXmlSecEncrypt::EAES256); + doc = parser.ParseFileL(p_AesDoc); + TRAP(err,buf = enc->DecryptXmlNodeL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + enc->SetKeyFromFileL(p_DesKey8,pt1n,CXmlSecEncrypt::E3DES); + doc = parser.ParseFileL(p_DesDoc); + TRAP(err,buf = enc->DecryptXmlNodeL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().Name().Compare(_L8("doc") )); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + TPtrC p_AesDoc; + aItem.GetNextString(p_AesDoc); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + RXmlEngDocument doc = parser.ParseFileL(p_AesDoc); + HBufC8* buf = NULL; + TRAPD(err,buf = enc->DecryptXmlNodeKeyFromFileL(doc.DocumentElement(),p_AesKey8,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + + doc.Close(); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlNodeKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t1a,"01234567012345670123456701234567"); + TPtrC8 pt1a(t1a); + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + + TPtrC p_AesDoc; + aItem.GetNextString(p_AesDoc); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + RXmlEngDocument doc = parser.ParseFileL(p_AesDoc); + HBufC8* buf = NULL; + TRAPD(err,buf = enc->DecryptXmlNodeKeyFromBufferL(doc.DocumentElement(),pt1a,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentLL(CStifItemParser& aItem) + { + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + _LIT8(t3,"name"); + TPtrC8 pt3(t3); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + TPtrC p_AesElem; + aItem.GetNextString(p_AesElem); + + TPtrC p_AesData; + aItem.GetNextString(p_AesData); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + + RXmlEngDocument doc; + TRAPD(err,enc->DecryptXmlNodeL(doc.AsElement())); + LOCAL_ASSERT( err == KErrWrongParameter ); + + doc.OpenL(domImp); + CleanupClosePushL(doc); + + TRAP(err,enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + TXmlEngElement elem = doc.CreateElementL(_L8("doc")); + doc.SetDocumentElement(elem); + TXmlEngElement elem2 = doc.CreateElementL(_L8("elem1")); + elem2.SetTextL(_L8("testtext")); + elem.AppendChildL(elem2); + elem2 = doc.CreateElementL(_L8("elem2")); + elem.AppendChildL(elem2); + + TRAP(err,enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrWrongParameter ); + doc.Close(); + + doc = parser.ParseFileL(p_AesElem); + HBufC8* buf = NULL; + TRAP(err,buf = enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrDecrypt ); + + enc->SetKeyFromFileL(p_AesKey8,pt1n,CXmlSecEncrypt::EAES256); + TRAP(err,buf = enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + enc->SetKeyFromFileL(p_AesKey8,pt1n,CXmlSecEncrypt::EAES256); + doc = parser.ParseFileL(p_AesData); + TRAP(err,buf = enc->DecryptXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !buf->Compare(pt3) ); + + doc.Close(); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(&doc); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + delete buf; + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + _LIT8(t3,"name"); + TPtrC8 pt3(t3); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + TPtrC p_AesElem; + aItem.GetNextString(p_AesElem); + + TPtrC p_AesData; + aItem.GetNextString(p_AesData); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + + RXmlEngDocument doc; + CleanupClosePushL(doc); + doc = parser.ParseFileL(p_AesElem); + HBufC8* buf = NULL; + TRAPD(err,buf = enc->DecryptXmlDocumentKeyFromFileL(doc,p_AesKey8,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + doc = parser.ParseFileL(p_AesData); + TRAP(err,buf = enc->DecryptXmlDocumentKeyFromFileL(doc,p_AesKey8,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !buf->Compare(pt3) ); + delete buf; + doc.Close(); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(&doc); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_DecryptXmlDocumentKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t1,"01234567012345670123456701234567"); + TPtrC8 pt1(t1); + _LIT8(t1n,"name"); + TPtrC8 pt1n(t1n); + _LIT8(t3,"name"); + TPtrC8 pt3(t3); + + TPtrC p_AesElem; + aItem.GetNextString(p_AesElem); + + TPtrC p_AesData; + aItem.GetNextString(p_AesData); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDOMParser parser; + parser.Open(domImp); + + RXmlEngDocument doc; + CleanupClosePushL(doc); + doc = parser.ParseFileL(p_AesElem); + HBufC8* buf = NULL; + TRAPD(err,buf = enc->DecryptXmlDocumentKeyFromBufferL(doc,pt1,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !doc.DocumentElement().FirstChild().NextSibling().Name().Compare(_L8("elem1")) ); + LOCAL_ASSERT( buf == NULL ); + doc.Close(); + doc = parser.ParseFileL(p_AesData); + TRAP(err,buf = enc->DecryptXmlDocumentKeyFromBufferL(doc,pt1,pt1n,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !buf->Compare(pt3) ); + delete buf; + doc.Close(); + + CleanupStack::PopAndDestroy(&doc); + parser.Close(); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromFileL_1L(CStifItemParser& aItem) + { + TPtrC pTem; + aItem.GetNextString(pTem); + HBufC8* p_BufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(pTem); + CleanupStack::PushL( p_BufTem8 ); + TPtrC8 pTem8 = p_BufTem8->Des(); + + TPtrC pTemWrng; + aItem.GetNextString(pTemWrng); + HBufC8* p_BufTemWrng8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(pTemWrng); + CleanupStack::PushL( p_BufTemWrng8 ); + TPtrC8 pTemWrng8 = p_BufTemWrng8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + enc->SetTemplateFromFileL(pTem8); + RXmlEngDocument tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc")) ); + + TRAPD(err,enc->SetTemplateFromFileL(pTemWrng8)); + LOCAL_ASSERT( err ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufTemWrng8); + CleanupStack::PopAndDestroy(p_BufTem8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromFileL_2L(CStifItemParser& aItem) + { + TPtrC pTem; + aItem.GetNextString(pTem); + HBufC8* p_BufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(pTem); + CleanupStack::PushL( p_BufTem8 ); + TPtrC8 pTem8 = p_BufTem8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + RFs fs; + fs.Connect(); + enc->SetTemplateFromFileL(fs,pTem8); + fs.Close(); + RXmlEngDocument tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc")) ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufTem8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateFromBufferLL() + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + _LIT8(t1,""); + TPtrC8 pt1(t1); + enc->SetTemplateFromBufferL(pt1); + RXmlEngDocument tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc")) ); + + _LIT8(t2,""); + TPtrC8 pt2(t2); + TRAPD(err,enc->SetTemplateFromBufferL(pt2)); + LOCAL_ASSERT( err ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetTemplateLL() + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + enc->SetTemplateL(doc); + CleanupStack::PopAndDestroy(&doc); + RXmlEngDocument tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test") )); + + doc.OpenL(domImp); + CleanupClosePushL(doc); + elem = doc.CreateElementL(_L8("test2")); + doc.SetDocumentElement(elem); + + enc->SetTemplateL(doc); + CleanupStack::PopAndDestroy(&doc); + tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test2") )); + RXmlEngDocument doc2; + TRAPD(err, enc->SetTemplateL(doc2)); + LOCAL_ASSERT( err == KErrTemplate ); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_CreateTemplateLL() + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + RXmlEngDocument tem = enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::ENode); + LOCAL_ASSERT( tem.NotNull() ); + + tem = enc->CreateTemplateL(CXmlSecEncrypt::E3DES,CXmlSecEncrypt::EData); + LOCAL_ASSERT( tem.NotNull() ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_GetCurrentTemplateLL() + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + RXmlEngDocument tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + enc->DestroyCurrentTemplate(); + tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + + enc->SetTemplateL(doc); + tem = enc->CurrentTemplate(); + + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test") )); + + enc->DestroyCurrentTemplate(); + + tem = enc->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t1,"e:\\testing\\data\\xmlsecurity\\encrypt\\deskey.bin"); + TPtrC8 pt1(t1); + _LIT8(t2,"e:\\testing\\data\\xmlsecurity\\encrypt\\aeskey.bin"); + TPtrC8 pt2(t2); + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + TPtrC8 pt5(KNullDesC8()); + + TPtrC p_DesKey; + aItem.GetNextString(p_DesKey); + HBufC8* p_BufDesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_DesKey); + CleanupStack::PushL( p_BufDesKey8 ); + TPtrC8 p_DesKey8 = p_BufDesKey8->Des(); + + TPtrC p_AesKey; + aItem.GetNextString(p_AesKey); + HBufC8* p_BufAesKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_AesKey); + CleanupStack::PushL( p_BufAesKey8 ); + TPtrC8 p_AesKey8 = p_BufAesKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + //ok + enc->SetKeyFromFileL(p_DesKey8,pt4,CXmlSecEncrypt::E3DES); + enc->SetKeyFromFileL(p_AesKey8,pt4,CXmlSecEncrypt::EAES256); + //filename=null + TRAPD(err,enc->SetKeyFromFileL(pt5,pt4,CXmlSecEncrypt::EAES256)) + LOCAL_ASSERT( err == KErrWrongParameter ); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufAesKey8); + CleanupStack::PopAndDestroy(p_BufDesKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t1,"012345678901234567890123"); + TPtrC8 pt1(t1); + _LIT8(t2,"01234567890123456789012345678901"); + TPtrC8 pt2(t2); + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + TPtrC8 pt5(KNullDesC8()); + + TPtrC p_WrngKey; + aItem.GetNextString(p_WrngKey); + HBufC8* p_BufWrngKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_WrngKey); + CleanupStack::PushL( p_BufWrngKey8 ); + TPtrC8 p_WrngKey8 = p_BufWrngKey8->Des(); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + //ok + enc->SetKeyFromBufferL(pt1,pt4,CXmlSecEncrypt::E3DES); + enc->SetKeyFromBufferL(pt2,pt4,CXmlSecEncrypt::EAES256); + //filename=null + TRAPD(err,enc->SetKeyFromBufferL(pt5,pt4,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + TRAP(err,enc->SetKeyFromBufferL(p_WrngKey8,pt4,CXmlSecEncrypt::EAES256)); + LOCAL_ASSERT( err == KErrKey ); + + TRAP(err,enc->SetKeyFromBufferL(p_WrngKey8,pt4,CXmlSecEncrypt::E3DES)); + LOCAL_ASSERT( err == KErrKey); + + TRAP(err,enc->SetKeyFromBufferL(pt1,pt5,CXmlSecEncrypt::E3DES)); + LOCAL_ASSERT( err == KErrNone); + + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufWrngKey8); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyInfoL_1L( ) + { + _LIT8(t4,"name"); + TPtrC8 pt4(t4); + TPtrC8 pt5(KNullDesC8()); + + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + + //no template + TRAPD(err,enc->SetKeyInfoL(pt4)); + LOCAL_ASSERT( err == KErrTemplate ); + //null param + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::EData); + TRAP(err,enc->SetKeyInfoL(pt5)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //ok + enc->SetKeyInfoL(pt4); + //no keyinfo + enc->SetTemplateL(doc); + TRAP(err,enc->SetKeyInfoL(pt4)); + LOCAL_ASSERT( err == KErrTemplate ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecEncryptTester::CXmlSecEncrypt_SetKeyInfoL_2L() + { + XmlSecPushL(); + CXmlSecEncrypt* enc = CXmlSecEncrypt::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + TXmlEngElement elem1; + + //no template + TRAPD(err,enc->SetKeyInfoL(doc.AsElement())); + LOCAL_ASSERT( err == KErrTemplate ); + enc->CreateTemplateL(CXmlSecEncrypt::EAES256,CXmlSecEncrypt::EData); + //wrong element = null + TRAP(err,enc->SetKeyInfoL(elem1)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //ok + enc->SetKeyInfoL(elem.CopyL()); + //no keyinfo node + enc->SetTemplateL(doc); + TRAP(err,enc->SetKeyInfoL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrTemplate ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(enc); + XmlSecPopAndDestroy(); + return KErrNone; + } +// END OF FILE diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_encryption_api/xml_encryption_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_encryption_api/xml_encryption_api.metaxml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ + + + XML Encryption API + + c++ + xmlsecurityengine + + + + + + + + yes + no + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XML Security Engine Utils API +* +*/ + + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/xmlsecwinit.h OS_LAYER_PLATFORM_EXPORT_PATH(xmlsecwinit.h) +../inc/xmlsecwerrors.h OS_LAYER_PLATFORM_EXPORT_PATH(xmlsecwerrors.h) + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/inc/xmlsecwerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/inc/xmlsecwerrors.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Error codes definitions used in XMLSec Wrapper +* +*/ + + + + + + + +#ifndef XMLSECW_ERROR_H +#define XMLSECW_ERROR_H + +#include + +/** + * Error during component initialization + */ +const TInt KErrInit = -32525; +/** + * Error during initialization of key manager + */ +const TInt KErrKeyManagerInit = -32526; +/** + * Template is not set or thera are errors in template + */ +const TInt KErrTemplate = -32528; +/** + * Key is not valid (f.e. size is wrong) + */ +const TInt KErrKey = -32529; +/** + * Cert is not valid + */ +const TInt KErrCert = -32530; +/** + * Error during encryption processing + * (i.e. template use functions that is not supported) + */ +const TInt KErrEncrypt = -32531; +/** + * Error during decryption processing + * (i.e. encryption was modified, wrong data is passed as input) + */ +const TInt KErrDecrypt = -32532; +/** + * Error during signing processing + * (i.e. template use functions that is not supported or + * signing document is not correct) + */ + const TInt KErrSign = -32535; +/** + * Error during verify processing + * (i.e. template use functions that is not supported or + * document that is verified is not correct) + */ +const TInt KErrVerify = -32536; +/** + * Id namespace used to create multisign template + * is unknown. + */ +const TInt KErrIdUndefineNS = -32537; +/** + * Wrong input parameters. + */ +const TInt KErrWrongParameter = -32544; +#endif // XMLSECW_ERROR_H diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/inc/xmlsecwinit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/inc/xmlsecwinit.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Functions used to initialize and close component. +* +*/ + + + + + + + +#ifndef _INIT_H +#define _INIT_H + +#include + +/** +* Initializes XmlSecWrapper data. It should be used before using the wrapper. +* +* @since S60 v3.2 +*/ +IMPORT_C void XmlSecInitializeL(); + +/** +* Closes XmlSecWrapper. It should be used after finishing work with wrapper. +* +* @since S60 v3.2 +* @param aGlobalState Pointer to global state +*/ +IMPORT_C void XmlSecCleanup(TAny* aGlobalState = NULL); + +/** +* Initializes XmlSecWrapper data and pushes it to cleanup stack. +* It should be used before using the wrapper. +* +* @since S60 v3.2 +*/ +IMPORT_C void XmlSecPushL(); + +/** +* Closes XmlSecWrapper. +* It should be used after finishing work with wrapper. +* +* @since S60 v3.2 +*/ +IMPORT_C void XmlSecPopAndDestroy(); + +#endif // _INIT_H diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/bwinscw/test_xmlsecutils.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/bwinscw/test_xmlsecutils.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/conf/XmlSecUtilsTester.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/conf/XmlSecUtilsTester.cfg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,34 @@ +[Test] +title test_XmlSecInitializeL_1L +create test_xmlsecutils obj +obj TestXmlSecInitializeL_1L +delete obj +[Endtest] + +[Test] +title test_XmlSecInitializeL_2L +create test_xmlsecutils obj +obj TestXmlSecInitializeL_2L +delete obj +[Endtest] + +[Test] +title test_XmlSecInitializeL_3L +create test_xmlsecutils obj +obj TestXmlSecInitializeL_3L +delete obj +[Endtest] + +[Test] +title test_XmlSecPushL_1L +create test_xmlsecutils obj +obj TestXmlSecPushL_1L +delete obj +[Endtest] + +[Test] +title test_XmlSecPushL_2L +create test_xmlsecutils obj +obj TestXmlSecPushL_2L +delete obj +[Endtest] diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/eabi/test_xmlsecutils.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/eabi/test_xmlsecutils.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for xml_security_engine_utils_api test components +* +*/ + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +PRJ_TESTEXPORTS +PRJ_MMPFILES + +PRJ_TESTMMPFILES +test_xmlsecutils.mmp + + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/test_xmlsecutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/test_xmlsecutils.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file for test_xmlsecutils of xml_security_engine_utils_api test component +* +*/ + +#include + + +TARGET test_xmlsecutils.dll +TARGETTYPE dll +//TARGETPATH /z/sys/bin +UID 0x1000af5a 0x01700000 + +#if defined(ARMCC) + DEFFILE ../eabi/test_xmlsecutils.def +#elif defined(WINSCW) || defined(WINS) +DEFFILE ../bwinscw/test_xmlsecutils.def +#endif + +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE xmlsecutilstester.cpp +SOURCE xmlsecutilstesterblocks.cpp + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/libc +USERINCLUDE ../inc + +LIBRARY stiftestinterface.lib +LIBRARY charconv.lib +LIBRARY efsrv.lib +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY InetProtUtil.lib +LIBRARY SysUtil.lib +LIBRARY XmlSecWrapper.lib + +nostrictdef +epocallowdlldata diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/test_xmlsecutils.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/group/test_xmlsecutils.pkg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,54 @@ +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + +; Languages +&EN + +; Provide value for uid +#{"XmlSecUtilsTester"},(0x00000000),1,0,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\test_xmlsecencrypt.dll" - "c:\Sys\Bin\test_xmlsecencrypt.dll" + +;Init files +"..\init\TestFramework.ini"-"c:\testframework\TestFramework.ini" + +;Conf Files +"..\conf\XmlSecUtilsTester.cfg"-"c:\testing\conf\XmlSecUtilsTester.cfg" + +;Data files diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/inc/xmlsecutilstester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/inc/xmlsecutilstester.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for XmlSecUtilsTester +* +*/ + + + + + + + +#ifndef __XMLSECUTILSTESTER_H__ +#define __XMLSECUTILSTESTER_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +// Logging path +_LIT( KXmlSecTesterLogPath, "e:\\temp\\xmlsec" ); + +// Log file +_LIT( KXmlSecTesterLogFile, "XmlSecUtilsTester.txt" ); + +// Test name +_LIT( KTEST_NAME, "XmlSecUtilsTester" ); + + +_LIT8(KImplementationID, ""); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CXmlSecUtilsTester; + + +// CLASS DEFINITION +/** +* CXmlSecTester test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CXmlSecUtilsTester) : public CScriptBase + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static CXmlSecUtilsTester* NewL(CTestModuleIf &); + /** + * Destructor + */ + virtual ~CXmlSecUtilsTester(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + + + virtual TInt RunMethodL( CStifItemParser& aItem ); + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //type ?member_function( ?type ?arg1 ); + + + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CXmlSecUtilsTester( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + + + void XmlSecInitializeL_1L(); + void XmlSecInitializeL_2L(); + void XmlSecInitializeL_3L(); + void XmlSecPushL_1L(); + void XmlSecPushL_2L(); + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // __XMLSECUTILSTESTER_H__ + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/init/TestFramework.ini Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,218 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file c:\. +# + OVERWRITE, Overwrites if the Test report file c:\. +# + APPEND, Continue logging after the old Test report information if +# report c:\. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= HTML # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= TestScripter +TestCaseFile= e:\testing\conf\XmlSecUtilsTester.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready c:\. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file c:\. +# + OVERWRITE, Overwrites if file(s) c:\. +# + APPEND, Continue logging after the old logging information if file(s) c:\. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/rom/test_xmlsecutils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/rom/test_xmlsecutils.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY for xmlsecwrapper module tests +* +*/ + +#ifndef __TEST_XMLSECUTILS_IBY__ +#define __TEST_XMLSECUTILS_IBY__ + +file=ABI_DIR\BUILD_DIR\test_xmlsecutils.dll SHARED_LIB_DIR\test_xmlsecutils.dll + +#endif //__TEST_XMLSECUTILS_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/src/xmlsecutilstester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/src/xmlsecutilstester.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main file +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "xmlsecutilstester.h" +#include "xmlsecwinit.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecUtilsTester::CXmlSecUtilsTester +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CXmlSecUtilsTester::CXmlSecUtilsTester( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + + + } + +// ----------------------------------------------------------------------------- +// CXmlSecUtilsTester::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CXmlSecUtilsTester::ConstructL() + { + iLog = CStifLogger::NewL( KXmlSecTesterLogPath, + KXmlSecTesterLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + } + +// ----------------------------------------------------------------------------- +// CXmlSecUtilsTester::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXmlSecUtilsTester* CXmlSecUtilsTester::NewL( + CTestModuleIf& aTestModuleIf ) + { + CXmlSecUtilsTester* self = new (ELeave) CXmlSecUtilsTester( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CXmlSecUtilsTester::~CXmlSecUtilsTester() + { + + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + + CloseSTDLIB(); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CXmlSecUtilsTester::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/tsrc/src/xmlsecutilstesterblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/tsrc/src/xmlsecutilstesterblocks.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Xmlsecurity utility tests +* +*/ + +// CLASS HEADER +#include "xmlsecutilstester.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "xmlsecwinit.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecTester::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CXmlSecUtilsTester::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CXmlSecTester::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CXmlSecUtilsTester::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + + // Test cases for encryption + ENTRY( "TestXmlSecInitializeL_1L", CXmlSecUtilsTester::XmlSecInitializeL_1L), + ENTRY( "TestXmlSecInitializeL_2L", CXmlSecUtilsTester::XmlSecInitializeL_2L), + ENTRY( "TestXmlSecInitializeL_3L", CXmlSecUtilsTester::XmlSecInitializeL_3L), + ENTRY( "TestXmlSecPushL_1L", CXmlSecUtilsTester::XmlSecPushL_1L), + ENTRY( "TestXmlSecPushL_2L", CXmlSecUtilsTester::XmlSecPushL_2L), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// CONSTRUCTION +void CXmlSecUtilsTester::XmlSecInitializeL_1L( ) + { + XmlSecCleanup(); + } + +void CXmlSecUtilsTester::XmlSecInitializeL_2L( ) + { + XmlSecInitializeL(); + XmlSecCleanup(); + } + +void CXmlSecUtilsTester::XmlSecInitializeL_3L( ) + { + for(int i = 0; i<100; i++) + XmlSecInitializeL(); + for(int i = 0; i<100; i++) + XmlSecCleanup(); + } + +void CXmlSecUtilsTester::XmlSecPushL_1L( ) + { + XmlSecPushL(); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + } + +void CXmlSecUtilsTester::XmlSecPushL_2L( ) + { + for(int i = 0; i<100; i++) + XmlSecPushL(); + for(int i = 0; i<100; i++) + { + XmlSecPopAndDestroy(); + CloseSTDLIB(); + } + } +// END OF FILE diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_security_engine_utils_api/xml_security_engine_utils_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_security_engine_utils_api/xml_security_engine_utils_api.metaxml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ + + + XML Security Engine Utils API + + c++ + xmlsecurityengine + + + + + + + + yes + no + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: XML Signature API +* +*/ + + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/xmlsecwsign.h OS_LAYER_PLATFORM_EXPORT_PATH(xmlsecwsign.h) + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/inc/xmlsecwsign.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/inc/xmlsecwsign.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,600 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class with methods used during signing and verification process. +* +*/ + + + + + + + +#ifndef C_SIGN_H +#define C_SIGN_H + +#include +#include + +#include + +class CXmlSecKeyManager; +class TXmlEngElement; + +/** + * Class used to sign data. + * + * How to use: + * + * Signing with key from file: + *
+ *  1. Create new object:
+ *          CXmlSecSign* sign = CXmlSecSign::NewLC();
+ *  2. Set template for signing: 
+ *          sign->SetTemplateFromFileL(doc);
+ *  3. Set the key that should be used during signing: 
+ *          sign->SetKeyFromFileL(keyfilename,keyname,CXmlSecSign::ERSA_PRIVATE); 
+ *  4. Sign xml node:
+ *          element = sign->SignXmlDocumentL(doc); 
+ *  
+ * + * Signing with key from SymbianKeyStore: + *
+ *  1. Create new object:
+ *          CXmlSecSign* sign = CXmlSecSign::NewLC();
+ *  2. Set template for signing: 
+ *          sign->SetTemplateFromFileL(doc);
+ *  3. Set the name of the key that should be used during signing: 
+ *          sign->SetKeyInfoL(keyname);
+ *  4. Sign xml node:
+ *          element = sign->SignXmlDocumentL(doc,FALSE);
+ *	   second parameter sets to FALSE determine using keys from SymbianKeyStore.
+ *  
+ * + * Verification with key: + *
+ *  1. Create new object:
+ *          CXmlSecSign* sign = CXmlSecSign::NewLC();
+ *  3. Set the key that should be used during verification (it should be set before verification): 
+ *          sign->SetKeyFromFileL(keyfilename, keyname, CXmlSecSign::ERSA_PUBLIC); 
+ *  3. Verify the signature 
+ *          ver=sign->VerifyXmlNodeL(element);
+ *     function will return true if sign is correct
+ *  
+ * + * Verification with certificate from root's cert chain: + *
+ *  1. Create new object:
+ *          CXmlSecSign* sign = CXmlSecSign::NewLC();
+ *  2. Add trusted root certificate from file:
+ *          sign->AddTrustedCertFromFileL(trustedCert);
+ *  3. Verify the signature:
+ *          ver=sign->VerifyXmlNodeL(element, CXmlSecSign::ERootCertChain);
+ *     Function will return true if sign is correct.
+ *  
+ * + * Verification with certificate from SymbianCertStore: + *
+ *  1. Create new object:
+ *          CXmlSecSign* sign = CXmlSecSign::NewLC();
+ *  2. Verify the signature:
+ *          ver=sign->VerifyXmlNodeL(element, CXmlSecSign::ECertStore);
+ *     Function will return true if sign is correct
+ *  
+ * + * @lib XmlSecWrapper.dll + * @since S60 v3.2 + */ +class CXmlSecSign : public CBase + { +public: + /** + * Key types. + * Currently simmetric key (used by HMAC algorithm) and + * asimmetric key (used by RSA algorithm) is supported. + * RSAPrivate is for private key (PKCS#8 syntax, DER encoding) + * RSAPrivate is for public key (DER encoding) + */ + enum TXmlSecKeyType + { + ERSAPrivate = 0, + ERSAPublic, + EHMAC + }; + + /** + * Verification key repository. + * A place where is key to use in verification. + * EThisObject - Key can set by SetKey method + * ECertStore - Symbian certificate store (@see CUnifiedCertStore) + * ERootCertChain - Trusted root cert set can be add by AddTrustedCertFrom(File/Buffer)L method + */ + enum TXmlSecVerificationKeyRepository + { + EThisObject = 0, + ECertStore, + ERootCertChain + }; + + /** Use Enveloped Signature Transform */ + static const TUint KEnvelopedSignature = 0x01; + /** Use c14n Transform */ + static const TUint KC14N = 0x02; + /** Use Exclusive c14n Transform */ + static const TUint KExclusiveC14N = 0x04; + +public: + /** + * Creates new object. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CXmlSecSign* NewL(); + + /** + * Creates new object and puts it on cleanup stack. + * + * @since S60 v3.2 + * @return pointer to new object + */ + IMPORT_C static CXmlSecSign* NewLC(); + + /** + * Destructor + */ + virtual ~CXmlSecSign(); + + /** + * Signs xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be signed. + * @param aUseCurrentKey Current key (sets by SetKey function) will be used. + * If sets to FALSE then key manager will be used. + * @return TElement with signature node (It is part of the document). + * + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlDocumentL(RXmlEngDocument& aDocument, + TBool aUseCurrentKey = ETrue); + + /** + * Signs xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be signed. + * @param aTemplate Template document + * @param aKeyFile File with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TElement with signature node (It is part of the document). + * + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlDocumentKeyFromFileL(RXmlEngDocument& aDocument, + RXmlEngDocument& aTemplate, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Signs xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be signed. + * @param aKeyFile File with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TElement with signature node (It is part of the document). + * + * @note Signature context should be in the document that should be sign + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlDocumentKeyFromFileL(RXmlEngDocument& aDocument, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Signs xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be signed. + * @param aTemplate Template document + * @param aKey Buffer with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TElement with signature node (It is part of the document). + * + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlDocumentKeyFromBufferL(RXmlEngDocument& aDocument, + RXmlEngDocument& aTemplate, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Signs xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be signed. + * @param aKey Buffer with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TElement with signature node (It is part of the document). + * + * @note Signature context should be in the document that should be sign + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlDocumentKeyFromBufferL(RXmlEngDocument& aDocument, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Signs xml nodes. + * + * @since S60 v3.2 + * @param aNodes Nodes that should be signed. + * @param aUseCurrentKey Current key (sets by SetKey method) will be used. + * If sets to FALSE then key manager will be used. + * @return TElement with signature node (It is part of the document). + * + * @note If signature template was used, result should be added by user to + * correct node in the document. If signature context was in + * document previously, no action is needed (signature is in place + * where it was before signing) + */ + IMPORT_C TXmlEngElement SignXmlNodesL(RArray& aNodes, + TBool aUseCurrentKey = ETrue); + + /** + * Verifies xml node. + * + * @since S60 v3.2 + * @param aNode Node that should be verified ( element). + * @param aKeySource place from key to verification will be taken. @see TXmlSecVerificationKeyRepository + * @return ETrue if correctly verificated. + */ + IMPORT_C TBool VerifyXmlNodeL(TXmlEngElement aNode, + TXmlSecVerificationKeyRepository aKeyRepository = EThisObject); + + /** + * Verifies xml node. + * + * @since S60 v3.2 + * @param aNode Node that should be verified ( element). + * @param aKeyFile File with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TRUE if node was correctly verificated. + */ + IMPORT_C TBool VerifyXmlNodeKeyFromFileL(TXmlEngElement aNode, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Verifies xml node. + * + * @since S60 v3.2 + * @param aNode Node that should be verified ( element). + * @param aKey Buffer with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TRUE if node was correctly verificated. + */ + IMPORT_C TBool VerifyXmlNodeKeyFromBufferL(TXmlEngElement aNode, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Verifies xml document. + * + * @since S60 v3.2 + * @param aDocument Document that should be verified. + * @param aKeySource place from key to verification will be taken. @see TXmlSecVerificationKeyRepository + * @return TRUE if node was correctly verificated. + */ + IMPORT_C TBool VerifyXmlDocumentL(const RXmlEngDocument& aDocument, + TXmlSecVerificationKeyRepository aKeyRepository = EThisObject); + + /** + * Verifies xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be verified. + * @param aKeyFile File with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TRUE if document was correctly verificated. + */ + IMPORT_C TBool VerifyXmlDocumentKeyFromFileL(const RXmlEngDocument& aDocument, + const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Verifies xml document. + * + * @since S60 v3.2 + * @param aDocument DOM tree that should be verified. + * @param aKey Buffer with key (only binary format. + * In case of RSA key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key + * @param aKeyType key type (i.e. HMAC) + * @return TRUE if document was correctly verificated. + */ + IMPORT_C TBool VerifyXmlDocumentKeyFromBufferL(const RXmlEngDocument& aDocument, + const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Sets signing template (parses template file). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template file + */ + IMPORT_C void SetTemplateFromFileL(const TDesC8& aTemplate); + + /** + * Sets signing template (parses template file). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aRFs handle to a file server session. + * @param aTemplate template file + */ + IMPORT_C void SetTemplateFromFileL(RFs& aRFs, const TDesC8& aTemplate); + + /** + * Sets signing template (parses buffer that contains template xml). + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate template xml in buffer + */ + IMPORT_C void SetTemplateFromBufferL(const TDesC8& aTemplate); + + /** + * Set copy of the argument as a sign template. + * This template will be used until new template will be set. + * + * @since S60 v3.2 + * @param aTemplate DOM tree with template document + */ + IMPORT_C void SetTemplateL(const RXmlEngDocument& aTemplate); + + /** + * Adds element to node and sets the value of it. + * The element will be added to current template. + * + * @since S60 v3.2 + * @param aKeyName Key name that should be set. + */ + IMPORT_C void SetKeyInfoL(const TDesC8& aKeyName); + + /** + * Adds element to node. This method allows to add specific data + * to element. + * The element will be added to current template. + * + * @since S60 v3.2 + * @param aKeyProp Element that should be set. + */ + IMPORT_C void SetKeyInfoL(TXmlEngElement aKeyProp); + + /** + * Creates template for singning. Template is created for specific key algorithm. + * This templete will sign whole xml document. + * + * This template will be used until new template will be set. + * Only SHA1 digest method is supported. + * + * @since S60 v3.2 + * @param aKeyType Key type determine signatureMethod. + * @param aCert If sets to TRUE then element will be added to template. + * @param aTransform Decide what transform should be used in reference elements + * Use one or more const (e.g. KEnvelopeSignature | KExclusiveC14N) + * @param aPref prefix that will be used for signature namespace + * @param aNewLine should new line be used in template + * @return template document + */ + IMPORT_C const RXmlEngDocument& CreateTemplateL(TXmlSecKeyType aKeyType, + TBool aCert = EFalse, + TUint aTransforms = KEnvelopedSignature, + const TDesC8& aPref = KNullDesC8(), + TBool aNewLine = TRUE); + + /** + * Creates template for signing. Template is created for specific key algorithm. + * Templete allows to sign element(s) identified by id. + * + * This template will be used until new template will be set. + * Only SHA1 digest method is supported. + * + * @since S60 v3.2 + * @param aKeyType Key type determine signatureMethod. + * @param aNodes Array with nodes that should be signed + * @param aId Id name that should be used in Reference (i.e."ns:Id") + * @param aCert If sets to TRUE then element will be added to template. + * @param aTransform Decide what transform should be used in reference elements + * Use one or more const (e.g. KEnvelopeSignature | KExclusiveC14N) + * @param aPref prefix that will be used for signature namespace + * @param aNewLine should new line be used in template + * @return template document + */ + IMPORT_C const RXmlEngDocument& CreateTemplateL(TXmlSecKeyType aKeyType, + RArray& aNodes, + const TDesC8& aId, + TBool aCert = EFalse, + TUint aTransforms = KEnvelopedSignature, + const TDesC8& aPref = KNullDesC8(), + TBool aNewLine = TRUE); + + /** + * Gets current template. + * + * @since S60 v3.2 + * @return template document + */ + IMPORT_C const RXmlEngDocument& CurrentTemplate() const; + + /** + * Destroys current template. + * + * @since S60 v3.2 + */ + IMPORT_C void DestroyCurrentTemplate(); + + /** + * Reads key from file and puts it to the SymbianKeyStore. + * Key will be used during signing/verification action until new key will be set. + * + * @since S60 v3.2 + * @param aKeyFile File with key (only binary format. + * In case of RSA private key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key (it can be null descriptor when HMAC key is used) + * @param aKeyFormat key type (i.e. HMAC) + */ + IMPORT_C void SetKeyFromFileL(const TDesC8& aKeyFile, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + + /** + * Reads key from buffer and puts it to the SymbianKeyStore. + * Key will be used during signing/verification action until new key will be set. + * + * @since S60 v3.2 + * @param aKey Buffer with key (only binary format. + * In case of RSA private key type - PKCS#8 syntax, DER encoding) + * @param aKeyName name of the key (it can be null descriptor when HMAC key is used) + * @param aKeyFormat key type (i.e. HMAC). + */ + IMPORT_C void SetKeyFromBufferL(const TDesC8& aKey, + const TDesC8& aKeyName, + TXmlSecKeyType aKeyType); + /** + * Reads certificate from file. + * This certificate will be added to current key. + * + * @since S60 v3.2 + * @param aCertFile Name of the file with certificate inside + */ + IMPORT_C void SetCertFromFileL(const TDesC8& aCertFile); + + /** + * Reads certificate from buffer. + * This certificate will be added to current key. + * + * @since S60 v3.2 + * @param aCert Buffer with certificate inside + */ + IMPORT_C void SetCertFromBufferL(const TDesC8& aCert); + + /** + * Reads X509 certificate from file and adds it to root's cert chain handled in memory (destroyed after session). + * This certificate IS NOT added to SymbianCertStore. + * + * @since S60 v3.2 + * @param aCertFile Name of the file with certificate. + */ + IMPORT_C void AddTrustedCertFromFileL(const TDesC8& aCertFile); + + /** + * Reads X509 certificate from buffer and adds it to root's cert chain handled in memory (destroyed after session). + * This certificate IS NOT added to SymbianCertStore. + * + * @since S60 v3.2 + * @param aCert Buffer with certificate. + */ + IMPORT_C void AddTrustedCertFromBufferL(const TDesC8& aCert); + +private: + /** + * Default constructor. + * + * @since S60 v3.2 + */ + CXmlSecSign(); + + /** + * Second phase constructor. + * + * @since S60 v3.2 + */ + void ConstructL(); + + /** + * Signs the xml node. + * + * @since S60 v3.2 + * @param aNode TElement Node that should be sign. + * @param aUseCurrentKey Current key (set by SetKey method) will be used. + * If sets to FALSE then key manager will be used. + * @return TElement with signed node. + */ + TXmlEngElement CXmlSecSign::SignXmlNodeL(TXmlEngElement aNode, TBool aUseCurrentKey); + +private: + /** + * DOM tree with template + */ + RXmlEngDocument iTemplate; + + /** + * Signing context + */ + void* iSigCtx; + + /** + * Key manager + */ + CXmlSecKeyManager* iMngr; + + /** + * Flag to skip searching for Template in document + */ + TBool iSkipTmplLookUp; + + }; + +#endif // C_SIGN_H diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/bwinscw/test_xmlsecsign.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/bwinscw/test_xmlsecsign.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/conf/XmlSecSignTester.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/conf/XmlSecSignTester.cfg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,237 @@ +[Define] +KEYPRIVRSA e:\testing\data\xmlsecurity\sign\priv-rsa-1024.der +KEYPRIVRSA1 e:\testing\data\xmlsecurity\sign\rsa-priv-2048.der +KEYPUBRSA e:\testing\data\xmlsecurity\sign\pub-rsa-1024.der +KEYHMAC e:\testing\data\xmlsecurity\sign\hmackey.bin +KEYINFO e:\testing\data\xmlsecurity\sign\template1.xml +CERT e:\testing\data\xmlsecurity\sign\II-level-cert-rsa-2048.der +CERT1 e:\testing\data\xmlsecurity\sign\cert1.der +TRUSTCERT e:\testing\data\xmlsecurity\sign\root-cert-rsa-1024.der +TMPL e:\testing\data\xmlsecurity\sign\template.xml +WRNGTMPL e:\testing\data\xmlsecurity\sign\wrongtemplate.xml +WRNGKEY e:\testing\data\xmlsecurity\sign\wrokey.bin +[Enddefine] + +[Test] +title NewLL +create test_xmlsecsign test +test Test-NewL +delete test +[Endtest] + +[Test] +title NewLCL +create test_xmlsecsign test +test Test-NewLC +delete test +[Endtest] + +[Test] +title SignXmlDocumentLL +create test_xmlsecsign test +test Test-SignXmlDocumentLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title SignXmlDocumentL_2L +create test_xmlsecsign test +test Test-SignXmlDocumentL_2L KEYINFO +delete test +[Endtest] + +[Test] +title SignXmlDocumentL_3L +create test_xmlsecsign test +test Test-SignXmlDocumentL_3L KEYINFO +delete test +[Endtest] + +[Test] +title SignXmlDocumentKeyFromFileL_1L +create test_xmlsecsign test +test Test-SignXmlDocumentKeyFromFileL_1L KEYHMAC +delete test +[Endtest] + +[Test] +title SignXmlDocumentKeyFromFileL_2L +create test_xmlsecsign test +test Test-SignXmlDocumentKeyFromFileL_2L KEYHMAC +delete test +[Endtest] + +[Test] +title SignXmlDocumentKeyFromBufferL_1L +create test_xmlsecsign test +test Test-SignXmlDocumentKeyFromBufferL_1L KEYHMAC +delete test +[Endtest] + +[Test] +title SignXmlDocumentKeyFromBufferL_2L +create test_xmlsecsign test +test Test-SignXmlDocumentKeyFromBufferL_2L KEYHMAC +delete test +[Endtest] + +[Test] +title SignXmlNodesLL +create test_xmlsecsign test +test Test-SignXmlNodesLL KEYHMAC +delete test +[Endtest] + +[Test] +title VerifyXmlNodeLL +create test_xmlsecsign test +test Test-VerifyXmlNodeLL KEYHMAC +delete test +[Endtest] + +[Test] +title VerifyXmlNodeL_2L +create test_xmlsecsign test +test Test-VerifyXmlNodeL_2L CERT TRUSTCERT KEYPRIVRSA1 +delete test +[Endtest] + +[Test] +title VerifyXmlNodeKeyFromFileLL +create test_xmlsecsign test +test Test-VerifyXmlNodeKeyFromFileLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title VerifyXmlNodeKeyFromBufferLL +create test_xmlsecsign test +test Test-VerifyXmlNodeKeyFromBufferLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title VerifyXmlDocumentLL +create test_xmlsecsign test +test Test-VerifyXmlDocumentLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title VerifyXmlDocumentKeyFromFileLL +create test_xmlsecsign test +test Test-VerifyXmlDocumentKeyFromFileLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title VerifyXmlDocumentKeyFromBufferLL +create test_xmlsecsign test +test Test-VerifyXmlDocumentKeyFromBufferLL KEYPRIVRSA +delete test +[Endtest] + +[Test] +title SetTemplateFromFileL_1L +create test_xmlsecsign test +test Test-SetTemplateFromFileL_1L TMPL WRNGTMPL +delete test +[Endtest] + +[Test] +title SetTemplateFromFileL_2L +create test_xmlsecsign test +test Test-SetTemplateFromFileL_2L TMPL +delete test +[Endtest] + +[Test] +title SetTemplateFromBufferLL +create test_xmlsecsign test +test Test-SetTemplateFromBufferLL +delete test +[Endtest] + +[Test] +title SetTemplateLL +create test_xmlsecsign test +test Test-SetTemplateLL +delete test +[Endtest] + +[Test] +title CreateTemplateL_1L +create test_xmlsecsign test +test Test-CreateTemplateL_1L +delete test +[Endtest] + +[Test] +title CreateTemplateL_2L +create test_xmlsecsign test +test Test-CreateTemplateL_2L +delete test +[Endtest] + +[Test] +title GetCurrentTemplateLL +create test_xmlsecsign test +test Test-GetCurrentTemplateLL +delete test +[Endtest] + +[Test] +title SetKeyInfoL_1L +create test_xmlsecsign test +test Test-SetKeyInfoL_1L +delete test +[Endtest] + +[Test] +title SetKeyInfoL_2L +create test_xmlsecsign test +test Test-SetKeyInfoL_2L +delete test +[Endtest] + +[Test] +title SetKeyFromFileLL +create test_xmlsecsign test +test Test-SetKeyFromFileLL KEYHMAC KEYPRIVRSA WRNGKEY KEYPUBRSA +delete test +[Endtest] + +[Test] +title SetKeyFromBufferLL +create test_xmlsecsign test +test Test-SetKeyFromBufferLL KEYPRIVRSA KEYPUBRSA +delete test +[Endtest] + +[Test] +title SetCertFromFileLL +create test_xmlsecsign test +test Test-SetCertFromFileLL CERT1 KEYPRIVRSA +delete test +[Endtest] + +[Test] +title SetCertFromBufferLL +create test_xmlsecsign test +test Test-SetCertFromBufferLL CERT1 KEYPRIVRSA +delete test +[Endtest] + +[Test] +title AddTrustedCertFromFileLL +create test_xmlsecsign test +test Test-AddTrustedCertFromFileLL CERT1 +delete test +[Endtest] + +[Test] +title AddTrustedCertFromBufferLL +create test_xmlsecsign test +test Test-AddTrustedCertFromBufferLL CERT1 +delete test +[Endtest] diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/II-level-cert-rsa-2048.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/II-level-cert-rsa-2048.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/cert1.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/cert1.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/forRSAsign.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/forRSAsign.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +eeeeeeeeeeee +wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww +eeeeeeeeeeeet diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/hmackey.bin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/hmackey.bin Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +01234567012345670123456701234567 \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/priv-rsa-1024.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/priv-rsa-1024.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/pub-rsa-1024.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/pub-rsa-1024.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/root-cert-rsa-1024.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/root-cert-rsa-1024.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/rsa-priv-2048.der Binary file xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/rsa-priv-2048.der has changed diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/template.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/template1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/template1.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,9 @@ + + + John Smith + + 4019 2445 0277 5567 + Example Bank + 04/02 + + \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/wrokey.bin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/wrokey.bin Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1 @@ +wvdeeeee34232-23244:23311135dsg3dsf34dsf \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/wrongtemplate.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/data/mmc/xmlsecurity/sign/wrongtemplate.xml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,2 @@ + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/eabi/test_xmlsecsign.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/eabi/test_xmlsecsign.def Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/group/bld.inf Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for xml_signature_api test components +* +*/ + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +PRJ_TESTEXPORTS +PRJ_MMPFILES + +PRJ_TESTMMPFILES +test_xmlsecsign.mmp + + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/group/test_xmlsecsign.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/group/test_xmlsecsign.mmp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project specification file for test_xmlsecsign of xml_signature_api test component +* +*/ +#include + + +TARGET test_xmlsecsign.dll +TARGETTYPE dll +//TARGETPATH /z/sys/bin +UID 0x1000af5a 0x01700000 + +#if defined(ARMCC) +DEFFILE ../eabi/test_xmlsecsign.def +#elif defined(WINSCW) || defined(WINS) +DEFFILE ../bwinscw/test_xmlsecsign.def +#endif + +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE xmlsecsigntester.cpp +SOURCE xmlsecsigntesterblocks.cpp + +OS_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/libc +USERINCLUDE ../inc + +LIBRARY stiftestinterface.lib +LIBRARY charconv.lib +LIBRARY efsrv.lib +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY InetProtUtil.lib +LIBRARY SysUtil.lib +LIBRARY XmlEngine.lib +LIBRARY XmlEngineDom.lib +LIBRARY XmlSecWrapper.lib + +nostrictdef +epocallowdlldata diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/group/test_xmlsecsign.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/group/test_xmlsecsign.pkg Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,69 @@ +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + +; Languages +&EN + +; Provide value for uid +#{"XmlSecSignTester"},(0x00000000),1,0,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\test_xmlsecsign.dll" - "c:\Sys\Bin\test_xmlsecsign.dll" + +;Init files +"..\init\TestFramework.ini"-"c:\testframework\TestFramework.ini" + +;Conf Files +"..\conf\XmlSecSignTester.cfg"-"c:\testing\conf\XmlSecSignTester.cfg" + +;Data files +"..\Data\mmc\xmlsecurity\sign\cert1.der" - "c:\testing\data\xmlsecurity\sign\cert1.der" +"..\Data\mmc\xmlsecurity\sign\forRSAsign.xml" - "c:\testing\data\xmlsecurity\sign\forRSAsign.xml" +"..\Data\mmc\xmlsecurity\sign\hmackey.bin" - "c:\testing\data\xmlsecurity\sign\hmackey.bin" +"..\Data\mmc\xmlsecurity\sign\II-level-cert-rsa-2048.der" - "c:\testing\data\xmlsecurity\sign\II-level-cert-rsa-2048.der" +"..\Data\mmc\xmlsecurity\sign\priv-rsa-1024.der" - "c:\testing\data\xmlsecurity\sign\priv-rsa-1024.der" +"..\Data\mmc\xmlsecurity\sign\pub-rsa-1024.der" - "c:\testing\data\xmlsecurity\sign\pub-rsa-1024.der" +"..\Data\mmc\xmlsecurity\sign\root-cert-rsa-1024.der" - "c:\testing\data\xmlsecurity\sign\root-cert-rsa-1024.der" +"..\Data\mmc\xmlsecurity\sign\rsa-priv-2048.der" - "c:\testing\data\xmlsecurity\sign\rsa-priv-2048.der" +"..\Data\mmc\xmlsecurity\sign\template1.xml" - "c:\testing\data\xmlsecurity\sign\template1.xml" +"..\Data\mmc\xmlsecurity\sign\template.xml" - "c:\testing\data\xmlsecurity\sign\template.xml" +"..\Data\mmc\xmlsecurity\sign\wrokey.bin" - "c:\testing\data\xmlsecurity\sign\wrokey.bin" +"..\Data\mmc\xmlsecurity\sign\wrongtemplate.xml" - "c:\testing\data\xmlsecurity\sign\wrongtemplate.xml" + + + diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/inc/xmlsecsigntester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/inc/xmlsecsigntester.h Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Header file for XmlSecSignTester +* +*/ +#ifndef __XMLSECSIGNTESTER_H__ +#define __XMLSECSIGNTESTER_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +// Logging path +_LIT( KXmlSecTesterLogPath, "e:\\temp\\xmlsec" ); + +// Log file +_LIT( KXmlSecTesterLogFile, "XmlSecSignTester.txt" ); + +// Test name +_LIT( KTEST_NAME, "XmlSecSignTester" ); + + +_LIT8(KImplementationID, ""); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CXmlSecSignTester; + + +// CLASS DEFINITION +/** +* CXmlSecSign test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CXmlSecSignTester) : public CScriptBase + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static CXmlSecSignTester* NewL(CTestModuleIf &); + /** + * Destructor + */ + virtual ~CXmlSecSignTester(); + + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + + + virtual TInt RunMethodL( CStifItemParser& aItem ); + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //type ?member_function( ?type ?arg1 ); + + + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: // Constructors and destructors + + /** + * C++ default constructor. + */ + CXmlSecSignTester( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + public: // From observer interface + + HBufC8* ReadFileL(const TDesC& aFileName); + + private: // New methods + + void CXmlSecSign_NewLL(); + void CXmlSecSign_NewLCL(); + TInt CXmlSecSign_SignXmlDocumentLL(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentKeyFromFileL_1L(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentKeyFromFileL_2L(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentKeyFromBufferL_1L(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentKeyFromBufferL_2L(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlNodesLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlNodeLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlNodeKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlNodeKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlDocumentLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlDocumentKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecSign_VerifyXmlDocumentKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecSign_SetTemplateFromFileL_1L(CStifItemParser& aItem); + TInt CXmlSecSign_SetTemplateFromFileL_2L(CStifItemParser& aItem); + TInt CXmlSecSign_SetTemplateFromBufferLL(); + TInt CXmlSecSign_SetTemplateLL(); + TInt CXmlSecSign_CreateTemplateL_1L(); + TInt CXmlSecSign_CreateTemplateL_2L(); + TInt CXmlSecSign_GetCurrentTemplateLL(); + TInt CXmlSecSign_SetKeyInfoL_1L( ); + TInt CXmlSecSign_SetKeyInfoL_2L( ); + TInt CXmlSecSign_SetKeyFromFileLL(CStifItemParser& aItem); + TInt CXmlSecSign_SetKeyFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecSign_SetCertFromFileLL(CStifItemParser& aItem); + TInt CXmlSecSign_SetCertFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecSign_AddTrustedCertFromFileLL(CStifItemParser& aItem); + TInt CXmlSecSign_AddTrustedCertFromBufferLL(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentL_2L(CStifItemParser& aItem); + TInt CXmlSecSign_SignXmlDocumentL_3L(); + TInt CXmlSecSign_VerifyXmlNodeL_2L(CStifItemParser& aItem); + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // __XMLSECSIGNTESTER_H__ + +// End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/init/TestFramework.ini Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,218 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= HTML # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testing\conf\XmlSecSignTester.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/rom/test_xmlsecsign.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/rom/test_xmlsecsign.iby Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY for xmlsecwrapper module tests +* +*/ + +#ifndef __TEST_XMLSECSIGN_IBY__ +#define __TEST_XMLSECSIGN_IBY__ + +file=ABI_DIR\BUILD_DIR\test_xmlsecsign.dll SHARED_LIB_DIR\test_xmlsecsign.dll + +#endif //__TEST_XMLSECSIGN_IBY__ \ No newline at end of file diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/src/xmlsecsigntester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/src/xmlsecsigntester.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Main file +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "xmlsecsigntester.h" +#include "xmlsecwinit.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecSignTester::CXmlSecSignTester +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CXmlSecSignTester::CXmlSecSignTester( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + + + } + +// ----------------------------------------------------------------------------- +// CXmlSecSignTester::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CXmlSecSignTester::ConstructL() + { + iLog = CStifLogger::NewL( KXmlSecTesterLogPath, + KXmlSecTesterLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + } + +// ----------------------------------------------------------------------------- +// CXmlSecSignTester::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CXmlSecSignTester* CXmlSecSignTester::NewL( + CTestModuleIf& aTestModuleIf ) + { + CXmlSecSignTester* self = new (ELeave) CXmlSecSignTester( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CXmlSecSignTester::~CXmlSecSignTester() + { + + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + + CloseSTDLIB(); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CXmlSecSignTester::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/tsrc/src/xmlsecsigntesterblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/tsrc/src/xmlsecsigntesterblocks.cpp Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,1386 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Xmlsecurity signing tests +* +*/ + +// CLASS HEADER +#include "xmlsecsigntester.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "xmlsecwinit.h" +#include "xmlsecwsign.h" +#include "xmlsecwerrors.h" +#include "inetprottextutils.h" + +#include +#include + + +// MACROS +//#define ?macro ?macro_def +#define LOCAL_ASSERT(expression) {if(!(expression)){return KErrArgument;}} + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CXmlSecTester::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CXmlSecSignTester::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CXmlSecTester::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CXmlSecSignTester::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + + // Test cases for encryption + ENTRY( "Test-NewLL", CXmlSecSignTester::CXmlSecSign_NewLL), + ENTRY( "Test-NewLC", CXmlSecSignTester::CXmlSecSign_NewLCL), + ENTRY( "Test-SignXmlDocumentLL", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentLL), + ENTRY( "Test-SignXmlDocumentL_2L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentL_2L), + ENTRY( "Test-SignXmlDocumentL_3L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentL_3L), + ENTRY( "Test-SignXmlDocumentKeyFromFileL_1L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromFileL_1L), + ENTRY( "Test-SignXmlDocumentKeyFromFileL_2L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromFileL_2L), + ENTRY( "Test-SignXmlDocumentKeyFromBufferL_1L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromBufferL_1L), + ENTRY( "Test-SignXmlDocumentKeyFromBufferL_2L", CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromBufferL_2L), + ENTRY( "Test-SignXmlNodesLL", CXmlSecSignTester::CXmlSecSign_SignXmlNodesLL), + ENTRY( "Test-VerifyXmlNodeLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeLL), + ENTRY( "Test-VerifyXmlNodeLL_2L", CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeL_2L), + ENTRY( "Test-VerifyXmlNodeKeyFromFileLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeKeyFromFileLL), + ENTRY( "Test-VerifyXmlNodeKeyFromBufferLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeKeyFromBufferLL), + ENTRY( "Test-VerifyXmlDocumentLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentLL), + ENTRY( "Test-VerifyXmlDocumentKeyFromFileLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentKeyFromFileLL), + ENTRY( "Test-VerifyXmlDocumentKeyFromBufferLL", CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentKeyFromBufferLL), + ENTRY( "Test-SetTemplateFromFileL_1L", CXmlSecSignTester::CXmlSecSign_SetTemplateFromFileL_1L), + ENTRY( "Test-SetTemplateFromFileL_2L", CXmlSecSignTester::CXmlSecSign_SetTemplateFromFileL_2L), + ENTRY( "Test-SetTemplateFromBufferLL", CXmlSecSignTester::CXmlSecSign_SetTemplateFromBufferLL), + ENTRY( "Test-SetTemplateLL", CXmlSecSignTester::CXmlSecSign_SetTemplateLL), + ENTRY( "Test-CreateTemplateL_1L", CXmlSecSignTester::CXmlSecSign_CreateTemplateL_1L), + ENTRY( "Test-CreateTemplateL_2L", CXmlSecSignTester::CXmlSecSign_CreateTemplateL_2L), + ENTRY( "Test-GetCurrentTemplateLL", CXmlSecSignTester::CXmlSecSign_GetCurrentTemplateLL), + ENTRY( "Test-SetKeyInfoL_1L", CXmlSecSignTester::CXmlSecSign_SetKeyInfoL_1L), + ENTRY( "Test-SetKeyInfoL_2L", CXmlSecSignTester::CXmlSecSign_SetKeyInfoL_2L), + ENTRY( "Test-SetKeyFromFileLL", CXmlSecSignTester::CXmlSecSign_SetKeyFromFileLL), + ENTRY( "Test-SetKeyFromBufferLL", CXmlSecSignTester::CXmlSecSign_SetKeyFromBufferLL), + ENTRY( "Test-SetCertFromFileLL", CXmlSecSignTester::CXmlSecSign_SetCertFromFileLL), + ENTRY( "Test-SetCertFromBufferLL", CXmlSecSignTester::CXmlSecSign_SetCertFromBufferLL), + ENTRY( "Test-AddTrustedCertFromFileLL", CXmlSecSignTester::CXmlSecSign_AddTrustedCertFromFileLL), + ENTRY( "Test-AddTrustedCertFromBufferLL", CXmlSecSignTester::CXmlSecSign_AddTrustedCertFromBufferLL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +HBufC8* CXmlSecSignTester::ReadFileL(const TDesC& aFileName) +{ + // open fs and file + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + + RFile file; + User::LeaveIfError(file.Open(fs, aFileName, EFileStream)); + CleanupClosePushL(file); + + TInt size=0; + User::LeaveIfError(file.Size(size)); + HBufC8* buf = HBufC8::NewLC(size); + TPtr8 bufPtr = buf->Des(); + User::LeaveIfError(file.Read(bufPtr)); + + CleanupStack::Pop(buf); + // cleanup + CleanupStack::PopAndDestroy(&file); + CleanupStack::PopAndDestroy(&fs); + return buf; +} + +// CONSTRUCTION +//------------------------------------------------------------------------------ +void CXmlSecSignTester::CXmlSecSign_NewLL() + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewL(); + CleanupStack::PushL(sign); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + } +//------------------------------------------------------------------------------ +// +void CXmlSecSignTester::CXmlSecSign_NewLCL() + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentLL(CStifItemParser& aItem) + { + // key + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL(p_BufStrKey8); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + _LIT8(t4,"name"); + XmlSecPushL(); + + CXmlSecSign* sign = CXmlSecSign::NewLC(); + //no document + RXmlEngDocument doc; + TXmlEngElement el; + TRAPD(err,el=sign->SignXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + sign->SetTemplateL(doc); + //bad template + TRAP(err,el=sign->SignXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrTemplate ); + //no key + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate); + TRAP(err,el=sign->SignXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrSign ); + //no key + + TRAP(err,el=sign->SignXmlDocumentL(doc,FALSE)); + LOCAL_ASSERT( err == KErrSign ); + + //ok + sign->SetKeyFromFileL(p_StrKey8,t4,CXmlSecSign::ERSAPrivate); + TRAP(err,el=sign->SignXmlDocumentL(doc)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + el.Remove(); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentL_2L( CStifItemParser& aItem ) + { + //key info + TPtrC p_KeyInfo; + aItem.GetNextString(p_KeyInfo); + HBufC8* p_BufInf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_KeyInfo); + CleanupStack::PushL(p_BufInf8); + TPtrC8 p_KeyInfo8 = p_BufInf8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + TXmlEngElement el; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + sign->SetTemplateL(doc); + //no key + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate); + + //key not ofund in keystore + sign->SetKeyInfoL(p_KeyInfo8); + TRAPD(err,el=sign->SignXmlDocumentL(doc,EFalse)); + LOCAL_ASSERT( err == KErrNotFound); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufInf8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentL_3L( ) + { + _LIT8(t4,"name"); + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + TXmlEngElement el; + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + sign->SetTemplateL(doc); + //no key + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate); + + sign->SetKeyInfoL(t4); + TRAPD(err,el=sign->SignXmlDocumentL(doc,FALSE)); + LOCAL_ASSERT( err == KErrNone); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromFileL_1L(CStifItemParser& aItem) + { + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + _LIT8(t4,"name"); + XmlSecPushL(); + + CXmlSecSign* sign = CXmlSecSign::NewLC(); + RXmlEngDocument doc; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + RXmlEngDocument doc3 = doc2.CloneDocumentL(); + TXmlEngElement el; + TRAPD(err,el=sign->SignXmlDocumentKeyFromFileL(doc,doc3,p_StrKey8,t4,CXmlSecSign::EHMAC)); + doc3.Close(); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromFileL_2L(CStifItemParser& aItem) + { + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + _LIT8(t4,"name"); + XmlSecPushL(); + + CXmlSecSign* sign = CXmlSecSign::NewLC(); + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + TRAPD(err,el=sign->SignXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC)); + + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromBufferL_1L(CStifItemParser& aItem) + { + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + + _LIT8(t4,"name"); + XmlSecPushL(); + + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + RXmlEngDocument doc3 = doc2.CloneDocumentL(); + + TRAPD(err,el=sign->SignXmlDocumentKeyFromBufferL(doc,doc3,*p_BufStrKey8,t4,CXmlSecSign::EHMAC)); + doc3.Close(); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlDocumentKeyFromBufferL_2L(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + TRAPD(err,el=sign->SignXmlDocumentKeyFromBufferL(doc,*p_BufStrKey8,t4,CXmlSecSign::EHMAC)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SignXmlNodesLL(CStifItemParser& aItem) + { + _LIT8(t4,"forsignnodesname"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + //zero TXmlEngElements + RXmlEngDocument doc; + RArray arrayelem; + TXmlEngElement el; + TRAPD(err,el=sign->SignXmlNodesL(arrayelem)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + + arrayelem.Append(elem); + TXmlEngElement elem2 = doc.CreateElementL(_L8("test2")); + //doc.SetDocumentElement(elem2); + arrayelem.Append(elem2); + + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + //ok + sign->SetKeyFromFileL(p_StrKey8,t4,CXmlSecSign::EHMAC); + TRAP(err,el=sign->SignXmlNodesL(arrayelem)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT( !el.Name().Compare(_L8("Signature"))); + + arrayelem.Close(); + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeLL( CStifItemParser& aItem ) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + TBool ver=EFalse; + XmlSecPushL(); + + CXmlSecSign* sign = CXmlSecSign::NewLC(); + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + el=sign->SignXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC); + + //no signature in doc + TRAPD(err,ver=sign->VerifyXmlNodeL(el)); + LOCAL_ASSERT(!ver); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlNodeL(el); + LOCAL_ASSERT(ver); + + TRAP(err,ver=sign->VerifyXmlNodeL(el,CXmlSecSign::ERootCertChain)); + LOCAL_ASSERT( err == KErrVerify ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// + TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeL_2L(CStifItemParser& aItem) + { + TPtrC p_Cert; + aItem.GetNextString(p_Cert); + HBufC8* p_CertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Cert); + CleanupStack::PushL(p_CertBuf8); + TPtrC8 p_Cert8 = p_CertBuf8->Des(); + + TPtrC p_TrustCert; + aItem.GetNextString(p_TrustCert); + HBufC8* p_TrustCertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_TrustCert); + CleanupStack::PushL(p_TrustCertBuf8); + TPtrC8 p_TrustCert8 = p_TrustCertBuf8->Des(); + + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + TBool ver=FALSE; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,TRUE); + //sign->SetKeyInfoL(keyRSA1); + sign->SetKeyFromFileL(p_StrKey8,p_StrKey8,CXmlSecSign::ERSAPrivate); + sign->SetCertFromFileL(p_Cert8); + + el=sign->SignXmlDocumentL(doc); + + doc.DocumentElement().AppendChildL(el); + + TRAPD(err,ver=sign->VerifyXmlNodeL(el,CXmlSecSign::ERootCertChain)); + LOCAL_ASSERT( err == KErrVerify ); + + sign->AddTrustedCertFromFileL(p_TrustCert8); + TRAP(err,ver=sign->VerifyXmlNodeL(el,CXmlSecSign::ERootCertChain)); + LOCAL_ASSERT( err == KErrNone ); + LOCAL_ASSERT(ver); + + TRAP(err,ver=sign->VerifyXmlNodeL(el,CXmlSecSign::ECertStore)); + LOCAL_ASSERT( err == KErrVerify ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CleanupStack::PopAndDestroy(p_TrustCertBuf8); + CleanupStack::PopAndDestroy(p_CertBuf8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + TBool ver; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + el=sign->SignXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlNodeKeyFromFileL(el,p_StrKey8,t4,CXmlSecSign::EHMAC); + LOCAL_ASSERT(ver); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlNodeKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + + TBool ver; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + el=sign->SignXmlDocumentKeyFromBufferL(doc,*p_BufStrKey8,t4,CXmlSecSign::EHMAC); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlNodeKeyFromBufferL(el,*p_BufStrKey8,t4,CXmlSecSign::EHMAC); + LOCAL_ASSERT(ver); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + TBool ver; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + TRAPD(err,ver=sign->VerifyXmlDocumentL(doc)); + LOCAL_ASSERT(err==KErrVerify); + + el=sign->SignXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlDocumentL(doc); + LOCAL_ASSERT(ver); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentKeyFromFileLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + TBool ver; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + el=sign->SignXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlDocumentKeyFromFileL(doc,p_StrKey8,t4,CXmlSecSign::EHMAC); + LOCAL_ASSERT(ver); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_VerifyXmlDocumentKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t4,"name"); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + + TBool ver; + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + RXmlEngDocument doc2 = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + + el=sign->SignXmlDocumentKeyFromBufferL(doc,*p_BufStrKey8,t4,CXmlSecSign::EHMAC); + + doc.DocumentElement().AppendChildL(el); + //ok + ver=sign->VerifyXmlDocumentKeyFromBufferL(doc,*p_BufStrKey8,t4,CXmlSecSign::EHMAC); + LOCAL_ASSERT(ver); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetTemplateFromFileL_1L(CStifItemParser& aItem) + { + TPtrC p_Template; + aItem.GetNextString(p_Template); + HBufC8* p_BufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Template); + CleanupStack::PushL(p_BufTem8); + TPtrC8 p_Template8 = p_BufTem8->Des(); + + TPtrC p_WrongTemplate; + aItem.GetNextString(p_WrongTemplate); + HBufC8* p_WrongBufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Template); + CleanupStack::PushL(p_WrongBufTem8); + TPtrC8 p_WrongTemplate8 = p_WrongBufTem8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + sign->SetTemplateFromFileL(p_Template8); + RXmlEngDocument tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc"))); + + TRAPD(err,sign->SetTemplateFromFileL(p_WrongTemplate8)); + LOCAL_ASSERT( err ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_WrongBufTem8); + CleanupStack::PopAndDestroy(p_BufTem8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetTemplateFromFileL_2L(CStifItemParser& aItem) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + TPtrC p_Template; + aItem.GetNextString(p_Template); + HBufC8* p_BufTem8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Template); + CleanupStack::PushL(p_BufTem8); + TPtrC8 p_Template8 = p_BufTem8->Des(); + + RFs fs; + fs.Connect(); + sign->SetTemplateFromFileL(fs,p_Template8); + fs.Close(); + RXmlEngDocument tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc")) ); + + CleanupStack::PopAndDestroy(sign); + CleanupStack::PopAndDestroy(p_BufTem8); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetTemplateFromBufferLL( ) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + _LIT8(t1,""); + sign->SetTemplateFromBufferL(t1); + RXmlEngDocument tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("doc")) ); + + _LIT8(t2,""); + TRAPD(err,sign->SetTemplateFromBufferL(t2)); + LOCAL_ASSERT( err ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetTemplateLL( ) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + sign->SetTemplateL(doc); + CleanupStack::PopAndDestroy(&doc); + RXmlEngDocument tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test")) ); + doc.Close(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + elem = doc.CreateElementL(_L8("test2")); + doc.SetDocumentElement(elem); + + sign->SetTemplateL(doc); + CleanupStack::PopAndDestroy(&doc); + tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test2")) ); + doc.Close(); + RXmlEngDocument doc2; + TRAPD(err, sign->SetTemplateL(doc2)); + LOCAL_ASSERT( err == KErrTemplate ); + + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_CreateTemplateL_1L( ) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + RXmlEngDocument tem = sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPublic); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,TRUE); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,1); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,2); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,4); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,1,_L8("tet")); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,1,_L8("")); + LOCAL_ASSERT( tem.NotNull() ); + + tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,FALSE,1,_L8("tet"),FALSE); + LOCAL_ASSERT( tem.NotNull() ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_CreateTemplateL_2L( ) + { + _LIT8(t8,"ex:outer"); + _LIT8(t9,"dsig:Signature"); + _LIT8(pIdName,"id"); + _LIT8(pIdVal,"http://exem.com"); + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument doc; + TXmlEngElement el; + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + doc.OpenL(domImp); + CleanupClosePushL(doc); + + TXmlEngElement elem = doc.CreateElementL(_L8("doc")); + + TXmlEngNamespace ns = elem.LookupNamespaceByUriL(_L8("a_uri")); + if (elem.LookupNamespaceByPrefixL(ns.Prefix()).IsSameNode(ns)){ + + elem.AddNewElementL(_L8("product"),ns); + } + + TXmlEngNamespace targetNs = elem.AddNamespaceDeclarationL(_L8("http://example.com/"),_L8("ex")); + + TXmlEngElement el_1 = elem.AddNewElementL(_L8("outer"), targetNs); + TXmlEngElement el_2 = el_1.AddNewElementL(_L8("inner")); + el_2.AddNamespaceDeclarationL(_L8("http://whatever.com/"),_L8("ex")); + TXmlEngElement el_3 = el_2.AddNewElementL(_L8("problem"), targetNs); + + + el_1.AddXmlIdL(pIdName, pIdVal ); + + doc.SetDocumentElement(elem); + RArray array; + CleanupClosePushL(array); + array.Append(elem); + + RXmlEngDocument tem; + TRAPD(err,tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,array,t9)); + LOCAL_ASSERT( err == KErrIdUndefineNS); + + array.Append(el_1); + array.Append(el_2); + array.Append(el_3); + + TRAP(err,tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,array,pIdName,0,4,_L8("tet"),FALSE)); + LOCAL_ASSERT( err == 0); + + TRAP(err,tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,array,pIdName,0,2,_L8("tet"),FALSE)); + LOCAL_ASSERT( err == 0); + + TRAP(err,tem = sign->CreateTemplateL(CXmlSecSign::ERSAPrivate,array,pIdName,1,1,_L8("tet"),FALSE)); + LOCAL_ASSERT( err == 0); + + CleanupStack::PopAndDestroy(&array); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_GetCurrentTemplateLL( ) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDocument tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + sign->DestroyCurrentTemplate(); + tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + + sign->SetTemplateL(doc); + tem = sign->CurrentTemplate(); + + LOCAL_ASSERT( tem.NotNull() ); + LOCAL_ASSERT( !tem.DocumentElement().Name().Compare(_L8("test")) ); + + sign->DestroyCurrentTemplate(); + tem = sign->CurrentTemplate(); + LOCAL_ASSERT( tem.IsNull() ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecSignTester::CXmlSecSign_SetKeyInfoL_1L( ) + { + _LIT8(t4,"name"); + _LIT8(t5,""); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + + //no template + TRAPD(err,sign->SetKeyInfoL(t4)); + LOCAL_ASSERT( err == KErrTemplate ); + //null param + sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + TRAP(err,sign->SetKeyInfoL(t5)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //ok + sign->SetKeyInfoL(t4); + //no keyinfo + sign->SetTemplateL(doc); + TRAP(err,sign->SetKeyInfoL(t4)); + LOCAL_ASSERT( err == KErrTemplate ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//-------------------------------------------------------------------------------- +// +TInt CXmlSecSignTester::CXmlSecSign_SetKeyInfoL_2L( ) + { + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + RXmlEngDOMImplementation domImp; + domImp.OpenL(); + RXmlEngDocument doc; + doc.OpenL(domImp); + CleanupClosePushL(doc); + TXmlEngElement elem = doc.CreateElementL(_L8("test")); + doc.SetDocumentElement(elem); + TXmlEngElement elem1; + + //no template + TRAPD(err,sign->SetKeyInfoL(doc.AsElement())); + LOCAL_ASSERT( err == KErrTemplate ); + sign->CreateTemplateL(CXmlSecSign::EHMAC,FALSE); + //wrong element = null + TRAP(err,sign->SetKeyInfoL(elem1)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //ok + sign->SetKeyInfoL(elem.CopyL()); + //no keyinfo node + sign->SetTemplateL(doc); + TRAP(err,sign->SetKeyInfoL(doc.DocumentElement())); + LOCAL_ASSERT( err == KErrTemplate ); + + CleanupStack::PopAndDestroy(&doc); + domImp.Close(); + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetKeyFromFileLL(CStifItemParser& aItem) + { + TPtrC p_StrKeyhmac; + aItem.GetNextString(p_StrKeyhmac); + HBufC8* p_BufStrKeyhmac8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyhmac); + CleanupStack::PushL( p_BufStrKeyhmac8 ); + TPtrC8 p_StrKeyhmac8 = p_BufStrKeyhmac8->Des(); + + TPtrC p_StrKeyPriv; + aItem.GetNextString(p_StrKeyPriv); + HBufC8* p_BufStrKeyPriv8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyPriv); + CleanupStack::PushL( p_BufStrKeyPriv8 ); + TPtrC8 p_StrKeyPriv8 = p_BufStrKeyPriv8->Des(); + + TPtrC p_WrngStrKey; + aItem.GetNextString(p_WrngStrKey); + HBufC8* p_WrngBufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_WrngStrKey); + CleanupStack::PushL( p_WrngBufStrKey8 ); + TPtrC8 p_WrngStrKey8 = p_WrngBufStrKey8->Des(); + + _LIT8(t4,"name"); + _LIT8(t5,""); + TPtrC p_StrKey; + aItem.GetNextString(p_StrKey); + HBufC8* p_BufStrKey8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKey); + CleanupStack::PushL( p_BufStrKey8 ); + TPtrC8 p_StrKey8 = p_BufStrKey8->Des(); + + _LIT8(t7,"namelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdfnamelongdf"); + _LIT8(t8,"name2"); + _LIT8(t9,"name3"); + _LIT8(t10,"name4"); + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //ok + sign->SetKeyFromFileL(p_StrKeyhmac8,t4,CXmlSecSign::EHMAC); + sign->SetKeyFromFileL(p_StrKeyPriv8,t7,CXmlSecSign::ERSAPrivate); + sign->SetKeyFromFileL(p_StrKey8,t4,CXmlSecSign::ERSAPublic); + //bad public + TRAPD(err,sign->SetKeyFromFileL(p_WrngStrKey8,t8,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrArgument ); + //bad private -> rsapub + TRAP(err,sign->SetKeyFromFileL(p_StrKey8,t9,CXmlSecSign::ERSAPrivate)); + LOCAL_ASSERT( err == KErrArgument ); + //bad private -> some data - hmac + TRAP(err,sign->SetKeyFromFileL(p_StrKeyhmac8,t10,CXmlSecSign::ERSAPrivate)); + LOCAL_ASSERT( err == KErrArgument ); + //name=null + TRAP(err,sign->SetKeyFromFileL(p_StrKeyPriv8,t5,CXmlSecSign::ERSAPrivate)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //name=null + TRAP(err,sign->SetKeyFromFileL(p_StrKey8,t5,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //filename=null + TRAP(err,sign->SetKeyFromFileL(t5,t4,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKey8); + CleanupStack::PopAndDestroy(p_WrngBufStrKey8); + CleanupStack::PopAndDestroy(p_BufStrKeyPriv8); + CleanupStack::PopAndDestroy(p_BufStrKeyhmac8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetKeyFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t1,"01234567012345670123456701234567"); + _LIT8(t3,"423"); + _LIT8(t4,"name"); + _LIT8(t5,""); + + TPtrC p_StrKeyPriv; + aItem.GetNextString(p_StrKeyPriv); + HBufC8* p_BufStrKeyPriv8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyPriv); + CleanupStack::PushL( p_BufStrKeyPriv8 ); + + TPtrC p_StrKeyPub; + aItem.GetNextString(p_StrKeyPub); + HBufC8* p_BufStrKeyPub8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyPub); + CleanupStack::PushL( p_BufStrKeyPub8 ); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //ok + sign->SetKeyFromBufferL(t1,t4,CXmlSecSign::EHMAC); + sign->SetKeyFromBufferL(*p_BufStrKeyPriv8,t4,CXmlSecSign::ERSAPrivate); + sign->SetKeyFromBufferL(*p_BufStrKeyPub8,t4,CXmlSecSign::ERSAPublic); + + //name=null + TRAPD(err,sign->SetKeyFromBufferL(*p_BufStrKeyPriv8,t5,CXmlSecSign::ERSAPrivate)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //name=null + TRAP(err,sign->SetKeyFromBufferL(*p_BufStrKeyPub8,t5,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrWrongParameter ); + //buffer=null + TRAP(err,sign->SetKeyFromBufferL(t5,t4,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrWrongParameter ); + + //bad public + TRAP(err,sign->SetKeyFromBufferL(t3,t4,CXmlSecSign::ERSAPublic)); + LOCAL_ASSERT( err == KErrArgument); + //bad private + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKeyPub8); + CleanupStack::PopAndDestroy(p_BufStrKeyPriv8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetCertFromFileLL(CStifItemParser& aItem) + { + _LIT8(t3,""); + _LIT8(t5,"name"); + + TPtrC p_Cert; + aItem.GetNextString(p_Cert); + HBufC8* p_CertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Cert); + CleanupStack::PushL(p_CertBuf8); + TPtrC8 p_Cert8 = p_CertBuf8->Des(); + + TPtrC p_StrKeyPriv; + aItem.GetNextString(p_StrKeyPriv); + HBufC8* p_BufStrKeyPriv8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyPriv); + CleanupStack::PushL( p_BufStrKeyPriv8 ); + TPtrC8 p_StrKeyPriv8 = p_BufStrKeyPriv8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //no key set + TRAPD(err,sign->SetCertFromFileL(p_Cert8)) + LOCAL_ASSERT( err == KErrKey ); + //ok + sign->SetKeyFromFileL(p_StrKeyPriv8,t5,CXmlSecSign::ERSAPrivate); + sign->SetCertFromFileL(p_Cert8); + //no cert file + TRAP(err,sign->SetCertFromFileL(t3)) + LOCAL_ASSERT( err == KErrCert ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKeyPriv8); + CleanupStack::PopAndDestroy(p_CertBuf8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_SetCertFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t5,"name"); + TPtrC p_Cert; + aItem.GetNextString(p_Cert); + HBufC8* p_CertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Cert); + CleanupStack::PushL(p_CertBuf8); + + TPtrC p_StrKeyPriv; + aItem.GetNextString(p_StrKeyPriv); + HBufC8* p_BufStrKeyPriv8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_StrKeyPriv); + CleanupStack::PushL( p_BufStrKeyPriv8 ); + TPtrC8 p_StrKeyPriv8 = p_BufStrKeyPriv8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //no key set + TRAPD(err,sign->SetCertFromBufferL(*p_CertBuf8)) + LOCAL_ASSERT( err == KErrKey ); + //ok + sign->SetKeyFromFileL(p_StrKeyPriv8,t5,CXmlSecSign::ERSAPrivate); + sign->SetCertFromBufferL(*p_CertBuf8); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_BufStrKeyPriv8); + CleanupStack::PopAndDestroy(p_CertBuf8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_AddTrustedCertFromFileLL(CStifItemParser& aItem) + { + _LIT8(t3,""); + TPtrC p_Cert; + aItem.GetNextString(p_Cert); + HBufC8* p_CertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Cert); + CleanupStack::PushL(p_CertBuf8); + TPtrC8 p_Cert8 = p_CertBuf8->Des(); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //ok + sign->AddTrustedCertFromFileL(p_Cert8); + //no cert file + TRAPD(err,sign->AddTrustedCertFromFileL(t3)) + LOCAL_ASSERT( err == KErrCert ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_CertBuf8); + CloseSTDLIB(); + return KErrNone; + } +//------------------------------------------------------------------------------ +// +TInt CXmlSecSignTester::CXmlSecSign_AddTrustedCertFromBufferLL(CStifItemParser& aItem) + { + _LIT8(t3,""); + TPtrC p_Cert; + aItem.GetNextString(p_Cert); + HBufC8* p_CertBuf8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(p_Cert); + CleanupStack::PushL(p_CertBuf8); + + XmlSecPushL(); + CXmlSecSign* sign = CXmlSecSign::NewLC(); + + //ok + sign->AddTrustedCertFromBufferL(*p_CertBuf8); + //no cert file + TRAPD(err,sign->AddTrustedCertFromBufferL(t3)) + LOCAL_ASSERT( err == KErrArgument ); + + CleanupStack::PopAndDestroy(sign); + XmlSecPopAndDestroy(); + CleanupStack::PopAndDestroy(p_CertBuf8); + CloseSTDLIB(); + return KErrNone; + } +// END OF FILE diff -r 000000000000 -r e35f40988205 xmlsrv_plat/xml_signature_api/xml_signature_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xmlsrv_plat/xml_signature_api/xml_signature_api.metaxml Thu Dec 17 09:29:21 2009 +0200 @@ -0,0 +1,17 @@ + + + XML Signature API + + c++ + xmlsecurityengine + + + + + + + + yes + no + +